/* * OmniNX Installer - Clean Install Mode * Backup, selective cleanup from list, restore, then install when no OmniNX found. * Does not wipe whole card; only paths in deletion_lists_clean.h are removed. */ #include "install.h" #include "backup.h" #include "deletion_lists_clean.h" #include "fs.h" #include "gfx.h" #include #undef COLOR_CYAN #undef COLOR_WHITE #undef COLOR_GREEN #undef COLOR_RED #define COLOR_CYAN 0xFF00FFFF #define COLOR_WHITE 0xFFFFFFFF #define COLOR_GREEN 0xFF00FF00 #define COLOR_RED 0xFFFF0000 #define set_color install_set_color #define check_and_clear_screen_if_needed install_check_and_clear_screen_if_needed #define path_exists install_path_exists // Clean mode: Backup user data int clean_mode_backup(void) { set_color(COLOR_CYAN); gfx_printf(" Sichere: DBI, Tinfoil, prod.keys\n"); set_color(COLOR_WHITE); int res = backup_user_data(); if (res == FR_OK) { set_color(COLOR_GREEN); gfx_printf(" [OK] Sicherung abgeschlossen\n"); set_color(COLOR_WHITE); } return res; } // Clean mode: Wipe using selective deletion list (does not wipe whole card) int clean_mode_wipe(void) { check_and_clear_screen_if_needed(); set_color(COLOR_CYAN); gfx_printf(" Bereinige: atmosphere/\n"); set_color(COLOR_WHITE); delete_path_list(clean_atmosphere_dirs_to_delete, "atmosphere subdirs"); delete_path_list(clean_atmosphere_contents_dirs_to_delete, "atmosphere contents dirs"); delete_path_list(clean_atmosphere_files_to_delete, "atmosphere files"); set_color(COLOR_CYAN); gfx_printf(" Bereinige: bootloader/\n"); set_color(COLOR_WHITE); delete_path_list(clean_bootloader_dirs_to_delete, "bootloader dirs"); delete_path_list(clean_bootloader_files_to_delete, "bootloader files"); set_color(COLOR_CYAN); gfx_printf(" Bereinige: config/\n"); set_color(COLOR_WHITE); delete_path_list(clean_config_dirs_to_delete, "config dirs"); set_color(COLOR_CYAN); gfx_printf(" Bereinige: switch/\n"); set_color(COLOR_WHITE); delete_path_list(clean_switch_dirs_to_delete, "switch dirs"); delete_path_list(clean_switch_files_to_delete, "switch files"); set_color(COLOR_CYAN); gfx_printf(" Bereinige: Root-Dateien\n"); set_color(COLOR_WHITE); delete_path_list(clean_root_files_to_delete, "root files"); delete_path_list(clean_misc_dirs_to_delete, "misc dirs"); delete_path_list(clean_misc_files_to_delete, "misc files"); set_color(COLOR_CYAN); gfx_printf(" Bereinige: Alte Versionsmarker\n"); set_color(COLOR_WHITE); delete_path_list(old_version_files_to_delete, "old version markers"); set_color(COLOR_CYAN); gfx_printf(" Erstelle: switch/\n"); set_color(COLOR_WHITE); f_mkdir("sd:/switch"); set_color(COLOR_GREEN); gfx_printf(" Bereinigung abgeschlossen!\n"); set_color(COLOR_WHITE); return FR_OK; } // Clean mode: Restore user data int clean_mode_restore(void) { set_color(COLOR_CYAN); gfx_printf(" Stelle wieder her: DBI, Tinfoil, prod.keys\n"); set_color(COLOR_WHITE); int res = restore_user_data(); if (res == FR_OK) { set_color(COLOR_GREEN); gfx_printf(" [OK] Wiederherstellung abgeschlossen\n"); set_color(COLOR_WHITE); } cleanup_backup(); return res; } // Clean mode: Install files (reuse update mode install) int clean_mode_install(omninx_variant_t variant) { return update_mode_install(variant); }