From 3a2fb4fb2eb03b1ee88f40a52a6f3ad85e03df48 Mon Sep 17 00:00:00 2001 From: niklascfw Date: Tue, 21 Jul 2026 13:50:33 +0200 Subject: [PATCH] Migrate legacy ram_config.ini into config.ini on extras post-copy. Port [Ram] from ram_config.ini when present, preserve existing HekateAms settings, then remove the legacy file. --- source/install.c | 36 ++++++++++++++++++++++++++---------- 1 file changed, 26 insertions(+), 10 deletions(-) diff --git a/source/install.c b/source/install.c index 6cc3363..e649c74 100644 --- a/source/install.c +++ b/source/install.c @@ -726,18 +726,13 @@ static bool install_config_read_key_bool(const char *path, const char *section, return found; } -/* Valid [Ram] 8gb=0|1 in config.ini (or legacy ram_config.ini) → silent; else menu. */ +/* Valid [Ram] 8gb=0|1 in config.ini → silent; else menu. */ static int install_config_read_ram(bool *use_8gb) { - static const char *paths[] = { INSTALL_CONFIG_INI, INSTALL_CONFIG_INI_LEGACY, NULL }; - - for (int i = 0; paths[i]; i++) { - if (!install_path_exists(paths[i])) - continue; - if (install_config_read_key_bool(paths[i], "Ram", "8gb", use_8gb)) - return INSTALL_CONFIG_OK; - } - + if (!install_path_exists(INSTALL_CONFIG_INI)) + return INSTALL_CONFIG_NEED_MENU; + if (install_config_read_key_bool(INSTALL_CONFIG_INI, "Ram", "8gb", use_8gb)) + return INSTALL_CONFIG_OK; return INSTALL_CONFIG_NEED_MENU; } @@ -777,6 +772,25 @@ static int install_config_write_extras(bool need_ram, bool use_8gb, bool need_he return FR_OK; } +/* If legacy ram_config.ini exists: port [Ram] into config.ini, then remove legacy. */ +static void install_config_migrate_legacy_ram(void) +{ + if (!install_path_exists(INSTALL_CONFIG_INI_LEGACY)) + return; + + bool use_8gb = false; + bool have_ram = install_config_read_key_bool(INSTALL_CONFIG_INI_LEGACY, "Ram", "8gb", &use_8gb); + + if (have_ram) { + bool use_pro = false; + bool have_pro = install_path_exists(INSTALL_CONFIG_INI) && + install_config_read_key_bool(INSTALL_CONFIG_INI, "HekateAms", "pro", &use_pro); + install_config_write_extras(true, use_8gb, have_pro, use_pro); + } + + unlink_ignore_err(INSTALL_CONFIG_INI_LEGACY); +} + #define INSTALL_PRESERVE_INI "sd:/config/omninx/preserve.ini" #define INSTALL_PRESERVE_MAX 96 #define INSTALL_PRESERVE_PATH_BYTES 224 @@ -1250,6 +1264,8 @@ static void install_apply_8gb_payload(bool use_8gb, bool use_pro) /* After pack copy: RAM + Hekate/AMS menus from extras; choices stored in config.ini. */ static void install_extras_post_copy(void) { + install_config_migrate_legacy_ram(); + if (!install_extras_post_copy_needed()) return;