mirror of
https://github.com/rvtr/unlaunch-installer_dev.git
synced 2026-01-26 13:43:08 -05:00
Cleanup conditionals
This commit is contained in:
parent
03f1df6f8e
commit
06d374d28b
@ -143,6 +143,7 @@ static int mainMenu(int cursor)
|
|||||||
if (konamiCode == 5)
|
if (konamiCode == 5)
|
||||||
{
|
{
|
||||||
advancedOptionsUnlocked = true;
|
advancedOptionsUnlocked = true;
|
||||||
|
addMenuItem(m, tidPatchesStr, NULL, foundUnlaunchInstallerVersion == v1_9 || foundUnlaunchInstallerVersion == v2_0, false);
|
||||||
addMenuItem(m, "Uninstall unlaunch no backup", NULL, unlaunchFound, false);
|
addMenuItem(m, "Uninstall unlaunch no backup", NULL, unlaunchFound, false);
|
||||||
addMenuItem(m, "Write nocash footer", NULL, needsNocashFooterToBeWritten, false);
|
addMenuItem(m, "Write nocash footer", NULL, needsNocashFooterToBeWritten, false);
|
||||||
}
|
}
|
||||||
@ -318,7 +319,14 @@ int main(int argc, char **argv)
|
|||||||
{
|
{
|
||||||
case MAIN_MENU_SAFE_UNLAUNCH_UNINSTALL:
|
case MAIN_MENU_SAFE_UNLAUNCH_UNINSTALL:
|
||||||
case MAIN_MENU_SAFE_UNLAUNCH_UNINSTALL_NO_BACKUP:
|
case MAIN_MENU_SAFE_UNLAUNCH_UNINSTALL_NO_BACKUP:
|
||||||
if(unlaunchFound && nandio_unlock_writing()) {
|
if(!unlaunchFound)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if(!nandio_unlock_writing())
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
bool unsafeUninstall = advancedOptionsUnlocked && cursor == MAIN_MENU_SAFE_UNLAUNCH_UNINSTALL_NO_BACKUP;
|
bool unsafeUninstall = advancedOptionsUnlocked && cursor == MAIN_MENU_SAFE_UNLAUNCH_UNINSTALL_NO_BACKUP;
|
||||||
printf("Uninstalling");
|
printf("Uninstalling");
|
||||||
if(needsNocashFooterToBeWritten)
|
if(needsNocashFooterToBeWritten)
|
||||||
@ -326,6 +334,7 @@ int main(int argc, char **argv)
|
|||||||
printf("Writing nocash footer\n");
|
printf("Writing nocash footer\n");
|
||||||
if(!nandio_write_nocash_footer(&computedNocashFooter))
|
if(!nandio_write_nocash_footer(&computedNocashFooter))
|
||||||
{
|
{
|
||||||
|
nandio_lock_writing();
|
||||||
messageBox("Failed to write nocash footer");
|
messageBox("Failed to write nocash footer");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -335,20 +344,26 @@ int main(int argc, char **argv)
|
|||||||
{
|
{
|
||||||
messageBox("Uninstall successful!\n");
|
messageBox("Uninstall successful!\n");
|
||||||
unlaunchFound = false;
|
unlaunchFound = false;
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
messageBox("\x1B[31mError:\x1B[33m Uninstall failed\n");
|
messageBox("\x1B[31mError:\x1B[33m Uninstall failed\n");
|
||||||
}
|
}
|
||||||
nandio_lock_writing();
|
nandio_lock_writing();
|
||||||
printf("Synchronizing FAT tables...\n");
|
printf("Synchronizing FAT tables...\n");
|
||||||
nandio_synchronize_fats();
|
nandio_synchronize_fats();
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MAIN_MENU_CUSTOM_BG:
|
case MAIN_MENU_CUSTOM_BG:
|
||||||
if(foundUnlaunchInstallerVersion != INVALID) {
|
if(foundUnlaunchInstallerVersion == INVALID)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
const char* customBg = backgroundMenu();
|
const char* customBg = backgroundMenu();
|
||||||
if(!customBg)
|
if(!customBg)
|
||||||
|
{
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
if(strcmp(customBg, "default") == 0)
|
if(strcmp(customBg, "default") == 0)
|
||||||
{
|
{
|
||||||
customBgPath = NULL;
|
customBgPath = NULL;
|
||||||
@ -357,7 +372,6 @@ int main(int argc, char **argv)
|
|||||||
{
|
{
|
||||||
customBgPath = customBg;
|
customBgPath = customBg;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MAIN_MENU_TID_PATCHES:
|
case MAIN_MENU_TID_PATCHES:
|
||||||
@ -373,16 +387,32 @@ int main(int argc, char **argv)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case MAIN_MENU_SAFE_UNLAUNCH_INSTALL:
|
case MAIN_MENU_SAFE_UNLAUNCH_INSTALL:
|
||||||
if (!unlaunchFound && foundUnlaunchInstallerVersion != INVALID && (choiceBox("Install unlaunch?") == YES)
|
if(unlaunchFound || foundUnlaunchInstallerVersion == INVALID)
|
||||||
&& (retailLauncherTmdPresentAndToBePatched || (choiceBox("There doesn't seem to be a launcher.tmd\nfile matcing the hwinfo file\nKeep installing?") == YES))
|
|
||||||
&& nandio_unlock_writing())
|
|
||||||
{
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if(choiceBox("Install unlaunch?") == NO)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if(!retailLauncherTmdPresentAndToBePatched
|
||||||
|
&& (choiceBox("There doesn't seem to be a launcher.tmd\n"
|
||||||
|
"file matcing the hwinfo file\n"
|
||||||
|
"Keep installing?") == NO))
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if(!nandio_unlock_writing())
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
printf("Installing\n");
|
printf("Installing\n");
|
||||||
if(needsNocashFooterToBeWritten)
|
if(needsNocashFooterToBeWritten)
|
||||||
{
|
{
|
||||||
printf("Writing nocash footer\n");
|
printf("Writing nocash footer\n");
|
||||||
if(!nandio_write_nocash_footer(&computedNocashFooter))
|
if(!nandio_write_nocash_footer(&computedNocashFooter))
|
||||||
{
|
{
|
||||||
|
nandio_lock_writing();
|
||||||
messageBox("Failed to write nocash footer");
|
messageBox("Failed to write nocash footer");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -396,25 +426,27 @@ int main(int argc, char **argv)
|
|||||||
{
|
{
|
||||||
messageBox("Install successful!\n");
|
messageBox("Install successful!\n");
|
||||||
unlaunchFound = true;
|
unlaunchFound = true;
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
messageBox("\x1B[31mError:\x1B[33m Install failed\n");
|
messageBox("\x1B[31mError:\x1B[33m Install failed\n");
|
||||||
}
|
}
|
||||||
nandio_lock_writing();
|
nandio_lock_writing();
|
||||||
printf("Synchronizing FAT tables...\n");
|
printf("Synchronizing FAT tables...\n");
|
||||||
nandio_synchronize_fats();
|
nandio_synchronize_fats();
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MAIN_MENU_WRITE_NOCASH_FOOTER_ONLY:
|
case MAIN_MENU_WRITE_NOCASH_FOOTER_ONLY:
|
||||||
if(needsNocashFooterToBeWritten)
|
if(!needsNocashFooterToBeWritten)
|
||||||
{
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
if(!nandio_write_nocash_footer(&computedNocashFooter))
|
if(!nandio_write_nocash_footer(&computedNocashFooter))
|
||||||
{
|
{
|
||||||
messageBox("Failed to write nocash footer");
|
messageBox("Failed to write nocash footer");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
needsNocashFooterToBeWritten = false;
|
needsNocashFooterToBeWritten = false;
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MAIN_MENU_EXIT:
|
case MAIN_MENU_EXIT:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user