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
This commit is contained in:
Ben 2020-11-23 15:52:35 +01:00 committed by GitHub
parent 3fa12d43f5
commit 182ffa4243
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 56 additions and 5 deletions

View file

@ -34,7 +34,7 @@ SERVICE_CONSTRUCT_IMPL(Service::APT::Module)
namespace Service::APT { namespace Service::APT {
template <class Archive> template <class Archive>
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_mem;
ar& shared_font_loaded; ar& shared_font_loaded;
ar& shared_font_relocated; ar& shared_font_relocated;
@ -44,6 +44,9 @@ void Module::serialize(Archive& ar, const unsigned int) {
ar& screen_capture_buffer; ar& screen_capture_buffer;
ar& screen_capture_post_permission; ar& screen_capture_post_permission;
ar& applet_manager; ar& applet_manager;
if (file_version > 0) {
ar& wireless_reboot_info;
}
} }
SERIALIZE_IMPL(Module) SERIALIZE_IMPL(Module)
@ -53,6 +56,19 @@ Module::NSInterface::NSInterface(std::shared_ptr<Module> apt, const char* name,
Module::NSInterface::~NSInterface() = default; Module::NSInterface::~NSInterface() = default;
void Module::NSInterface::SetWirelessRebootInfo(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x06, 1, 2); // 0x00060042
u32 size = rp.Pop<u32>();
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) { void Module::APTInterface::Initialize(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x2, 2, 0); // 0x20080 IPC::RequestParser rp(ctx, 0x2, 2, 0); // 0x20080
AppletId app_id = rp.PopEnum<AppletId>(); AppletId app_id = rp.PopEnum<AppletId>();
@ -257,6 +273,17 @@ void Module::APTInterface::GetSharedFont(Kernel::HLERequestContext& ctx) {
rb.PushCopyObjects(apt->shared_font_mem); 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<u32>();
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) { void Module::APTInterface::NotifyToWait(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x43, 1, 0); // 0x430040 IPC::RequestParser rp(ctx, 0x43, 1, 0); // 0x430040
u32 app_id = rp.Pop<u32>(); u32 app_id = rp.Pop<u32>();

View file

@ -72,6 +72,17 @@ public:
protected: protected:
std::shared_ptr<Module> apt; std::shared_ptr<Module> 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<APTInterface> { class APTInterface : public ServiceFramework<APTInterface> {
@ -139,6 +150,16 @@ public:
*/ */
void Unwrap(Kernel::HLERequestContext& ctx); 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 * APT::NotifyToWait service function
* Inputs: * Inputs:
@ -697,6 +718,8 @@ private:
std::shared_ptr<AppletManager> applet_manager; std::shared_ptr<AppletManager> applet_manager;
std::vector<u8> wireless_reboot_info;
template <class Archive> template <class Archive>
void serialize(Archive& ar, const unsigned int); void serialize(Archive& ar, const unsigned int);
friend class boost::serialization::access; friend class boost::serialization::access;
@ -707,3 +730,4 @@ void InstallInterfaces(Core::System& system);
} // namespace Service::APT } // namespace Service::APT
SERVICE_CONSTRUCT(Service::APT::Module) SERVICE_CONSTRUCT(Service::APT::Module)
BOOST_CLASS_VERSION(Service::APT::Module, 1)

View file

@ -78,7 +78,7 @@ APT_A::APT_A(std::shared_ptr<Module> apt)
{0x00420080, nullptr, "SleepSystem"}, {0x00420080, nullptr, "SleepSystem"},
{0x00430040, &APT_A::NotifyToWait, "NotifyToWait"}, {0x00430040, &APT_A::NotifyToWait, "NotifyToWait"},
{0x00440000, &APT_A::GetSharedFont, "GetSharedFont"}, {0x00440000, &APT_A::GetSharedFont, "GetSharedFont"},
{0x00450040, nullptr, "GetWirelessRebootInfo"}, {0x00450040, &APT_A::GetWirelessRebootInfo, "GetWirelessRebootInfo"},
{0x00460104, &APT_A::Wrap, "Wrap"}, {0x00460104, &APT_A::Wrap, "Wrap"},
{0x00470104, &APT_A::Unwrap, "Unwrap"}, {0x00470104, &APT_A::Unwrap, "Unwrap"},
{0x00480100, nullptr, "GetProgramInfo"}, {0x00480100, nullptr, "GetProgramInfo"},

View file

@ -78,7 +78,7 @@ APT_S::APT_S(std::shared_ptr<Module> apt)
{0x00420080, nullptr, "SleepSystem"}, {0x00420080, nullptr, "SleepSystem"},
{0x00430040, &APT_S::NotifyToWait, "NotifyToWait"}, {0x00430040, &APT_S::NotifyToWait, "NotifyToWait"},
{0x00440000, &APT_S::GetSharedFont, "GetSharedFont"}, {0x00440000, &APT_S::GetSharedFont, "GetSharedFont"},
{0x00450040, nullptr, "GetWirelessRebootInfo"}, {0x00450040, &APT_S::GetWirelessRebootInfo, "GetWirelessRebootInfo"},
{0x00460104, &APT_S::Wrap, "Wrap"}, {0x00460104, &APT_S::Wrap, "Wrap"},
{0x00470104, &APT_S::Unwrap, "Unwrap"}, {0x00470104, &APT_S::Unwrap, "Unwrap"},
{0x00480100, nullptr, "GetProgramInfo"}, {0x00480100, nullptr, "GetProgramInfo"},

View file

@ -78,7 +78,7 @@ APT_U::APT_U(std::shared_ptr<Module> apt)
{0x00420080, nullptr, "SleepSystem"}, {0x00420080, nullptr, "SleepSystem"},
{0x00430040, &APT_U::NotifyToWait, "NotifyToWait"}, {0x00430040, &APT_U::NotifyToWait, "NotifyToWait"},
{0x00440000, &APT_U::GetSharedFont, "GetSharedFont"}, {0x00440000, &APT_U::GetSharedFont, "GetSharedFont"},
{0x00450040, nullptr, "GetWirelessRebootInfo"}, {0x00450040, &APT_U::GetWirelessRebootInfo, "GetWirelessRebootInfo"},
{0x00460104, &APT_U::Wrap, "Wrap"}, {0x00460104, &APT_U::Wrap, "Wrap"},
{0x00470104, &APT_U::Unwrap, "Unwrap"}, {0x00470104, &APT_U::Unwrap, "Unwrap"},
{0x00480100, nullptr, "GetProgramInfo"}, {0x00480100, nullptr, "GetProgramInfo"},

View file

@ -15,7 +15,7 @@ NS_S::NS_S(std::shared_ptr<Service::APT::Module> apt)
{0x00030000, nullptr, "TerminateApplication"}, {0x00030000, nullptr, "TerminateApplication"},
{0x00040040, nullptr, "TerminateProcess"}, {0x00040040, nullptr, "TerminateProcess"},
{0x000500C0, nullptr, "LaunchApplicationFIRM"}, {0x000500C0, nullptr, "LaunchApplicationFIRM"},
{0x00060042, nullptr, "SetFIRMParams4A0"}, {0x00060042, &NS_S::SetWirelessRebootInfo, "SetWirelessRebootInfo"},
{0x00070042, nullptr, "CardUpdateInitialize"}, {0x00070042, nullptr, "CardUpdateInitialize"},
{0x00080000, nullptr, "CardUpdateShutdown"}, {0x00080000, nullptr, "CardUpdateShutdown"},
{0x000D0140, nullptr, "SetTWLBannerHMAC"}, {0x000D0140, nullptr, "SetTWLBannerHMAC"},