mirror of
https://github.com/aydencharles/onionHEN.git
synced 2026-10-22 20:02:59 -05:00
Move util cheats orchestration to C++ (CheatService, Repository, Applier, IMemoryBackend, ICheatParser factory for json/shn/mc4 with ShnExt C adapter). Drop the obsolete RELOAD_CHEATS UI/IPC path; reloads use file-signature hot reload only. Document util cheats architecture under docs/util_arch.
46 lines
1.2 KiB
C++
46 lines
1.2 KiB
C++
#pragma once
|
|
|
|
#include <cstdint>
|
|
#include <string>
|
|
|
|
#include "cheats/cheat_engine.h"
|
|
#include "util_platform.h"
|
|
|
|
namespace orion::cheats {
|
|
|
|
struct FileSignature {
|
|
std::string path;
|
|
uint64_t size = 0;
|
|
uint64_t inode = 0;
|
|
int64_t mtime = 0;
|
|
int64_t ctime = 0;
|
|
|
|
bool operator==(const FileSignature &o) const {
|
|
return path == o.path && size == o.size && inode == o.inode &&
|
|
mtime == o.mtime && ctime == o.ctime;
|
|
}
|
|
bool operator!=(const FileSignature &o) const { return !(*this == o); }
|
|
};
|
|
|
|
/**
|
|
* Resolves flat cheat paths and loads format-specific files
|
|
* via CheatParserFactory (Strategy: json / shn / mc4 / ShnExt).
|
|
*/
|
|
class CheatRepository {
|
|
public:
|
|
/** Resolve existing cheat file for title+version; empty if none. */
|
|
static std::string resolvePath(const game_context_t &game);
|
|
|
|
static bool fileExists(const std::string &path);
|
|
static bool statSignature(const std::string &path, FileSignature &out);
|
|
|
|
/** Load path into out (clears out first). 0 = ok. */
|
|
static int loadFile(const std::string &path, orion_cheat_file_t &out);
|
|
|
|
static void ensureCheatsDir();
|
|
/** Flatten nested repo tree into ORION_CHEATS_DIR. */
|
|
static int flattenInstallTree(const std::string &root);
|
|
};
|
|
|
|
} // namespace orion::cheats
|