From 4181169f80b56701f61452a1981d9131534a3bb3 Mon Sep 17 00:00:00 2001 From: hexkyz Date: Tue, 16 Jun 2026 19:18:26 +0100 Subject: [PATCH] emummc: update for 22.5.0 --- emummc/source/FS/FS_offsets.c | 8 +++ emummc/source/FS/FS_versions.h | 3 ++ emummc/source/FS/offsets/2250.h | 59 +++++++++++++++++++++ emummc/source/FS/offsets/2250_exfat.h | 59 +++++++++++++++++++++ fusee/program/source/fusee_stratosphere.cpp | 8 +++ 5 files changed, 137 insertions(+) create mode 100644 emummc/source/FS/offsets/2250.h create mode 100644 emummc/source/FS/offsets/2250_exfat.h diff --git a/emummc/source/FS/FS_offsets.c b/emummc/source/FS/FS_offsets.c index 9749aef3e..133e0e816 100644 --- a/emummc/source/FS/FS_offsets.c +++ b/emummc/source/FS/FS_offsets.c @@ -85,6 +85,8 @@ #include "offsets/2120_exfat.h" #include "offsets/2200.h" #include "offsets/2200_exfat.h" +#include "offsets/2250.h" +#include "offsets/2250_exfat.h" #include "../utils/fatal.h" #define GET_OFFSET_STRUCT_NAME(vers) g_offsets##vers @@ -181,6 +183,8 @@ DEFINE_OFFSET_STRUCT(_2120); DEFINE_OFFSET_STRUCT(_2120_EXFAT); DEFINE_OFFSET_STRUCT(_2200); DEFINE_OFFSET_STRUCT(_2200_EXFAT); +DEFINE_OFFSET_STRUCT(_2250); +DEFINE_OFFSET_STRUCT(_2250_EXFAT); const fs_offsets_t *get_fs_offsets(enum FS_VER version) { switch (version) { @@ -322,6 +326,10 @@ const fs_offsets_t *get_fs_offsets(enum FS_VER version) { return &(GET_OFFSET_STRUCT_NAME(_2200)); case FS_VER_22_0_0_EXFAT: return &(GET_OFFSET_STRUCT_NAME(_2200_EXFAT)); + case FS_VER_22_5_0: + return &(GET_OFFSET_STRUCT_NAME(_2250)); + case FS_VER_22_5_0_EXFAT: + return &(GET_OFFSET_STRUCT_NAME(_2250_EXFAT)); default: fatal_abort(Fatal_UnknownVersion); } diff --git a/emummc/source/FS/FS_versions.h b/emummc/source/FS/FS_versions.h index 892bc4c7c..af2913d0f 100644 --- a/emummc/source/FS/FS_versions.h +++ b/emummc/source/FS/FS_versions.h @@ -124,6 +124,9 @@ enum FS_VER FS_VER_22_0_0, FS_VER_22_0_0_EXFAT, + + FS_VER_22_5_0, + FS_VER_22_5_0_EXFAT, FS_VER_MAX, }; diff --git a/emummc/source/FS/offsets/2250.h b/emummc/source/FS/offsets/2250.h new file mode 100644 index 000000000..a613c0a97 --- /dev/null +++ b/emummc/source/FS/offsets/2250.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_2250_H__ +#define __FS_2250_H__ + +// Accessor vtable getters +#define FS_OFFSET_2250_SDMMC_ACCESSOR_GC 0x1B01C0 +#define FS_OFFSET_2250_SDMMC_ACCESSOR_SD 0x1B21C0 +#define FS_OFFSET_2250_SDMMC_ACCESSOR_NAND 0x1B07F0 + +// Hooks +#define FS_OFFSET_2250_SDMMC_WRAPPER_READ 0x1AC0F0 +#define FS_OFFSET_2250_SDMMC_WRAPPER_WRITE 0x1AC150 +#define FS_OFFSET_2250_RTLD 0x2DED0 +#define FS_OFFSET_2250_RTLD_DESTINATION ((uintptr_t)(INT64_C(-0x4C))) + +#define FS_OFFSET_2250_CLKRST_SET_MIN_V_CLK_RATE 0x1CF260 + +// Misc funcs +#define FS_OFFSET_2250_LOCK_MUTEX 0x1A4EF0 +#define FS_OFFSET_2250_UNLOCK_MUTEX 0x1A4F40 + +#define FS_OFFSET_2250_SDMMC_WRAPPER_CONTROLLER_OPEN 0x1AC0B0 +#define FS_OFFSET_2250_SDMMC_WRAPPER_CONTROLLER_CLOSE 0x1AC0D0 + +// Misc Data +#define FS_OFFSET_2250_SD_MUTEX 0xFF1408 +#define FS_OFFSET_2250_NAND_MUTEX 0xFECD00 +#define FS_OFFSET_2250_ACTIVE_PARTITION 0xFECD40 +#define FS_OFFSET_2250_SDMMC_DAS_HANDLE 0xFCEB98 + +// NOPs +#define FS_OFFSET_2250_SD_DAS_INIT 0x2B438 + +// Nintendo Paths +#define FS_OFFSET_2250_NINTENDO_PATHS \ +{ \ + {.opcode_reg = 3, .adrp_offset = 0x000715EC, .add_rel_offset = 0x00000004}, \ + {.opcode_reg = 3, .adrp_offset = 0x00082E64, .add_rel_offset = 0x00000004}, \ + {.opcode_reg = 4, .adrp_offset = 0x0008B888, .add_rel_offset = 0x00000004}, \ + {.opcode_reg = 4, .adrp_offset = 0x000A1B1C, .add_rel_offset = 0x00000004}, \ + {.opcode_reg = 0, .adrp_offset = 0, .add_rel_offset = 0}, \ +} + +#endif // __FS_2250_H__ diff --git a/emummc/source/FS/offsets/2250_exfat.h b/emummc/source/FS/offsets/2250_exfat.h new file mode 100644 index 000000000..c8d428180 --- /dev/null +++ b/emummc/source/FS/offsets/2250_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_2250_EXFAT_H__ +#define __FS_2250_EXFAT_H__ + +// Accessor vtable getters +#define FS_OFFSET_2250_EXFAT_SDMMC_ACCESSOR_GC 0x1BB3B0 +#define FS_OFFSET_2250_EXFAT_SDMMC_ACCESSOR_SD 0x1BD3B0 +#define FS_OFFSET_2250_EXFAT_SDMMC_ACCESSOR_NAND 0x1BB9E0 + +// Hooks +#define FS_OFFSET_2250_EXFAT_SDMMC_WRAPPER_READ 0x1B72E0 +#define FS_OFFSET_2250_EXFAT_SDMMC_WRAPPER_WRITE 0x1B7340 +#define FS_OFFSET_2250_EXFAT_RTLD 0x2DED0 +#define FS_OFFSET_2250_EXFAT_RTLD_DESTINATION ((uintptr_t)(INT64_C(-0x4C))) + +#define FS_OFFSET_2250_EXFAT_CLKRST_SET_MIN_V_CLK_RATE 0x1DA450 + +// Misc funcs +#define FS_OFFSET_2250_EXFAT_LOCK_MUTEX 0x1B00E0 +#define FS_OFFSET_2250_EXFAT_UNLOCK_MUTEX 0x1B0130 + +#define FS_OFFSET_2250_EXFAT_SDMMC_WRAPPER_CONTROLLER_OPEN 0x1B72A0 +#define FS_OFFSET_2250_EXFAT_SDMMC_WRAPPER_CONTROLLER_CLOSE 0x1B72C0 + +// Misc Data +#define FS_OFFSET_2250_EXFAT_SD_MUTEX 0x1002408 +#define FS_OFFSET_2250_EXFAT_NAND_MUTEX 0xFFDD00 +#define FS_OFFSET_2250_EXFAT_ACTIVE_PARTITION 0xFFDD40 +#define FS_OFFSET_2250_EXFAT_SDMMC_DAS_HANDLE 0xFDBB98 + +// NOPs +#define FS_OFFSET_2250_EXFAT_SD_DAS_INIT 0x2B438 + +// Nintendo Paths +#define FS_OFFSET_2250_EXFAT_NINTENDO_PATHS \ +{ \ + {.opcode_reg = 3, .adrp_offset = 0x000715EC, .add_rel_offset = 0x00000004}, \ + {.opcode_reg = 3, .adrp_offset = 0x00082E64, .add_rel_offset = 0x00000004}, \ + {.opcode_reg = 4, .adrp_offset = 0x0008B888, .add_rel_offset = 0x00000004}, \ + {.opcode_reg = 4, .adrp_offset = 0x000A1B1C, .add_rel_offset = 0x00000004}, \ + {.opcode_reg = 0, .adrp_offset = 0, .add_rel_offset = 0}, \ +} + +#endif // __FS_2250_EXFAT_H__ \ No newline at end of file diff --git a/fusee/program/source/fusee_stratosphere.cpp b/fusee/program/source/fusee_stratosphere.cpp index e784cb5e2..8f34237d6 100644 --- a/fusee/program/source/fusee_stratosphere.cpp +++ b/fusee/program/source/fusee_stratosphere.cpp @@ -194,6 +194,9 @@ namespace ams::nxboot { FsVersion_22_0_0, FsVersion_22_0_0_Exfat, + + FsVersion_22_5_0, + FsVersion_22_5_0_Exfat, FsVersion_Count, }; @@ -302,6 +305,9 @@ namespace ams::nxboot { { 0xB7, 0xA2, 0x97, 0x39, 0xB7, 0xED, 0xDE, 0xFC }, /* FsVersion_22_0_0 */ { 0xFB, 0x0B, 0x68, 0xDB, 0x24, 0x03, 0xD1, 0x19 }, /* FsVersion_22_0_0_Exfat */ + + { 0x53, 0x6D, 0x93, 0x84, 0x69, 0xFE, 0x73, 0xBE }, /* FsVersion_22_5_0 */ + { 0xD4, 0x45, 0x28, 0x29, 0x5B, 0x41, 0x92, 0xBA }, /* FsVersion_22_5_0_Exfat */ }; const InitialProcessBinaryHeader *FindInitialProcessBinary(const pkg2::Package2Header *header, const u8 *data, ams::TargetFirmware target_firmware) { @@ -716,11 +722,13 @@ namespace ams::nxboot { AddPatch(fs_meta, 0x18AD40, NogcPatch1, sizeof(NogcPatch1)); break; case FsVersion_22_0_0: + case FsVersion_22_5_0: AddPatch(fs_meta, 0x1B023D, NogcPatch0, sizeof(NogcPatch0)); AddPatch(fs_meta, 0x1B0255, NogcPatch0, sizeof(NogcPatch0)); AddPatch(fs_meta, 0x183060, NogcPatch1, sizeof(NogcPatch1)); break; case FsVersion_22_0_0_Exfat: + case FsVersion_22_5_0_Exfat: AddPatch(fs_meta, 0x1BB42D, NogcPatch0, sizeof(NogcPatch0)); AddPatch(fs_meta, 0x1BB445, NogcPatch0, sizeof(NogcPatch0)); AddPatch(fs_meta, 0x18E250, NogcPatch1, sizeof(NogcPatch1));