Batch operations: allow continue after failed operation

This commit is contained in:
d0k3 2018-02-13 03:11:31 +01:00
parent 388a89a970
commit 1e39cbacd4
3 changed files with 26 additions and 18 deletions

View File

@ -1334,10 +1334,11 @@ u32 FileHandlerMenu(char* current_path, u32* cursor, u32* scroll, PaneData** pan
DrawDirContents(current_dir, (*cursor = i), scroll); DrawDirContents(current_dir, (*cursor = i), scroll);
if (!(filetype & BIN_KEYDB) && (CryptGameFile(path, inplace, false) == 0)) n_success++; if (!(filetype & BIN_KEYDB) && (CryptGameFile(path, inplace, false) == 0)) n_success++;
else if ((filetype & BIN_KEYDB) && (CryptAesKeyDb(path, inplace, false) == 0)) n_success++; else if ((filetype & BIN_KEYDB) && (CryptAesKeyDb(path, inplace, false) == 0)) n_success++;
else { // on failure: show error, break else { // on failure: show error, continue
TruncateString(pathstr, path, 32, 8); char lpathstr[32+1];
ShowPrompt(false, "%s\nDecryption failed", pathstr); TruncateString(lpathstr, path, 32, 8);
break; if (ShowPrompt(true, "%s\nDecryption failed\n \nContinue?", lpathstr)) continue;
else break;
} }
current_dir->entry[i].marked = false; current_dir->entry[i].marked = false;
} }
@ -1382,10 +1383,11 @@ u32 FileHandlerMenu(char* current_path, u32* cursor, u32* scroll, PaneData** pan
DrawDirContents(current_dir, (*cursor = i), scroll); DrawDirContents(current_dir, (*cursor = i), scroll);
if (!(filetype & BIN_KEYDB) && (CryptGameFile(path, inplace, true) == 0)) n_success++; if (!(filetype & BIN_KEYDB) && (CryptGameFile(path, inplace, true) == 0)) n_success++;
else if ((filetype & BIN_KEYDB) && (CryptAesKeyDb(path, inplace, true) == 0)) n_success++; else if ((filetype & BIN_KEYDB) && (CryptAesKeyDb(path, inplace, true) == 0)) n_success++;
else { // on failure: show error, break else { // on failure: show error, continue
TruncateString(pathstr, path, 32, 8); char lpathstr[32+1];
ShowPrompt(false, "%s\nEncryption failed", pathstr); TruncateString(lpathstr, path, 32, 8);
break; if (ShowPrompt(true, "%s\nEncryption failed\n \nContinue?", lpathstr)) continue;
else break;
} }
current_dir->entry[i].marked = false; current_dir->entry[i].marked = false;
} }
@ -1419,10 +1421,11 @@ u32 FileHandlerMenu(char* current_path, u32* cursor, u32* scroll, PaneData** pan
DrawDirContents(current_dir, (*cursor = i), scroll); DrawDirContents(current_dir, (*cursor = i), scroll);
if (((user_select != cxi_dump) && (BuildCiaFromGameFile(path, force_legit) == 0)) || if (((user_select != cxi_dump) && (BuildCiaFromGameFile(path, force_legit) == 0)) ||
((user_select == cxi_dump) && (DumpCxiSrlFromTmdFile(path) == 0))) n_success++; ((user_select == cxi_dump) && (DumpCxiSrlFromTmdFile(path) == 0))) n_success++;
else { // on failure: show error, break else { // on failure: show error, continue
TruncateString(pathstr, path, 32, 8); char lpathstr[32+1];
ShowPrompt(false, "%s\nBuild %s failed", pathstr, type); TruncateString(lpathstr, path, 32, 8);
break; if (ShowPrompt(true, "%s\nBuild %s failed\n \nContinue?", lpathstr, type)) continue;
else break;
} }
current_dir->entry[i].marked = false; current_dir->entry[i].marked = false;
} }
@ -1443,7 +1446,7 @@ u32 FileHandlerMenu(char* current_path, u32* cursor, u32* scroll, PaneData** pan
else if (user_select == verify) { // -> verify game / nand file else if (user_select == verify) { // -> verify game / nand file
if ((n_marked > 1) && ShowPrompt(true, "Try to verify all %lu selected files?", n_marked)) { if ((n_marked > 1) && ShowPrompt(true, "Try to verify all %lu selected files?", n_marked)) {
u32 n_success = 0; u32 n_success = 0;
u32 n_other = 0; u32 n_other = 0;
u32 n_processed = 0; u32 n_processed = 0;
for (u32 i = 0; i < current_dir->n_entries; i++) { for (u32 i = 0; i < current_dir->n_entries; i++) {
const char* path = current_dir->entry[i].path; const char* path = current_dir->entry[i].path;
@ -1458,10 +1461,13 @@ u32 FileHandlerMenu(char* current_path, u32* cursor, u32* scroll, PaneData** pan
DrawDirContents(current_dir, (*cursor = i), scroll); DrawDirContents(current_dir, (*cursor = i), scroll);
if ((filetype & IMG_NAND) && (ValidateNandDump(path) == 0)) n_success++; if ((filetype & IMG_NAND) && (ValidateNandDump(path) == 0)) n_success++;
else if (VerifyGameFile(path) == 0) n_success++; else if (VerifyGameFile(path) == 0) n_success++;
else { // on failure: show error, break else { // on failure: show error, continue
TruncateString(pathstr, path, 32, 8); char lpathstr[32+1];
ShowPrompt(false, "%s\nVerification failed", pathstr); TruncateString(lpathstr, path, 32, 8);
break; if (ShowPrompt(true, "%s\nVerification failed\n \nContinue?", lpathstr)) {
if (!(filetype & (GAME_CIA|GAME_TMD))) ShowProgress(0, n_marked, path); // restart progress bar
continue;
} else break;
} }
current_dir->entry[i].marked = false; current_dir->entry[i].marked = false;
} }

View File

@ -46,6 +46,9 @@
// stuff in FCRAM // stuff in FCRAM
#define __FIRMRAM_ADDR (__FCRAM0_ADDR + 0x0001000)
#define __FIRMRAM_END (__FIRMRAM_ADDR + 0x0400000)
#define __FIRMTMP_ADDR (__FCRAM0_END - 0x0800000) #define __FIRMTMP_ADDR (__FCRAM0_END - 0x0800000)
#define __FIRMTMP_END (__FIRMTMP_ADDR + 0x0400000) #define __FIRMTMP_END (__FIRMTMP_ADDR + 0x0400000)

View File

@ -1 +0,0 @@
MD5: A5B28945A7C051D7A0CD18AF0E580D1B