diff options
| author | lizzie <lizzie@eden-emu.dev> | 2025-12-31 17:10:36 +0100 |
|---|---|---|
| committer | crueter <crueter@eden-emu.dev> | 2025-12-31 17:10:36 +0100 |
| commit | 742622a98df67d00c5d753bd4cd5aa6741dae577 (patch) | |
| tree | 8129d42d16c5e23836f28ae2150c886bad9ef82d /src | |
| parent | 011278b6a874696ee0b81f24ef83da200478cb7e (diff) | |
[file_sys, cheats] fix cheat_xxx.txt not being able to be disabled from Qt frontend (#3223)
fixes cheat_xxx.txt not appearing in Qt frontend - the cheat gets enabled but won't be able to be disabled from UI
Signed-off-by: lizzie lizzie@eden-emu.dev
Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/3223
Reviewed-by: DraVee <dravee@eden-emu.dev>
Reviewed-by: MaranBr <maranbr@eden-emu.dev>
Reviewed-by: Maufeat <sahyno1996@gmail.com>
Co-authored-by: lizzie <lizzie@eden-emu.dev>
Co-committed-by: lizzie <lizzie@eden-emu.dev>
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/file_sys/patch_manager.cpp | 19 | ||||
| -rw-r--r-- | src/core/memory/cheat_engine.cpp | 8 |
2 files changed, 20 insertions, 7 deletions
diff --git a/src/core/file_sys/patch_manager.cpp b/src/core/file_sys/patch_manager.cpp index a28fdf9056..657172fb4d 100644 --- a/src/core/file_sys/patch_manager.cpp +++ b/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_') // <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(); if (name.starts_with("cheat_") && std::find(disabled.cbegin(), disabled.cend(), name) == disabled.cend()) { std::vector<u8> data(f->GetSize()); @@ -525,6 +524,19 @@ std::vector<Patch> PatchManager::GetPatches(VirtualFile update_raw) const { // General Mods (LayeredFS and IPS) const auto mod_dir = fs_controller.GetModificationLoadRoot(title_id); 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()) { std::string types; @@ -561,8 +573,7 @@ std::vector<Patch> PatchManager::GetPatches(VirtualFile update_raw) const { if (types.empty()) 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, .name = mod->GetName(), .version = types, diff --git a/src/core/memory/cheat_engine.cpp b/src/core/memory/cheat_engine.cpp index 77cd587238..dcfd23644f 100644 --- a/src/core/memory/cheat_engine.cpp +++ b/src/core/memory/cheat_engine.cpp @@ -226,14 +226,16 @@ CheatEngine::CheatEngine(System& system_, std::vector<CheatEntry> cheats_, } CheatEngine::~CheatEngine() { - core_timing.UnscheduleEvent(event); + if (event) + core_timing.UnscheduleEvent(event); + else + LOG_ERROR(CheatEngine, "~CheatEngine before event was registered"); } void CheatEngine::Initialize() { event = Core::Timing::CreateEvent( "CheatEngine::FrameCallback::" + Common::HexToString(metadata.main_nso_build_id), - [this](s64 time, - std::chrono::nanoseconds ns_late) -> std::optional<std::chrono::nanoseconds> { + [this](s64 time, std::chrono::nanoseconds ns_late) -> std::optional<std::chrono::nanoseconds> { FrameCallback(ns_late); return std::nullopt; }); |
