Skip to content
Permalink
Browse files

pcsx2: Remove special case from pointer patch command parsing (#3135)

Removes the special case in type 6 (pointer) code parsing when the data value
is 0. This matches Codebreaker behaviour.
  • Loading branch information...
Some1fromthedark authored and turtleli committed Oct 23, 2019
1 parent b34338a commit e7d1a58a5a5f6049869354e2df98ba44798db2fe
Showing with 20 additions and 61 deletions.
  1. +20 −61 pcsx2/Patch_Memory.cpp
@@ -84,75 +84,34 @@ void handle_extended_t(IniPatch *p)
break;

case 0x6000: // 000Xnnnn iiiiiiii
if (IterationIncrement == 0x0)
{
//LastType = ((u32)p->addr & 0x000F0000) >> 16;
u32 mem = memRead32(PrevCheatAddr);
if ((u32)p->addr < 0x100)
{
LastType = 0x0;
PrevCheatAddr = mem + ((u32)p->addr);
}
else if ((u32)p->addr < 0x1000)
{
LastType = 0x1;
PrevCheatAddr = mem + ((u32)p->addr * 2);
}
else
{
LastType = 0x2;
PrevCheatAddr = mem + ((u32)p->addr * 4);
}
{
// Get Number of pointers
if (((u32)p->addr & 0x0000FFFF) == 0)
IterationCount = 1;
else
IterationCount = (u32)p->addr & 0x0000FFFF;

// Check if needed to read another pointer
// Read first pointer
LastType = ((u32)p->addr & 0x000F0000) >> 16;
u32 mem = memRead32(PrevCheatAddr);

PrevCheatAddr = mem + (u32)p->data;
IterationCount--;

// Check if needed to read another pointer
if (IterationCount == 0)
{
PrevCheatType = 0;
if (((mem & 0x0FFFFFFF) & 0x3FFFFFFC) != 0)
{
switch (LastType)
{
case 0x0:
memWrite8(PrevCheatAddr, (u8)p->data & 0xFF);
break;
case 0x1:
memWrite16(PrevCheatAddr, (u16)p->data & 0x0FFFF);
break;
case 0x2:
memWrite32(PrevCheatAddr, (u32)p->data);
break;
default:
break;
}
}
if (((mem & 0x0FFFFFFF) & 0x3FFFFFFC) != 0) writeCheat();
}
else
{
// Get Number of pointers
if (((u32)p->addr & 0x0000FFFF) == 0)
IterationCount = 1;
else
IterationCount = (u32)p->addr & 0x0000FFFF;

// Read first pointer
LastType = ((u32)p->addr & 0x000F0000) >> 16;
u32 mem = memRead32(PrevCheatAddr);

PrevCheatAddr = mem + (u32)p->data;
IterationCount--;

// Check if needed to read another pointer
if (IterationCount == 0)
{
if (((mem & 0x0FFFFFFF) & 0x3FFFFFFC) == 0)
PrevCheatType = 0;
if (((mem & 0x0FFFFFFF) & 0x3FFFFFFC) != 0) writeCheat();
}
else
{
if (((mem & 0x0FFFFFFF) & 0x3FFFFFFC) == 0)
PrevCheatType = 0;
else
PrevCheatType = 0x6001;
}
PrevCheatType = 0x6001;
}
}
break;

case 0x6001: // 000Xnnnn iiiiiiii

0 comments on commit e7d1a58

Please sign in to comment.
You can’t perform that action at this time.