Merge pull request #700 from LiquidFenrir/wifi-toggle
Add wireless toggling in rosalina
This commit is contained in:
commit
817475257e
@ -63,6 +63,7 @@
|
|||||||
#define COLOR_TITLE RGB565(0x00, 0x26, 0x1F)
|
#define COLOR_TITLE RGB565(0x00, 0x26, 0x1F)
|
||||||
#define COLOR_WHITE RGB565(0x1F, 0x3F, 0x1F)
|
#define COLOR_WHITE RGB565(0x1F, 0x3F, 0x1F)
|
||||||
#define COLOR_RED RGB565(0x1F, 0x00, 0x00)
|
#define COLOR_RED RGB565(0x1F, 0x00, 0x00)
|
||||||
|
#define COLOR_GREEN RGB565(0x00, 0x1F, 0x00)
|
||||||
#define COLOR_BLACK RGB565(0x00, 0x00, 0x00)
|
#define COLOR_BLACK RGB565(0x00, 0x00, 0x00)
|
||||||
|
|
||||||
#define DRAW_MAX_FORMATTED_STRING_SIZE 512
|
#define DRAW_MAX_FORMATTED_STRING_SIZE 512
|
||||||
|
@ -35,5 +35,6 @@ 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_ToggleWireless(void);
|
||||||
void MiscellaneousMenu_PowerOff(void);
|
void MiscellaneousMenu_PowerOff(void);
|
||||||
void MiscellaneousMenu_Reboot(void);
|
void MiscellaneousMenu_Reboot(void);
|
||||||
|
@ -37,12 +37,13 @@
|
|||||||
|
|
||||||
Menu miscellaneousMenu = {
|
Menu miscellaneousMenu = {
|
||||||
"Miscellaneous options menu",
|
"Miscellaneous options menu",
|
||||||
.nbItems = 6,
|
.nbItems = 7,
|
||||||
{
|
{
|
||||||
{ "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 },
|
{ "Save settings", METHOD, .method = &MiscellaneousMenu_SaveSettings },
|
||||||
{ "Start InputRedirection", METHOD, .method = &MiscellaneousMenu_InputRedirection },
|
{ "Start InputRedirection", METHOD, .method = &MiscellaneousMenu_InputRedirection },
|
||||||
|
{ "Toggle Wireless", METHOD, .method = &MiscellaneousMenu_ToggleWireless },
|
||||||
{ "Power off", METHOD, .method = &MiscellaneousMenu_PowerOff },
|
{ "Power off", METHOD, .method = &MiscellaneousMenu_PowerOff },
|
||||||
{ "Reboot", METHOD, .method = &MiscellaneousMenu_Reboot },
|
{ "Reboot", METHOD, .method = &MiscellaneousMenu_Reboot },
|
||||||
}
|
}
|
||||||
@ -335,6 +336,39 @@ void MiscellaneousMenu_InputRedirection(void)
|
|||||||
while(!(waitInput() & BUTTON_B) && !terminationRequest);
|
while(!(waitInput() & BUTTON_B) && !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)
|
void MiscellaneousMenu_Reboot(void)
|
||||||
{
|
{
|
||||||
Draw_Lock();
|
Draw_Lock();
|
||||||
|
Reference in New Issue
Block a user