Pontifice from our forums fixed some cheating related code he wrote for pcsx2 earlier.

This supposedly makes using codebreaker / ar max cheats more reliable :p

Thanks for that, Pontifice ;)

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@669 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
ramapcsx2 2009-03-03 15:34:51 +00:00
parent c4aec82c00
commit 57abad9d44
1 changed files with 81 additions and 35 deletions

View File

@ -164,49 +164,95 @@ void handle_extended_t( IniPatch *p)
break; break;
case 0x6000: // 000Xnnnn iiiiiiii case 0x6000: // 000Xnnnn iiiiiiii
if (IterationIncrement == 0x0)
{
LastType = ((u32)p->addr&0x000F0000)/0x10000;
u32Val = memRead32(PrevCheataddr);
if ((u32)p->addr < 0x100)
{
LastType = 0x0;
PrevCheataddr =u32Val+((u32)p->addr);
}
else if ((u32)p->addr < 0x1000)
{
LastType = 0x1;
PrevCheataddr =u32Val+((u32)p->addr*2);
}
else
{
LastType = 0x2;
PrevCheataddr =u32Val+((u32)p->addr*4);
}
// Check if needed to read another pointer
PrevCheatType = 0;
if (((u32Val&0x0FFFFFFF) & 0x3FFFFFFC) != 0)
{
if (LastType=0x0)
memWrite8(PrevCheataddr,(u8)p->data&0xFF);
else if (LastType=0x1)
memWrite16(PrevCheataddr,(u16)p->data&0x0FFFF);
else if (LastType=0x2)
memWrite32(PrevCheataddr,(u32)p->data);
}
}
else
{
// Get Number of pointers // Get Number of pointers
if (IterationCount == 0) IterationCount = (u32)p->addr&0x0000FFFF; if (((u32)p->addr&0x0000FFFF) == 0)
IterationCount = 1;
else
IterationCount = (u32)p->addr&0x0000FFFF;
// Read first pointer // Read first pointer
LastType = ((u32)p->addr&0x000F0000)/0x10000; LastType = ((u32)p->addr&0x000F0000)/0x10000;
u32Val = memRead32(PrevCheataddr); u32Val = memRead32(PrevCheataddr);
PrevCheataddr = u32Val+(u32)p->data;
IterationCount--;
PrevCheataddr =u32Val+(u32)p->data;
IterationCount--;
// Check if needed to read another pointer // Check if needed to read another pointer
if (IterationCount == 0) if (IterationCount == 0){
{ PrevCheatType = 0;
if (((u32Val&0x0FFFFFFF) & 0x3FFFFFFC) != 0) writeCheat();
}else{
if (((u32Val&0x0FFFFFFF) & 0x3FFFFFFC) != 0)
PrevCheatType = 0; PrevCheatType = 0;
writeCheat();
}
else else
PrevCheatType = 0x6001; PrevCheatType = 0x6001;
}
}
break;
case 0x6001: // 000Xnnnn iiiiiiii case 0x6001: // 000Xnnnn iiiiiiii
// Read first pointer // Read first pointer
u32Val = memRead32(PrevCheataddr); u32Val = memRead32(PrevCheataddr&0x0FFFFFFF);
PrevCheataddr =u32Val+(u32)p->addr; PrevCheataddr =u32Val+(u32)p->addr;
IterationCount--; IterationCount--;
// Check if needed to read another pointer // Check if needed to read another pointer
if (IterationCount == 0) if (IterationCount == 0){
{
PrevCheatType = 0; PrevCheatType = 0;
writeCheat(); if (((u32Val&0x0FFFFFFF) & 0x3FFFFFFC) != 0) writeCheat();
} }else{
else
{
u32Val = memRead32(PrevCheataddr); u32Val = memRead32(PrevCheataddr);
PrevCheataddr =u32Val+(u32)p->data; PrevCheataddr =u32Val+(u32)p->data;
IterationCount--; IterationCount--;
if (IterationCount == 0){
if (IterationCount == 0)
{
PrevCheatType = 0; PrevCheatType = 0;
writeCheat(); if (((u32Val&0x0FFFFFFF) & 0x3FFFFFFC) != 0) writeCheat();
} }
} }
break;
default: default:
if ((p->addr&0xF0000000) == 0x00000000) // 0aaaaaaa 0000000vv if ((p->addr&0xF0000000) == 0x00000000) // 0aaaaaaa 0000000vv
{ {