From be399772c0af24f35683fd0e4d02cc250a9a7372 Mon Sep 17 00:00:00 2001 From: Michael Scire Date: Wed, 23 Mar 2022 04:32:08 -0700 Subject: [PATCH] emummc: add 14.0.0 patches --- emummc/source/FS/FS_offsets.c | 8 ++++ emummc/source/FS/FS_versions.h | 3 ++ emummc/source/FS/offsets/1400.h | 59 +++++++++++++++++++++++++++ emummc/source/FS/offsets/1400_exfat.h | 59 +++++++++++++++++++++++++++ 4 files changed, 129 insertions(+) create mode 100644 emummc/source/FS/offsets/1400.h create mode 100644 emummc/source/FS/offsets/1400_exfat.h diff --git a/emummc/source/FS/FS_offsets.c b/emummc/source/FS/FS_offsets.c index 12fc947b4..627590c38 100644 --- a/emummc/source/FS/FS_offsets.c +++ b/emummc/source/FS/FS_offsets.c @@ -59,6 +59,8 @@ #include "offsets/1300_exfat.h" #include "offsets/1310.h" #include "offsets/1310_exfat.h" +#include "offsets/1400.h" +#include "offsets/1400_exfat.h" #include "../utils/fatal.h" #define GET_OFFSET_STRUCT_NAME(vers) g_offsets##vers @@ -129,6 +131,8 @@ DEFINE_OFFSET_STRUCT(_1300); DEFINE_OFFSET_STRUCT(_1300_EXFAT); DEFINE_OFFSET_STRUCT(_1310); DEFINE_OFFSET_STRUCT(_1310_EXFAT); +DEFINE_OFFSET_STRUCT(_1400); +DEFINE_OFFSET_STRUCT(_1400_EXFAT); const fs_offsets_t *get_fs_offsets(enum FS_VER version) { switch (version) { @@ -218,6 +222,10 @@ const fs_offsets_t *get_fs_offsets(enum FS_VER version) { return &(GET_OFFSET_STRUCT_NAME(_1310)); case FS_VER_13_1_0_EXFAT: return &(GET_OFFSET_STRUCT_NAME(_1310_EXFAT)); + case FS_VER_14_0_0: + return &(GET_OFFSET_STRUCT_NAME(_1400)); + case FS_VER_14_0_0_EXFAT: + return &(GET_OFFSET_STRUCT_NAME(_1400_EXFAT)); default: fatal_abort(Fatal_UnknownVersion); } diff --git a/emummc/source/FS/FS_versions.h b/emummc/source/FS/FS_versions.h index 8ea653888..70e1f105a 100644 --- a/emummc/source/FS/FS_versions.h +++ b/emummc/source/FS/FS_versions.h @@ -86,6 +86,9 @@ enum FS_VER FS_VER_13_1_0, FS_VER_13_1_0_EXFAT, + FS_VER_14_0_0, + FS_VER_14_0_0_EXFAT, + FS_VER_MAX, }; diff --git a/emummc/source/FS/offsets/1400.h b/emummc/source/FS/offsets/1400.h new file mode 100644 index 000000000..c6e1acaee --- /dev/null +++ b/emummc/source/FS/offsets/1400.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_1400_H__ +#define __FS_1400_H__ + +// Accessor vtable getters +#define FS_OFFSET_1400_SDMMC_ACCESSOR_GC 0x189F50 +#define FS_OFFSET_1400_SDMMC_ACCESSOR_SD 0x18BD60 +#define FS_OFFSET_1400_SDMMC_ACCESSOR_NAND 0x18A480 + +// Hooks +#define FS_OFFSET_1400_SDMMC_WRAPPER_READ 0x185AF0 +#define FS_OFFSET_1400_SDMMC_WRAPPER_WRITE 0x185B50 +#define FS_OFFSET_1400_RTLD 0x282B8 +#define FS_OFFSET_1400_RTLD_DESTINATION ((uintptr_t)(INT64_C(-0x3C))) + +#define FS_OFFSET_1400_CLKRST_SET_MIN_V_CLK_RATE 0x1A5D90 + +// Misc funcs +#define FS_OFFSET_1400_LOCK_MUTEX 0x17E9F0 +#define FS_OFFSET_1400_UNLOCK_MUTEX 0x17EA40 + +#define FS_OFFSET_1400_SDMMC_WRAPPER_CONTROLLER_OPEN 0x185AA0 +#define FS_OFFSET_1400_SDMMC_WRAPPER_CONTROLLER_CLOSE 0x185AD0 + +// Misc Data +#define FS_OFFSET_1400_SD_MUTEX 0xF2E3F0 +#define FS_OFFSET_1400_NAND_MUTEX 0xF292F8 +#define FS_OFFSET_1400_ACTIVE_PARTITION 0xF29338 +#define FS_OFFSET_1400_SDMMC_DAS_HANDLE 0xDFE9C8 + +// NOPs +#define FS_OFFSET_1400_SD_DAS_INIT 0x27004 + +// Nintendo Paths +#define FS_OFFSET_1400_NINTENDO_PATHS \ +{ \ + {.opcode_reg = 3, .adrp_offset = 0x0006D9C0, .add_rel_offset = 0x00000004}, \ + {.opcode_reg = 3, .adrp_offset = 0x0007AC24, .add_rel_offset = 0x00000004}, \ + {.opcode_reg = 4, .adrp_offset = 0x000813E8, .add_rel_offset = 0x00000004}, \ + {.opcode_reg = 4, .adrp_offset = 0x0009387C, .add_rel_offset = 0x00000004}, \ + {.opcode_reg = 0, .adrp_offset = 0, .add_rel_offset = 0}, \ +} + +#endif // __FS_1400_H__ diff --git a/emummc/source/FS/offsets/1400_exfat.h b/emummc/source/FS/offsets/1400_exfat.h new file mode 100644 index 000000000..3ce63e5bc --- /dev/null +++ b/emummc/source/FS/offsets/1400_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_1400_EXFAT_H__ +#define __FS_1400_EXFAT_H__ + +// Accessor vtable getters +#define FS_OFFSET_1400_EXFAT_SDMMC_ACCESSOR_GC 0x1952D0 +#define FS_OFFSET_1400_EXFAT_SDMMC_ACCESSOR_SD 0x1970E0 +#define FS_OFFSET_1400_EXFAT_SDMMC_ACCESSOR_NAND 0x195800 + +// Hooks +#define FS_OFFSET_1400_EXFAT_SDMMC_WRAPPER_READ 0x190E70 +#define FS_OFFSET_1400_EXFAT_SDMMC_WRAPPER_WRITE 0x190ED0 +#define FS_OFFSET_1400_EXFAT_RTLD 0x282B8 +#define FS_OFFSET_1400_EXFAT_RTLD_DESTINATION ((uintptr_t)(INT64_C(-0x3C))) + +#define FS_OFFSET_1400_EXFAT_CLKRST_SET_MIN_V_CLK_RATE 0x1B1110 + +// Misc funcs +#define FS_OFFSET_1400_EXFAT_LOCK_MUTEX 0x189D70 +#define FS_OFFSET_1400_EXFAT_UNLOCK_MUTEX 0x189DC0 + +#define FS_OFFSET_1400_EXFAT_SDMMC_WRAPPER_CONTROLLER_OPEN 0x190E20 +#define FS_OFFSET_1400_EXFAT_SDMMC_WRAPPER_CONTROLLER_CLOSE 0x190E50 + +// Misc Data +#define FS_OFFSET_1400_EXFAT_SD_MUTEX 0x10123F0 +#define FS_OFFSET_1400_EXFAT_NAND_MUTEX 0x100D2F8 +#define FS_OFFSET_1400_EXFAT_ACTIVE_PARTITION 0x100D338 +#define FS_OFFSET_1400_EXFAT_SDMMC_DAS_HANDLE 0xE0B9C8 + +// NOPs +#define FS_OFFSET_1400_EXFAT_SD_DAS_INIT 0x27004 + +// Nintendo Paths +#define FS_OFFSET_1400_EXFAT_NINTENDO_PATHS \ +{ \ + {.opcode_reg = 3, .adrp_offset = 0x0006D9C0, .add_rel_offset = 0x00000004}, \ + {.opcode_reg = 3, .adrp_offset = 0x0007AC24, .add_rel_offset = 0x00000004}, \ + {.opcode_reg = 4, .adrp_offset = 0x000813E8, .add_rel_offset = 0x00000004}, \ + {.opcode_reg = 4, .adrp_offset = 0x0009387C, .add_rel_offset = 0x00000004}, \ + {.opcode_reg = 0, .adrp_offset = 0, .add_rel_offset = 0}, \ +} + +#endif // __FS_1400_EXFAT_H__