From c878e963985e5e6245e5cd874ec1f38cf7bfaea4 Mon Sep 17 00:00:00 2001 From: hexkyz Date: Sat, 6 Apr 2019 20:01:11 +0100 Subject: [PATCH] emunand: Fix bugs and add missing stuff --- common/defaults/BCT.ini | 6 +++++- fusee/fusee-primary/src/main.c | 8 ++------ fusee/fusee-secondary/src/nxfs.c | 9 ++++++--- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/common/defaults/BCT.ini b/common/defaults/BCT.ini index b74c19725..3dd5d2afc 100644 --- a/common/defaults/BCT.ini +++ b/common/defaults/BCT.ini @@ -4,6 +4,10 @@ stage2_path = atmosphere/fusee-secondary.bin stage2_addr = 0xF0000000 stage2_entrypoint = 0xF0000000 +[emunand] +emunand_enabled = 0 +emunand_path = atmosphere/emunand + [exosphere] ; Note: Disabling debugmode will cause parts of ams.tma to not work, in the future. debugmode = 1 @@ -11,4 +15,4 @@ debugmode_user = 0 [stratosphere] ; To force-enable nogc, add nogc = 1 -; To force-disable nogc, add nogc = 0 +; To force-disable nogc, add nogc = 0 \ No newline at end of file diff --git a/fusee/fusee-primary/src/main.c b/fusee/fusee-primary/src/main.c index e1fa9fa10..95e599d16 100644 --- a/fusee/fusee-primary/src/main.c +++ b/fusee/fusee-primary/src/main.c @@ -37,7 +37,7 @@ static char g_bct0_buffer[BCTO_MAX_SIZE]; typedef struct { bool enabled; - char* path; + char path[0x100]; } emunand_config_t; #define CONFIG_LOG_LEVEL_KEY "log_level" @@ -159,11 +159,7 @@ int main(void) { stage2_args_t *stage2_args; uint32_t stage2_version = 0; ScreenLogLevel log_level = SCREEN_LOG_LEVEL_MANDATORY; - emunand_config_t emunand_cfg = {0}; - - /* Set default values for emunand settings. */ - emunand_cfg.enabled = false; - emunand_cfg.path = "atmosphere/emunand"; + emunand_config_t emunand_cfg = {.enabled = false, .path = ""}; /* Override the global logging level. */ log_set_log_level(log_level); diff --git a/fusee/fusee-secondary/src/nxfs.c b/fusee/fusee-secondary/src/nxfs.c index f11984993..c57288099 100644 --- a/fusee/fusee-secondary/src/nxfs.c +++ b/fusee/fusee-secondary/src/nxfs.c @@ -294,9 +294,12 @@ int nxfs_mount_all(bool emunand_enabled, const char *emunand_path) { char emu_boot0_path[0x100]; char emu_boot1_path[0x100]; char emu_rawnand_path[0x100]; - snprintf(emu_boot0_path, sizeof(emu_boot0_path) - 1, "sdmc:/%s/%s", emunand_path, "boot0"); - snprintf(emu_boot1_path, sizeof(emu_boot1_path) - 1, "sdmc:/%s/%s", emunand_path, "boot1"); - snprintf(emu_rawnand_path, sizeof(emu_rawnand_path) - 1, "sdmc:/%s/%s", emunand_path, "rawnand"); + memset(emu_boot0_path, 0, sizeof(emu_boot0_path)); + memset(emu_boot1_path, 0, sizeof(emu_boot1_path)); + memset(emu_rawnand_path, 0, sizeof(emu_rawnand_path)); + snprintf(emu_boot0_path, sizeof(emu_boot0_path), "sdmc:/%s/%s", emunand_path, "boot0"); + snprintf(emu_boot1_path, sizeof(emu_boot1_path), "sdmc:/%s/%s", emunand_path, "boot1"); + snprintf(emu_rawnand_path, sizeof(emu_rawnand_path), "sdmc:/%s/%s", emunand_path, "rawnand"); /* Setup an emulation template for boot0. */ model = g_emummc_devpart_template;