mirror of
https://github.com/libretro/ppsspp.git
synced 2024-11-27 18:30:56 +00:00
Cheats: Split parsing and execution.
This makes the code easier to read, and makes it easier to add other types later on. Also, the parser can now handle a file with multiple game ids.
This commit is contained in:
parent
70c70b1e76
commit
c62a53c223
1362
Core/CwCheat.cpp
1362
Core/CwCheat.cpp
File diff suppressed because it is too large
Load Diff
@ -18,25 +18,45 @@ void __CheatDoState(PointerWrap &p);
|
||||
// Return whether cheats are enabled and in effect.
|
||||
bool CheatsInEffect();
|
||||
|
||||
struct CheatLine {
|
||||
uint32_t part1;
|
||||
uint32_t part2;
|
||||
};
|
||||
|
||||
enum class CheatCodeFormat {
|
||||
UNDEFINED,
|
||||
CWCHEAT,
|
||||
TEMPAR,
|
||||
};
|
||||
|
||||
struct CheatCode {
|
||||
CheatCodeFormat fmt;
|
||||
std::vector<CheatLine> lines;
|
||||
};
|
||||
|
||||
struct CheatOperation;
|
||||
|
||||
class CWCheatEngine {
|
||||
public:
|
||||
CWCheatEngine();
|
||||
std::vector<std::string> GetCodesList();
|
||||
void CreateCodeList();
|
||||
void ParseCheats();
|
||||
void CreateCheatFile();
|
||||
void Exit();
|
||||
void Run();
|
||||
std::vector<int> GetNextCode();
|
||||
bool HasCheats();
|
||||
|
||||
private:
|
||||
void InvalidateICache(u32 addr, int size);
|
||||
void SkipCodes(int count);
|
||||
void SkipAllCodes();
|
||||
bool exit2, cheatEnabled;
|
||||
int GetAddress(int value);
|
||||
std::vector<std::string> codeNameList;
|
||||
u32 GetAddress(u32 value);
|
||||
|
||||
std::vector<std::string> codes, initialCodesList, parts;
|
||||
size_t currentCode;
|
||||
CheatOperation InterpretNextOp(const CheatCode &cheat, size_t &i);
|
||||
CheatOperation InterpretNextCwCheat(const CheatCode &cheat, size_t &i);
|
||||
CheatOperation InterpretNextTempAR(const CheatCode &cheat, size_t &i);
|
||||
|
||||
void ExecuteOp(const CheatOperation &op, const CheatCode &cheat, size_t &i);
|
||||
void ApplyMemoryOperator(const CheatOperation &op, uint32_t(*oper)(uint32_t, uint32_t));
|
||||
bool TestIf(const CheatOperation &op, bool(*oper)(int a, int b));
|
||||
bool TestIfAddr(const CheatOperation &op, bool(*oper)(int a, int b));
|
||||
|
||||
std::vector<CheatCode> cheats_;
|
||||
};
|
||||
|
@ -155,6 +155,7 @@ UI::EventReturn CwCheatScreen::OnEnableAll(UI::EventParams ¶ms) {
|
||||
}
|
||||
fs.close();
|
||||
|
||||
g_Config.bReloadCheats = true;
|
||||
return UI::EVENT_DONE;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user