cheat mgr
This commit is contained in:
parent
a93d249ac1
commit
68b4f65390
@ -511,6 +511,7 @@ std::vector<Patch> PatchManager::GetPatches(VirtualFile update_raw) const {
|
||||
const auto mod_dir = fs_controller.GetModificationLoadRoot(title_id);
|
||||
if (mod_dir != nullptr) {
|
||||
for (const auto& mod : mod_dir->GetSubdirectories()) {
|
||||
std::vector<CheatPatch> cheats;
|
||||
std::string types;
|
||||
|
||||
const auto exefs_dir = FindSubdirectoryCaseless(mod, "exefs");
|
||||
@ -539,20 +540,32 @@ std::vector<Patch> PatchManager::GetPatches(VirtualFile update_raw) const {
|
||||
}
|
||||
if (IsDirValidAndNonEmpty(FindSubdirectoryCaseless(mod, "romfs")))
|
||||
AppendCommaIfNotEmpty(types, "LayeredFS");
|
||||
if (IsDirValidAndNonEmpty(FindSubdirectoryCaseless(mod, "cheats")))
|
||||
if (IsDirValidAndNonEmpty(FindSubdirectoryCaseless(mod, "cheats"))) {
|
||||
AppendCommaIfNotEmpty(types, "Cheats");
|
||||
cheats.push_back({
|
||||
.enabled = true,
|
||||
.name = "1. Pointed Unit Refill HP/Gas/Ammo (ZL+B)",
|
||||
});
|
||||
cheats.push_back({
|
||||
.enabled = true,
|
||||
.name = "2. Pointed Unit Can Move Again (ZL+B)",
|
||||
});
|
||||
}
|
||||
|
||||
if (types.empty())
|
||||
continue;
|
||||
|
||||
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,
|
||||
.type = PatchType::Mod,
|
||||
.program_id = title_id,
|
||||
.title_id = title_id});
|
||||
out.push_back({
|
||||
.enabled = !mod_disabled,
|
||||
.name = mod->GetName(),
|
||||
.version = types,
|
||||
.type = PatchType::Mod,
|
||||
.program_id = title_id,
|
||||
.title_id = title_id,
|
||||
.cheats = cheats,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -28,6 +28,11 @@ class NACP;
|
||||
|
||||
enum class PatchType { Update, DLC, Mod };
|
||||
|
||||
struct CheatPatch {
|
||||
bool enabled;
|
||||
std::string name;
|
||||
};
|
||||
|
||||
struct Patch {
|
||||
bool enabled;
|
||||
std::string name;
|
||||
@ -35,6 +40,7 @@ struct Patch {
|
||||
PatchType type;
|
||||
u64 program_id;
|
||||
u64 title_id;
|
||||
std::vector<CheatPatch> cheats;
|
||||
};
|
||||
|
||||
// A centralized class to manage patches to games.
|
||||
|
@ -18,7 +18,7 @@
|
||||
#include "core/memory/cheat_engine.h"
|
||||
#include "hid_core/resource_manager.h"
|
||||
#include "hid_core/resources/npad/npad.h"
|
||||
|
||||
#pragma optimize("", off)
|
||||
namespace Core::Memory {
|
||||
namespace {
|
||||
constexpr auto CHEAT_ENGINE_NS = std::chrono::nanoseconds{1000000000 / 12};
|
||||
@ -286,3 +286,4 @@ void CheatEngine::FrameCallback(std::chrono::nanoseconds ns_late) {
|
||||
}
|
||||
|
||||
} // namespace Core::Memory
|
||||
#pragma optimize("", on)
|
@ -134,6 +134,16 @@ void ConfigurePerGameAddons::LoadConfiguration() {
|
||||
|
||||
first_item->setCheckState(patch_disabled ? Qt::Unchecked : Qt::Checked);
|
||||
|
||||
for (const auto& cheat : patch.cheats) {
|
||||
auto* const sub_item = new QStandardItem;
|
||||
const auto cheat_name = QString::fromStdString(cheat.name);
|
||||
sub_item->setText(cheat_name);
|
||||
sub_item->setCheckable(true);
|
||||
sub_item->setCheckState(cheat.enabled ? Qt::Checked : Qt::Unchecked);
|
||||
|
||||
first_item->appendRow(sub_item);
|
||||
}
|
||||
|
||||
list_items.push_back(QList<QStandardItem*>{
|
||||
first_item, new QStandardItem{QString::fromStdString(patch.version)}});
|
||||
item_model->appendRow(list_items.back());
|
||||
|
Loading…
x
Reference in New Issue
Block a user