mirror of
https://github.com/rvtr/TDT.git
synced 2025-10-31 13:51:07 -04:00
Minor code cleanup
This commit is contained in:
parent
643bc4143c
commit
580d98535b
@ -191,7 +191,7 @@ static void restore(Menu* m)
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!sdnandMode && !nandio_unlock_writing())
|
||||
if (!sdnandMode && !nandio_unlock_writing())
|
||||
return;
|
||||
|
||||
clearScreen(&bottomScreen);
|
||||
@ -205,7 +205,7 @@ static void restore(Menu* m)
|
||||
messagePrint("\x1B[42m\nBackup restored.\n\x1B[47m");
|
||||
}
|
||||
|
||||
if(!sdnandMode)
|
||||
if (!sdnandMode)
|
||||
nandio_lock_writing();
|
||||
}
|
||||
}
|
||||
|
||||
@ -347,8 +347,8 @@ bool install(char* fpath, bool systemTitle)
|
||||
goto error;
|
||||
}
|
||||
|
||||
if(!sdnandMode && !nandio_unlock_writing())
|
||||
return false;
|
||||
if (!sdnandMode && !nandio_unlock_writing())
|
||||
return false;
|
||||
|
||||
clearScreen(&bottomScreen);
|
||||
iprintf("Installing %s\n\n", fpath); swiWaitForVBlank();
|
||||
@ -491,10 +491,10 @@ bool install(char* fpath, bool systemTitle)
|
||||
mkdir(contentPath, 0777);
|
||||
|
||||
u8 appVersion = 0;
|
||||
if(tmdFound)
|
||||
if (tmdFound)
|
||||
{
|
||||
FILE *file = fopen(tmdPath, "rb");
|
||||
if(file)
|
||||
if (file)
|
||||
{
|
||||
fseek(file, 0x1E7, SEEK_SET);
|
||||
fread(&appVersion, sizeof(appVersion), 1, file);
|
||||
@ -669,7 +669,7 @@ error:
|
||||
complete:
|
||||
free(h);
|
||||
|
||||
if(!sdnandMode)
|
||||
if (!sdnandMode)
|
||||
nandio_lock_writing();
|
||||
|
||||
return result;
|
||||
|
||||
@ -91,8 +91,9 @@ static int _mainMenu(int cursor)
|
||||
return result;
|
||||
}
|
||||
|
||||
void fifoHandler(u32 value32, void* userdata) {
|
||||
if(value32 == 0x54495845) // 'EXIT'
|
||||
void fifoHandler(u32 value32, void* userdata)
|
||||
{
|
||||
if (value32 == 0x54495845) // 'EXIT'
|
||||
programEnd = true;
|
||||
}
|
||||
|
||||
@ -157,7 +158,8 @@ int main(int argc, char **argv)
|
||||
break;
|
||||
|
||||
case MAIN_MENU_FIX:
|
||||
if(nandio_unlock_writing()) {
|
||||
if (nandio_unlock_writing())
|
||||
{
|
||||
nandio_force_fat_fix();
|
||||
nandio_lock_writing();
|
||||
messageBox("Mismatch in FAT copies will be\nfixed on close.\n");
|
||||
|
||||
@ -93,7 +93,8 @@ bool randomConfirmBox(char* message)
|
||||
int sequencePosition = 0;
|
||||
|
||||
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]));
|
||||
}
|
||||
|
||||
@ -111,19 +112,22 @@ bool randomConfirmBox(char* message)
|
||||
|
||||
//Print sequence
|
||||
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("%s ", keysLabels[sequence[i]]);
|
||||
}
|
||||
|
||||
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() & (KEY_UP | KEY_DOWN | KEY_RIGHT | KEY_LEFT | KEY_A | KEY_B | KEY_X | KEY_Y))
|
||||
{
|
||||
if (keysDown() & keys[sequence[sequencePosition]])
|
||||
sequencePosition++;
|
||||
else
|
||||
sequencePosition = 0;
|
||||
}
|
||||
|
||||
if (keysDown() & KEY_START) {
|
||||
if (keysDown() & KEY_START)
|
||||
{
|
||||
sequencePosition = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -171,7 +171,7 @@ bool nandio_read_sectors(sec_t offset, sec_t len, void *buffer)
|
||||
|
||||
bool nandio_write_sectors(sec_t offset, sec_t len, const void *buffer)
|
||||
{
|
||||
if(writingLocked)
|
||||
if (writingLocked)
|
||||
return false;
|
||||
|
||||
nandWritten = true;
|
||||
@ -202,7 +202,8 @@ bool nandio_clear_status()
|
||||
|
||||
bool nandio_shutdown()
|
||||
{
|
||||
if(nandWritten) {
|
||||
if (nandWritten)
|
||||
{
|
||||
// at cleanup we synchronize the FAT statgings
|
||||
// A FatFS might have multiple copies of the FAT.
|
||||
// we will get them back synchonized as we just worked on the first copy
|
||||
@ -249,7 +250,7 @@ bool nandio_lock_writing()
|
||||
|
||||
bool nandio_unlock_writing()
|
||||
{
|
||||
if(writingLocked && randomConfirmBox("Writing to NAND is locked!\nIf you're sure you understand\nthe risk, input the sequence\nbelow."))
|
||||
if (writingLocked && randomConfirmBox("Writing to NAND is locked!\nIf you're sure you understand\nthe risk, input the sequence\nbelow."))
|
||||
writingLocked = false;
|
||||
|
||||
return !writingLocked;
|
||||
@ -257,7 +258,7 @@ bool nandio_unlock_writing()
|
||||
|
||||
bool nandio_force_fat_fix()
|
||||
{
|
||||
if(!writingLocked)
|
||||
if (!writingLocked)
|
||||
nandWritten = true;
|
||||
|
||||
return true;
|
||||
|
||||
@ -258,7 +258,7 @@ bool copyDir(char const* src, char const* dst)
|
||||
|
||||
int ret = copyFile(fsrc, fdst);
|
||||
|
||||
if(ret != 0)
|
||||
if (ret != 0)
|
||||
{
|
||||
iprintf("\x1B[31m"); //red
|
||||
iprintf("Fail\n");
|
||||
@ -396,7 +396,7 @@ unsigned long long getDirSize(const char* path)
|
||||
{
|
||||
while ((ent = readdir(dir)))
|
||||
{
|
||||
if(strcmp(".", ent->d_name) == 0 || strcmp("..", ent->d_name) == 0)
|
||||
if (strcmp(".", ent->d_name) == 0 || strcmp("..", ent->d_name) == 0)
|
||||
continue;
|
||||
|
||||
if (ent->d_type == DT_DIR)
|
||||
@ -455,7 +455,7 @@ int getMenuSlotsFree()
|
||||
{
|
||||
while ( (ent = readdir(dir)) != NULL )
|
||||
{
|
||||
if(strcmp(".", ent->d_name) == 0 || strcmp("..", ent->d_name) == 0)
|
||||
if (strcmp(".", ent->d_name) == 0 || strcmp("..", ent->d_name) == 0)
|
||||
continue;
|
||||
|
||||
if (ent->d_type == DT_DIR)
|
||||
|
||||
@ -361,7 +361,7 @@ static bool delete(Menu* m)
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!sdnandMode && !nandio_unlock_writing())
|
||||
if (!sdnandMode && !nandio_unlock_writing())
|
||||
return false;
|
||||
|
||||
clearScreen(&bottomScreen);
|
||||
@ -376,7 +376,7 @@ static bool delete(Menu* m)
|
||||
messagePrint("\nTitle could not be deleted.\n");
|
||||
}
|
||||
|
||||
if(!sdnandMode)
|
||||
if (!sdnandMode)
|
||||
nandio_lock_writing();
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user