mirror of
				https://git.suyu.dev/suyu/suyu
				synced 2025-11-04 00:49:02 -06:00 
			
		
		
		
	Implemented some basic sleep functions
This commit is contained in:
		@@ -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();
 | 
			
		||||
 
 | 
			
		||||
@@ -18,6 +18,7 @@ public:
 | 
			
		||||
    ~IGlobalStateController() override;
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
    Result StartSleepSequence(u8 a);
 | 
			
		||||
    Result StartShutdownSequence();
 | 
			
		||||
    Result StartRebootSequence();
 | 
			
		||||
    Result LoadAndApplyIdlePolicySettings();
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
 
 | 
			
		||||
@@ -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);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user