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 committed 2021-09-20 11:41:48 +03:00
1 parent ebefd1c2d3
commit 05c989a1ce
2 files changed
+9 -2

No files matched your search

+8 -1
View File
@@ -109,7 +109,14 @@ bool emummc_set_path(char *path)
if (found)
{
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);
strcat(emu_cfg.nintendo_path, "/Nintendo");
}