forked from ShuriZma/suyu
1
0
Fork 0

Implemented some basic sleep functions

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

View File

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

View File

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

View File

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

View File

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