Don't overwrite existing saves when installing

thanks @aspargas2
This commit is contained in:
d0k3 2020-07-24 10:41:02 +02:00
parent 6116545fef
commit e568348086

View File

@ -1436,12 +1436,13 @@ u32 InstallCiaSystemData(CiaStub* cia, const char* drv) {
drv, tid_high, tid_low);
}
// generate the save file
// generate the save file, first check if it already exists
if (fvx_qsize(path_save) != exthdr->savedata_size) {
static const u8 zeroes[0x20] = { 0x00 };
UINT bw;
FIL save;
fvx_rmkpath(path_save);
if (fvx_open(&save, path_save, FA_WRITE | FA_CREATE_NEW) != FR_OK)
if (fvx_open(&save, path_save, FA_WRITE | FA_CREATE_ALWAYS) != FR_OK)
return 1;
if ((fvx_write(&save, zeroes, 0x20, &bw) != FR_OK) || (bw != 0x20))
bw = 0;
@ -1450,6 +1451,7 @@ u32 InstallCiaSystemData(CiaStub* cia, const char* drv) {
fvx_close(&save);
if (bw != 0x20) return 1;
}
}
// progress update
if (!ShowProgress(3, 5, "TMD/CMD/TiE/Ticket/Save")) return 1;