Fix latest commit

This commit is contained in:
TuxSH 2020-05-15 02:06:52 +01:00
parent 22db3445a0
commit a2313d1c03
9 changed files with 152 additions and 110 deletions

View File

@ -27,26 +27,15 @@
#pragma once #pragma once
#include <3ds/types.h> #include <3ds/types.h>
#include <3ds/services/hid.h>
#include "MyThread.h" #include "MyThread.h"
#include "utils.h" #include "utils.h"
#define HID_PAD (REG32(0x10146000) ^ 0xFFF) #define HID_PAD (REG32(0x10146000) ^ 0xFFF)
#define BUTTON_A (1 << 0)
#define BUTTON_B (1 << 1)
#define BUTTON_SELECT (1 << 2)
#define BUTTON_START (1 << 3)
#define BUTTON_RIGHT (1 << 4)
#define BUTTON_LEFT (1 << 5)
#define BUTTON_UP (1 << 6)
#define BUTTON_DOWN (1 << 7)
#define BUTTON_R1 (1 << 8)
#define BUTTON_L1 (1 << 9)
#define BUTTON_X (1 << 10)
#define BUTTON_Y (1 << 11)
#define DEFAULT_MENU_COMBO (BUTTON_L1 | BUTTON_DOWN | BUTTON_SELECT) #define DEFAULT_MENU_COMBO (KEY_L | KEY_DDOWN | KEY_SELECT)
#define DIRECTIONAL_KEYS (BUTTON_DOWN | BUTTON_UP | BUTTON_LEFT | BUTTON_RIGHT) #define DIRECTIONAL_KEYS (KEY_DOWN | KEY_UP | KEY_LEFT | KEY_RIGHT)
#define CORE_APPLICATION 0 #define CORE_APPLICATION 0
#define CORE_SYSTEM 1 #define CORE_SYSTEM 1

View File

@ -183,12 +183,14 @@ static void handlePreTermNotification(u32 notificationId)
SysConfigMenu_UpdateStatus(true); SysConfigMenu_UpdateStatus(true);
} }
Draw_Lock();
if (isHidInitialized) if (isHidInitialized)
hidExit(); hidExit();
// Termination request // Termination request
terminationRequest = true; terminationRequest = true;
svcSignalEvent(terminationRequestEvent); svcSignalEvent(terminationRequestEvent);
Draw_Unlock();
} }
static void handleNextApplicationDebuggedByForce(u32 notificationId) static void handleNextApplicationDebuggedByForce(u32 notificationId)

View File

