[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>
This commit is contained in:
parent
011278b6a8
commit
742622a98d
|
|
@ -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 : load_dir->GetFiles()) {
|
||||||
for (auto const& f : patch_files) {
|
|
||||||
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 =
|
const auto mod_disabled = std::find(disabled.begin(), disabled.end(), mod->GetName()) != disabled.end();
|
||||||
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,
|
||||||
|
|
|
||||||
|
|
@ -226,14 +226,16 @@ CheatEngine::CheatEngine(System& system_, std::vector<CheatEntry> cheats_,
|
||||||
}
|
}
|
||||||
|
|
||||||
CheatEngine::~CheatEngine() {
|
CheatEngine::~CheatEngine() {
|
||||||
core_timing.UnscheduleEvent(event);
|
if (event)
|
||||||
|
core_timing.UnscheduleEvent(event);
|
||||||
|
else
|
||||||
|
LOG_ERROR(CheatEngine, "~CheatEngine before event was registered");
|
||||||
}
|
}
|
||||||
|
|
||||||
void CheatEngine::Initialize() {
|
void CheatEngine::Initialize() {
|
||||||
event = Core::Timing::CreateEvent(
|
event = Core::Timing::CreateEvent(
|
||||||
"CheatEngine::FrameCallback::" + Common::HexToString(metadata.main_nso_build_id),
|
"CheatEngine::FrameCallback::" + Common::HexToString(metadata.main_nso_build_id),
|
||||||
[this](s64 time,
|
[this](s64 time, std::chrono::nanoseconds ns_late) -> std::optional<std::chrono::nanoseconds> {
|
||||||
std::chrono::nanoseconds ns_late) -> std::optional<std::chrono::nanoseconds> {
|
|
||||||
FrameCallback(ns_late);
|
FrameCallback(ns_late);
|
||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue