diff --git a/emummc/README.md b/emummc/README.md index aa9736d27..a69168b45 100644 --- a/emummc/README.md +++ b/emummc/README.md @@ -2,7 +2,7 @@ *A SDMMC driver replacement for Nintendo's Filesystem Services, by **m4xw*** ### Supported Horizon Versions -**1.0.0 - 20.1.0** +**1.0.0 - 21.0.0** ## Features * Arbitrary SDMMC backend selection diff --git a/emummc/source/FS/FS_offsets.c b/emummc/source/FS/FS_offsets.c index 0db07fe8e..a84770903 100644 --- a/emummc/source/FS/FS_offsets.c +++ b/emummc/source/FS/FS_offsets.c @@ -79,6 +79,8 @@ #include "offsets/2000_exfat.h" #include "offsets/2010.h" #include "offsets/2010_exfat.h" +#include "offsets/2100.h" +#include "offsets/2100_exfat.h" #include "../utils/fatal.h" #define GET_OFFSET_STRUCT_NAME(vers) g_offsets##vers @@ -169,6 +171,8 @@ DEFINE_OFFSET_STRUCT(_2000); DEFINE_OFFSET_STRUCT(_2000_EXFAT); DEFINE_OFFSET_STRUCT(_2010); DEFINE_OFFSET_STRUCT(_2010_EXFAT); +DEFINE_OFFSET_STRUCT(_2100); +DEFINE_OFFSET_STRUCT(_2100_EXFAT); const fs_offsets_t *get_fs_offsets(enum FS_VER version) { switch (version) { @@ -298,6 +302,10 @@ const fs_offsets_t *get_fs_offsets(enum FS_VER version) { return &(GET_OFFSET_STRUCT_NAME(_2010)); case FS_VER_20_1_0_EXFAT: return &(GET_OFFSET_STRUCT_NAME(_2010_EXFAT)); + case FS_VER_21_0_0: + return &(GET_OFFSET_STRUCT_NAME(_2100)); + case FS_VER_21_0_0_EXFAT: + return &(GET_OFFSET_STRUCT_NAME(_2100_EXFAT)); default: fatal_abort(Fatal_UnknownVersion); } diff --git a/emummc/source/FS/FS_versions.h b/emummc/source/FS/FS_versions.h index 312f63224..c1d21797d 100644 --- a/emummc/source/FS/FS_versions.h +++ b/emummc/source/FS/FS_versions.h @@ -116,6 +116,9 @@ enum FS_VER FS_VER_20_1_0, FS_VER_20_1_0_EXFAT, + FS_VER_21_0_0, + FS_VER_21_0_0_EXFAT, + FS_VER_MAX, }; diff --git a/emummc/source/FS/offsets/2100.h b/emummc/source/FS/offsets/2100.h new file mode 100644 index 000000000..dcd7828d2 --- /dev/null +++ b/emummc/source/FS/offsets/2100.h @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2019 m4xw + * Copyright (c) 2019 Atmosphere-NX + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +#ifndef __FS_2100_H__ +#define __FS_2100_H__ + +// Accessor vtable getters +#define FS_OFFSET_2100_SDMMC_ACCESSOR_GC 0x1AC970 +#define FS_OFFSET_2100_SDMMC_ACCESSOR_SD 0x1AE980 +#define FS_OFFSET_2100_SDMMC_ACCESSOR_NAND 0x1ACFA0 + +// Hooks +#define FS_OFFSET_2100_SDMMC_WRAPPER_READ 0x1A8850 +#define FS_OFFSET_2100_SDMMC_WRAPPER_WRITE 0x1A88B0 +#define FS_OFFSET_2100_RTLD 0x2E1C0 +#define FS_OFFSET_2100_RTLD_DESTINATION ((uintptr_t)(INT64_C(-0x4C))) + +#define FS_OFFSET_2100_CLKRST_SET_MIN_V_CLK_RATE 0x1CB9B0 + +// Misc funcs +#define FS_OFFSET_2100_LOCK_MUTEX 0x1A17D0 +#define FS_OFFSET_2100_UNLOCK_MUTEX 0x1A1830 + +#define FS_OFFSET_2100_SDMMC_WRAPPER_CONTROLLER_OPEN 0x1A8810 +#define FS_OFFSET_2100_SDMMC_WRAPPER_CONTROLLER_CLOSE 0x1A8830 + +// Misc Data +#define FS_OFFSET_2100_SD_MUTEX 0xFEE408 +#define FS_OFFSET_2100_NAND_MUTEX 0xFE9CF0 +#define FS_OFFSET_2100_ACTIVE_PARTITION 0xFE9D30 +#define FS_OFFSET_2100_SDMMC_DAS_HANDLE 0xFCBB18 + +// NOPs +#define FS_OFFSET_2100_SD_DAS_INIT 0x2B5C8 + +// Nintendo Paths +#define FS_OFFSET_2100_NINTENDO_PATHS \ +{ \ + {.opcode_reg = 3, .adrp_offset = 0x000718CC, .add_rel_offset = 0x00000004}, \ + {.opcode_reg = 3, .adrp_offset = 0x000824F4, .add_rel_offset = 0x00000004}, \ + {.opcode_reg = 4, .adrp_offset = 0x0008AF18, .add_rel_offset = 0x00000004}, \ + {.opcode_reg = 4, .adrp_offset = 0x000A0B8C, .add_rel_offset = 0x00000004}, \ + {.opcode_reg = 0, .adrp_offset = 0, .add_rel_offset = 0}, \ +} + +#endif // __FS_2100_H__ diff --git a/emummc/source/FS/offsets/2100_exfat.h b/emummc/source/FS/offsets/2100_exfat.h new file mode 100644 index 000000000..d449e2372 --- /dev/null +++ b/emummc/source/FS/offsets/2100_exfat.h @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2019 m4xw + * Copyright (c) 2019 Atmosphere-NX + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +#ifndef __FS_2100_EXFAT_EXFAT_H__ +#define __FS_2100_EXFAT_EXFAT_H__ + +// Accessor vtable getters +#define FS_OFFSET_2100_EXFAT_SDMMC_ACCESSOR_GC 0x1B7AD0 +#define FS_OFFSET_2100_EXFAT_SDMMC_ACCESSOR_SD 0x1B9AE0 +#define FS_OFFSET_2100_EXFAT_SDMMC_ACCESSOR_NAND 0x1B8100 + +// Hooks +#define FS_OFFSET_2100_EXFAT_SDMMC_WRAPPER_READ 0x1B39B0 +#define FS_OFFSET_2100_EXFAT_SDMMC_WRAPPER_WRITE 0x1B3A10 +#define FS_OFFSET_2100_EXFAT_RTLD 0x2E1C0 +#define FS_OFFSET_2100_EXFAT_RTLD_DESTINATION ((uintptr_t)(INT64_C(-0x4C))) + +#define FS_OFFSET_2100_EXFAT_CLKRST_SET_MIN_V_CLK_RATE 0x1D6B10 + +// Misc funcs +#define FS_OFFSET_2100_EXFAT_LOCK_MUTEX 0x1AC930 +#define FS_OFFSET_2100_EXFAT_UNLOCK_MUTEX 0x1AC990 + +#define FS_OFFSET_2100_EXFAT_SDMMC_WRAPPER_CONTROLLER_OPEN 0x1B3970 +#define FS_OFFSET_2100_EXFAT_SDMMC_WRAPPER_CONTROLLER_CLOSE 0x1B3990 + +// Misc Data +#define FS_OFFSET_2100_EXFAT_SD_MUTEX 0xFFF408 +#define FS_OFFSET_2100_EXFAT_NAND_MUTEX 0xFFACF0 +#define FS_OFFSET_2100_EXFAT_ACTIVE_PARTITION 0xFFAD30 +#define FS_OFFSET_2100_EXFAT_SDMMC_DAS_HANDLE 0xFD8B18 + +// NOPs +#define FS_OFFSET_2100_EXFAT_SD_DAS_INIT 0x2B5C8 + +// Nintendo Paths +#define FS_OFFSET_2100_EXFAT_NINTENDO_PATHS \ +{ \ + {.opcode_reg = 3, .adrp_offset = 0x000718CC, .add_rel_offset = 0x00000004}, \ + {.opcode_reg = 3, .adrp_offset = 0x000824F4, .add_rel_offset = 0x00000004}, \ + {.opcode_reg = 4, .adrp_offset = 0x0008AF18, .add_rel_offset = 0x00000004}, \ + {.opcode_reg = 4, .adrp_offset = 0x000A0B8C, .add_rel_offset = 0x00000004}, \ + {.opcode_reg = 0, .adrp_offset = 0, .add_rel_offset = 0}, \ +} + +#endif // __FS_2100_EXFAT_EXFAT_H__