Preserve CyberFoil across clean install backup/restore.
All checks were successful
Build / Build (push) Successful in 13s

Back up cyberfoil.nro, config.json, and remotes/ when sd:/switch/CyberFoil exists, then restore them after the wipe.
This commit is contained in:
2026-06-14 17:31:46 +02:00
parent d6ec345cce
commit c0741beda3
4 changed files with 72 additions and 4 deletions

View File

@@ -39,6 +39,35 @@ int backup_user_data(void) {
return res;
}
}
// Backup CyberFoil (nro, config, remotes) if installed
if (path_exists(CYBERFOIL_DIR)) {
res = f_mkdir(TEMP_BACKUP_CYBERFOIL);
if (res != FR_OK && res != FR_EXIST) {
return res;
}
if (path_exists(CYBERFOIL_NRO)) {
res = file_copy(CYBERFOIL_NRO, TEMP_BACKUP_CYBERFOIL_NRO);
if (res != FR_OK) {
return res;
}
}
if (path_exists(CYBERFOIL_CONFIG)) {
res = file_copy(CYBERFOIL_CONFIG, TEMP_BACKUP_CYBERFOIL_CONFIG);
if (res != FR_OK) {
return res;
}
}
if (path_exists(CYBERFOIL_REMOTES)) {
res = folder_copy(CYBERFOIL_REMOTES, TEMP_BACKUP_CYBERFOIL);
if (res != FR_OK) {
return res;
}
}
}
return FR_OK;
}
@@ -72,6 +101,35 @@ int restore_user_data(void) {
return res;
}
}
// Restore CyberFoil if backed up
if (path_exists(TEMP_BACKUP_CYBERFOIL)) {
res = f_mkdir(CYBERFOIL_DIR);
if (res != FR_OK && res != FR_EXIST) {
return res;
}
if (path_exists(TEMP_BACKUP_CYBERFOIL_NRO)) {
res = file_copy(TEMP_BACKUP_CYBERFOIL_NRO, CYBERFOIL_NRO);
if (res != FR_OK) {
return res;
}
}
if (path_exists(TEMP_BACKUP_CYBERFOIL_CONFIG)) {
res = file_copy(TEMP_BACKUP_CYBERFOIL_CONFIG, CYBERFOIL_CONFIG);
if (res != FR_OK) {
return res;
}
}
if (path_exists(TEMP_BACKUP_CYBERFOIL_REMOTES)) {
res = folder_copy(TEMP_BACKUP_CYBERFOIL_REMOTES, CYBERFOIL_DIR);
if (res != FR_OK) {
return res;
}
}
}
return FR_OK;
}