diff --git a/emummc/.gitrepo b/emummc/.gitrepo index 3336bd207..a6da23bb7 100644 --- a/emummc/.gitrepo +++ b/emummc/.gitrepo @@ -6,7 +6,7 @@ [subrepo] remote = https://github.com/m4xw/emuMMC branch = develop - commit = bd81a674a946c30b566e1732a95c18f19b701558 - parent = 6ee525201ccef107c61d81ba73c891e3eb5f0215 + commit = d12dd5464422029a1e5601916517ec3f1c81d8d0 + parent = 259a1a7513236a1de4d373bc6cb99032ede2c626 method = rebase - cmdver = 0.4.0 + cmdver = 0.4.1 diff --git a/emummc/README.md b/emummc/README.md index 604292ddc..a4dd40a55 100644 --- a/emummc/README.md +++ b/emummc/README.md @@ -1,21 +1,21 @@ # emuMMC -*A SDMMC driver replacement for Nintendo's Filesystem Services, by **m4xw*** +*A SDMMC driver replacement for Nintendo's Filesystem Services, by **m4xw*** ### Supported Horizon Versions **1.0.0 - 9.1.0** ## Features -* Arbitrary SDMMC backend selection +* Arbitrary SDMMC backend selection **This allows loading eMMC from SD or even SD from eMMC** -* On the fly hooking / patching, fully self-infesting +* On the fly hooking / patching, fully self-infesting **Only one payload required for all versions!** -* File-based SDMMC backend support (from SD) +* File-based SDMMC backend support (from SD) **This allows loading eMMC images from hekate-backups (split or not)** -* SDMMC device based sector offset (*currently eMMC only*) +* SDMMC device based sector offset (*currently eMMC only*) **Raw partition support for eMMC from SD with less performance overhead** -* Full support for `/Nintendo` folder redirection to a arbitrary path +* Full support for `/Nintendo` folder redirection to a arbitrary path **No 8 char length restriction!** -* exosphere based context configuration +* exosphere based context configuration **This includes full support for multiple emuMMC images** ## Compiling diff --git a/emummc/source/FS/offsets/100.h b/emummc/source/FS/offsets/100.h index 7b4e6fc01..779601580 100644 --- a/emummc/source/FS/offsets/100.h +++ b/emummc/source/FS/offsets/100.h @@ -48,10 +48,8 @@ // Nintendo Paths #define FS_OFFSET_100_NINTENDO_PATHS \ { \ - {.opcode_reg = 9, .adrp_offset = 0x00032C58, .add_rel_offset = 4}, \ - {.opcode_reg = 8, .adrp_offset = 0x00032C60, .add_rel_offset = 4}, \ - {.opcode_reg = 9, .adrp_offset = 0x00032F3C, .add_rel_offset = 4}, \ - {.opcode_reg = 8, .adrp_offset = 0x00032F44, .add_rel_offset = 4}, \ + {.opcode_reg = 8, .adrp_offset = 0x00032C58, .add_rel_offset = 8}, \ + {.opcode_reg = 9, .adrp_offset = 0x00032F40, .add_rel_offset = 8}, \ {.opcode_reg = 0, .adrp_offset = 0, .add_rel_offset = 0}, \ } diff --git a/emummc/source/main.c b/emummc/source/main.c index efd7ac049..520c1ea22 100644 --- a/emummc/source/main.c +++ b/emummc/source/main.c @@ -48,6 +48,9 @@ extern char __argdata__; // TODO static char nintendo_path[0x80] = "Nintendo"; +// 1.0.0 requires special path handling because it has separate album and contents paths. +#define FS_100_ALBUM_PATH 0 +#define FS_100_CONTENTS_PATH 1 static char nintendo_path_album_100[0x100] = "/Nintendo/Album"; static char nintendo_path_contents_100[0x100] = "/Nintendo/Contents"; @@ -275,23 +278,18 @@ void setup_nintendo_paths(void) // 1.0.0 needs special handling because it uses two paths. // Do album path { - int path_len = snprintf(nintendo_path_album_100, sizeof(nintendo_path_album_100), "/%s/Album", nintendo_path); + snprintf(nintendo_path_album_100, sizeof(nintendo_path_album_100), "/%s/Album", nintendo_path); intptr_t nintendo_album_path_location = (intptr_t)&nintendo_path_album_100; - intptr_t album_path_location = nintendo_album_path_location + path_len - 6; // "/Album" - uintptr_t fs_n_adrp_opcode_location = INJECT_OFFSET(uintptr_t, fs_offsets->nintendo_paths[0].adrp_offset); - uintptr_t fs_adrp_opcode_location = INJECT_OFFSET(uintptr_t, fs_offsets->nintendo_paths[1].adrp_offset); - write_adrp_add(fs_offsets->nintendo_paths[0].opcode_reg, fs_n_adrp_opcode_location, fs_offsets->nintendo_paths[0].add_rel_offset, nintendo_album_path_location); - write_adrp_add(fs_offsets->nintendo_paths[1].opcode_reg, fs_adrp_opcode_location, fs_offsets->nintendo_paths[1].add_rel_offset, album_path_location); + uintptr_t fs_adrp_opcode_location = INJECT_OFFSET(uintptr_t, fs_offsets->nintendo_paths[FS_100_ALBUM_PATH].adrp_offset); + write_adrp_add(fs_offsets->nintendo_paths[FS_100_ALBUM_PATH].opcode_reg, fs_adrp_opcode_location, fs_offsets->nintendo_paths[FS_100_ALBUM_PATH].add_rel_offset, nintendo_album_path_location); } + // Do contents path { - int path_len = snprintf(nintendo_path_contents_100, sizeof(nintendo_path_contents_100), "/%s/Contents", nintendo_path); + snprintf(nintendo_path_contents_100, sizeof(nintendo_path_contents_100), "/%s/Contents", nintendo_path); intptr_t nintendo_contents_path_location = (intptr_t)&nintendo_path_contents_100; - intptr_t contents_path_location = nintendo_contents_path_location + path_len - 9; // "/Contents" - uintptr_t fs_n_adrp_opcode_location = INJECT_OFFSET(uintptr_t, fs_offsets->nintendo_paths[2].adrp_offset); - uintptr_t fs_adrp_opcode_location = INJECT_OFFSET(uintptr_t, fs_offsets->nintendo_paths[3].adrp_offset); - write_adrp_add(fs_offsets->nintendo_paths[2].opcode_reg, fs_n_adrp_opcode_location, fs_offsets->nintendo_paths[2].add_rel_offset, nintendo_contents_path_location); - write_adrp_add(fs_offsets->nintendo_paths[3].opcode_reg, fs_adrp_opcode_location, fs_offsets->nintendo_paths[3].add_rel_offset, contents_path_location); + uintptr_t fs_adrp_opcode_location = INJECT_OFFSET(uintptr_t, fs_offsets->nintendo_paths[FS_100_CONTENTS_PATH].adrp_offset); + write_adrp_add(fs_offsets->nintendo_paths[FS_100_CONTENTS_PATH].opcode_reg, fs_adrp_opcode_location, fs_offsets->nintendo_paths[FS_100_CONTENTS_PATH].add_rel_offset, nintendo_contents_path_location); } } }