From 3f9d6574fbdc1e72ec7385652c12556e7697f308 Mon Sep 17 00:00:00 2001 From: Michael Scire Date: Wed, 19 Jun 2019 12:53:24 -0700 Subject: [PATCH] emummc: support for 8.1.0 --- emummc/source/FS/FS_offsets.c | 8 ++++ emummc/source/FS/FS_versions.h | 3 ++ emummc/source/FS/offsets/810.h | 58 ++++++++++++++++++++++++++++ emummc/source/FS/offsets/810_exfat.h | 58 ++++++++++++++++++++++++++++ 4 files changed, 127 insertions(+) create mode 100644 emummc/source/FS/offsets/810.h create mode 100644 emummc/source/FS/offsets/810_exfat.h diff --git a/emummc/source/FS/FS_offsets.c b/emummc/source/FS/FS_offsets.c index 7f0cff371..1f578cd68 100644 --- a/emummc/source/FS/FS_offsets.c +++ b/emummc/source/FS/FS_offsets.c @@ -39,6 +39,8 @@ #include "offsets/700_exfat.h" #include "offsets/800.h" #include "offsets/800_exfat.h" +#include "offsets/810.h" +#include "offsets/810_exfat.h" #include "../utils/fatal.h" #define GET_OFFSET_STRUCT_NAME(vers) g_offsets##vers @@ -88,6 +90,8 @@ DEFINE_OFFSET_STRUCT(_700); DEFINE_OFFSET_STRUCT(_700_EXFAT); DEFINE_OFFSET_STRUCT(_800); DEFINE_OFFSET_STRUCT(_800_EXFAT); +DEFINE_OFFSET_STRUCT(_810); +DEFINE_OFFSET_STRUCT(_810_EXFAT); const fs_offsets_t *get_fs_offsets(enum FS_VER version) { switch (version) { @@ -137,6 +141,10 @@ const fs_offsets_t *get_fs_offsets(enum FS_VER version) { return &(GET_OFFSET_STRUCT_NAME(_800)); case FS_VER_8_0_0_EXFAT: return &(GET_OFFSET_STRUCT_NAME(_800_EXFAT)); + case FS_VER_8_1_0: + return &(GET_OFFSET_STRUCT_NAME(_810)); + case FS_VER_8_1_0_EXFAT: + return &(GET_OFFSET_STRUCT_NAME(_810_EXFAT)); default: fatal_abort(Fatal_UnknownVersion); } diff --git a/emummc/source/FS/FS_versions.h b/emummc/source/FS/FS_versions.h index 8dd88827c..e952ee48e 100644 --- a/emummc/source/FS/FS_versions.h +++ b/emummc/source/FS/FS_versions.h @@ -56,6 +56,9 @@ enum FS_VER FS_VER_8_0_0, FS_VER_8_0_0_EXFAT, + FS_VER_8_1_0, + FS_VER_8_1_0_EXFAT, + FS_VER_MAX, }; diff --git a/emummc/source/FS/offsets/810.h b/emummc/source/FS/offsets/810.h new file mode 100644 index 000000000..02f60dcd9 --- /dev/null +++ b/emummc/source/FS/offsets/810.h @@ -0,0 +1,58 @@ +/* + * 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_810_H__ +#define __FS_810_H__ + +// Accessor vtable getters +#define FS_OFFSET_810_SDMMC_ACCESSOR_GC 0x15EA20 +#define FS_OFFSET_810_SDMMC_ACCESSOR_SD 0x15E790 +#define FS_OFFSET_810_SDMMC_ACCESSOR_NAND 0x15AC80 + +// Hooks +#define FS_OFFSET_810_SDMMC_WRAPPER_READ 0x152A80 +#define FS_OFFSET_810_SDMMC_WRAPPER_WRITE 0x152B60 +#define FS_OFFSET_810_RTLD 0x5B4 +#define FS_OFFSET_810_RTLD_DESTINATION 0x9C + +#define FS_OFFSET_810_CLKRST_SET_MIN_V_CLK_RATE 0x16F370 + +// Misc funcs +#define FS_OFFSET_810_LOCK_MUTEX 0x14B6D0 +#define FS_OFFSET_810_UNLOCK_MUTEX 0x14B720 + +// Misc Data +#define FS_OFFSET_810_SD_MUTEX 0xF1A3E8 +#define FS_OFFSET_810_NAND_MUTEX 0xF15BE8 +#define FS_OFFSET_810_ACTIVE_PARTITION 0xF15C28 +#define FS_OFFSET_810_SDMMC_DAS_HANDLE 0xE167C0 + +// NOPs +#define FS_OFFSET_810_SHUTDOWN_SD 0xBAF6C +#define FS_OFFSET_810_SD_DAS_INIT 0x87D58 + +// Nintendo Paths +#define FS_OFFSET_810_NINTENDO_PATHS \ +{ \ + {.opcode_reg = 3, .adrp_offset = 0x0007F5F0, .add_rel_offset = 4}, \ + {.opcode_reg = 3, .adrp_offset = 0x00081084, .add_rel_offset = 4}, \ + {.opcode_reg = 3, .adrp_offset = 0x00081278, .add_rel_offset = 4}, \ + {.opcode_reg = 3, .adrp_offset = 0x00081654, .add_rel_offset = 4}, \ + {.opcode_reg = 4, .adrp_offset = 0x00081818, .add_rel_offset = 4}, \ + {.opcode_reg = 0, .adrp_offset = 0, .add_rel_offset = 0} \ +} + +#endif // __FS_810_H__ diff --git a/emummc/source/FS/offsets/810_exfat.h b/emummc/source/FS/offsets/810_exfat.h new file mode 100644 index 000000000..bd8240582 --- /dev/null +++ b/emummc/source/FS/offsets/810_exfat.h @@ -0,0 +1,58 @@ +/* + * 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_810_EXFAT_H__ +#define __FS_810_EXFAT_H__ + +// Accessor vtable getters +#define FS_OFFSET_810_EXFAT_SDMMC_ACCESSOR_GC 0x169FD0 +#define FS_OFFSET_810_EXFAT_SDMMC_ACCESSOR_SD 0x169D40 +#define FS_OFFSET_810_EXFAT_SDMMC_ACCESSOR_NAND 0x166230 + +// Hooks +#define FS_OFFSET_810_EXFAT_SDMMC_WRAPPER_READ 0x15E030 +#define FS_OFFSET_810_EXFAT_SDMMC_WRAPPER_WRITE 0x15E110 +#define FS_OFFSET_810_EXFAT_RTLD 0x5B4 +#define FS_OFFSET_810_EXFAT_RTLD_DESTINATION 0x9C + +#define FS_OFFSET_810_EXFAT_CLKRST_SET_MIN_V_CLK_RATE 0x17A920 + +// Misc funcs +#define FS_OFFSET_810_EXFAT_LOCK_MUTEX 0x156C80 +#define FS_OFFSET_810_EXFAT_UNLOCK_MUTEX 0x156CD0 + +// Misc Data +#define FS_OFFSET_810_EXFAT_SD_MUTEX 0xFFE3E8 +#define FS_OFFSET_810_EXFAT_NAND_MUTEX 0xFF9BE8 +#define FS_OFFSET_810_EXFAT_ACTIVE_PARTITION 0xFF9C28 +#define FS_OFFSET_810_EXFAT_SDMMC_DAS_HANDLE 0xEFAA20 + +// NOPs +#define FS_OFFSET_810_EXFAT_SHUTDOWN_SD 0xC651C +#define FS_OFFSET_810_EXFAT_SD_DAS_INIT 0x93308 + +// Nintendo Paths +#define FS_OFFSET_810_EXFAT_NINTENDO_PATHS \ +{ \ + {.opcode_reg = 3, .adrp_offset = 0x0008ABA0, .add_rel_offset = 4}, \ + {.opcode_reg = 3, .adrp_offset = 0x0008C634, .add_rel_offset = 4}, \ + {.opcode_reg = 3, .adrp_offset = 0x0008C828, .add_rel_offset = 4}, \ + {.opcode_reg = 3, .adrp_offset = 0x0008CC04, .add_rel_offset = 4}, \ + {.opcode_reg = 4, .adrp_offset = 0x0008CDC8, .add_rel_offset = 4}, \ + {.opcode_reg = 0, .adrp_offset = 0, .add_rel_offset = 0} \ +} + +#endif // __FS_810_EXFAT_H__