From f29f4ccdc9c69a970df4f7f97aab4a259eff8957 Mon Sep 17 00:00:00 2001 From: N00byKing Date: Tue, 10 Apr 2018 17:05:06 +0200 Subject: [PATCH] gsp_gpu, shared_page: Change 3D LED State on SetLedForceOff --- src/core/hle/service/gsp/gsp_gpu.cpp | 14 +++++++++++++- src/core/hle/service/gsp/gsp_gpu.h | 3 +++ src/core/hle/shared_page.cpp | 4 ++++ src/core/hle/shared_page.h | 2 ++ 4 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/core/hle/service/gsp/gsp_gpu.cpp b/src/core/hle/service/gsp/gsp_gpu.cpp index 0b7cf9123..ebe5a0503 100644 --- a/src/core/hle/service/gsp/gsp_gpu.cpp +++ b/src/core/hle/service/gsp/gsp_gpu.cpp @@ -13,6 +13,7 @@ #include "core/hle/kernel/shared_memory.h" #include "core/hle/result.h" #include "core/hle/service/gsp/gsp_gpu.h" +#include "core/hle/shared_page.h" #include "core/hw/gpu.h" #include "core/hw/hw.h" #include "core/hw/lcd.h" @@ -712,6 +713,17 @@ void GSP_GPU::StoreDataCache(Kernel::HLERequestContext& ctx) { size, process->process_id); } +void GSP_GPU::SetLedForceOff(Kernel::HLERequestContext& ctx) { + IPC::RequestParser rp(ctx, 0x1C, 1, 0); + + u8 state = rp.Pop(); + SharedPage::Set3DLed(state); + + IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); + rb.Push(RESULT_SUCCESS); + LOG_DEBUG(Service_GSP, "(STUBBED) called"); +} + SessionData* GSP_GPU::FindRegisteredThreadData(u32 thread_id) { for (auto& session_info : connected_sessions) { SessionData* data = static_cast(session_info.data.get()); @@ -752,7 +764,7 @@ GSP_GPU::GSP_GPU() : ServiceFramework("gsp::Gpu", 2) { {0x00190000, nullptr, "SaveVramSysArea"}, {0x001A0000, nullptr, "RestoreVramSysArea"}, {0x001B0000, nullptr, "ResetGpuCore"}, - {0x001C0040, nullptr, "SetLedForceOff"}, + {0x001C0040, &GSP_GPU::SetLedForceOff, "SetLedForceOff"}, {0x001D0040, nullptr, "SetTestCommand"}, {0x001E0080, nullptr, "SetInternalPriorities"}, {0x001F0082, &GSP_GPU::StoreDataCache, "StoreDataCache"}, diff --git a/src/core/hle/service/gsp/gsp_gpu.h b/src/core/hle/service/gsp/gsp_gpu.h index 94dddfa6a..484b1a332 100644 --- a/src/core/hle/service/gsp/gsp_gpu.h +++ b/src/core/hle/service/gsp/gsp_gpu.h @@ -379,6 +379,9 @@ private: */ void StoreDataCache(Kernel::HLERequestContext& ctx); + /// Force the 3D LED State (0 = On, Non-Zero = Off) + void SetLedForceOff(Kernel::HLERequestContext& ctx); + /// Returns the session data for the specified registered thread id, or nullptr if not found. SessionData* FindRegisteredThreadData(u32 thread_id); diff --git a/src/core/hle/shared_page.cpp b/src/core/hle/shared_page.cpp index 0102d0f5e..8a8a32d51 100644 --- a/src/core/hle/shared_page.cpp +++ b/src/core/hle/shared_page.cpp @@ -93,4 +93,8 @@ void SetWifiLinkLevel(WifiLinkLevel level) { shared_page.wifi_link_level = static_cast(level); } +void Set3DLed(u8 state) { + shared_page.ledstate_3d = state; +} + } // namespace SharedPage diff --git a/src/core/hle/shared_page.h b/src/core/hle/shared_page.h index 1e2fce6b7..4d3f0d455 100644 --- a/src/core/hle/shared_page.h +++ b/src/core/hle/shared_page.h @@ -82,4 +82,6 @@ void SetMacAddress(const MacAddress&); void SetWifiLinkLevel(WifiLinkLevel); +void Set3DLed(u8); + } // namespace SharedPage