@ -46,17 +46,10 @@ bool hidShouldUseIrrst(void)
return false; return false;
} }
static u32 convertHidKeys(u32 keys) static inline u32 convertHidKeys(u32 keys)
{ {
u32 buttons = keys & 0xFFF; // Nothing to do yet
return keys;
// Transform Circle Pad and C-stick into directional keys
if (keys & KEY_LEFT) buttons |= BUTTON_LEFT;
if (keys & KEY_RIGHT) buttons |= BUTTON_RIGHT;
if (keys & KEY_UP) buttons |= BUTTON_UP;
if (keys & KEY_DOWN) buttons |= BUTTON_DOWN;
return buttons;
} }
u32 waitInputWithTimeout(s32 msec) u32 waitInputWithTimeout(s32 msec)
@ -67,12 +60,19 @@ u32 waitInputWithTimeout(s32 msec)
do do
{ {
svcSleepThread(1 * 1000 * 1000LL); svcSleepThread(1 * 1000 * 1000LL);
if (!isHidInitialized || terminationRequest) break; Draw_Lock();
n += 1; if (!isHidInitialized || terminationRequest)
{
keys = 0;
Draw_Unlock();
break;
}
n++;
hidScanInput(); hidScanInput();
keys = convertHidKeys(hidKeysDown()) | (convertHidKeys(hidKeysDownRepeat()) & DIRECTIONAL_KEYS); keys = convertHidKeys(hidKeysDown()) | (convertHidKeys(hidKeysDownRepeat()) & DIRECTIONAL_KEYS);
} while (keys == 0 && !terminationRequest && isHidInitialized && n < msec); Draw_Unlock();
} while (keys == 0 && !terminationRequest && isHidInitialized && (msec < 0 || n < msec));
return keys; return keys;
@ -83,22 +83,54 @@ u32 waitInput(void)
return waitInputWithTimeout(-1); return waitInputWithTimeout(-1);
} }
static u32 scanHeldKeys(void)
{
u32 keys;
Draw_Lock();
if (!isHidInitialized || terminationRequest)
keys = 0;
else
{
hidScanInput();
keys = convertHidKeys(hidKeysHeld());
}
Draw_Unlock();
return keys;
}
u32 waitComboWithTimeout(s32 msec) u32 waitComboWithTimeout(s32 msec)
{ {
s32 n = 0; s32 n = 0;
u32 keys; u32 keys = 0;
u32 tempKeys = 0;
hidScanInput(); // Wait for nothing to be pressed
keys = convertHidKeys(hidKeysHeld()); while (scanHeldKeys() != 0 && !terminationRequest && isHidInitialized && (msec < 0 || n < msec))
{
svcSleepThread(1 * 1000 * 1000LL);
n++;
}
if (terminationRequest || !isHidInitialized || !(msec < 0 || n < msec))
return 0;
do do
{ {
svcSleepThread(1 * 1000 * 1000LL); svcSleepThread(1 * 1000 * 1000LL);
if (!isHidInitialized || terminationRequest) break; n++;
n += 1;
hidScanInput(); tempKeys = scanHeldKeys();
keys = convertHidKeys(hidKeysHeld());
} while (keys == 0 && !terminationRequest && isHidInitialized && n < msec); for (u32 i = 0x10000; i > 0; i--)
{
if (tempKeys != scanHeldKeys()) break;
if (i == 1) keys = tempKeys;
}
}
while((keys == 0 || scanHeldKeys() != 0) && !terminationRequest && isHidInitialized && (msec < 0 || n < msec));
return keys; return keys;
} }
@ -137,15 +169,13 @@ void menuThreadMain(void)
svcSleepThread(500 * 1000 * 1000LL); svcSleepThread(500 * 1000 * 1000LL);
hidInit(); // assume this doesn't fail hidInit(); // assume this doesn't fail
hidSetRepeatParameters(250, 100);
isHidInitialized = true; isHidInitialized = true;
while(!terminationRequest) while(!terminationRequest)
{ {
u32 keys = waitComboWithTimeout(1);
Cheat_ApplyCheats(); Cheat_ApplyCheats();
if((keys & menuCombo) == menuCombo) if((scanHeldKeys() & menuCombo) == menuCombo)
{ {
menuEnter(); menuEnter();
if(isN3DS) N3DSMenu_UpdateStatus(); if(isN3DS) N3DSMenu_UpdateStatus();
@ -268,14 +298,25 @@ void menuShow(Menu *root)
Draw_Lock(); Draw_Lock();
Draw_ClearFramebuffer(); Draw_ClearFramebuffer();
Draw_FlushFramebuffer(); Draw_FlushFramebuffer();
hidSetRepeatParameters(0, 0);
menuDraw(currentMenu, selectedItem); menuDraw(currentMenu, selectedItem);
Draw_Unlock(); Draw_Unlock();
bool menuComboReleased = false;
do do
{ {
u32 pressed = waitInputWithTimeout(1000); u32 pressed = waitInputWithTimeout(1000);
if(pressed & BUTTON_A) if(!menuComboReleased && (scanHeldKeys() & menuCombo) != menuCombo)
{
menuComboReleased = true;
Draw_Lock();
hidSetRepeatParameters(200, 100);
Draw_Unlock();
}
if(pressed & KEY_A)
{ {
Draw_Lock(); Draw_Lock();
Draw_ClearFramebuffer(); Draw_ClearFramebuffer();
@ -301,7 +342,7 @@ void menuShow(Menu *root)
Draw_FlushFramebuffer(); Draw_FlushFramebuffer();
Draw_Unlock(); Draw_Unlock();
} }
else if(pressed & BUTTON_B) else if(pressed & KEY_B)
{ {
Draw_Lock(); Draw_Lock();
Draw_ClearFramebuffer(); Draw_ClearFramebuffer();
@ -316,12 +357,12 @@ void menuShow(Menu *root)
else else
break; break;
} }
else if(pressed & BUTTON_DOWN) else if(pressed & KEY_DOWN)
{ {
if(++selectedItem >= currentMenu->nbItems) if(++selectedItem >= currentMenu->nbItems)
selectedItem = 0; selectedItem = 0;
} }
else if(pressed & BUTTON_UP) else if(pressed & KEY_UP)
{ {
if(selectedItem-- <= 0) if(selectedItem-- <= 0)
selectedItem = currentMenu->nbItems - 1; selectedItem = currentMenu->nbItems - 1;

View File

@ -89,7 +89,7 @@ void RosalinaMenu_ShowCredits(void)
Draw_FlushFramebuffer(); Draw_FlushFramebuffer();
Draw_Unlock(); Draw_Unlock();
} }
while(!(waitInput() & BUTTON_B) && !terminationRequest); while(!(waitInput() & KEY_B) && !terminationRequest);
} }
void RosalinaMenu_Reboot(void) void RosalinaMenu_Reboot(void)
@ -109,12 +109,12 @@ void RosalinaMenu_Reboot(void)
u32 pressed = waitInputWithTimeout(1000); u32 pressed = waitInputWithTimeout(1000);
if(pressed & BUTTON_A) if(pressed & KEY_A)
{ {
menuLeave(); menuLeave();
APT_HardwareResetAsync(); APT_HardwareResetAsync();
return; return;
} else if(pressed & BUTTON_B) } else if(pressed & KEY_B)
return; return;
} }
while(!terminationRequest); while(!terminationRequest);
@ -137,13 +137,13 @@ void RosalinaMenu_PowerOff(void) // Soft shutdown.
u32 pressed = waitInputWithTimeout(1000); u32 pressed = waitInputWithTimeout(1000);
if(pressed & BUTTON_A) if(pressed & KEY_A)
{ {
menuLeave(); menuLeave();
srvPublishToSubscriber(0x203, 0); srvPublishToSubscriber(0x203, 0);
return; return;
} }
else if(pressed & BUTTON_B) else if(pressed & KEY_B)
return; return;
} }
while(!terminationRequest); while(!terminationRequest);
@ -310,7 +310,7 @@ end:
Draw_FlushFramebuffer(); Draw_FlushFramebuffer();
Draw_Unlock(); Draw_Unlock();
} }
while(!(waitInput() & BUTTON_B) && !terminationRequest); while(!(waitInput() & KEY_B) && !terminationRequest);
#undef TRY #undef TRY
} }

