Minor code cleanup

This commit is contained in:
Pk11 2022-01-09 20:29:51 -06:00
parent 643bc4143c
commit 580d98535b
7 changed files with 31 additions and 24 deletions

View File

@ -91,7 +91,8 @@ static int _mainMenu(int cursor)
return result; return result;
} }
void fifoHandler(u32 value32, void* userdata) { void fifoHandler(u32 value32, void* userdata)
{
if (value32 == 0x54495845) // 'EXIT' if (value32 == 0x54495845) // 'EXIT'
programEnd = true; programEnd = true;
} }
@ -157,7 +158,8 @@ int main(int argc, char **argv)
break; break;
case MAIN_MENU_FIX: case MAIN_MENU_FIX:
if(nandio_unlock_writing()) { if (nandio_unlock_writing())
{
nandio_force_fat_fix(); nandio_force_fat_fix();
nandio_lock_writing(); nandio_lock_writing();
messageBox("Mismatch in FAT copies will be\nfixed on close.\n"); messageBox("Mismatch in FAT copies will be\nfixed on close.\n");

View File

@ -93,7 +93,8 @@ bool randomConfirmBox(char* message)
int sequencePosition = 0; int sequencePosition = 0;
u8 sequence[8]; u8 sequence[8];
for(int i = 0; i < sizeof(sequence); i++) { for (int i = 0; i < sizeof(sequence); i++)
{
sequence[i] = rand() % (sizeof(keys) / sizeof(keys[0])); sequence[i] = rand() % (sizeof(keys) / sizeof(keys[0]));
} }
@ -111,19 +112,22 @@ bool randomConfirmBox(char* message)
//Print sequence //Print sequence
iprintf("\x1b[%d;0H", choiceRow); iprintf("\x1b[%d;0H", choiceRow);
for(int i = 0; i < sizeof(sequence); i++) { for (int i = 0; i < sizeof(sequence); i++)
{
iprintf("\x1B[%0om", i < sequencePosition ? 032 : 047); iprintf("\x1B[%0om", i < sequencePosition ? 032 : 047);
iprintf("%s ", keysLabels[sequence[i]]); iprintf("%s ", keysLabels[sequence[i]]);
} }
if (keysDown() & (KEY_UP | KEY_DOWN | KEY_RIGHT | KEY_LEFT | KEY_A | KEY_B | KEY_X | KEY_Y)) { if (keysDown() & (KEY_UP | KEY_DOWN | KEY_RIGHT | KEY_LEFT | KEY_A | KEY_B | KEY_X | KEY_Y))
{
if (keysDown() & keys[sequence[sequencePosition]]) if (keysDown() & keys[sequence[sequencePosition]])
sequencePosition++; sequencePosition++;
else else
sequencePosition = 0; sequencePosition = 0;
} }
if (keysDown() & KEY_START) { if (keysDown() & KEY_START)
{
sequencePosition = 0; sequencePosition = 0;
break; break;
} }

View File

@ -202,7 +202,8 @@ bool nandio_clear_status()
bool nandio_shutdown() bool nandio_shutdown()
{ {
if(nandWritten) { if (nandWritten)
{
// at cleanup we synchronize the FAT statgings // at cleanup we synchronize the FAT statgings
// A FatFS might have multiple copies of the FAT. // A FatFS might have multiple copies of the FAT.
// we will get them back synchonized as we just worked on the first copy // we will get them back synchonized as we just worked on the first copy