Fix bug in CwCheat icache invalidation. Fixes #7430

This commit is contained in:
Henrik Rydgard 2015-02-04 10:56:38 +01:00
parent fef70c528b
commit 2f6216d787
2 changed files with 8 additions and 4 deletions

View File

@ -392,11 +392,11 @@ void CWCheatEngine::Run() {
int data = code[0];
int dataAdd = code[1];
int maxAddr = (arg >> 16) & 0xFFFF;
int count = (arg >> 16) & 0xFFFF;
int stepAddr = (arg & 0xFFFF) * 4;
InvalidateICache(addr, maxAddr - addr);
for (int a = 0; a < maxAddr; a++) {
InvalidateICache(addr, count * stepAddr);
for (int a = 0; a < count; a++) {
if (Memory::IsValidAddress(addr)) {
Memory::Write_U32((u32) data, addr);
}
@ -471,7 +471,6 @@ void CWCheatEngine::Run() {
}
}
InvalidateICache((base + offset) & ~3, 4);
switch (type) {
case 0: // 8 bit write
Memory::Write_U8((u8) arg, base + offset);

View File

@ -593,6 +593,11 @@ void JitBlockCache::InvalidateICache(u32 address, const u32 length) {
const u32 pAddr = address & 0x1FFFFFFF;
const u32 pEnd = pAddr + length;
if (pEnd < pAddr) {
ERROR_LOG(JIT, "Bad InvalidateICache: %08x with len=%d", address, length);
return;
}
// Blocks may start and end in overlapping ways, and destroying one invalidates iterators.
// So after destroying one, we start over.
do {