Files
onionHEN/source/util/include/cheats/CheatRepository.hpp
T
Hexwell 793719abf4 refactor(cheats): C++ service/parsers and remove RELOAD index cache
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.
2026-07-10 14:06:42 +08:00

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