hekate: move emummc config load inside relevant functions

This ensures that hekate can re-read it in case of sd card swap while in TUI and also doesn't read it if not needed.
This commit is contained in:
CTCaer 2021-09-26 12:23:54 +03:00
parent 609a76045a
commit 05ce867064
2 changed files with 11 additions and 8 deletions

View file

@ -527,7 +527,7 @@ wrong_emupath:
if (emummc_path)
{
sd_mount();
emummc_load_cfg();
emummc_load_cfg(); // Reload emuMMC config in case of emupath.
}
}
@ -550,6 +550,9 @@ void launch_firmware()
if (sd_mount())
{
// Load emuMMC configuration.
emummc_load_cfg();
if (ini_parse(&ini_sections, "bootloader/hekate_ipl.ini", false))
{
// Build configuration menu.
@ -666,7 +669,7 @@ wrong_emupath:
if (emummc_path)
{
sd_mount();
emummc_load_cfg();
emummc_load_cfg(); // Reload emuMMC config in case of emupath.
}
}
@ -822,6 +825,9 @@ static void _auto_launch_firmware()
if (sd_mount())
{
// Load emuMMC configuration.
emummc_load_cfg();
if (f_stat("bootloader/hekate_ipl.ini", NULL))
create_config_entry();
@ -1068,7 +1074,7 @@ wrong_emupath:
if (emummc_path || b_cfg.boot_cfg & BOOT_CFG_TO_EMUMMC)
{
sd_mount();
emummc_load_cfg();
emummc_load_cfg(); // Reload emuMMC config in case of emupath.
}
payload_error:
@ -1531,9 +1537,6 @@ void ipl_main()
// Check if RCM is patched and protect from a possible brick.
_patched_rcm_protection();
// Load emuMMC configuration from SD.
emummc_load_cfg();
// Show exception, library errors and L4T kernel panics.
_show_errors();

View file

@ -42,9 +42,9 @@ void emummc_load_cfg()
emu_cfg.active_part = 0;
emu_cfg.fs_ver = 0;
if (!emu_cfg.nintendo_path)
emu_cfg.nintendo_path = (char *)malloc(0x80);
emu_cfg.nintendo_path = (char *)malloc(0x200);
if (!emu_cfg.emummc_file_based_path)
emu_cfg.emummc_file_based_path = (char *)malloc(0x80);
emu_cfg.emummc_file_based_path = (char *)malloc(0x200);
emu_cfg.nintendo_path[0] = 0;
emu_cfg.emummc_file_based_path[0] = 0;