From 8cdb50d703de0264e9746c7ee2a26782af97cdc5 Mon Sep 17 00:00:00 2001
From: Ac_K <Acoustik666@gmail.com>
Date: Sun, 21 Feb 2021 09:21:32 +0100
Subject: [PATCH] appletAE: Implement SetLcdBacklighOffEnabled (#2037)

This PR implement `appletAE ICommonStateGetter SetLcdBacklighOffEnabled` accordingly to RE.

Closes #2021
---
 .../SystemAppletProxy/ICommonStateGetter.cs   | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/Ryujinx.HLE/HOS/Services/Am/AppletAE/AllSystemAppletProxiesService/SystemAppletProxy/ICommonStateGetter.cs b/Ryujinx.HLE/HOS/Services/Am/AppletAE/AllSystemAppletProxiesService/SystemAppletProxy/ICommonStateGetter.cs
index 0d003abaa7..17b8dddfd1 100644
--- a/Ryujinx.HLE/HOS/Services/Am/AppletAE/AllSystemAppletProxiesService/SystemAppletProxy/ICommonStateGetter.cs
+++ b/Ryujinx.HLE/HOS/Services/Am/AppletAE/AllSystemAppletProxiesService/SystemAppletProxy/ICommonStateGetter.cs
@@ -13,8 +13,9 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.Sys
         private Lbl.LblControllerServer _lblControllerServer;
 
         private bool _vrModeEnabled;
-        private int _messageEventHandle;
-        private int _displayResolutionChangedEventHandle;
+        private bool _lcdBacklighOffEnabled;
+        private int  _messageEventHandle;
+        private int  _displayResolutionChangedEventHandle;
 
         public ICommonStateGetter(ServiceCtx context)
         {
@@ -130,6 +131,20 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.Sys
             return ResultCode.Success;
         }
 
+        [Command(52)] // 4.0.0+
+        // SetLcdBacklighOffEnabled(b8)
+        public ResultCode SetLcdBacklighOffEnabled(ServiceCtx context)
+        {
+            // NOTE: Service sets a private field here, maybe this field is used somewhere else to turned off the backlight.
+            //       Since we don't support backlight, it's fine to do nothing.
+
+            _lcdBacklighOffEnabled = context.RequestData.ReadBoolean();
+
+            Logger.Stub?.PrintStub(LogClass.ServiceAm);
+
+            return ResultCode.Success;
+        }
+
         [Command(53)] // 7.0.0+
         // BeginVrModeEx()
         public ResultCode BeginVrModeEx(ServiceCtx context)