From 05ce8670648c5d23ce629fafde6fad9fcea84309 Mon Sep 17 00:00:00 2001 From: CTCaer Date: Sun, 26 Sep 2021 12:23:54 +0300 Subject: [PATCH] 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. --- bootloader/main.c | 15 +++++++++------ bootloader/storage/emummc.c | 4 ++-- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/bootloader/main.c b/bootloader/main.c index a929b52..315aabf 100644 --- a/bootloader/main.c +++ b/bootloader/main.c @@ -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(); diff --git a/bootloader/storage/emummc.c b/bootloader/storage/emummc.c index 62e3578..fc44be3 100644 --- a/bootloader/storage/emummc.c +++ b/bootloader/storage/emummc.c @@ -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;