From 182ffa4243fd1f5dc0627df9f1755384ce8f7f48 Mon Sep 17 00:00:00 2001 From: Ben Date: Mon, 23 Nov 2020 15:52:35 +0100 Subject: [PATCH] APT: implement Set and GetWirelessRebootInfo (#5328) * APT: implement Set and GetWirelessRebootInfo * make wireless_reboot_info a member of APT::Module * Removed stubbed from log message --- src/core/hle/service/apt/apt.cpp | 29 ++++++++++++++++++++++++++++- src/core/hle/service/apt/apt.h | 24 ++++++++++++++++++++++++ src/core/hle/service/apt/apt_a.cpp | 2 +- src/core/hle/service/apt/apt_s.cpp | 2 +- src/core/hle/service/apt/apt_u.cpp | 2 +- src/core/hle/service/apt/ns_s.cpp | 2 +- 6 files changed, 56 insertions(+), 5 deletions(-) diff --git a/src/core/hle/service/apt/apt.cpp b/src/core/hle/service/apt/apt.cpp index 31a1d3dac..0190cd43f 100644 --- a/src/core/hle/service/apt/apt.cpp +++ b/src/core/hle/service/apt/apt.cpp @@ -34,7 +34,7 @@ SERVICE_CONSTRUCT_IMPL(Service::APT::Module) namespace Service::APT { template -void Module::serialize(Archive& ar, const unsigned int) { +void Module::serialize(Archive& ar, const unsigned int file_version) { ar& shared_font_mem; ar& shared_font_loaded; ar& shared_font_relocated; @@ -44,6 +44,9 @@ void Module::serialize(Archive& ar, const unsigned int) { ar& screen_capture_buffer; ar& screen_capture_post_permission; ar& applet_manager; + if (file_version > 0) { + ar& wireless_reboot_info; + } } SERIALIZE_IMPL(Module) @@ -53,6 +56,19 @@ Module::NSInterface::NSInterface(std::shared_ptr apt, const char* name, Module::NSInterface::~NSInterface() = default; +void Module::NSInterface::SetWirelessRebootInfo(Kernel::HLERequestContext& ctx) { + IPC::RequestParser rp(ctx, 0x06, 1, 2); // 0x00060042 + u32 size = rp.Pop(); + auto buffer = rp.PopStaticBuffer(); + + apt->wireless_reboot_info = std::move(buffer); + + auto rb = rp.MakeBuilder(1, 0); + rb.Push(RESULT_SUCCESS); + + LOG_WARNING(Service_APT, "called size={}", size); +} + void Module::APTInterface::Initialize(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp(ctx, 0x2, 2, 0); // 0x20080 AppletId app_id = rp.PopEnum(); @@ -257,6 +273,17 @@ void Module::APTInterface::GetSharedFont(Kernel::HLERequestContext& ctx) { rb.PushCopyObjects(apt->shared_font_mem); } +void Module::APTInterface::GetWirelessRebootInfo(Kernel::HLERequestContext& ctx) { + IPC::RequestParser rp(ctx, 0x45, 1, 0); // 0x00450040 + u32 size = rp.Pop(); + + LOG_WARNING(Service_APT, "called size={:08X}", size); + + IPC::RequestBuilder rb = rp.MakeBuilder(1, 2); + rb.Push(RESULT_SUCCESS); + rb.PushStaticBuffer(apt->wireless_reboot_info, 0); +} + void Module::APTInterface::NotifyToWait(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp(ctx, 0x43, 1, 0); // 0x430040 u32 app_id = rp.Pop(); diff --git a/src/core/hle/service/apt/apt.h b/src/core/hle/service/apt/apt.h index 85cb99cf3..5b9e7435b 100644 --- a/src/core/hle/service/apt/apt.h +++ b/src/core/hle/service/apt/apt.h @@ -72,6 +72,17 @@ public: protected: std::shared_ptr apt; + + /** + * NS::SetWirelessRebootInfo service function. This sets the wireless reboot info. + * Inputs: + * 1 : size + * 2 : (Size<<14) | 2 + * 3 : Wireless reboot info buffer ptr + * Outputs: + * 0 : Result of function, 0 on success, otherwise error code + */ + void SetWirelessRebootInfo(Kernel::HLERequestContext& ctx); }; class APTInterface : public ServiceFramework { @@ -139,6 +150,16 @@ public: */ void Unwrap(Kernel::HLERequestContext& ctx); + /** + * APT::GetWirelessRebootInfo service function + * Inputs: + * 1 : size + * Outputs: + * 1 : Result of function, 0 on success, otherwise error code + * 2 : Output parameter buffer ptr + */ + void GetWirelessRebootInfo(Kernel::HLERequestContext& ctx); + /** * APT::NotifyToWait service function * Inputs: @@ -697,6 +718,8 @@ private: std::shared_ptr applet_manager; + std::vector wireless_reboot_info; + template void serialize(Archive& ar, const unsigned int); friend class boost::serialization::access; @@ -707,3 +730,4 @@ void InstallInterfaces(Core::System& system); } // namespace Service::APT SERVICE_CONSTRUCT(Service::APT::Module) +BOOST_CLASS_VERSION(Service::APT::Module, 1) diff --git a/src/core/hle/service/apt/apt_a.cpp b/src/core/hle/service/apt/apt_a.cpp index abe1a948b..4ddeae0aa 100644 --- a/src/core/hle/service/apt/apt_a.cpp +++ b/src/core/hle/service/apt/apt_a.cpp @@ -78,7 +78,7 @@ APT_A::APT_A(std::shared_ptr apt) {0x00420080, nullptr, "SleepSystem"}, {0x00430040, &APT_A::NotifyToWait, "NotifyToWait"}, {0x00440000, &APT_A::GetSharedFont, "GetSharedFont"}, - {0x00450040, nullptr, "GetWirelessRebootInfo"}, + {0x00450040, &APT_A::GetWirelessRebootInfo, "GetWirelessRebootInfo"}, {0x00460104, &APT_A::Wrap, "Wrap"}, {0x00470104, &APT_A::Unwrap, "Unwrap"}, {0x00480100, nullptr, "GetProgramInfo"}, diff --git a/src/core/hle/service/apt/apt_s.cpp b/src/core/hle/service/apt/apt_s.cpp index de5151470..20359c2ae 100644 --- a/src/core/hle/service/apt/apt_s.cpp +++ b/src/core/hle/service/apt/apt_s.cpp @@ -78,7 +78,7 @@ APT_S::APT_S(std::shared_ptr apt) {0x00420080, nullptr, "SleepSystem"}, {0x00430040, &APT_S::NotifyToWait, "NotifyToWait"}, {0x00440000, &APT_S::GetSharedFont, "GetSharedFont"}, - {0x00450040, nullptr, "GetWirelessRebootInfo"}, + {0x00450040, &APT_S::GetWirelessRebootInfo, "GetWirelessRebootInfo"}, {0x00460104, &APT_S::Wrap, "Wrap"}, {0x00470104, &APT_S::Unwrap, "Unwrap"}, {0x00480100, nullptr, "GetProgramInfo"}, diff --git a/src/core/hle/service/apt/apt_u.cpp b/src/core/hle/service/apt/apt_u.cpp index f36da98e5..0811544e7 100644 --- a/src/core/hle/service/apt/apt_u.cpp +++ b/src/core/hle/service/apt/apt_u.cpp @@ -78,7 +78,7 @@ APT_U::APT_U(std::shared_ptr apt) {0x00420080, nullptr, "SleepSystem"}, {0x00430040, &APT_U::NotifyToWait, "NotifyToWait"}, {0x00440000, &APT_U::GetSharedFont, "GetSharedFont"}, - {0x00450040, nullptr, "GetWirelessRebootInfo"}, + {0x00450040, &APT_U::GetWirelessRebootInfo, "GetWirelessRebootInfo"}, {0x00460104, &APT_U::Wrap, "Wrap"}, {0x00470104, &APT_U::Unwrap, "Unwrap"}, {0x00480100, nullptr, "GetProgramInfo"}, diff --git a/src/core/hle/service/apt/ns_s.cpp b/src/core/hle/service/apt/ns_s.cpp index 1f86b9a61..2988ea5d8 100644 --- a/src/core/hle/service/apt/ns_s.cpp +++ b/src/core/hle/service/apt/ns_s.cpp @@ -15,7 +15,7 @@ NS_S::NS_S(std::shared_ptr apt) {0x00030000, nullptr, "TerminateApplication"}, {0x00040040, nullptr, "TerminateProcess"}, {0x000500C0, nullptr, "LaunchApplicationFIRM"}, - {0x00060042, nullptr, "SetFIRMParams4A0"}, + {0x00060042, &NS_S::SetWirelessRebootInfo, "SetWirelessRebootInfo"}, {0x00070042, nullptr, "CardUpdateInitialize"}, {0x00080000, nullptr, "CardUpdateShutdown"}, {0x000D0140, nullptr, "SetTWLBannerHMAC"},