Browse Source

[file_sys, cheats] fix cheat_xxx.txt not being able to be disabled from Qt frontend

pull/3223/head
lizzie 1 month ago
parent
commit
79634f56b7
  1. 19
      src/core/file_sys/patch_manager.cpp

19
src/core/file_sys/patch_manager.cpp

@ -341,8 +341,7 @@ std::vector<Core::Memory::CheatEntry> PatchManager::CreateCheatList(const BuildI
} }
// Uncareless user-friendly loading of patches (must start with 'cheat_') // Uncareless user-friendly loading of patches (must start with 'cheat_')
// <mod dir> / <cheat file>.txt // <mod dir> / <cheat file>.txt
auto const patch_files = load_dir->GetFiles();
for (auto const& f : patch_files) {
for (auto const& f : load_dir->GetFiles()) {
auto const name = f->GetName(); auto const name = f->GetName();
if (name.starts_with("cheat_") && std::find(disabled.cbegin(), disabled.cend(), name) == disabled.cend()) { if (name.starts_with("cheat_") && std::find(disabled.cbegin(), disabled.cend(), name) == disabled.cend()) {
std::vector<u8> data(f->GetSize()); std::vector<u8> data(f->GetSize());
@ -525,6 +524,19 @@ std::vector<Patch> PatchManager::GetPatches(VirtualFile update_raw) const {
// General Mods (LayeredFS and IPS) // General Mods (LayeredFS and IPS)
const auto mod_dir = fs_controller.GetModificationLoadRoot(title_id); const auto mod_dir = fs_controller.GetModificationLoadRoot(title_id);
if (mod_dir != nullptr) { if (mod_dir != nullptr) {
for (auto const& f : mod_dir->GetFiles())
if (auto const name = f->GetName(); name.starts_with("cheat_")) {
auto const mod_disabled = std::find(disabled.begin(), disabled.end(), name) != disabled.end();
out.push_back({
.enabled = !mod_disabled,
.name = name,
.version = "Cheats",
.type = PatchType::Mod,
.program_id = title_id,
.title_id = title_id
});
}
for (const auto& mod : mod_dir->GetSubdirectories()) { for (const auto& mod : mod_dir->GetSubdirectories()) {
std::string types; std::string types;
@ -561,8 +573,7 @@ std::vector<Patch> PatchManager::GetPatches(VirtualFile update_raw) const {
if (types.empty()) if (types.empty())
continue; continue;
const auto mod_disabled =
std::find(disabled.begin(), disabled.end(), mod->GetName()) != disabled.end();
const auto mod_disabled = std::find(disabled.begin(), disabled.end(), mod->GetName()) != disabled.end();
out.push_back({.enabled = !mod_disabled, out.push_back({.enabled = !mod_disabled,
.name = mod->GetName(), .name = mod->GetName(),
.version = types, .version = types,

Loading…
Cancel
Save