This commit is contained in:
Aurora Wright 2017-06-06 01:21:52 +02:00 committed by TuxSH
parent 0ba7f9dba0
commit 60d136f9b5
3 changed files with 45 additions and 1 deletions

View File

@ -78,6 +78,9 @@ extern u32 menuCombo;
u32 waitInputWithTimeout(u32 msec);
u32 waitInput(void);
u32 waitComboWithTimeout(u32 msec);
u32 waitCombo(void);
MyThread *menuCreateThread(void);
void menuEnter(void);
void menuLeave(void);

View File

@ -81,6 +81,47 @@ u32 waitInput(void)
return waitInputWithTimeout(0);
}
u32 waitComboWithTimeout(u32 msec)
{
u32 key = 0;
u32 n = 0;
//Wait for no keys to be pressed
while(HID_PAD && !terminationRequest && (msec == 0 || n < msec))
{
svcSleepThread(1 * 1000 * 1000LL);
n++;
}
if(terminationRequest || (msec != 0 && n >= msec))
return 0;
do
{
svcSleepThread(1 * 1000 * 1000LL);
n++;
u32 tempKey = HID_PAD;
for(u32 i = 0x26000; i > 0; i--)
{
if(tempKey != HID_PAD) break;
if(i == 1) key = tempKey;
}
}
while((!key || HID_PAD) && !terminationRequest && (msec == 0 || n < msec));
if(terminationRequest || (msec != 0 && n >= msec))
return 0;
return key;
}
u32 waitCombo(void)
{
return waitComboWithTimeout(0);
}
static Result _MCUHWC_GetBatteryLevel(u8 *out)
{
#define TRY(expr) if(R_FAILED(res = (expr))) { svcCloseHandle(mcuhwcHandle); return res; }

View File

@ -146,7 +146,7 @@ void MiscellaneousMenu_ChangeMenuCombo(void)
Draw_FlushFramebuffer();
Draw_Unlock();
menuCombo = waitInput();
menuCombo = waitCombo();
MiscellaneousMenu_ConvertComboToString(comboStr, menuCombo);
do