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.
This commit is contained in:
@@ -726,18 +726,13 @@ static bool install_config_read_key_bool(const char *path, const char *section,
|
|||||||
return found;
|
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 int install_config_read_ram(bool *use_8gb)
|
||||||
{
|
{
|
||||||
static const char *paths[] = { INSTALL_CONFIG_INI, INSTALL_CONFIG_INI_LEGACY, NULL };
|
if (!install_path_exists(INSTALL_CONFIG_INI))
|
||||||
|
return INSTALL_CONFIG_NEED_MENU;
|
||||||
for (int i = 0; paths[i]; i++) {
|
if (install_config_read_key_bool(INSTALL_CONFIG_INI, "Ram", "8gb", use_8gb))
|
||||||
if (!install_path_exists(paths[i]))
|
return INSTALL_CONFIG_OK;
|
||||||
continue;
|
|
||||||
if (install_config_read_key_bool(paths[i], "Ram", "8gb", use_8gb))
|
|
||||||
return INSTALL_CONFIG_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
return INSTALL_CONFIG_NEED_MENU;
|
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;
|
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_INI "sd:/config/omninx/preserve.ini"
|
||||||
#define INSTALL_PRESERVE_MAX 96
|
#define INSTALL_PRESERVE_MAX 96
|
||||||
#define INSTALL_PRESERVE_PATH_BYTES 224
|
#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. */
|
/* After pack copy: RAM + Hekate/AMS menus from extras; choices stored in config.ini. */
|
||||||
static void install_extras_post_copy(void)
|
static void install_extras_post_copy(void)
|
||||||
{
|
{
|
||||||
|
install_config_migrate_legacy_ram();
|
||||||
|
|
||||||
if (!install_extras_post_copy_needed())
|
if (!install_extras_post_copy_needed())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user