Cleaned up and rearranged the Rosalina menu in preparation for future features
This commit is contained in:
parent
a0c2b43b34
commit
a4629e4b65
@ -35,3 +35,5 @@ extern Menu rosalinaMenu;
|
|||||||
void RosalinaMenu_TakeScreenshot(void);
|
void RosalinaMenu_TakeScreenshot(void);
|
||||||
void RosalinaMenu_ShowCredits(void);
|
void RosalinaMenu_ShowCredits(void);
|
||||||
void RosalinaMenu_ProcessList(void);
|
void RosalinaMenu_ProcessList(void);
|
||||||
|
void RosalinaMenu_PowerOff(void);
|
||||||
|
void RosalinaMenu_Reboot(void);
|
||||||
|
@ -35,7 +35,3 @@ void MiscellaneousMenu_SwitchBoot3dsxTargetTitle(void);
|
|||||||
void MiscellaneousMenu_ChangeMenuCombo(void);
|
void MiscellaneousMenu_ChangeMenuCombo(void);
|
||||||
void MiscellaneousMenu_SaveSettings(void);
|
void MiscellaneousMenu_SaveSettings(void);
|
||||||
void MiscellaneousMenu_InputRedirection(void);
|
void MiscellaneousMenu_InputRedirection(void);
|
||||||
void MiscellaneousMenu_ToggleLEDs(void);
|
|
||||||
void MiscellaneousMenu_ToggleWireless(void);
|
|
||||||
void MiscellaneousMenu_PowerOff(void);
|
|
||||||
void MiscellaneousMenu_Reboot(void);
|
|
||||||
|
35
sysmodules/rosalina/include/menus/sysconfig.h
Normal file
35
sysmodules/rosalina/include/menus/sysconfig.h
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of Luma3DS
|
||||||
|
* Copyright (C) 2016-2017 Aurora Wright, TuxSH
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* Additional Terms 7.b and 7.c of GPLv3 apply to this file:
|
||||||
|
* * Requiring preservation of specified reasonable legal notices or
|
||||||
|
* author attributions in that material or in the Appropriate Legal
|
||||||
|
* Notices displayed by works containing it.
|
||||||
|
* * Prohibiting misrepresentation of the origin of that material,
|
||||||
|
* or requiring that modified versions of such material be marked in
|
||||||
|
* reasonable ways as different from the original version.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <3ds/types.h>
|
||||||
|
#include "menu.h"
|
||||||
|
|
||||||
|
extern Menu sysconfigMenu;
|
||||||
|
|
||||||
|
void SysConfigMenu_ToggleLEDs(void);
|
||||||
|
void SysConfigMenu_ToggleWireless(void);
|
@ -33,20 +33,24 @@
|
|||||||
#include "menus/n3ds.h"
|
#include "menus/n3ds.h"
|
||||||
#include "menus/debugger.h"
|
#include "menus/debugger.h"
|
||||||
#include "menus/miscellaneous.h"
|
#include "menus/miscellaneous.h"
|
||||||
|
#include "menus/sysconfig.h"
|
||||||
#include "ifile.h"
|
#include "ifile.h"
|
||||||
#include "memory.h"
|
#include "memory.h"
|
||||||
#include "fmt.h"
|
#include "fmt.h"
|
||||||
|
|
||||||
Menu rosalinaMenu = {
|
Menu rosalinaMenu = {
|
||||||
"Rosalina menu",
|
"Rosalina menu",
|
||||||
.nbItems = 7,
|
.nbItems = 10,
|
||||||
{
|
{
|
||||||
{ "Process list", METHOD, .method = &RosalinaMenu_ProcessList },
|
{ "Process list", METHOD, .method = &RosalinaMenu_ProcessList },
|
||||||
{ "Process patches menu...", MENU, .menu = &processPatchesMenu },
|
{ "Process patches menu...", MENU, .menu = &processPatchesMenu },
|
||||||
{ "Take screenshot (slow!)", METHOD, .method = &RosalinaMenu_TakeScreenshot },
|
{ "Take screenshot (slow!)", METHOD, .method = &RosalinaMenu_TakeScreenshot },
|
||||||
{ "New 3DS menu...", MENU, .menu = &N3DSMenu },
|
{ "New 3DS menu...", MENU, .menu = &N3DSMenu },
|
||||||
{ "Debugger options...", MENU, .menu = &debuggerMenu },
|
{ "Debugger options...", MENU, .menu = &debuggerMenu },
|
||||||
|
{ "System configuration...", MENU, .menu = &sysconfigMenu },
|
||||||
{ "Miscellaneous options...", MENU, .menu = &miscellaneousMenu },
|
{ "Miscellaneous options...", MENU, .menu = &miscellaneousMenu },
|
||||||
|
{ "Power off", METHOD, .method = &RosalinaMenu_PowerOff },
|
||||||
|
{ "Reboot", METHOD, .method = &RosalinaMenu_Reboot },
|
||||||
{ "Credits", METHOD, .method = &RosalinaMenu_ShowCredits }
|
{ "Credits", METHOD, .method = &RosalinaMenu_ShowCredits }
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -85,6 +89,59 @@ void RosalinaMenu_ShowCredits(void)
|
|||||||
while(!(waitInput() & BUTTON_B) && !terminationRequest);
|
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];
|
extern u8 framebufferCache[FB_BOTTOM_SIZE];
|
||||||
void RosalinaMenu_TakeScreenshot(void)
|
void RosalinaMenu_TakeScreenshot(void)
|
||||||
{
|
{
|
||||||
|
@ -38,16 +38,12 @@
|
|||||||
|
|
||||||
Menu miscellaneousMenu = {
|
Menu miscellaneousMenu = {
|
||||||
"Miscellaneous options menu",
|
"Miscellaneous options menu",
|
||||||
.nbItems = 8,
|
.nbItems = 4,
|
||||||
{
|
{
|
||||||
{ "Switch the hb. title to the current app.", METHOD, .method = &MiscellaneousMenu_SwitchBoot3dsxTargetTitle },
|
{ "Switch the hb. title to the current app.", METHOD, .method = &MiscellaneousMenu_SwitchBoot3dsxTargetTitle },
|
||||||
{ "Change the menu combo", METHOD, .method = MiscellaneousMenu_ChangeMenuCombo },
|
{ "Change the menu combo", METHOD, .method = MiscellaneousMenu_ChangeMenuCombo },
|
||||||
{ "Save settings", METHOD, .method = &MiscellaneousMenu_SaveSettings },
|
|
||||||
{ "Start InputRedirection", METHOD, .method = &MiscellaneousMenu_InputRedirection },
|
{ "Start InputRedirection", METHOD, .method = &MiscellaneousMenu_InputRedirection },
|
||||||
{ "Toggle LEDs", METHOD, .method = &MiscellaneousMenu_ToggleLEDs },
|
{ "Save settings", METHOD, .method = &MiscellaneousMenu_SaveSettings },
|
||||||
{ "Toggle Wireless", METHOD, .method = &MiscellaneousMenu_ToggleWireless },
|
|
||||||
{ "Power Off", METHOD, .method = &MiscellaneousMenu_PowerOff },
|
|
||||||
{ "Reboot", METHOD, .method = &MiscellaneousMenu_Reboot },
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -338,123 +334,3 @@ void MiscellaneousMenu_InputRedirection(void)
|
|||||||
}
|
}
|
||||||
while(!(waitInput() & BUTTON_B) && !terminationRequest);
|
while(!(waitInput() & BUTTON_B) && !terminationRequest);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MiscellaneousMenu_ToggleLEDs(void)
|
|
||||||
{
|
|
||||||
Draw_Lock();
|
|
||||||
Draw_ClearFramebuffer();
|
|
||||||
Draw_FlushFramebuffer();
|
|
||||||
Draw_Unlock();
|
|
||||||
|
|
||||||
do
|
|
||||||
{
|
|
||||||
Draw_Lock();
|
|
||||||
Draw_DrawString(10, 10, COLOR_TITLE, "Miscellaneous options menu");
|
|
||||||
Draw_DrawString(10, 30, COLOR_WHITE, "Press A to toggle, press B to go back.");
|
|
||||||
Draw_DrawString(10, 40, COLOR_RED, "NOTE: Entering sleep mode will reset the LED state!");
|
|
||||||
|
|
||||||
Draw_FlushFramebuffer();
|
|
||||||
Draw_Unlock();
|
|
||||||
|
|
||||||
u32 pressed = waitInputWithTimeout(1000);
|
|
||||||
|
|
||||||
if(pressed & BUTTON_A)
|
|
||||||
{
|
|
||||||
mcuInit();
|
|
||||||
u8 result;
|
|
||||||
mcuGetLEDState(&result);
|
|
||||||
u8 value = ~result;
|
|
||||||
mcuWriteRegister(40, &value, 1);
|
|
||||||
mcuExit();
|
|
||||||
}
|
|
||||||
else if(pressed & BUTTON_B)
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
while(!terminationRequest);
|
|
||||||
}
|
|
||||||
|
|
||||||
void MiscellaneousMenu_ToggleWireless(void)
|
|
||||||
{
|
|
||||||
Draw_Lock();
|
|
||||||
Draw_ClearFramebuffer();
|
|
||||||
Draw_FlushFramebuffer();
|
|
||||||
Draw_Unlock();
|
|
||||||
|
|
||||||
do
|
|
||||||
{
|
|
||||||
Draw_Lock();
|
|
||||||
Draw_DrawString(10, 10, COLOR_TITLE, "Miscellaneous options menu");
|
|
||||||
Draw_DrawString(10, 30, COLOR_WHITE, "Press A to toggle, press B to go back.");
|
|
||||||
Draw_DrawString(10, 40, COLOR_WHITE, "Current status:");
|
|
||||||
|
|
||||||
u8 wireless = (*(vu8 *)((0x10140000 | (1u << 31)) + 0x180));
|
|
||||||
Draw_DrawString(100, 40, (wireless ? COLOR_GREEN : COLOR_RED), (wireless ? " ON " : " OFF"));
|
|
||||||
Draw_FlushFramebuffer();
|
|
||||||
Draw_Unlock();
|
|
||||||
|
|
||||||
u32 pressed = waitInputWithTimeout(1000);
|
|
||||||
|
|
||||||
if(pressed & BUTTON_A)
|
|
||||||
{
|
|
||||||
nwmExtInit();
|
|
||||||
NWMEXT_ControlWirelessEnabled(!wireless);
|
|
||||||
nwmExtExit();
|
|
||||||
}
|
|
||||||
else if(pressed & BUTTON_B)
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
while(!terminationRequest);
|
|
||||||
}
|
|
||||||
|
|
||||||
void MiscellaneousMenu_Reboot(void)
|
|
||||||
{
|
|
||||||
Draw_Lock();
|
|
||||||
Draw_ClearFramebuffer();
|
|
||||||
Draw_FlushFramebuffer();
|
|
||||||
Draw_Unlock();
|
|
||||||
|
|
||||||
do
|
|
||||||
{
|
|
||||||
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();
|
|
||||||
|
|
||||||
u32 pressed = waitInputWithTimeout(1000);
|
|
||||||
|
|
||||||
if(pressed & BUTTON_A)
|
|
||||||
svcKernelSetState(7);
|
|
||||||
else if(pressed & BUTTON_B)
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
while(!terminationRequest);
|
|
||||||
}
|
|
||||||
|
|
||||||
void MiscellaneousMenu_PowerOff(void) // Soft shutdown.
|
|
||||||
{
|
|
||||||
Draw_Lock();
|
|
||||||
Draw_ClearFramebuffer();
|
|
||||||
Draw_FlushFramebuffer();
|
|
||||||
Draw_Unlock();
|
|
||||||
|
|
||||||
do
|
|
||||||
{
|
|
||||||
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();
|
|
||||||
|
|
||||||
u32 pressed = waitInputWithTimeout(1000);
|
|
||||||
|
|
||||||
if(pressed & BUTTON_A)
|
|
||||||
{
|
|
||||||
menuLeave();
|
|
||||||
srvPublishToSubscriber(0x203, 0);
|
|
||||||
}
|
|
||||||
else if(pressed & BUTTON_B)
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
while(!terminationRequest);
|
|
||||||
}
|
|
||||||
|
112
sysmodules/rosalina/source/menus/sysconfig.c
Normal file
112
sysmodules/rosalina/source/menus/sysconfig.c
Normal file
@ -0,0 +1,112 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of Luma3DS
|
||||||
|
* Copyright (C) 2016-2017 Aurora Wright, TuxSH
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* Additional Terms 7.b and 7.c of GPLv3 apply to this file:
|
||||||
|
* * Requiring preservation of specified reasonable legal notices or
|
||||||
|
* author attributions in that material or in the Appropriate Legal
|
||||||
|
* Notices displayed by works containing it.
|
||||||
|
* * Prohibiting misrepresentation of the origin of that material,
|
||||||
|
* or requiring that modified versions of such material be marked in
|
||||||
|
* reasonable ways as different from the original version.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <3ds.h>
|
||||||
|
#include "menus/sysconfig.h"
|
||||||
|
#include "mcu.h"
|
||||||
|
#include "memory.h"
|
||||||
|
#include "draw.h"
|
||||||
|
#include "fmt.h"
|
||||||
|
#include "utils.h"
|
||||||
|
#include "ifile.h"
|
||||||
|
|
||||||
|
Menu sysconfigMenu = {
|
||||||
|
"System configuration menu",
|
||||||
|
.nbItems = 2,
|
||||||
|
{
|
||||||
|
{ "Toggle LEDs", METHOD, .method = &SysConfigMenu_ToggleLEDs },
|
||||||
|
{ "Toggle Wireless", METHOD, .method = &SysConfigMenu_ToggleWireless },
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
void SysConfigMenu_ToggleLEDs(void)
|
||||||
|
{
|
||||||
|
Draw_Lock();
|
||||||
|
Draw_ClearFramebuffer();
|
||||||
|
Draw_FlushFramebuffer();
|
||||||
|
Draw_Unlock();
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
Draw_Lock();
|
||||||
|
Draw_DrawString(10, 10, COLOR_TITLE, "System configuration menu");
|
||||||
|
Draw_DrawString(10, 30, COLOR_WHITE, "Press A to toggle, press B to go back.");
|
||||||
|
Draw_DrawString(10, 50, COLOR_RED, "WARNING:");
|
||||||
|
Draw_DrawString(10, 60, COLOR_WHITE, " * Entering sleep mode will reset the LED state!");
|
||||||
|
Draw_DrawString(10, 70, COLOR_WHITE, " * LEDs cannot be toggled when the battery is low!");
|
||||||
|
|
||||||
|
Draw_FlushFramebuffer();
|
||||||
|
Draw_Unlock();
|
||||||
|
|
||||||
|
u32 pressed = waitInputWithTimeout(1000);
|
||||||
|
|
||||||
|
if(pressed & BUTTON_A)
|
||||||
|
{
|
||||||
|
mcuInit();
|
||||||
|
u8 result;
|
||||||
|
mcuGetLEDState(&result);
|
||||||
|
u8 value = ~result;
|
||||||
|
mcuWriteRegister(40, &value, 1);
|
||||||
|
mcuExit();
|
||||||
|
}
|
||||||
|
else if(pressed & BUTTON_B)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
while(!terminationRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SysConfigMenu_ToggleWireless(void)
|
||||||
|
{
|
||||||
|
Draw_Lock();
|
||||||
|
Draw_ClearFramebuffer();
|
||||||
|
Draw_FlushFramebuffer();
|
||||||
|
Draw_Unlock();
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
Draw_Lock();
|
||||||
|
Draw_DrawString(10, 10, COLOR_TITLE, "System configuration menu");
|
||||||
|
Draw_DrawString(10, 30, COLOR_WHITE, "Press A to toggle, press B to go back.");
|
||||||
|
Draw_DrawString(10, 50, COLOR_WHITE, "Current status:");
|
||||||
|
|
||||||
|
u8 wireless = (*(vu8 *)((0x10140000 | (1u << 31)) + 0x180));
|
||||||
|
Draw_DrawString(100, 50, (wireless ? COLOR_GREEN : COLOR_RED), (wireless ? " ON " : " OFF"));
|
||||||
|
Draw_FlushFramebuffer();
|
||||||
|
Draw_Unlock();
|
||||||
|
|
||||||
|
u32 pressed = waitInputWithTimeout(1000);
|
||||||
|
|
||||||
|
if(pressed & BUTTON_A)
|
||||||
|
{
|
||||||
|
nwmExtInit();
|
||||||
|
NWMEXT_ControlWirelessEnabled(!wireless);
|
||||||
|
nwmExtExit();
|
||||||
|
}
|
||||||
|
else if(pressed & BUTTON_B)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
while(!terminationRequest);
|
||||||
|
}
|
Reference in New Issue
Block a user