View File

@ -1944,7 +1944,7 @@ void RosalinaMenu_Cheats(void)
Draw_FlushFramebuffer(); Draw_FlushFramebuffer();
Draw_Unlock(); Draw_Unlock();
} while (!(waitInput() & BUTTON_B) && !terminationRequest); } while (!(waitInput() & KEY_B) && !terminationRequest);
} }
else else
{ {
@ -1991,9 +1991,9 @@ void RosalinaMenu_Cheats(void)
if (pressed != 0) break; if (pressed != 0) break;
} while (pressed == 0 && !terminationRequest); } while (pressed == 0 && !terminationRequest);
if (pressed & BUTTON_B) if (pressed & KEY_B)
break; break;
else if ((pressed & BUTTON_A) && R_SUCCEEDED(r)) else if ((pressed & KEY_A) && R_SUCCEEDED(r))
{ {
if (cheats[selected]->active) if (cheats[selected]->active)
{ {
@ -2004,13 +2004,13 @@ void RosalinaMenu_Cheats(void)
r = Cheat_MapMemoryAndApplyCheat(pid, cheats[selected]); r = Cheat_MapMemoryAndApplyCheat(pid, cheats[selected]);
} }
} }
else if (pressed & BUTTON_DOWN) else if (pressed & KEY_DOWN)
selected++; selected++;
else if (pressed & BUTTON_UP) else if (pressed & KEY_UP)
selected--; selected--;
else if (pressed & BUTTON_LEFT) else if (pressed & KEY_LEFT)
selected -= CHEATS_PER_MENU_PAGE; selected -= CHEATS_PER_MENU_PAGE;
else if (pressed & BUTTON_RIGHT) else if (pressed & KEY_RIGHT)
{ {
if (selected + CHEATS_PER_MENU_PAGE < cheatCount) if (selected + CHEATS_PER_MENU_PAGE < cheatCount)
selected += CHEATS_PER_MENU_PAGE; selected += CHEATS_PER_MENU_PAGE;

View File

@ -162,7 +162,7 @@ void DebuggerMenu_EnableDebugger(void)
Draw_FlushFramebuffer(); Draw_FlushFramebuffer();
Draw_Unlock(); Draw_Unlock();
} }
while(!(waitInput() & BUTTON_B) && !terminationRequest); while(!(waitInput() & KEY_B) && !terminationRequest);
} }
void DebuggerMenu_DisableDebugger(void) void DebuggerMenu_DisableDebugger(void)
@ -183,7 +183,7 @@ void DebuggerMenu_DisableDebugger(void)
Draw_FlushFramebuffer(); Draw_FlushFramebuffer();
Draw_Unlock(); Draw_Unlock();
} }
while(!(waitInput() & BUTTON_B) && !terminationRequest); while(!(waitInput() & KEY_B) && !terminationRequest);
} }
void DebuggerMenu_DebugNextApplicationByForce(void) void DebuggerMenu_DebugNextApplicationByForce(void)
@ -232,7 +232,7 @@ void DebuggerMenu_DebugNextApplicationByForce(void)
Draw_FlushFramebuffer(); Draw_FlushFramebuffer();
Draw_Unlock(); Draw_Unlock();
} }
while(!(waitInput() & BUTTON_B) && !terminationRequest); while(!(waitInput() & KEY_B) && !terminationRequest);
} }
void debuggerSocketThreadMain(void) void debuggerSocketThreadMain(void)

