diff --git a/source/backup.c b/source/backup.c index c53a1b2..438768e 100644 --- a/source/backup.c +++ b/source/backup.c @@ -24,17 +24,9 @@ int backup_user_data(void) { return res; } - // Backup DBI if it exists - if (path_exists("sd:/switch/DBI")) { - res = folder_copy("sd:/switch/DBI", TEMP_BACKUP_PATH); - if (res != FR_OK) { - return res; - } - } - - // Backup Tinfoil if it exists - if (path_exists("sd:/switch/tinfoil")) { - res = folder_copy("sd:/switch/tinfoil", TEMP_BACKUP_PATH); + // Backup DBI settings file only (not .nro installers) + if (path_exists(DBI_CONFIG_PATH)) { + res = file_copy(DBI_CONFIG_PATH, TEMP_BACKUP_DBI_CONFIG); if (res != FR_OK) { return res; } @@ -61,25 +53,15 @@ int restore_user_data(void) { return res; } - // Restore DBI if backup exists - if (path_exists("sd:/temp_backup/DBI")) { - res = folder_copy("sd:/temp_backup/DBI", "sd:/switch"); - if (res == FR_OK) { - // Delete old DBI .nro files - f_unlink("sd:/switch/DBI/DBI_810_EN.nro"); - f_unlink("sd:/switch/DBI/DBI_810_DE.nro"); - f_unlink("sd:/switch/DBI/DBI_845_EN.nro"); - f_unlink("sd:/switch/DBI/DBI_845_DE.nro"); - f_unlink("sd:/switch/DBI/DBI.nro"); + // Restore DBI settings if backed up + if (path_exists(TEMP_BACKUP_DBI_CONFIG)) { + res = f_mkdir("sd:/switch/DBI"); + if (res != FR_OK && res != FR_EXIST) { + return res; } - } - - // Restore Tinfoil if backup exists - if (path_exists("sd:/temp_backup/tinfoil")) { - res = folder_copy("sd:/temp_backup/tinfoil", "sd:/switch"); - if (res == FR_OK) { - // Delete old tinfoil.nro - f_unlink("sd:/switch/tinfoil/tinfoil.nro"); + res = file_copy(TEMP_BACKUP_DBI_CONFIG, DBI_CONFIG_PATH); + if (res != FR_OK) { + return res; } } diff --git a/source/backup.h b/source/backup.h index c8ec35a..fe7113a 100644 --- a/source/backup.h +++ b/source/backup.h @@ -7,6 +7,9 @@ #include #define TEMP_BACKUP_PATH "sd:/temp_backup" +/** DBI settings; preserved across clean install (not whole DBI folder). */ +#define DBI_CONFIG_PATH "sd:/switch/DBI/dbi.config" +#define TEMP_BACKUP_DBI_CONFIG TEMP_BACKUP_PATH "/dbi.config" /** Live HorizonOC settings (Overclock tool). */ #define HORIZON_OC_CONFIG_PATH "sd:/config/horizon-oc/config.ini" @@ -14,7 +17,7 @@ #define HORIZON_OC_UPDATE_BACKUP_DIR "sd:/.omninx_oc_update" #define HORIZON_OC_UPDATE_BACKUP_INI HORIZON_OC_UPDATE_BACKUP_DIR "/config.ini" -// Backup user data (DBI, Tinfoil, prod.keys) before clean install +// Backup user data (DBI dbi.config, prod.keys) before clean install int backup_user_data(void); // Restore user data after clean install diff --git a/source/deletion_lists_clean.h b/source/deletion_lists_clean.h index d279047..70db1d8 100644 --- a/source/deletion_lists_clean.h +++ b/source/deletion_lists_clean.h @@ -2,8 +2,7 @@ * OmniNX Installer - Deletion Lists for Clean Install Mode * Deletion policy aligned with NiklasCFW pack clean install (TegraExplorer script): * full sd:/atmosphere, bootloader/config subsets, sd:/switch, root + misc, then - * post-restore paths (e.g. tinfoil db). Backup/restore of DBI, Tinfoil, prod.keys - * is implemented in backup.c, not here. + * post-restore paths (e.g. tinfoil db). DBI/prod.keys backup is in backup.c. */ #pragma once @@ -114,7 +113,7 @@ static const char* clean_misc_files_to_delete[] = { NULL }; -// After DBI/Tinfoil/prod.keys restore (NiklasCFW: deldir("sd:/switch/tinfoil/db")) +// After DBI/prod.keys restore (NiklasCFW: deldir("sd:/switch/tinfoil/db")) static const char* clean_post_restore_dirs_to_delete[] = { "sd:/switch/tinfoil/db", NULL diff --git a/source/install_clean.c b/source/install_clean.c index 7d9a60e..30341ce 100644 --- a/source/install_clean.c +++ b/source/install_clean.c @@ -34,7 +34,7 @@ // Clean mode: Backup user data int clean_mode_backup(void) { set_color(COLOR_CYAN); - gfx_printf(" Sichere: DBI, Tinfoil, prod.keys\n"); + gfx_printf(" Sichere: DBI (dbi.config), prod.keys\n"); set_color(COLOR_WHITE); int res = backup_user_data(); if (res == FR_OK) { @@ -95,7 +95,7 @@ int clean_mode_wipe(void) { // Clean mode: Restore user data int clean_mode_restore(void) { set_color(COLOR_CYAN); - gfx_printf(" Stelle wieder her: DBI, Tinfoil, prod.keys\n"); + gfx_printf(" Stelle wieder her: DBI (dbi.config), prod.keys\n"); set_color(COLOR_WHITE); int res = restore_user_data(); if (res == FR_OK) {