Merge pull request #5110 from zhaowenlan1779/game-modding-2

core/file_sys: Add alternative override pathes for ExeFS files
This commit is contained in:
Pengfei Zhu 2020-02-29 11:16:42 +08:00 committed by GitHub
commit cd46e62ad4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 3 deletions

View File

@ -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<std::string, 2> exheader_override_paths{{
const std::array<std::string, 2> exheader_override_paths{{
mods_path + "exheader.bin",
filepath + ".exheader",
}};
@ -539,9 +539,11 @@ Loader::ResultStatus NCCHContainer::ApplyCodePatch(std::vector<u8>& code) const
const auto mods_path =
fmt::format("{}mods/{:016X}/", FileUtil::GetUserPath(FileUtil::UserPath::LoadDir),
GetModId(ncch_header.program_id));
const std::array<PatchLocation, 4> patch_paths{{
const std::array<PatchLocation, 6> 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<std::string, 2> override_paths{{
const std::array<std::string, 3> override_paths{{
mods_path + "exefs/" + override_name,
mods_path + override_name,
filepath + ".exefsdir/" + override_name,
}};