From 73c27891140e4f706ea53953b91b597abd101be8 Mon Sep 17 00:00:00 2001 From: niklascfw Date: Sat, 22 Aug 2026 15:26:02 +0200 Subject: [PATCH] Preserve Checkpoint saves across clean install backup/restore. Back up and restore sd:/switch/Checkpoint with CyberFoil and DBI settings during clean installs. --- source/backup.c | 16 ++++++++++++++++ source/backup.h | 6 +++++- source/deletion_lists_clean.h | 2 +- source/install_clean.c | 4 ++-- 4 files changed, 24 insertions(+), 4 deletions(-) diff --git a/source/backup.c b/source/backup.c index 83948d6..0489f51 100644 --- a/source/backup.c +++ b/source/backup.c @@ -68,6 +68,14 @@ int backup_user_data(void) { } } } + + // Backup Checkpoint (saves and app data) if installed + if (path_exists(CHECKPOINT_DIR)) { + res = folder_copy(CHECKPOINT_DIR, TEMP_BACKUP_PATH); + if (res != FR_OK) { + return res; + } + } return FR_OK; } @@ -130,6 +138,14 @@ int restore_user_data(void) { } } } + + // Restore Checkpoint if backed up + if (path_exists(TEMP_BACKUP_CHECKPOINT)) { + res = folder_copy(TEMP_BACKUP_CHECKPOINT, "sd:/switch"); + if (res != FR_OK) { + return res; + } + } return FR_OK; } diff --git a/source/backup.h b/source/backup.h index f5e295d..5a980da 100644 --- a/source/backup.h +++ b/source/backup.h @@ -21,13 +21,17 @@ #define TEMP_BACKUP_CYBERFOIL_CONFIG TEMP_BACKUP_CYBERFOIL "/config.json" #define TEMP_BACKUP_CYBERFOIL_REMOTES TEMP_BACKUP_CYBERFOIL "/remotes" +/** Checkpoint save manager; preserved across clean install (full folder). */ +#define CHECKPOINT_DIR "sd:/switch/Checkpoint" +#define TEMP_BACKUP_CHECKPOINT TEMP_BACKUP_PATH "/Checkpoint" + /** Live HorizonOC settings (Overclock tool). */ #define HORIZON_OC_CONFIG_PATH "sd:/config/horizon-oc/config.ini" /** Scratch dir during OC-variant update only; removed after successful restore. */ #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 (CyberFoil, DBI dbi.config, prod.keys) before clean install +// Backup user data (CyberFoil, Checkpoint, 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 4caae8a..2ef50e0 100644 --- a/source/deletion_lists_clean.h +++ b/source/deletion_lists_clean.h @@ -2,7 +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). CyberFoil/DBI/prod.keys backup is in backup.c. + * post-restore paths (e.g. tinfoil db). CyberFoil/Checkpoint/DBI/prod.keys backup is in backup.c. */ #pragma once diff --git a/source/install_clean.c b/source/install_clean.c index 55a7ea9..09b7837 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: CyberFoil, DBI (dbi.config), prod.keys\n"); + gfx_printf(" Sichere: CyberFoil, Checkpoint, 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: CyberFoil, DBI (dbi.config), prod.keys\n"); + gfx_printf(" Stelle wieder her: CyberFoil, Checkpoint, DBI (dbi.config), prod.keys\n"); set_color(COLOR_WHITE); int res = restore_user_data(); if (res == FR_OK) {