mirror of
https://github.com/yuzu-emu/yuzu.git
synced 2024-11-23 16:15:50 +01:00
core: Simplify SDMC mod loading
If someone else wants to support other mod formats in the SDMC directory, that can be added later. For now, just allow RomFS modding here and force people to do other types of mods the old way. Addresses review comments. Co-authored-by: LC <mathew1800@gmail.com>
This commit is contained in:
parent
1664c74a6c
commit
844e0114b0
@ -529,26 +529,13 @@ PatchManager::PatchVersionNames PatchManager::GetPatchVersionNames(VirtualFile u
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// SDMC mod directory (LayeredFS)
|
// SDMC mod directory (RomFS LayeredFS)
|
||||||
const auto sdmc_mod_dir = fs_controller.GetSDMCModificationLoadRoot(title_id);
|
const auto sdmc_mod_dir = fs_controller.GetSDMCModificationLoadRoot(title_id);
|
||||||
if (sdmc_mod_dir != nullptr && sdmc_mod_dir->GetSize() > 0) {
|
if (sdmc_mod_dir != nullptr && sdmc_mod_dir->GetSize() > 0 &&
|
||||||
std::string types;
|
IsDirValidAndNonEmpty(FindSubdirectoryCaseless(sdmc_mod_dir, "romfs"))) {
|
||||||
|
const auto mod_disabled =
|
||||||
const auto exefs_dir = FindSubdirectoryCaseless(sdmc_mod_dir, "exefs");
|
std::find(disabled.begin(), disabled.end(), "SDMC") != disabled.end();
|
||||||
if (IsDirValidAndNonEmpty(exefs_dir)) {
|
out.insert_or_assign(mod_disabled ? "[D] SDMC" : "SDMC", "LayeredFS");
|
||||||
bool layeredfs = false;
|
|
||||||
|
|
||||||
if (layeredfs)
|
|
||||||
AppendCommaIfNotEmpty(types, "LayeredExeFS");
|
|
||||||
}
|
|
||||||
if (IsDirValidAndNonEmpty(FindSubdirectoryCaseless(sdmc_mod_dir, "romfs")))
|
|
||||||
AppendCommaIfNotEmpty(types, "LayeredFS");
|
|
||||||
|
|
||||||
if (!types.empty()) {
|
|
||||||
const auto mod_disabled =
|
|
||||||
std::find(disabled.begin(), disabled.end(), "SDMC") != disabled.end();
|
|
||||||
out.insert_or_assign(mod_disabled ? "[D] SDMC" : "SDMC", types);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// DLC
|
// DLC
|
||||||
|
@ -29,8 +29,9 @@ ResultVal<VirtualDir> SDMCFactory::Open() const {
|
|||||||
|
|
||||||
VirtualDir SDMCFactory::GetSDMCModificationLoadRoot(u64 title_id) const {
|
VirtualDir SDMCFactory::GetSDMCModificationLoadRoot(u64 title_id) const {
|
||||||
// LayeredFS doesn't work on updates and title id-less homebrew
|
// LayeredFS doesn't work on updates and title id-less homebrew
|
||||||
if (title_id == 0 || (title_id & 0xFFF) == 0x800)
|
if (title_id == 0 || (title_id & 0xFFF) == 0x800) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
}
|
||||||
return GetOrCreateDirectoryRelative(dir, fmt::format("/atmosphere/contents/{:016X}", title_id));
|
return GetOrCreateDirectoryRelative(dir, fmt::format("/atmosphere/contents/{:016X}", title_id));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -706,8 +706,9 @@ FileSys::VirtualDir FileSystemController::GetModificationLoadRoot(u64 title_id)
|
|||||||
FileSys::VirtualDir FileSystemController::GetSDMCModificationLoadRoot(u64 title_id) const {
|
FileSys::VirtualDir FileSystemController::GetSDMCModificationLoadRoot(u64 title_id) const {
|
||||||
LOG_TRACE(Service_FS, "Opening SDMC mod load root for tid={:016X}", title_id);
|
LOG_TRACE(Service_FS, "Opening SDMC mod load root for tid={:016X}", title_id);
|
||||||
|
|
||||||
if (sdmc_factory == nullptr)
|
if (sdmc_factory == nullptr) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
return sdmc_factory->GetSDMCModificationLoadRoot(title_id);
|
return sdmc_factory->GetSDMCModificationLoadRoot(title_id);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user