1
0
Fork 0
mirror of https://github.com/CTCaer/hekate.git synced 2024-11-26 19:52:11 +00:00

emummc: Fix issue with emu_path corrupting bss

This commit is contained in:
CTCaer 2020-06-14 13:32:04 +03:00
parent ad5a50ecd9
commit 28f2fb1468

View file

@ -29,21 +29,25 @@
#include "../utils/types.h" #include "../utils/types.h"
extern hekate_config h_cfg; extern hekate_config h_cfg;
emummc_cfg_t emu_cfg; emummc_cfg_t emu_cfg = { 0 };
void emummc_load_cfg() void emummc_load_cfg()
{ {
emu_cfg.enabled = 0; emu_cfg.enabled = 0;
emu_cfg.path = NULL; emu_cfg.path = NULL;
emu_cfg.nintendo_path = NULL;
emu_cfg.sector = 0; emu_cfg.sector = 0;
emu_cfg.id = 0; emu_cfg.id = 0;
emu_cfg.file_based_part_size = 0; emu_cfg.file_based_part_size = 0;
emu_cfg.active_part = 0; emu_cfg.active_part = 0;
emu_cfg.fs_ver = 0; emu_cfg.fs_ver = 0;
if (!emu_cfg.nintendo_path)
emu_cfg.nintendo_path = (char *)malloc(0x80);
if (!emu_cfg.emummc_file_based_path) if (!emu_cfg.emummc_file_based_path)
emu_cfg.emummc_file_based_path = (char *)malloc(0x80); emu_cfg.emummc_file_based_path = (char *)malloc(0x80);
emu_cfg.nintendo_path[0] = 0;
emu_cfg.emummc_file_based_path[0] = 0;
LIST_INIT(ini_sections); LIST_INIT(ini_sections);
if (ini_parse(&ini_sections, "emuMMC/emummc.ini", false)) if (ini_parse(&ini_sections, "emuMMC/emummc.ini", false))
{ {
@ -65,7 +69,7 @@ void emummc_load_cfg()
else if (!strcmp("path", kv->key)) else if (!strcmp("path", kv->key))
emu_cfg.path = kv->val; emu_cfg.path = kv->val;
else if (!strcmp("nintendo_path", kv->key)) else if (!strcmp("nintendo_path", kv->key))
emu_cfg.nintendo_path = kv->val; strcpy(emu_cfg.nintendo_path, kv->val);
} }
break; break;
} }
@ -170,8 +174,10 @@ out:
int emummc_storage_end(sdmmc_storage_t *storage) int emummc_storage_end(sdmmc_storage_t *storage)
{ {
sd_end(); if (!emu_cfg.enabled || h_cfg.emummc_force_disable)
sdmmc_storage_end(storage); sdmmc_storage_end(storage);
else
sd_end();
return 1; return 1;
} }