View File

@ -95,13 +95,25 @@ void MiscellaneousMenu_SwitchBoot3dsxTargetTitle(void)
Draw_FlushFramebuffer(); Draw_FlushFramebuffer();
Draw_Unlock(); Draw_Unlock();
} }
while(!(waitInput() & BUTTON_B) && !terminationRequest); while(!(waitInput() & KEY_B) && !terminationRequest);
} }
static void MiscellaneousMenu_ConvertComboToString(char *out, u32 combo) static void MiscellaneousMenu_ConvertComboToString(char *out, u32 combo)
{ {
static const char *keys[] = { "A", "B", "Select", "Start", "Right", "Left", "Up", "Down", "R", "L", "X", "Y" }; static const char *keys[] = {
for(s32 i = 11; i >= 0; i--) "A", "B", "Select", "Start", "Right", "Left", "Up", "Down", "R", "L", "X", "Y",
"?", "?",
"ZL", "ZR",
"?", "?", "?", "?",
"Touch",
"?", "?", "?",
"CStick Right", "CStick Left", "CStick Up", "CStick Down",
"CPad Right", "CPad Left", "CPad Up", "CPad Down",
};
char *outOrig = out;
out[0] = 0;
for(s32 i = 31; i >= 0; i--)
{ {
if(combo & (1 << i)) if(combo & (1 << i))
{ {
@ -111,12 +123,13 @@ static void MiscellaneousMenu_ConvertComboToString(char *out, u32 combo)
} }
} }
if (out != outOrig)
out[-1] = 0; out[-1] = 0;
} }
void MiscellaneousMenu_ChangeMenuCombo(void) void MiscellaneousMenu_ChangeMenuCombo(void)
{ {
char comboStrOrig[64], comboStr[64]; char comboStrOrig[128], comboStr[128];
u32 posY; u32 posY;
Draw_Lock(); Draw_Lock();
@ -132,9 +145,6 @@ void MiscellaneousMenu_ChangeMenuCombo(void)
posY = Draw_DrawFormattedString(10, 30, COLOR_WHITE, "The current menu combo is: %s", comboStrOrig); posY = Draw_DrawFormattedString(10, 30, COLOR_WHITE, "The current menu combo is: %s", comboStrOrig);
posY = Draw_DrawString(10, posY + SPACING_Y, COLOR_WHITE, "Please enter the new combo:"); posY = Draw_DrawString(10, posY + SPACING_Y, COLOR_WHITE, "Please enter the new combo:");
Draw_FlushFramebuffer();
Draw_Unlock();
menuCombo = waitCombo(); menuCombo = waitCombo();
MiscellaneousMenu_ConvertComboToString(comboStr, menuCombo); MiscellaneousMenu_ConvertComboToString(comboStr, menuCombo);
@ -151,7 +161,7 @@ void MiscellaneousMenu_ChangeMenuCombo(void)
Draw_FlushFramebuffer(); Draw_FlushFramebuffer();
Draw_Unlock(); Draw_Unlock();
} }
while(!(waitInput() & BUTTON_B) && !terminationRequest); while(!(waitInput() & KEY_B) && !terminationRequest);
} }
void MiscellaneousMenu_SaveSettings(void) void MiscellaneousMenu_SaveSettings(void)
@ -217,7 +227,7 @@ void MiscellaneousMenu_SaveSettings(void)
Draw_FlushFramebuffer(); Draw_FlushFramebuffer();
Draw_Unlock(); Draw_Unlock();
} }
while(!(waitInput() & BUTTON_B) && !terminationRequest); while(!(waitInput() & KEY_B) && !terminationRequest);
} }
void MiscellaneousMenu_InputRedirection(void) void MiscellaneousMenu_InputRedirection(void)
@ -317,7 +327,7 @@ void MiscellaneousMenu_InputRedirection(void)
Draw_FlushFramebuffer(); Draw_FlushFramebuffer();
Draw_Unlock(); Draw_Unlock();
} }
while(!(waitInput() & BUTTON_B) && !terminationRequest); while(!(waitInput() & KEY_B) && !terminationRequest);
} }
void MiscellaneousMenu_SyncTimeDate(void) void MiscellaneousMenu_SyncTimeDate(void)
@ -351,16 +361,16 @@ void MiscellaneousMenu_SyncTimeDate(void)
input = waitInput(); input = waitInput();
if(input & BUTTON_LEFT) utcOffset = (24 + utcOffset - 1) % 24; // ensure utcOffset >= 0 if(input & KEY_LEFT) utcOffset = (24 + utcOffset - 1) % 24; // ensure utcOffset >= 0
if(input & BUTTON_RIGHT) utcOffset = (utcOffset + 1) % 24; if(input & KEY_RIGHT) utcOffset = (utcOffset + 1) % 24;
if(input & BUTTON_UP) utcOffsetMinute = (utcOffsetMinute + 1) % 60; if(input & KEY_UP) utcOffsetMinute = (utcOffsetMinute + 1) % 60;
if(input & BUTTON_DOWN) utcOffsetMinute = (60 + utcOffsetMinute - 1) % 60; if(input & KEY_DOWN) utcOffsetMinute = (60 + utcOffsetMinute - 1) % 60;
Draw_FlushFramebuffer(); Draw_FlushFramebuffer();
Draw_Unlock(); Draw_Unlock();
} }
while(!(input & (BUTTON_A | BUTTON_B)) && !terminationRequest); while(!(input & (KEY_A | KEY_B)) && !terminationRequest);
if (input & BUTTON_B) if (input & KEY_B)
return; return;
utcOffset -= 12; utcOffset -= 12;
@ -400,6 +410,6 @@ void MiscellaneousMenu_SyncTimeDate(void)
Draw_FlushFramebuffer(); Draw_FlushFramebuffer();
Draw_Unlock(); Draw_Unlock();
} }
while(!(input & BUTTON_B) && !terminationRequest); while(!(input & KEY_B) && !terminationRequest);
} }

