From 9d57325a8b65cc574d3274272a2589822076cbd6 Mon Sep 17 00:00:00 2001 From: zhupengfei Date: Fri, 28 Feb 2020 23:36:17 +0800 Subject: [PATCH 1/2] core/file_sys: Add alternative override pathes for ExeFS files You can now directly place ExeFS overrides/patches inside the mod folder (instead of the exefs subfolder). This allows us to have drop-in compatibility with Luma3DS mods. --- src/core/file_sys/ncch_container.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/core/file_sys/ncch_container.cpp b/src/core/file_sys/ncch_container.cpp index 81525786f..177526aff 100644 --- a/src/core/file_sys/ncch_container.cpp +++ b/src/core/file_sys/ncch_container.cpp @@ -539,9 +539,11 @@ Loader::ResultStatus NCCHContainer::ApplyCodePatch(std::vector& code) const const auto mods_path = fmt::format("{}mods/{:016X}/", FileUtil::GetUserPath(FileUtil::UserPath::LoadDir), GetModId(ncch_header.program_id)); - const std::array patch_paths{{ + const std::array patch_paths{{ {mods_path + "exefs/code.ips", Patch::ApplyIpsPatch}, {mods_path + "exefs/code.bps", Patch::ApplyBpsPatch}, + {mods_path + "code.ips", Patch::ApplyIpsPatch}, + {mods_path + "code.bps", Patch::ApplyBpsPatch}, {filepath + ".exefsdir/code.ips", Patch::ApplyIpsPatch}, {filepath + ".exefsdir/code.bps", Patch::ApplyBpsPatch}, }}; @@ -583,8 +585,9 @@ Loader::ResultStatus NCCHContainer::LoadOverrideExeFSSection(const char* name, const auto mods_path = fmt::format("{}mods/{:016X}/", FileUtil::GetUserPath(FileUtil::UserPath::LoadDir), GetModId(ncch_header.program_id)); - std::array override_paths{{ + std::array override_paths{{ mods_path + "exefs/" + override_name, + mods_path + override_name, filepath + ".exefsdir/" + override_name, }}; From 0fe832bb49eaa4c0b82d52955ddc73fa6c7fd575 Mon Sep 17 00:00:00 2001 From: zhupengfei Date: Sat, 29 Feb 2020 09:11:34 +0800 Subject: [PATCH 2/2] Make the arrays const --- src/core/file_sys/ncch_container.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/file_sys/ncch_container.cpp b/src/core/file_sys/ncch_container.cpp index 177526aff..056f7a901 100644 --- a/src/core/file_sys/ncch_container.cpp +++ b/src/core/file_sys/ncch_container.cpp @@ -315,7 +315,7 @@ Loader::ResultStatus NCCHContainer::Load() { const auto mods_path = fmt::format("{}mods/{:016X}/", FileUtil::GetUserPath(FileUtil::UserPath::LoadDir), GetModId(ncch_header.program_id)); - std::array exheader_override_paths{{ + const std::array exheader_override_paths{{ mods_path + "exheader.bin", filepath + ".exheader", }}; @@ -585,7 +585,7 @@ Loader::ResultStatus NCCHContainer::LoadOverrideExeFSSection(const char* name, const auto mods_path = fmt::format("{}mods/{:016X}/", FileUtil::GetUserPath(FileUtil::UserPath::LoadDir), GetModId(ncch_header.program_id)); - std::array override_paths{{ + const std::array override_paths{{ mods_path + "exefs/" + override_name, mods_path + override_name, filepath + ".exefsdir/" + override_name,