Cleaned up and rearranged the Rosalina menu in preparation for future features

This commit is contained in:
Hikari-chin
2017-07-23 22:44:14 -04:00
committed by Aurora Wright
parent a0c2b43b34
commit a4629e4b65
6 changed files with 209 additions and 131 deletions

View File

@@ -33,20 +33,24 @@
#include "menus/n3ds.h"
#include "menus/debugger.h"
#include "menus/miscellaneous.h"
#include "menus/sysconfig.h"
#include "ifile.h"
#include "memory.h"
#include "fmt.h"
Menu rosalinaMenu = {
"Rosalina menu",
.nbItems = 7,
.nbItems = 10,
{
{ "Process list", METHOD, .method = &RosalinaMenu_ProcessList },
{ "Process patches menu...", MENU, .menu = &processPatchesMenu },
{ "Take screenshot (slow!)", METHOD, .method = &RosalinaMenu_TakeScreenshot },
{ "New 3DS menu...", MENU, .menu = &N3DSMenu },
{ "Debugger options...", MENU, .menu = &debuggerMenu },
{ "System configuration...", MENU, .menu = &sysconfigMenu },
{ "Miscellaneous options...", MENU, .menu = &miscellaneousMenu },
{ "Power off", METHOD, .method = &RosalinaMenu_PowerOff },
{ "Reboot", METHOD, .method = &RosalinaMenu_Reboot },
{ "Credits", METHOD, .method = &RosalinaMenu_ShowCredits }
}
};
@@ -85,6 +89,59 @@ void RosalinaMenu_ShowCredits(void)
while(!(waitInput() & BUTTON_B) && !terminationRequest);
}
void RosalinaMenu_Reboot(void)
{
Draw_Lock();
Draw_ClearFramebuffer();
Draw_FlushFramebuffer();
Draw_Unlock();
do
{
Draw_Lock();
Draw_DrawString(10, 10, COLOR_TITLE, "Rosalina menu");
Draw_DrawString(10, 30, COLOR_WHITE, "Press A to reboot, press B to go back.");
Draw_FlushFramebuffer();
Draw_Unlock();
u32 pressed = waitInputWithTimeout(1000);
if(pressed & BUTTON_A)
svcKernelSetState(7);
else if(pressed & BUTTON_B)
return;
}
while(!terminationRequest);
}
void RosalinaMenu_PowerOff(void) // Soft shutdown.
{
Draw_Lock();
Draw_ClearFramebuffer();
Draw_FlushFramebuffer();
Draw_Unlock();
do
{
Draw_Lock();
Draw_DrawString(10, 10, COLOR_TITLE, "Rosalina menu");
Draw_DrawString(10, 30, COLOR_WHITE, "Press A to power off, press B to go back.");
Draw_FlushFramebuffer();
Draw_Unlock();
u32 pressed = waitInputWithTimeout(1000);
if(pressed & BUTTON_A)
{
menuLeave();
srvPublishToSubscriber(0x203, 0);
}
else if(pressed & BUTTON_B)
return;
}
while(!terminationRequest);
}
extern u8 framebufferCache[FB_BOTTOM_SIZE];
void RosalinaMenu_TakeScreenshot(void)
{