diff --git a/sysmodules/rosalina/include/menus/miscellaneous.h b/sysmodules/rosalina/include/menus/miscellaneous.h index f46439e..2601d6c 100644 --- a/sysmodules/rosalina/include/menus/miscellaneous.h +++ b/sysmodules/rosalina/include/menus/miscellaneous.h @@ -34,3 +34,5 @@ extern Menu miscellaneousMenu; void MiscellaneousMenu_SwitchBoot3dsxTargetTitle(void); void MiscellaneousMenu_ChangeMenuCombo(void); void MiscellaneousMenu_InputRedirection(void); +void MiscellaneousMenu_PowerOff(void); +void MiscellaneousMenu_Reboot(void); diff --git a/sysmodules/rosalina/source/menus/miscellaneous.c b/sysmodules/rosalina/source/menus/miscellaneous.c index 666ff31..8ed5c88 100644 --- a/sysmodules/rosalina/source/menus/miscellaneous.c +++ b/sysmodules/rosalina/source/menus/miscellaneous.c @@ -36,11 +36,13 @@ Menu miscellaneousMenu = { "Miscellaneous options menu", - .nbItems = 3, + .nbItems = 5, { { "Switch the hb. title to the current app.", METHOD, .method = &MiscellaneousMenu_SwitchBoot3dsxTargetTitle }, { "Change the menu combo", METHOD, .method = MiscellaneousMenu_ChangeMenuCombo }, { "Start InputRedirection", METHOD, .method = &MiscellaneousMenu_InputRedirection }, + { "Power off", METHOD, .method = &MiscellaneousMenu_PowerOff }, + { "Reboot", METHOD, .method = &MiscellaneousMenu_Reboot }, } }; @@ -259,3 +261,52 @@ void MiscellaneousMenu_InputRedirection(void) } while(!(waitInput() & BUTTON_B) && !terminationRequest); } + +void MiscellaneousMenu_Reboot() +{ + Draw_Lock(); + Draw_DrawString(10, 10, COLOR_TITLE, "Miscellaneous options menu"); + Draw_DrawString(10, 30, COLOR_WHITE, "Press A to reboot, press B to go back."); + Draw_FlushFramebuffer(); + Draw_Unlock(); + + do + { + u32 pressed = waitInputWithTimeout(1000); + + if(pressed & BUTTON_A) + { + svcKernelSetState(7); + } + else if(pressed & BUTTON_B) + { + return; + } + } + while(!terminationRequest); +} + +void MiscellaneousMenu_PowerOff() // Soft shutdown. +{ + Draw_Lock(); + Draw_DrawString(10, 10, COLOR_TITLE, "Miscellaneous options menu"); + Draw_DrawString(10, 30, COLOR_WHITE, "Press A to power off, press B to go back."); + Draw_FlushFramebuffer(); + Draw_Unlock(); + + do + { + u32 pressed = waitInputWithTimeout(1000); + + if(pressed & BUTTON_A) + { + menuLeave(); + srvPublishToSubscriber(0x203, 0); + } + else if(pressed & BUTTON_B) + { + return; + } + } + while(!terminationRequest); +} \ No newline at end of file