View File

@ -197,7 +197,7 @@ end:
Draw_FlushFramebuffer(); Draw_FlushFramebuffer();
Draw_Unlock(); Draw_Unlock();
} }
while(!(waitInput() & BUTTON_B) && !terminationRequest); while(!(waitInput() & KEY_B) && !terminationRequest);
#undef TRY #undef TRY
} }
@ -493,21 +493,21 @@ static void ProcessListMenu_MemoryViewer(const ProcessInfo *info)
u32 pressed = waitInputWithTimeout(1000); u32 pressed = waitInputWithTimeout(1000);
if(pressed & BUTTON_A) if(pressed & KEY_A)
editing = !editing; editing = !editing;
else if(pressed & BUTTON_X) else if(pressed & KEY_X)
{ {
if(checkMode(MENU_MODE_GOTO)) if(checkMode(MENU_MODE_GOTO))
finishJumping(); finishJumping();
else else
gotoAddress = __builtin_bswap32(((u32)menus[MENU_MODE_NORMAL].buf) + menus[MENU_MODE_NORMAL].selected); gotoAddress = __builtin_bswap32(((u32)menus[MENU_MODE_NORMAL].buf) + menus[MENU_MODE_NORMAL].selected);
} }
else if(pressed & BUTTON_Y) else if(pressed & KEY_Y)
{ {
if(checkMode(MENU_MODE_SEARCH)) if(checkMode(MENU_MODE_SEARCH))
finishSearching(); finishSearching();
} }
else if(pressed & BUTTON_SELECT) else if(pressed & KEY_SELECT)
{ {
clearMenu(); clearMenu();
ProcessListMenu_DumpMemory(info->name, menus[MENU_MODE_NORMAL].buf, menus[MENU_MODE_NORMAL].max); ProcessListMenu_DumpMemory(info->name, menus[MENU_MODE_NORMAL].buf, menus[MENU_MODE_NORMAL].max);
@ -517,35 +517,35 @@ static void ProcessListMenu_MemoryViewer(const ProcessInfo *info)
if(editing) if(editing)
{ {
// Edit the highlighted byte // Edit the highlighted byte
if(pressed & BUTTON_LEFT) if(pressed & KEY_LEFT)
selectedByteAdd0x10(); selectedByteAdd0x10();
else if(pressed & BUTTON_RIGHT) else if(pressed & KEY_RIGHT)
selectedByteSub0x10(); selectedByteSub0x10();
else if(pressed & BUTTON_UP) else if(pressed & KEY_UP)
selectedByteIncrement(); selectedByteIncrement();
else if(pressed & BUTTON_DOWN) else if(pressed & KEY_DOWN)
selectedByteDecrement(); selectedByteDecrement();
} }
else else
{ {
// Move the cursor // Move the cursor
if(pressed & BUTTON_LEFT) if(pressed & KEY_LEFT)
selectedMoveLeft(); selectedMoveLeft();
else if(pressed & BUTTON_RIGHT) else if(pressed & KEY_RIGHT)
selectedMoveRight(); selectedMoveRight();
else if(pressed & BUTTON_UP) else if(pressed & KEY_UP)
selectedMoveUp(); selectedMoveUp();
else if(pressed & BUTTON_DOWN) else if(pressed & KEY_DOWN)
selectedMoveDown(); selectedMoveDown();
else if(pressed & BUTTON_L1) else if(pressed & KEY_L)
{ {
if(menuMode == MENU_MODE_NORMAL) if(menuMode == MENU_MODE_NORMAL)
viewHeap(); viewHeap();
else if(menuMode == MENU_MODE_SEARCH) else if(menuMode == MENU_MODE_SEARCH)
searchPatternReduce(); searchPatternReduce();
} }
else if(pressed & BUTTON_R1) else if(pressed & KEY_R)
{ {
if(menuMode == MENU_MODE_NORMAL) if(menuMode == MENU_MODE_NORMAL)
viewCode(); viewCode();
@ -554,7 +554,7 @@ static void ProcessListMenu_MemoryViewer(const ProcessInfo *info)
} }
} }
if(pressed & BUTTON_B) // go back to the list, or the simple viewer if(pressed & KEY_B) // go back to the list, or the simple viewer
{ {
if(menuMode != MENU_MODE_NORMAL) if(menuMode != MENU_MODE_NORMAL)
{ {
@ -700,17 +700,17 @@ void RosalinaMenu_ProcessList(void)
} }
while(pressed == 0 && !terminationRequest); while(pressed == 0 && !terminationRequest);
if(pressed & BUTTON_B) if(pressed & KEY_B)
break; break;
else if(pressed & BUTTON_A) else if(pressed & KEY_A)
ProcessListMenu_HandleSelected(&infos[selected]); ProcessListMenu_HandleSelected(&infos[selected]);
else if(pressed & BUTTON_DOWN) else if(pressed & KEY_DOWN)
selected++; selected++;
else if(pressed & BUTTON_UP) else if(pressed & KEY_UP)
selected--; selected--;
else if(pressed & BUTTON_LEFT) else if(pressed & KEY_LEFT)
selected -= PROCESSES_PER_MENU_PAGE; selected -= PROCESSES_PER_MENU_PAGE;
else if(pressed & BUTTON_RIGHT) else if(pressed & KEY_RIGHT)
{ {
if(selected + PROCESSES_PER_MENU_PAGE < processAmount) if(selected + PROCESSES_PER_MENU_PAGE < processAmount)
selected += PROCESSES_PER_MENU_PAGE; selected += PROCESSES_PER_MENU_PAGE;

View File

@ -66,7 +66,7 @@ void SysConfigMenu_ToggleLEDs(void)
u32 pressed = waitInputWithTimeout(1000); u32 pressed = waitInputWithTimeout(1000);
if(pressed & BUTTON_A) if(pressed & KEY_A)
{ {
mcuHwcInit(); mcuHwcInit();
u8 result; u8 result;
@ -75,7 +75,7 @@ void SysConfigMenu_ToggleLEDs(void)
MCUHWC_WriteRegister(0x28, &result, 1); MCUHWC_WriteRegister(0x28, &result, 1);
mcuHwcExit(); mcuHwcExit();
} }
else if(pressed & BUTTON_B) else if(pressed & KEY_B)
return; return;
} }
while(!terminationRequest); while(!terminationRequest);
@ -139,13 +139,13 @@ void SysConfigMenu_ToggleWireless(void)
u32 pressed = waitInputWithTimeout(1000); u32 pressed = waitInputWithTimeout(1000);
if(pressed & BUTTON_A && nwmRunning) if(pressed & KEY_A && nwmRunning)
{ {
nwmExtInit(); nwmExtInit();
NWMEXT_ControlWirelessEnabled(!wireless); NWMEXT_ControlWirelessEnabled(!wireless);
nwmExtExit(); nwmExtExit();
} }
else if(pressed & BUTTON_B) else if(pressed & KEY_B)
return; return;
} }
while(!terminationRequest); while(!terminationRequest);
@ -224,7 +224,7 @@ static bool SysConfigMenu_ForceWifiConnection(int slot)
u32 pressed = waitInputWithTimeout(1000); u32 pressed = waitInputWithTimeout(1000);
if(pressed & BUTTON_B) if(pressed & KEY_B)
break; break;
} }
while(!terminationRequest); while(!terminationRequest);
@ -259,7 +259,7 @@ void SysConfigMenu_TogglePowerButton(void)
u32 pressed = waitInputWithTimeout(1000); u32 pressed = waitInputWithTimeout(1000);
if(pressed & BUTTON_A) if(pressed & KEY_A)
{ {
mcuHwcInit(); mcuHwcInit();
MCUHWC_ReadRegister(0x18, (u8*)&mcuIRQMask, 4); MCUHWC_ReadRegister(0x18, (u8*)&mcuIRQMask, 4);
@ -267,7 +267,7 @@ void SysConfigMenu_TogglePowerButton(void)
MCUHWC_WriteRegister(0x18, (u8*)&mcuIRQMask, 4); MCUHWC_WriteRegister(0x18, (u8*)&mcuIRQMask, 4);
mcuHwcExit(); mcuHwcExit();
} }
else if(pressed & BUTTON_B) else if(pressed & KEY_B)
return; return;
} }
while(!terminationRequest); while(!terminationRequest);
@ -296,7 +296,7 @@ void SysConfigMenu_ControlWifi(void)
u32 pressed = waitInputWithTimeout(1000); u32 pressed = waitInputWithTimeout(1000);
if(pressed & BUTTON_A) if(pressed & KEY_A)
{ {
if(SysConfigMenu_ForceWifiConnection(slot)) if(SysConfigMenu_ForceWifiConnection(slot))
{ {
@ -309,7 +309,7 @@ void SysConfigMenu_ControlWifi(void)
Draw_FlushFramebuffer(); Draw_FlushFramebuffer();
Draw_Unlock(); Draw_Unlock();
} }
else if(pressed & BUTTON_LEFT) else if(pressed & KEY_LEFT)
{ {
slotString[slot * 4] = ' '; slotString[slot * 4] = ' ';
slotString[(slot * 4) + 2] = ' '; slotString[(slot * 4) + 2] = ' ';
@ -319,7 +319,7 @@ void SysConfigMenu_ControlWifi(void)
slotString[slot * 4] = '>'; slotString[slot * 4] = '>';
slotString[(slot * 4) + 2] = '<'; slotString[(slot * 4) + 2] = '<';
} }
else if(pressed & BUTTON_RIGHT) else if(pressed & KEY_RIGHT)
{ {
slotString[slot * 4] = ' '; slotString[slot * 4] = ' ';
slotString[(slot * 4) + 2] = ' '; slotString[(slot * 4) + 2] = ' ';
@ -329,7 +329,7 @@ void SysConfigMenu_ControlWifi(void)
slotString[slot * 4] = '>'; slotString[slot * 4] = '>';
slotString[(slot * 4) + 2] = '<'; slotString[(slot * 4) + 2] = '<';
} }
else if(pressed & BUTTON_B) else if(pressed & KEY_B)
return; return;
} }
while(!terminationRequest); while(!terminationRequest);
@ -352,7 +352,7 @@ void SysConfigMenu_DisableForcedWifiConnection(void)
Draw_DrawString(10, 30, COLOR_WHITE, "Forced connection successfully disabled.\nNote: auto-connection may remain broken."); Draw_DrawString(10, 30, COLOR_WHITE, "Forced connection successfully disabled.\nNote: auto-connection may remain broken.");
u32 pressed = waitInputWithTimeout(1000); u32 pressed = waitInputWithTimeout(1000);
if(pressed & BUTTON_B) if(pressed & KEY_B)
return; return;
} }
while(!terminationRequest); while(!terminationRequest);