From 49763aee9298224d73f941ebc92d1a1793476e2f Mon Sep 17 00:00:00 2001 From: Michael Scire Date: Thu, 10 Oct 2024 02:44:19 -0700 Subject: [PATCH] pm: add new 19.0.0 commands This is functionally correct, but I have no idea what these are meant to represent. These functions are completely unused on NX. --- .../stratosphere/pm/impl/pm_boot_mode_interface.hpp | 8 +++++--- .../libvapours/include/vapours/results/pm_results.hpp | 1 + stratosphere/pm/source/pm_boot_mode_service.cpp | 11 +++++++++++ stratosphere/pm/source/pm_boot_mode_service.hpp | 2 ++ 4 files changed, 19 insertions(+), 3 deletions(-) diff --git a/libraries/libstratosphere/include/stratosphere/pm/impl/pm_boot_mode_interface.hpp b/libraries/libstratosphere/include/stratosphere/pm/impl/pm_boot_mode_interface.hpp index a34f2272d..66faf57e2 100644 --- a/libraries/libstratosphere/include/stratosphere/pm/impl/pm_boot_mode_interface.hpp +++ b/libraries/libstratosphere/include/stratosphere/pm/impl/pm_boot_mode_interface.hpp @@ -19,8 +19,10 @@ #include #include -#define AMS_PM_I_BOOT_MODE_INTERFACE_INTERFACE_INFO(C, H) \ - AMS_SF_METHOD_INFO(C, H, 0, void, GetBootMode, (sf::Out out), (out)) \ - AMS_SF_METHOD_INFO(C, H, 1, void, SetMaintenanceBoot, (), ()) +#define AMS_PM_I_BOOT_MODE_INTERFACE_INTERFACE_INFO(C, H) \ + AMS_SF_METHOD_INFO(C, H, 0, void, GetBootMode, (sf::Out out), (out)) \ + AMS_SF_METHOD_INFO(C, H, 1, void, SetMaintenanceBoot, (), ()) \ + AMS_SF_METHOD_INFO(C, H, 2, void, GetUnknown, (sf::Out out), (out)) \ + AMS_SF_METHOD_INFO(C, H, 3, Result, SetUnknown, (u32 val), (val)) AMS_SF_DEFINE_INTERFACE(ams::pm::impl, IBootModeInterface, AMS_PM_I_BOOT_MODE_INTERFACE_INTERFACE_INFO, 0x96D01649) diff --git a/libraries/libvapours/include/vapours/results/pm_results.hpp b/libraries/libvapours/include/vapours/results/pm_results.hpp index 4c9e51ad5..4e4c0e24b 100644 --- a/libraries/libvapours/include/vapours/results/pm_results.hpp +++ b/libraries/libvapours/include/vapours/results/pm_results.hpp @@ -27,5 +27,6 @@ namespace ams::pm { R_DEFINE_ERROR_RESULT(DebugHookInUse, 4); R_DEFINE_ERROR_RESULT(ApplicationRunning, 5); R_DEFINE_ERROR_RESULT(InvalidSize, 6); + R_DEFINE_ERROR_RESULT(Unknown7, 7); } diff --git a/stratosphere/pm/source/pm_boot_mode_service.cpp b/stratosphere/pm/source/pm_boot_mode_service.cpp index ff389fe75..a1a762d34 100644 --- a/stratosphere/pm/source/pm_boot_mode_service.cpp +++ b/stratosphere/pm/source/pm_boot_mode_service.cpp @@ -22,6 +22,7 @@ namespace ams::pm { /* Global bootmode. */ constinit BootMode g_boot_mode = BootMode::Normal; + constinit u32 g_unknown = 0; } @@ -47,4 +48,14 @@ namespace ams::pm { pm::bm::SetMaintenanceBoot(); } + void BootModeService::GetUnknown(sf::Out out) { + out.SetValue(g_unknown); + } + + Result BootModeService::SetUnknown(u32 val) { + R_UNLESS(val <= 3, pm::ResultUnknown7()); + g_unknown = val; + R_SUCCEED(); + } + } diff --git a/stratosphere/pm/source/pm_boot_mode_service.hpp b/stratosphere/pm/source/pm_boot_mode_service.hpp index c650e9b47..b47536ed7 100644 --- a/stratosphere/pm/source/pm_boot_mode_service.hpp +++ b/stratosphere/pm/source/pm_boot_mode_service.hpp @@ -22,6 +22,8 @@ namespace ams::pm { public: void GetBootMode(sf::Out out); void SetMaintenanceBoot(); + void GetUnknown(sf::Out out); + Result SetUnknown(u32 val); }; static_assert(pm::impl::IsIBootModeInterface);