1
0
mirror of https://github.com/CTCaer/hekate.git synced 2024-12-25 15:17:19 +00:00

emummc: correct id size and also set id if emupath is used

This corrects a truncation that was happening and also if `emupath` key is used to change emuMMC on the fly, it now uses the path as id instead of 0.
This commit is contained in:
CTCaer 2021-09-20 11:41:48 +03:00
parent ebefd1c2d3
commit 05c989a1ce
2 changed files with 9 additions and 2 deletions

View File

@ -109,7 +109,14 @@ bool emummc_set_path(char *path)
if (found) if (found)
{ {
emu_cfg.enabled = 1; emu_cfg.enabled = 1;
emu_cfg.id = 0;
// Get ID from path.
u32 id_from_path = 0;
u32 path_size = strlen(path);
if (path_size >= 4)
memcpy(&id_from_path, path + path_size - 4, 4);
emu_cfg.id = id_from_path;
strcpy(emu_cfg.nintendo_path, path); strcpy(emu_cfg.nintendo_path, path);
strcat(emu_cfg.nintendo_path, "/Nintendo"); strcat(emu_cfg.nintendo_path, "/Nintendo");
} }

View File

@ -37,7 +37,7 @@ typedef struct _emummc_cfg_t
{ {
int enabled; int enabled;
u64 sector; u64 sector;
u16 id; u32 id;
char *path; char *path;
char *nintendo_path; char *nintendo_path;
// Internal. // Internal.