From 0c3f1bed33873b80f1b961a5c7c7790a17412296 Mon Sep 17 00:00:00 2001 From: Michael Scire Date: Wed, 12 Oct 2022 00:53:34 -0700 Subject: [PATCH] emummc: update for 15.0.0 --- emummc/README.md | 2 +- emummc/source/FS/FS_offsets.c | 8 ++++ emummc/source/FS/FS_versions.h | 3 ++ emummc/source/FS/offsets/1500.h | 59 +++++++++++++++++++++++++++ emummc/source/FS/offsets/1500_exfat.h | 59 +++++++++++++++++++++++++++ 5 files changed, 130 insertions(+), 1 deletion(-) create mode 100644 emummc/source/FS/offsets/1500.h create mode 100644 emummc/source/FS/offsets/1500_exfat.h diff --git a/emummc/README.md b/emummc/README.md index af22061a0..2270f4e36 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 - 13.1.0** +**1.0.0 - 15.0.0** ## Features * Arbitrary SDMMC backend selection diff --git a/emummc/source/FS/FS_offsets.c b/emummc/source/FS/FS_offsets.c index 627590c38..1158f284c 100644 --- a/emummc/source/FS/FS_offsets.c +++ b/emummc/source/FS/FS_offsets.c @@ -61,6 +61,8 @@ #include "offsets/1310_exfat.h" #include "offsets/1400.h" #include "offsets/1400_exfat.h" +#include "offsets/1500.h" +#include "offsets/1500_exfat.h" #include "../utils/fatal.h" #define GET_OFFSET_STRUCT_NAME(vers) g_offsets##vers @@ -133,6 +135,8 @@ DEFINE_OFFSET_STRUCT(_1310); DEFINE_OFFSET_STRUCT(_1310_EXFAT); DEFINE_OFFSET_STRUCT(_1400); DEFINE_OFFSET_STRUCT(_1400_EXFAT); +DEFINE_OFFSET_STRUCT(_1500); +DEFINE_OFFSET_STRUCT(_1500_EXFAT); const fs_offsets_t *get_fs_offsets(enum FS_VER version) { switch (version) { @@ -226,6 +230,10 @@ const fs_offsets_t *get_fs_offsets(enum FS_VER version) { return &(GET_OFFSET_STRUCT_NAME(_1400)); case FS_VER_14_0_0_EXFAT: return &(GET_OFFSET_STRUCT_NAME(_1400_EXFAT)); + case FS_VER_15_0_0: + return &(GET_OFFSET_STRUCT_NAME(_1500)); + case FS_VER_15_0_0_EXFAT: + return &(GET_OFFSET_STRUCT_NAME(_1500_EXFAT)); default: fatal_abort(Fatal_UnknownVersion); } diff --git a/emummc/source/FS/FS_versions.h b/emummc/source/FS/FS_versions.h index 70e1f105a..c050141ff 100644 --- a/emummc/source/FS/FS_versions.h +++ b/emummc/source/FS/FS_versions.h @@ -89,6 +89,9 @@ enum FS_VER FS_VER_14_0_0, FS_VER_14_0_0_EXFAT, + FS_VER_15_0_0, + FS_VER_15_0_0_EXFAT, + FS_VER_MAX, }; diff --git a/emummc/source/FS/offsets/1500.h b/emummc/source/FS/offsets/1500.h new file mode 100644 index 000000000..5802f2477 --- /dev/null +++ b/emummc/source/FS/offsets/1500.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_1500_H__ +#define __FS_1500_H__ + +// Accessor vtable getters +#define FS_OFFSET_1500_SDMMC_ACCESSOR_GC 0x183E20 +#define FS_OFFSET_1500_SDMMC_ACCESSOR_SD 0x185AA0 +#define FS_OFFSET_1500_SDMMC_ACCESSOR_NAND 0x1842E0 + +// Hooks +#define FS_OFFSET_1500_SDMMC_WRAPPER_READ 0x17FCF0 +#define FS_OFFSET_1500_SDMMC_WRAPPER_WRITE 0x17FD50 +#define FS_OFFSET_1500_RTLD 0x26518 +#define FS_OFFSET_1500_RTLD_DESTINATION ((uintptr_t)(INT64_C(-0x3C))) + +#define FS_OFFSET_1500_CLKRST_SET_MIN_V_CLK_RATE 0x1A0870 + +// Misc funcs +#define FS_OFFSET_1500_LOCK_MUTEX 0x1791A0 +#define FS_OFFSET_1500_UNLOCK_MUTEX 0x1791F0 + +#define FS_OFFSET_1500_SDMMC_WRAPPER_CONTROLLER_OPEN 0x17FCB0 +#define FS_OFFSET_1500_SDMMC_WRAPPER_CONTROLLER_CLOSE 0x17FCD0 + +// Misc Data +#define FS_OFFSET_1500_SD_MUTEX 0xFF33F0 +#define FS_OFFSET_1500_NAND_MUTEX 0xFEE2E8 +#define FS_OFFSET_1500_ACTIVE_PARTITION 0xFEE328 +#define FS_OFFSET_1500_SDMMC_DAS_HANDLE 0xFD38D8 + +// NOPs +#define FS_OFFSET_1500_SD_DAS_INIT 0x25454 + +// Nintendo Paths +#define FS_OFFSET_1500_NINTENDO_PATHS \ +{ \ + {.opcode_reg = 3, .adrp_offset = 0x00063050, .add_rel_offset = 0x00000004}, \ + {.opcode_reg = 3, .adrp_offset = 0x0006FDE8, .add_rel_offset = 0x00000004}, \ + {.opcode_reg = 4, .adrp_offset = 0x000768D4, .add_rel_offset = 0x00000004}, \ + {.opcode_reg = 4, .adrp_offset = 0x00089364, .add_rel_offset = 0x00000004}, \ + {.opcode_reg = 0, .adrp_offset = 0, .add_rel_offset = 0}, \ +} + +#endif // __FS_1500_H__ diff --git a/emummc/source/FS/offsets/1500_exfat.h b/emummc/source/FS/offsets/1500_exfat.h new file mode 100644 index 000000000..d757f63d5 --- /dev/null +++ b/emummc/source/FS/offsets/1500_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_1500_EXFAT_H__ +#define __FS_1500_EXFAT_H__ + +// Accessor vtable getters +#define FS_OFFSET_1500_EXFAT_SDMMC_ACCESSOR_GC 0x18EDB0 +#define FS_OFFSET_1500_EXFAT_SDMMC_ACCESSOR_SD 0x190A30 +#define FS_OFFSET_1500_EXFAT_SDMMC_ACCESSOR_NAND 0x18F270 + +// Hooks +#define FS_OFFSET_1500_EXFAT_SDMMC_WRAPPER_READ 0x18AC80 +#define FS_OFFSET_1500_EXFAT_SDMMC_WRAPPER_WRITE 0x18ACE0 +#define FS_OFFSET_1500_EXFAT_RTLD 0x26518 +#define FS_OFFSET_1500_EXFAT_RTLD_DESTINATION ((uintptr_t)(INT64_C(-0x3C))) + +#define FS_OFFSET_1500_EXFAT_CLKRST_SET_MIN_V_CLK_RATE 0x1AB800 + +// Misc funcs +#define FS_OFFSET_1500_EXFAT_LOCK_MUTEX 0x184130 +#define FS_OFFSET_1500_EXFAT_UNLOCK_MUTEX 0x184180 + +#define FS_OFFSET_1500_EXFAT_SDMMC_WRAPPER_CONTROLLER_OPEN 0x18AC40 +#define FS_OFFSET_1500_EXFAT_SDMMC_WRAPPER_CONTROLLER_CLOSE 0x18AC60 + +// Misc Data +#define FS_OFFSET_1500_EXFAT_SD_MUTEX 0x10053F0 +#define FS_OFFSET_1500_EXFAT_NAND_MUTEX 0x10002E8 +#define FS_OFFSET_1500_EXFAT_ACTIVE_PARTITION 0x1000328 +#define FS_OFFSET_1500_EXFAT_SDMMC_DAS_HANDLE 0xFE08D8 + +// NOPs +#define FS_OFFSET_1500_EXFAT_SD_DAS_INIT 0x25454 + +// Nintendo Paths +#define FS_OFFSET_1500_EXFAT_NINTENDO_PATHS \ +{ \ + {.opcode_reg = 3, .adrp_offset = 0x00063050, .add_rel_offset = 0x00000004}, \ + {.opcode_reg = 3, .adrp_offset = 0x0006FDE8, .add_rel_offset = 0x00000004}, \ + {.opcode_reg = 4, .adrp_offset = 0x000768D4, .add_rel_offset = 0x00000004}, \ + {.opcode_reg = 4, .adrp_offset = 0x00089364, .add_rel_offset = 0x00000004}, \ + {.opcode_reg = 0, .adrp_offset = 0, .add_rel_offset = 0}, \ +} + +#endif // __FS_1500_EXFAT_H__