From b0817626571179e63c6d7ab20c138388ec8b9e1b Mon Sep 17 00:00:00 2001 From: Michael Scire Date: Thu, 28 Mar 2024 04:33:44 -0700 Subject: [PATCH] emummc: update for 18.0.0 --- emummc/README.md | 2 +- emummc/source/FS/FS_offsets.c | 8 ++++ emummc/source/FS/FS_versions.h | 3 ++ emummc/source/FS/offsets/1800.h | 59 +++++++++++++++++++++++++++ emummc/source/FS/offsets/1800_exfat.h | 59 +++++++++++++++++++++++++++ 5 files changed, 130 insertions(+), 1 deletion(-) create mode 100644 emummc/source/FS/offsets/1800.h create mode 100644 emummc/source/FS/offsets/1800_exfat.h diff --git a/emummc/README.md b/emummc/README.md index 3b36a5a57..81e43f4b4 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 - 17.0.0** +**1.0.0 - 18.0.0** ## Features * Arbitrary SDMMC backend selection diff --git a/emummc/source/FS/FS_offsets.c b/emummc/source/FS/FS_offsets.c index a1031a8bc..069f5d9d1 100644 --- a/emummc/source/FS/FS_offsets.c +++ b/emummc/source/FS/FS_offsets.c @@ -69,6 +69,8 @@ #include "offsets/1603_exfat.h" #include "offsets/1700.h" #include "offsets/1700_exfat.h" +#include "offsets/1800.h" +#include "offsets/1800_exfat.h" #include "../utils/fatal.h" #define GET_OFFSET_STRUCT_NAME(vers) g_offsets##vers @@ -149,6 +151,8 @@ DEFINE_OFFSET_STRUCT(_1603); DEFINE_OFFSET_STRUCT(_1603_EXFAT); DEFINE_OFFSET_STRUCT(_1700); DEFINE_OFFSET_STRUCT(_1700_EXFAT); +DEFINE_OFFSET_STRUCT(_1800); +DEFINE_OFFSET_STRUCT(_1800_EXFAT); const fs_offsets_t *get_fs_offsets(enum FS_VER version) { switch (version) { @@ -258,6 +262,10 @@ const fs_offsets_t *get_fs_offsets(enum FS_VER version) { return &(GET_OFFSET_STRUCT_NAME(_1700)); case FS_VER_17_0_0_EXFAT: return &(GET_OFFSET_STRUCT_NAME(_1700_EXFAT)); + case FS_VER_18_0_0: + return &(GET_OFFSET_STRUCT_NAME(_1800)); + case FS_VER_18_0_0_EXFAT: + return &(GET_OFFSET_STRUCT_NAME(_1800_EXFAT)); default: fatal_abort(Fatal_UnknownVersion); } diff --git a/emummc/source/FS/FS_versions.h b/emummc/source/FS/FS_versions.h index 0459f9b9b..fc7011011 100644 --- a/emummc/source/FS/FS_versions.h +++ b/emummc/source/FS/FS_versions.h @@ -101,6 +101,9 @@ enum FS_VER FS_VER_17_0_0, FS_VER_17_0_0_EXFAT, + FS_VER_18_0_0, + FS_VER_18_0_0_EXFAT, + FS_VER_MAX, }; diff --git a/emummc/source/FS/offsets/1800.h b/emummc/source/FS/offsets/1800.h new file mode 100644 index 000000000..1b0513152 --- /dev/null +++ b/emummc/source/FS/offsets/1800.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_1800_H__ +#define __FS_1800_H__ + +// Accessor vtable getters +#define FS_OFFSET_1800_SDMMC_ACCESSOR_GC 0x18AB00 +#define FS_OFFSET_1800_SDMMC_ACCESSOR_SD 0x18C800 +#define FS_OFFSET_1800_SDMMC_ACCESSOR_NAND 0x18AFE0 + +// Hooks +#define FS_OFFSET_1800_SDMMC_WRAPPER_READ 0x186A50 +#define FS_OFFSET_1800_SDMMC_WRAPPER_WRITE 0x186AB0 +#define FS_OFFSET_1800_RTLD 0x2A3A4 +#define FS_OFFSET_1800_RTLD_DESTINATION ((uintptr_t)(INT64_C(-0x44))) + +#define FS_OFFSET_1800_CLKRST_SET_MIN_V_CLK_RATE 0x1A77D0 + +// Misc funcs +#define FS_OFFSET_1800_LOCK_MUTEX 0x17FCC0 +#define FS_OFFSET_1800_UNLOCK_MUTEX 0x17FD10 + +#define FS_OFFSET_1800_SDMMC_WRAPPER_CONTROLLER_OPEN 0x186A10 +#define FS_OFFSET_1800_SDMMC_WRAPPER_CONTROLLER_CLOSE 0x186A30 + +// Misc Data +#define FS_OFFSET_1800_SD_MUTEX 0xFD13F0 +#define FS_OFFSET_1800_NAND_MUTEX 0xFCCB28 +#define FS_OFFSET_1800_ACTIVE_PARTITION 0xFCCB68 +#define FS_OFFSET_1800_SDMMC_DAS_HANDLE 0xFB1950 + +// NOPs +#define FS_OFFSET_1800_SD_DAS_INIT 0x28F24 + +// Nintendo Paths +#define FS_OFFSET_1800_NINTENDO_PATHS \ +{ \ + {.opcode_reg = 3, .adrp_offset = 0x00068B08, .add_rel_offset = 0x00000004}, \ + {.opcode_reg = 3, .adrp_offset = 0x000758DC, .add_rel_offset = 0x00000004}, \ + {.opcode_reg = 4, .adrp_offset = 0x0007C77C, .add_rel_offset = 0x00000004}, \ + {.opcode_reg = 4, .adrp_offset = 0x000905C4, .add_rel_offset = 0x00000004}, \ + {.opcode_reg = 0, .adrp_offset = 0, .add_rel_offset = 0}, \ +} + +#endif // __FS_1800_H__ diff --git a/emummc/source/FS/offsets/1800_exfat.h b/emummc/source/FS/offsets/1800_exfat.h new file mode 100644 index 000000000..358c65f8f --- /dev/null +++ b/emummc/source/FS/offsets/1800_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_1800_EXFAT_H__ +#define __FS_1800_EXFAT_H__ + +// Accessor vtable getters +#define FS_OFFSET_1800_EXFAT_SDMMC_ACCESSOR_GC 0x195B90 +#define FS_OFFSET_1800_EXFAT_SDMMC_ACCESSOR_SD 0x197890 +#define FS_OFFSET_1800_EXFAT_SDMMC_ACCESSOR_NAND 0x196070 + +// Hooks +#define FS_OFFSET_1800_EXFAT_SDMMC_WRAPPER_READ 0x191AE0 +#define FS_OFFSET_1800_EXFAT_SDMMC_WRAPPER_WRITE 0x191B40 +#define FS_OFFSET_1800_EXFAT_RTLD 0x2A3A4 +#define FS_OFFSET_1800_EXFAT_RTLD_DESTINATION ((uintptr_t)(INT64_C(-0x44))) + +#define FS_OFFSET_1800_EXFAT_CLKRST_SET_MIN_V_CLK_RATE 0x1B2860 + +// Misc funcs +#define FS_OFFSET_1800_EXFAT_LOCK_MUTEX 0x18AD50 +#define FS_OFFSET_1800_EXFAT_UNLOCK_MUTEX 0x18ADA0 + +#define FS_OFFSET_1800_EXFAT_SDMMC_WRAPPER_CONTROLLER_OPEN 0x191AA0 +#define FS_OFFSET_1800_EXFAT_SDMMC_WRAPPER_CONTROLLER_CLOSE 0x191AC0 + +// Misc Data +#define FS_OFFSET_1800_EXFAT_SD_MUTEX 0xFE33F0 +#define FS_OFFSET_1800_EXFAT_NAND_MUTEX 0xFDEB28 +#define FS_OFFSET_1800_EXFAT_ACTIVE_PARTITION 0xFDEB68 +#define FS_OFFSET_1800_EXFAT_SDMMC_DAS_HANDLE 0xFBE950 + +// NOPs +#define FS_OFFSET_1800_EXFAT_SD_DAS_INIT 0x28F24 + +// Nintendo Paths +#define FS_OFFSET_1800_EXFAT_NINTENDO_PATHS \ +{ \ + {.opcode_reg = 3, .adrp_offset = 0x00068B08, .add_rel_offset = 0x00000004}, \ + {.opcode_reg = 3, .adrp_offset = 0x000758DC, .add_rel_offset = 0x00000004}, \ + {.opcode_reg = 4, .adrp_offset = 0x0007C77C, .add_rel_offset = 0x00000004}, \ + {.opcode_reg = 4, .adrp_offset = 0x000905C4, .add_rel_offset = 0x00000004}, \ + {.opcode_reg = 0, .adrp_offset = 0, .add_rel_offset = 0}, \ +} + +#endif // __FS_1800_EXFAT_H__