mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
CwCheats: Avoid logspam with some bad cheats. Tag cheat structs with names (sometimes useful for debugging).
This commit is contained in:
parent
1481dee980
commit
01acd59357
2 changed files with 27 additions and 14 deletions
|
@ -126,8 +126,8 @@ bool CheatFileParser::Parse() {
|
|||
|
||||
void CheatFileParser::Flush() {
|
||||
if (!pendingLines_.empty()) {
|
||||
cheats_.push_back({ codeFormat_, lastCheatInfo_.name, pendingLines_ });
|
||||
FlushCheatInfo();
|
||||
cheats_.push_back({ codeFormat_, pendingLines_ });
|
||||
pendingLines_.clear();
|
||||
}
|
||||
codeFormat_ = CheatCodeFormat::UNDEFINED;
|
||||
|
@ -1161,28 +1161,40 @@ void CWCheatEngine::ExecuteOp(const CheatOperation &op, const CheatCode &cheat,
|
|||
|
||||
switch (type) {
|
||||
case 0: // 8 bit write
|
||||
InvalidateICache(base + op.pointerCommands.offset, 1);
|
||||
Memory::Write_U8((u8)val, base + op.pointerCommands.offset);
|
||||
if (Memory::IsValidAddress(base + op.pointerCommands.offset)) {
|
||||
InvalidateICache(base + op.pointerCommands.offset, 1);
|
||||
Memory::WriteUnchecked_U8((u8)val, base + op.pointerCommands.offset);
|
||||
}
|
||||
break;
|
||||
case 1: // 16-bit write
|
||||
InvalidateICache(base + op.pointerCommands.offset, 2);
|
||||
Memory::Write_U16((u16)val, base + op.pointerCommands.offset);
|
||||
if (Memory::IsValidAddress(base + op.pointerCommands.offset)) {
|
||||
InvalidateICache(base + op.pointerCommands.offset, 2);
|
||||
Memory::WriteUnchecked_U16((u16)val, base + op.pointerCommands.offset);
|
||||
}
|
||||
break;
|
||||
case 2: // 32-bit write
|
||||
InvalidateICache(base + op.pointerCommands.offset, 4);
|
||||
Memory::Write_U32((u32)val, base + op.pointerCommands.offset);
|
||||
if (Memory::IsValidAddress(base + op.pointerCommands.offset)) {
|
||||
InvalidateICache(base + op.pointerCommands.offset, 4);
|
||||
Memory::WriteUnchecked_U32((u32)val, base + op.pointerCommands.offset);
|
||||
}
|
||||
break;
|
||||
case 3: // 8 bit inverse write
|
||||
InvalidateICache(base - op.pointerCommands.offset, 1);
|
||||
Memory::Write_U8((u8)val, base - op.pointerCommands.offset);
|
||||
if (Memory::IsValidAddress(base - op.pointerCommands.offset)) {
|
||||
InvalidateICache(base - op.pointerCommands.offset, 1);
|
||||
Memory::WriteUnchecked_U8((u8)val, base - op.pointerCommands.offset);
|
||||
}
|
||||
break;
|
||||
case 4: // 16-bit inverse write
|
||||
InvalidateICache(base - op.pointerCommands.offset, 2);
|
||||
Memory::Write_U16((u16)val, base - op.pointerCommands.offset);
|
||||
if (Memory::IsValidAddress(base - op.pointerCommands.offset)) {
|
||||
InvalidateICache(base - op.pointerCommands.offset, 2);
|
||||
Memory::WriteUnchecked_U16((u16)val, base - op.pointerCommands.offset);
|
||||
}
|
||||
break;
|
||||
case 5: // 32-bit inverse write
|
||||
InvalidateICache(base - op.pointerCommands.offset, 4);
|
||||
Memory::Write_U32((u32)val, base - op.pointerCommands.offset);
|
||||
if (Memory::IsValidAddress(base - op.pointerCommands.offset)) {
|
||||
InvalidateICache(base - op.pointerCommands.offset, 4);
|
||||
Memory::WriteUnchecked_U32((u32)val, base - op.pointerCommands.offset);
|
||||
}
|
||||
break;
|
||||
case -1: // Operation already performed, nothing to do
|
||||
break;
|
||||
|
@ -1200,7 +1212,7 @@ void CWCheatEngine::Run() {
|
|||
return;
|
||||
}
|
||||
|
||||
for (CheatCode cheat : cheats_) {
|
||||
for (const CheatCode &cheat : cheats_) {
|
||||
// InterpretNextOp and ExecuteOp move i.
|
||||
for (size_t i = 0; i < cheat.lines.size(); ) {
|
||||
CheatOperation op = InterpretNextOp(cheat, i);
|
||||
|
|
|
@ -32,6 +32,7 @@ enum class CheatCodeFormat {
|
|||
|
||||
struct CheatCode {
|
||||
CheatCodeFormat fmt;
|
||||
std::string name;
|
||||
std::vector<CheatLine> lines;
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue