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.
This commit is contained in:
Michael Scire 2024-10-10 02:44:19 -07:00
parent a6e14c5989
commit 49763aee92
4 changed files with 19 additions and 3 deletions

View file

@ -19,8 +19,10 @@
#include <stratosphere/pm/pm_types.hpp> #include <stratosphere/pm/pm_types.hpp>
#include <stratosphere/sf.hpp> #include <stratosphere/sf.hpp>
#define AMS_PM_I_BOOT_MODE_INTERFACE_INTERFACE_INFO(C, H) \ #define AMS_PM_I_BOOT_MODE_INTERFACE_INTERFACE_INFO(C, H) \
AMS_SF_METHOD_INFO(C, H, 0, void, GetBootMode, (sf::Out<u32> out), (out)) \ AMS_SF_METHOD_INFO(C, H, 0, void, GetBootMode, (sf::Out<u32> out), (out)) \
AMS_SF_METHOD_INFO(C, H, 1, void, SetMaintenanceBoot, (), ()) AMS_SF_METHOD_INFO(C, H, 1, void, SetMaintenanceBoot, (), ()) \
AMS_SF_METHOD_INFO(C, H, 2, void, GetUnknown, (sf::Out<u32> 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) AMS_SF_DEFINE_INTERFACE(ams::pm::impl, IBootModeInterface, AMS_PM_I_BOOT_MODE_INTERFACE_INTERFACE_INFO, 0x96D01649)

View file

@ -27,5 +27,6 @@ namespace ams::pm {
R_DEFINE_ERROR_RESULT(DebugHookInUse, 4); R_DEFINE_ERROR_RESULT(DebugHookInUse, 4);
R_DEFINE_ERROR_RESULT(ApplicationRunning, 5); R_DEFINE_ERROR_RESULT(ApplicationRunning, 5);
R_DEFINE_ERROR_RESULT(InvalidSize, 6); R_DEFINE_ERROR_RESULT(InvalidSize, 6);
R_DEFINE_ERROR_RESULT(Unknown7, 7);
} }

View file

@ -22,6 +22,7 @@ namespace ams::pm {
/* Global bootmode. */ /* Global bootmode. */
constinit BootMode g_boot_mode = BootMode::Normal; constinit BootMode g_boot_mode = BootMode::Normal;
constinit u32 g_unknown = 0;
} }
@ -47,4 +48,14 @@ namespace ams::pm {
pm::bm::SetMaintenanceBoot(); pm::bm::SetMaintenanceBoot();
} }
void BootModeService::GetUnknown(sf::Out<u32> out) {
out.SetValue(g_unknown);
}
Result BootModeService::SetUnknown(u32 val) {
R_UNLESS(val <= 3, pm::ResultUnknown7());
g_unknown = val;
R_SUCCEED();
}
} }

View file

@ -22,6 +22,8 @@ namespace ams::pm {
public: public:
void GetBootMode(sf::Out<u32> out); void GetBootMode(sf::Out<u32> out);
void SetMaintenanceBoot(); void SetMaintenanceBoot();
void GetUnknown(sf::Out<u32> out);
Result SetUnknown(u32 val);
}; };
static_assert(pm::impl::IsIBootModeInterface<BootModeService>); static_assert(pm::impl::IsIBootModeInterface<BootModeService>);