Merge pull request #775 from LiquidFenrir/nwmcheck
Add a warning when nwm isn't running
This commit is contained in:
commit
6b9b0472bc
@ -85,21 +85,58 @@ void SysConfigMenu_ToggleWireless(void)
|
|||||||
Draw_FlushFramebuffer();
|
Draw_FlushFramebuffer();
|
||||||
Draw_Unlock();
|
Draw_Unlock();
|
||||||
|
|
||||||
|
bool nwmRunning = false;
|
||||||
|
|
||||||
|
u32 pidList[0x40];
|
||||||
|
s32 processAmount;
|
||||||
|
|
||||||
|
svcGetProcessList(&processAmount, pidList, 0x40);
|
||||||
|
|
||||||
|
for(s32 i = 0; i < processAmount; i++)
|
||||||
|
{
|
||||||
|
Handle processHandle;
|
||||||
|
Result res = svcOpenProcess(&processHandle, pidList[i]);
|
||||||
|
if(R_FAILED(res))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
char processName[8] = {0};
|
||||||
|
svcGetProcessInfo((s64 *)&processName, processHandle, 0x10000);
|
||||||
|
svcCloseHandle(processHandle);
|
||||||
|
|
||||||
|
if(!strncmp(processName, "nwm", 4))
|
||||||
|
{
|
||||||
|
nwmRunning = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
Draw_Lock();
|
Draw_Lock();
|
||||||
Draw_DrawString(10, 10, COLOR_TITLE, "System configuration menu");
|
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, 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));
|
u8 wireless = (*(vu8 *)((0x10140000 | (1u << 31)) + 0x180));
|
||||||
|
|
||||||
|
if(nwmRunning)
|
||||||
|
{
|
||||||
|
Draw_DrawString(10, 50, COLOR_WHITE, "Current status:");
|
||||||
Draw_DrawString(100, 50, (wireless ? COLOR_GREEN : COLOR_RED), (wireless ? " ON " : " OFF"));
|
Draw_DrawString(100, 50, (wireless ? COLOR_GREEN : COLOR_RED), (wireless ? " ON " : " OFF"));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Draw_DrawString(10, 50, COLOR_RED, "NWM isn't running.");
|
||||||
|
Draw_DrawString(10, 60, COLOR_RED, "If you're currently on Test Menu,");
|
||||||
|
Draw_DrawString(10, 70, COLOR_RED, "exit then press R+RIGHT to toggle the WiFi.");
|
||||||
|
Draw_DrawString(10, 80, COLOR_RED, "Otherwise, simply exit and wait a few seconds.");
|
||||||
|
}
|
||||||
|
|
||||||
Draw_FlushFramebuffer();
|
Draw_FlushFramebuffer();
|
||||||
Draw_Unlock();
|
Draw_Unlock();
|
||||||
|
|
||||||
u32 pressed = waitInputWithTimeout(1000);
|
u32 pressed = waitInputWithTimeout(1000);
|
||||||
|
|
||||||
if(pressed & BUTTON_A)
|
if(pressed & BUTTON_A && nwmRunning)
|
||||||
{
|
{
|
||||||
nwmExtInit();
|
nwmExtInit();
|
||||||
NWMEXT_ControlWirelessEnabled(!wireless);
|
NWMEXT_ControlWirelessEnabled(!wireless);
|
||||||
|
Reference in New Issue
Block a user