From 070853b465719a4e392fe131f870122bedb5ab0f Mon Sep 17 00:00:00 2001 From: Steveice10 <1269164+Steveice10@users.noreply.github.com> Date: Fri, 8 Dec 2023 23:34:54 -0800 Subject: [PATCH] apt: Stub ReplySleepQuery and ReplySleepNotificationComplete. (#7236) --- src/core/hle/service/apt/applet_manager.h | 6 ++++++ src/core/hle/service/apt/apt.cpp | 22 ++++++++++++++++++++++ src/core/hle/service/apt/apt.h | 21 +++++++++++++++++++++ src/core/hle/service/apt/apt_a.cpp | 4 ++-- src/core/hle/service/apt/apt_s.cpp | 4 ++-- src/core/hle/service/apt/apt_u.cpp | 4 ++-- 6 files changed, 55 insertions(+), 6 deletions(-) diff --git a/src/core/hle/service/apt/applet_manager.h b/src/core/hle/service/apt/applet_manager.h index 8794b7713..98f6adc8e 100644 --- a/src/core/hle/service/apt/applet_manager.h +++ b/src/core/hle/service/apt/applet_manager.h @@ -245,6 +245,12 @@ private: }; static_assert(sizeof(CaptureBufferInfo) == 0x20, "CaptureBufferInfo struct has incorrect size"); +enum class SleepQueryReply : u32 { + Reject = 0, + Accept = 1, + Later = 2, +}; + class AppletManager : public std::enable_shared_from_this { public: explicit AppletManager(Core::System& system); diff --git a/src/core/hle/service/apt/apt.cpp b/src/core/hle/service/apt/apt.cpp index 754230824..860a7513d 100644 --- a/src/core/hle/service/apt/apt.cpp +++ b/src/core/hle/service/apt/apt.cpp @@ -935,6 +935,28 @@ void Module::APTInterface::SendDspWakeUp(Kernel::HLERequestContext& ctx) { rb.Push(apt->applet_manager->SendDspWakeUp(from_app_id, object)); } +void Module::APTInterface::ReplySleepQuery(Kernel::HLERequestContext& ctx) { + IPC::RequestParser rp(ctx); + const auto from_app_id = rp.PopEnum(); + const auto reply_value = rp.PopEnum(); + + LOG_WARNING(Service_APT, "(STUBBED) called, from_app_id={:08X}, reply_value={:08X}", + from_app_id, reply_value); + + IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); + rb.Push(RESULT_SUCCESS); +} + +void Module::APTInterface::ReplySleepNotificationComplete(Kernel::HLERequestContext& ctx) { + IPC::RequestParser rp(ctx); + const auto from_app_id = rp.PopEnum(); + + LOG_WARNING(Service_APT, "(STUBBED) called, from_app_id={:08X}", from_app_id); + + IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); + rb.Push(RESULT_SUCCESS); +} + void Module::APTInterface::PrepareToJumpToHomeMenu(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp(ctx); diff --git a/src/core/hle/service/apt/apt.h b/src/core/hle/service/apt/apt.h index 3a4251691..81cb4ce4e 100644 --- a/src/core/hle/service/apt/apt.h +++ b/src/core/hle/service/apt/apt.h @@ -755,6 +755,27 @@ public: */ void SendDspWakeUp(Kernel::HLERequestContext& ctx); + /** + * APT::ReplySleepQuery service function + * Inputs: + * 1 : Source App ID + * 2 : Reply Value + * Outputs: + * 0 : Header code + * 1 : Result code + */ + void ReplySleepQuery(Kernel::HLERequestContext& ctx); + + /** + * APT::ReplySleepNotificationComplete service function + * Inputs: + * 1 : Source App ID + * Outputs: + * 0 : Header code + * 1 : Result code + */ + void ReplySleepNotificationComplete(Kernel::HLERequestContext& ctx); + /** * APT::PrepareToJumpToHomeMenu service function * Inputs: diff --git a/src/core/hle/service/apt/apt_a.cpp b/src/core/hle/service/apt/apt_a.cpp index 443005858..dc4c72c90 100644 --- a/src/core/hle/service/apt/apt_a.cpp +++ b/src/core/hle/service/apt/apt_a.cpp @@ -72,8 +72,8 @@ APT_A::APT_A(std::shared_ptr apt) {0x003B, &APT_A::CancelLibraryApplet, "CancelLibraryApplet"}, {0x003C, &APT_A::SendDspSleep, "SendDspSleep"}, {0x003D, &APT_A::SendDspWakeUp, "SendDspWakeUp"}, - {0x003E, nullptr, "ReplySleepQuery"}, - {0x003F, nullptr, "ReplySleepNotificationComplete"}, + {0x003E, &APT_A::ReplySleepQuery, "ReplySleepQuery"}, + {0x003F, &APT_A::ReplySleepNotificationComplete, "ReplySleepNotificationComplete"}, {0x0040, &APT_A::SendCaptureBufferInfo, "SendCaptureBufferInfo"}, {0x0041, &APT_A::ReceiveCaptureBufferInfo, "ReceiveCaptureBufferInfo"}, {0x0042, nullptr, "SleepSystem"}, diff --git a/src/core/hle/service/apt/apt_s.cpp b/src/core/hle/service/apt/apt_s.cpp index 82cbfce85..9bd6d81ed 100644 --- a/src/core/hle/service/apt/apt_s.cpp +++ b/src/core/hle/service/apt/apt_s.cpp @@ -72,8 +72,8 @@ APT_S::APT_S(std::shared_ptr apt) {0x003B, &APT_S::CancelLibraryApplet, "CancelLibraryApplet"}, {0x003C, &APT_S::SendDspSleep, "SendDspSleep"}, {0x003D, &APT_S::SendDspWakeUp, "SendDspWakeUp"}, - {0x003E, nullptr, "ReplySleepQuery"}, - {0x003F, nullptr, "ReplySleepNotificationComplete"}, + {0x003E, &APT_S::ReplySleepQuery, "ReplySleepQuery"}, + {0x003F, &APT_S::ReplySleepNotificationComplete, "ReplySleepNotificationComplete"}, {0x0040, &APT_S::SendCaptureBufferInfo, "SendCaptureBufferInfo"}, {0x0041, &APT_S::ReceiveCaptureBufferInfo, "ReceiveCaptureBufferInfo"}, {0x0042, nullptr, "SleepSystem"}, diff --git a/src/core/hle/service/apt/apt_u.cpp b/src/core/hle/service/apt/apt_u.cpp index 2d5373179..fd302ab4e 100644 --- a/src/core/hle/service/apt/apt_u.cpp +++ b/src/core/hle/service/apt/apt_u.cpp @@ -72,8 +72,8 @@ APT_U::APT_U(std::shared_ptr apt) {0x003B, &APT_U::CancelLibraryApplet, "CancelLibraryApplet"}, {0x003C, &APT_U::SendDspSleep, "SendDspSleep"}, {0x003D, &APT_U::SendDspWakeUp, "SendDspWakeUp"}, - {0x003E, nullptr, "ReplySleepQuery"}, - {0x003F, nullptr, "ReplySleepNotificationComplete"}, + {0x003E, &APT_U::ReplySleepQuery, "ReplySleepQuery"}, + {0x003F, &APT_U::ReplySleepNotificationComplete, "ReplySleepNotificationComplete"}, {0x0040, &APT_U::SendCaptureBufferInfo, "SendCaptureBufferInfo"}, {0x0041, &APT_U::ReceiveCaptureBufferInfo, "ReceiveCaptureBufferInfo"}, {0x0042, nullptr, "SleepSystem"},