1
0
Fork 0
forked from suyu/suyu

Implemented some basic sleep functions

This commit is contained in:
niansa 2024-03-09 04:23:16 +01:00 committed by niansa
parent ad43131df5
commit a1db3cb668
4 changed files with 18 additions and 4 deletions

View file

@ -14,7 +14,7 @@ IGlobalStateController::IGlobalStateController(Core::System& system_)
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, nullptr, "RequestToEnterSleep"}, {0, nullptr, "RequestToEnterSleep"},
{1, nullptr, "EnterSleep"}, {1, nullptr, "EnterSleep"},
{2, nullptr, "StartSleepSequence"}, {2, D<&IGlobalStateController::StartSleepSequence>, "StartSleepSequence"},
{3, D<&IGlobalStateController::StartShutdownSequence>, "StartShutdownSequence"}, {3, D<&IGlobalStateController::StartShutdownSequence>, "StartShutdownSequence"},
{4, D<&IGlobalStateController::StartRebootSequence>, "StartRebootSequence"}, {4, D<&IGlobalStateController::StartRebootSequence>, "StartRebootSequence"},
{9, nullptr, "IsAutoPowerDownRequested"}, {9, nullptr, "IsAutoPowerDownRequested"},
@ -31,6 +31,14 @@ IGlobalStateController::IGlobalStateController(Core::System& system_)
RegisterHandlers(functions); RegisterHandlers(functions);
} }
IGlobalStateController::~IGlobalStateController() = default;
Result IGlobalStateController::StartSleepSequence(u8 a) {
LOG_WARNING(Service_AM, "called, a={}", a);
system.Pause();
R_SUCCEED();
}
Result IGlobalStateController::StartShutdownSequence() { Result IGlobalStateController::StartShutdownSequence() {
LOG_INFO(Service_AM, "called"); LOG_INFO(Service_AM, "called");
system.Exit(); system.Exit();
@ -43,8 +51,6 @@ Result IGlobalStateController::StartRebootSequence() {
R_SUCCEED(); R_SUCCEED();
} }
IGlobalStateController::~IGlobalStateController() = default;
Result IGlobalStateController::LoadAndApplyIdlePolicySettings() { Result IGlobalStateController::LoadAndApplyIdlePolicySettings() {
LOG_WARNING(Service_AM, "(STUBBED) called"); LOG_WARNING(Service_AM, "(STUBBED) called");
R_SUCCEED(); R_SUCCEED();

View file

@ -18,6 +18,7 @@ public:
~IGlobalStateController() override; ~IGlobalStateController() override;
private: private:
Result StartSleepSequence(u8 a);
Result StartShutdownSequence(); Result StartShutdownSequence();
Result StartRebootSequence(); Result StartRebootSequence();
Result LoadAndApplyIdlePolicySettings(); Result LoadAndApplyIdlePolicySettings();

View file

@ -23,7 +23,7 @@ IHomeMenuFunctions::IHomeMenuFunctions(Core::System& system_, std::shared_ptr<Ap
{21, D<&IHomeMenuFunctions::GetPopFromGeneralChannelEvent>, "GetPopFromGeneralChannelEvent"}, {21, D<&IHomeMenuFunctions::GetPopFromGeneralChannelEvent>, "GetPopFromGeneralChannelEvent"},
{30, nullptr, "GetHomeButtonWriterLockAccessor"}, {30, nullptr, "GetHomeButtonWriterLockAccessor"},
{31, nullptr, "GetWriterLockAccessorEx"}, {31, nullptr, "GetWriterLockAccessorEx"},
{40, nullptr, "IsSleepEnabled"}, {40, D<&IHomeMenuFunctions::IsSleepEnabled>, "IsSleepEnabled"},
{41, D<&IHomeMenuFunctions::IsRebootEnabled>, "IsRebootEnabled"}, {41, D<&IHomeMenuFunctions::IsRebootEnabled>, "IsRebootEnabled"},
{50, nullptr, "LaunchSystemApplet"}, {50, nullptr, "LaunchSystemApplet"},
{51, nullptr, "LaunchStarter"}, {51, nullptr, "LaunchStarter"},
@ -64,6 +64,12 @@ Result IHomeMenuFunctions::GetPopFromGeneralChannelEvent(
R_SUCCEED(); R_SUCCEED();
} }
Result IHomeMenuFunctions::IsSleepEnabled(Out<bool> out_is_sleep_enbaled) {
LOG_INFO(Service_AM, "called");
*out_is_sleep_enbaled = true;
R_SUCCEED();
}
Result IHomeMenuFunctions::IsRebootEnabled(Out<bool> out_is_reboot_enbaled) { Result IHomeMenuFunctions::IsRebootEnabled(Out<bool> out_is_reboot_enbaled) {
LOG_INFO(Service_AM, "called"); LOG_INFO(Service_AM, "called");
*out_is_reboot_enbaled = true; *out_is_reboot_enbaled = true;

View file

@ -24,6 +24,7 @@ private:
Result LockForeground(); Result LockForeground();
Result UnlockForeground(); Result UnlockForeground();
Result GetPopFromGeneralChannelEvent(OutCopyHandle<Kernel::KReadableEvent> out_event); Result GetPopFromGeneralChannelEvent(OutCopyHandle<Kernel::KReadableEvent> out_event);
Result IsSleepEnabled(Out<bool> out_is_sleep_enbaled);
Result IsRebootEnabled(Out<bool> out_is_reboot_enbaled); Result IsRebootEnabled(Out<bool> out_is_reboot_enbaled);
Result IsForceTerminateApplicationDisabledForDebug( Result IsForceTerminateApplicationDisabledForDebug(
Out<bool> out_is_force_terminate_application_disabled_for_debug); Out<bool> out_is_force_terminate_application_disabled_for_debug);