mirror of https://github.com/PCSX2/pcsx2.git
Clean up Patch.c a bit, and add a few fixmes to the code.
git-svn-id: http://pcsx2-playground.googlecode.com/svn/trunk@253 a6443dda-0b58-4228-96e9-037be469359c
This commit is contained in:
parent
bce2cfe5f1
commit
76f08e165e
|
@ -446,22 +446,6 @@ BOOL loadSectionHeaders( char * Exepath )
|
||||||
if ( elfSectH[i].sh_flags & 0x2 ) {
|
if ( elfSectH[i].sh_flags & 0x2 ) {
|
||||||
//2002-09-19 (Florin)
|
//2002-09-19 (Florin)
|
||||||
args_ptr = min( args_ptr, elfSectH[ i ].sh_addr & 0x1ffffff );
|
args_ptr = min( args_ptr, elfSectH[ i ].sh_addr & 0x1ffffff );
|
||||||
//---------------
|
|
||||||
/* if (elfSectH[i].sh_offset < elfsize) {
|
|
||||||
int size;
|
|
||||||
|
|
||||||
if ((elfSectH[i].sh_size + elfSectH[i].sh_offset) > elfsize) {
|
|
||||||
size = elfsize - elfSectH[i].sh_offset;
|
|
||||||
} else {
|
|
||||||
size = elfSectH[i].sh_size;
|
|
||||||
}
|
|
||||||
memcpy(&PS2MEM_BASE[ elfSectH[ i ].sh_addr &0x1ffffff ],
|
|
||||||
&elfdata[elfSectH[i].sh_offset],
|
|
||||||
size);
|
|
||||||
}
|
|
||||||
#ifdef ELF_LOG
|
|
||||||
ELF_LOG( "\t*LOADED*" );
|
|
||||||
#endif*/
|
|
||||||
}
|
}
|
||||||
#ifdef ELF_LOG
|
#ifdef ELF_LOG
|
||||||
ELF_LOG("\n");
|
ELF_LOG("\n");
|
||||||
|
@ -548,12 +532,7 @@ BOOL loadSectionHeaders( char * Exepath )
|
||||||
|
|
||||||
for ( i = 1; i < (int)( elfSectH[ i_st ].sh_size / sizeof( Elf32_Sym ) ); i++ ) {
|
for ( i = 1; i < (int)( elfSectH[ i_st ].sh_size / sizeof( Elf32_Sym ) ); i++ ) {
|
||||||
if ( ( eS[ i ].st_value != 0 ) && ( ELF32_ST_TYPE( eS[ i ].st_info ) == 2 ) ) {
|
if ( ( eS[ i ].st_value != 0 ) && ( ELF32_ST_TYPE( eS[ i ].st_info ) == 2 ) ) {
|
||||||
// SysPrintf("%x:%s\n", eS[i].st_value, &SymNames[eS[i].st_name]);
|
|
||||||
disR5900AddSym( eS[i].st_value, &SymNames[ eS[ i ].st_name ] );
|
disR5900AddSym( eS[i].st_value, &SymNames[ eS[ i ].st_name ] );
|
||||||
/* if (!strcmp(&SymNames[eS[i].st_name], "sceSifCheckStatRpc")) {
|
|
||||||
psMu32(eS[i].st_value & 0x1ffffff) = (0x3b << 26) | 1;
|
|
||||||
SysPrintf("found sceSifCheckStatRpc!!\n");
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -587,15 +566,9 @@ int loadElfFile(char *filename) {
|
||||||
if (elfdata == NULL) return -1;
|
if (elfdata == NULL) return -1;
|
||||||
readFile(filename, (char*)elfdata, 0, elfsize);
|
readFile(filename, (char*)elfdata, 0, elfsize);
|
||||||
|
|
||||||
/* {
|
|
||||||
FILE *f = fopen("game.elf", "wb");
|
|
||||||
fwrite(elfdata, 1, elfsize, f);
|
|
||||||
fclose(f);
|
|
||||||
}*/
|
|
||||||
|
|
||||||
//2002-09-19 (Florin)
|
//2002-09-19 (Florin)
|
||||||
args_ptr = 0xFFFFFFFF; //big value, searching for minimum
|
args_ptr = 0xFFFFFFFF; //big value, searching for minimum
|
||||||
//-------------------
|
|
||||||
loadHeaders( filename );
|
loadHeaders( filename );
|
||||||
cpuRegs.pc = elfHeader->e_entry; //set pc to proper place
|
cpuRegs.pc = elfHeader->e_entry; //set pc to proper place
|
||||||
loadProgramHeaders( filename );
|
loadProgramHeaders( filename );
|
||||||
|
@ -609,7 +582,6 @@ int loadElfFile(char *filename) {
|
||||||
|
|
||||||
//2002-09-19 (Florin)
|
//2002-09-19 (Florin)
|
||||||
cpuRegs.GPR.n.a0.UL[0] = parseCommandLine( filename );
|
cpuRegs.GPR.n.a0.UL[0] = parseCommandLine( filename );
|
||||||
//---------------
|
|
||||||
|
|
||||||
for ( i = 0; i < 0x100000; i++ ) {
|
for ( i = 0; i < 0x100000; i++ ) {
|
||||||
if ( strcmp( "rom0:OSDSYS", (char*)PSM( i ) ) == 0 ) {
|
if ( strcmp( "rom0:OSDSYS", (char*)PSM( i ) ) == 0 ) {
|
||||||
|
@ -652,6 +624,8 @@ int loadElfFile(char *filename) {
|
||||||
extern int g_FFXHack;
|
extern int g_FFXHack;
|
||||||
extern int path3hack;
|
extern int path3hack;
|
||||||
int g_VUGameFixes = 0;
|
int g_VUGameFixes = 0;
|
||||||
|
|
||||||
|
// fixme - this should be moved to patches or eliminated
|
||||||
void LoadGameSpecificSettings()
|
void LoadGameSpecificSettings()
|
||||||
{
|
{
|
||||||
// default
|
// default
|
||||||
|
@ -659,20 +633,23 @@ void LoadGameSpecificSettings()
|
||||||
g_FFXHack = 0;
|
g_FFXHack = 0;
|
||||||
|
|
||||||
switch(ElfCRC) {
|
switch(ElfCRC) {
|
||||||
case 0x0c414549: // spacefisherman, missing gfx
|
// The code involving VUFIX_SIGNEDZERO & VUFIX_EXTRAFLAGS
|
||||||
g_VUGameFixes |= VUFIX_SIGNEDZERO;
|
// is no longer in pcsx2.
|
||||||
break;
|
|
||||||
case 0x4C9EE7DF: // crazy taxi (u)
|
//case 0x0c414549: // spacefisherman, missing gfx
|
||||||
case 0xC9C145BF: // crazy taxi, missing gfx
|
// g_VUGameFixes |= VUFIX_SIGNEDZERO;
|
||||||
g_VUGameFixes |= VUFIX_EXTRAFLAGS;
|
// break;
|
||||||
break;
|
//case 0x4C9EE7DF: // crazy taxi (u)
|
||||||
|
//case 0xC9C145BF: // crazy taxi, missing gfx
|
||||||
|
// g_VUGameFixes |= VUFIX_EXTRAFLAGS;
|
||||||
|
// break;
|
||||||
|
|
||||||
case 0xb99379b7: // erementar gerad (discolored chars)
|
case 0xb99379b7: // erementar gerad (discolored chars)
|
||||||
g_VUGameFixes |= VUFIX_XGKICKDELAY2;
|
g_VUGameFixes |= VUFIX_XGKICKDELAY2;
|
||||||
break;
|
break;
|
||||||
case 0xa08c4057: //Sprint Cars (SLUS)
|
case 0xa08c4057: //Sprint Cars (SLUS)
|
||||||
case 0x8b0725d5: //Flinstones Bedrock Racing (SLES)
|
case 0x8b0725d5: //Flinstones Bedrock Racing (SLES)
|
||||||
path3hack = 1;
|
path3hack = 1; // We can move this to patch files right now
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x6a4efe60: // ffx(j)
|
case 0x6a4efe60: // ffx(j)
|
||||||
|
|
|
@ -344,6 +344,7 @@ extern __forceinline long InterlockedExchange(long volatile* Target, long Value)
|
||||||
__asm__ __volatile__(".intel_syntax\n"
|
__asm__ __volatile__(".intel_syntax\n"
|
||||||
"lock xchg [%0], %%eax\n"
|
"lock xchg [%0], %%eax\n"
|
||||||
".att_syntax\n" : : "r"(Target), "a"(Value) : "memory" );
|
".att_syntax\n" : : "r"(Target), "a"(Value) : "memory" );
|
||||||
|
return 0; // The only function that even looks at this is a debugging function
|
||||||
}
|
}
|
||||||
|
|
||||||
extern __forceinline long InterlockedExchangeAdd(long volatile* Addend, long Value)
|
extern __forceinline long InterlockedExchangeAdd(long volatile* Addend, long Value)
|
||||||
|
@ -351,6 +352,7 @@ extern __forceinline long InterlockedExchangeAdd(long volatile* Addend, long Val
|
||||||
__asm__ __volatile__(".intel_syntax\n"
|
__asm__ __volatile__(".intel_syntax\n"
|
||||||
"lock xadd [%0], %%eax\n"
|
"lock xadd [%0], %%eax\n"
|
||||||
".att_syntax\n" : : "r"(Addend), "a"(Value) : "memory" );
|
".att_syntax\n" : : "r"(Addend), "a"(Value) : "memory" );
|
||||||
|
return 0; // The return value is never looked at.
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
247
pcsx2/Patch.c
247
pcsx2/Patch.c
|
@ -24,8 +24,9 @@
|
||||||
|
|
||||||
|
|
||||||
#include "PsxCommon.h"
|
#include "PsxCommon.h"
|
||||||
|
|
||||||
#include "Paths.h"
|
#include "Paths.h"
|
||||||
|
#include "Patch.h"
|
||||||
|
#include "VU.h"
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include "windows/cheats/cheats.h"
|
#include "windows/cheats/cheats.h"
|
||||||
|
@ -38,9 +39,21 @@
|
||||||
#pragma warning(disable:4996) //ignore the stricmp deprecated warning
|
#pragma warning(disable:4996) //ignore the stricmp deprecated warning
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "Patch.h"
|
IniPatch patch[ MAX_PATCH ];
|
||||||
|
|
||||||
|
u32 SkipCount=0;
|
||||||
|
u32 IterationCount=0;
|
||||||
|
u32 IterationIncrement=0;
|
||||||
|
u32 ValueIncrement=0;
|
||||||
|
u32 PrevCheatType=0;
|
||||||
|
u32 PrevCheataddr = 0;
|
||||||
|
u32 LastType = 0;
|
||||||
|
|
||||||
int g_ZeroGSOptions=0;
|
int g_ZeroGSOptions=0;
|
||||||
|
int patchnumber;
|
||||||
|
extern int RunExe;
|
||||||
|
|
||||||
|
char strgametitle[256]= {0};
|
||||||
|
|
||||||
//
|
//
|
||||||
// Variables
|
// Variables
|
||||||
|
@ -59,6 +72,8 @@ PatchTextTable commands[] =
|
||||||
{ "zerogs", 6, patchFunc_zerogs }, // zerogs=hex
|
{ "zerogs", 6, patchFunc_zerogs }, // zerogs=hex
|
||||||
{ "path3hack", 7, patchFunc_path3hack },
|
{ "path3hack", 7, patchFunc_path3hack },
|
||||||
{ "vunanmode",8, patchFunc_vunanmode },
|
{ "vunanmode",8, patchFunc_vunanmode },
|
||||||
|
{ "ffxhack",9, patchFunc_ffxhack},
|
||||||
|
{ "xkickdelay",10, patchFunc_xkickdelay},
|
||||||
{ "", 0, NULL }
|
{ "", 0, NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -79,10 +94,6 @@ PatchTextTable cpuCore[] =
|
||||||
{ "", 0, NULL }
|
{ "", 0, NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
IniPatch patch[ MAX_PATCH ];
|
|
||||||
int patchnumber;
|
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Function Implementations
|
// Function Implementations
|
||||||
//
|
//
|
||||||
|
@ -106,63 +117,59 @@ int PatchTableExecute( char * text1, char * text2, PatchTextTable * Table )
|
||||||
|
|
||||||
return Table[ i ].code;
|
return Table[ i ].code;
|
||||||
}
|
}
|
||||||
u32 SkipCount=0;
|
|
||||||
u32 IterationCount=0;
|
|
||||||
u32 IterationIncrement=0;
|
|
||||||
u32 ValueIncrement=0;
|
|
||||||
u32 PrevCheatType=0;
|
|
||||||
u32 PrevCheataddr = 0;
|
|
||||||
u32 LastType = 0;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void _applypatch(int place, IniPatch *p) {
|
void _applypatch(int place, IniPatch *p) {
|
||||||
u32 Cheataddr = 0;
|
|
||||||
u8 u8Val=0;
|
u8 u8Val=0;
|
||||||
u16 u16Val=0;
|
u16 u16Val=0;
|
||||||
u32 u32Val=0;
|
u32 u32Val=0;
|
||||||
u32 i;
|
u32 i;
|
||||||
|
|
||||||
if (p->placetopatch != place) return;
|
if (p->placetopatch != place) return;
|
||||||
|
|
||||||
if (p->enabled == 0) return;
|
if (p->enabled == 0) return;
|
||||||
|
|
||||||
if (p->cpu == 1) { //EE
|
switch (p->cpu) {
|
||||||
if (p->type == 1) { //byte
|
case EE:
|
||||||
|
switch (p->type) {
|
||||||
|
case BYTE_T:
|
||||||
memWrite8(p->addr, (u8)p->data);
|
memWrite8(p->addr, (u8)p->data);
|
||||||
} else
|
break;
|
||||||
if (p->type == 2) { //short
|
case SHORT_T:
|
||||||
memWrite16(p->addr, (u16)p->data);
|
memWrite16(p->addr, (u16)p->data);
|
||||||
} else
|
break;
|
||||||
if (p->type == 3) { //word
|
case WORD_T:
|
||||||
memWrite32(p->addr, (u32)p->data);
|
memWrite32(p->addr, (u32)p->data);
|
||||||
} else
|
break;
|
||||||
if (p->type == 4) { //double
|
case DOUBLE_T:
|
||||||
memWrite64(p->addr, p->data);
|
memWrite64(p->addr, p->data);
|
||||||
}
|
break;
|
||||||
if (p->type == 5) { //extended
|
case EXTENDED_T:
|
||||||
|
|
||||||
if (SkipCount > 0){
|
if (SkipCount > 0){
|
||||||
SkipCount--;
|
SkipCount--;
|
||||||
}else if (PrevCheatType == 0x3040) { // vvvvvvvv 00000000 Inc
|
}
|
||||||
|
else switch (PrevCheatType) {
|
||||||
|
case 0x3040: // vvvvvvvv 00000000 Inc
|
||||||
memRead32(PrevCheataddr,&u32Val);
|
memRead32(PrevCheataddr,&u32Val);
|
||||||
memWrite32(PrevCheataddr, u32Val+(p->addr));
|
memWrite32(PrevCheataddr, u32Val+(p->addr));
|
||||||
PrevCheatType = 0;
|
PrevCheatType = 0;
|
||||||
}else if (PrevCheatType == 0x3050){ // vvvvvvvv 00000000 Dec
|
break;
|
||||||
|
case 0x3050: // vvvvvvvv 00000000 Dec
|
||||||
memRead32(PrevCheataddr,&u32Val);
|
memRead32(PrevCheataddr,&u32Val);
|
||||||
memWrite32(PrevCheataddr, u32Val-(p->addr));
|
memWrite32(PrevCheataddr, u32Val-(p->addr));
|
||||||
PrevCheatType = 0;
|
PrevCheatType = 0;
|
||||||
}else if (PrevCheatType == 0x4000){ // vvvvvvvv iiiiiiii
|
break;
|
||||||
|
case 0x4000: // vvvvvvvv iiiiiiii
|
||||||
for(i=0;i<IterationCount;i++)
|
for(i=0;i<IterationCount;i++)
|
||||||
memWrite32((u32)(PrevCheataddr+(i*IterationIncrement)),(u32)((u32)p->addr+((u32)p->data*i)));
|
memWrite32((u32)(PrevCheataddr+(i*IterationIncrement)),(u32)(p->addr+((u32)p->data*i)));
|
||||||
PrevCheatType = 0;
|
PrevCheatType = 0;
|
||||||
}else if (PrevCheatType == 0x5000){ // dddddddd iiiiiiii
|
break;
|
||||||
|
case 0x5000: // dddddddd iiiiiiii
|
||||||
for(i=0;i<IterationCount;i++){
|
for(i=0;i<IterationCount;i++){
|
||||||
memRead8(PrevCheataddr+i,&u8Val);
|
memRead8(PrevCheataddr+i,&u8Val);
|
||||||
memWrite8(((u32)p->data)+i,u8Val);
|
memWrite8(((u32)p->data)+i,u8Val);
|
||||||
}
|
}
|
||||||
PrevCheatType = 0;
|
PrevCheatType = 0;
|
||||||
}else if (PrevCheatType == 0x6000){ // 000Xnnnn iiiiiiii
|
break;
|
||||||
|
case 0x6000: // 000Xnnnn iiiiiiii
|
||||||
// Get Number of pointers
|
// Get Number of pointers
|
||||||
if (IterationCount == 0)
|
if (IterationCount == 0)
|
||||||
IterationCount = (u32)p->addr&0x0000FFFF;
|
IterationCount = (u32)p->addr&0x0000FFFF;
|
||||||
|
@ -170,7 +177,7 @@ void _applypatch(int place, IniPatch *p) {
|
||||||
// Read first pointer
|
// Read first pointer
|
||||||
LastType = ((u32)p->addr&0x000F0000)/0x10000;
|
LastType = ((u32)p->addr&0x000F0000)/0x10000;
|
||||||
memRead32(PrevCheataddr,&u32Val);
|
memRead32(PrevCheataddr,&u32Val);
|
||||||
PrevCheataddr =u32Val+(u32)p->data;
|
PrevCheataddr = u32Val+(u32)p->data;
|
||||||
IterationCount--;
|
IterationCount--;
|
||||||
|
|
||||||
// Check if needed to read another pointer
|
// Check if needed to read another pointer
|
||||||
|
@ -182,12 +189,10 @@ void _applypatch(int place, IniPatch *p) {
|
||||||
memWrite16(PrevCheataddr,IterationIncrement&0xFFFF);
|
memWrite16(PrevCheataddr,IterationIncrement&0xFFFF);
|
||||||
if (LastType==0x2)
|
if (LastType==0x2)
|
||||||
memWrite32(PrevCheataddr,IterationIncrement);
|
memWrite32(PrevCheataddr,IterationIncrement);
|
||||||
}else{
|
|
||||||
PrevCheatType = 0x6001;
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
}else if (PrevCheatType == 0x6001){ // 000Xnnnn iiiiiiii
|
PrevCheatType = 0x6001;
|
||||||
|
case 0x6001: // 000Xnnnn iiiiiiii
|
||||||
// Read first pointer
|
// Read first pointer
|
||||||
memRead32(PrevCheataddr,&u32Val);
|
memRead32(PrevCheataddr,&u32Val);
|
||||||
PrevCheataddr =u32Val+(u32)p->addr;
|
PrevCheataddr =u32Val+(u32)p->addr;
|
||||||
|
@ -202,7 +207,9 @@ void _applypatch(int place, IniPatch *p) {
|
||||||
memWrite16(PrevCheataddr,IterationIncrement&0xFFFF);
|
memWrite16(PrevCheataddr,IterationIncrement&0xFFFF);
|
||||||
if (LastType==0x2)
|
if (LastType==0x2)
|
||||||
memWrite32(PrevCheataddr,IterationIncrement);
|
memWrite32(PrevCheataddr,IterationIncrement);
|
||||||
}else{
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
memRead32(PrevCheataddr,&u32Val);
|
memRead32(PrevCheataddr,&u32Val);
|
||||||
PrevCheataddr =u32Val+(u32)p->data;
|
PrevCheataddr =u32Val+(u32)p->data;
|
||||||
IterationCount--;
|
IterationCount--;
|
||||||
|
@ -216,122 +223,122 @@ void _applypatch(int place, IniPatch *p) {
|
||||||
memWrite32(PrevCheataddr,IterationIncrement);
|
memWrite32(PrevCheataddr,IterationIncrement);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
default:
|
||||||
}else if ((p->addr&0xF0000000) == 0x00000000){ // 0aaaaaaa 0000000vv
|
if ((p->addr&0xF0000000) == 0x00000000){ // 0aaaaaaa 0000000vv
|
||||||
memWrite8(p->addr&0x0FFFFFFF, (u8)p->data&0x000000FF);
|
memWrite8(p->addr&0x0FFFFFFF, (u8)p->data&0x000000FF);
|
||||||
PrevCheatType = 0;
|
PrevCheatType = 0;
|
||||||
}else if ((p->addr&0xF0000000) == 0x10000000){ // 0aaaaaaa 0000vvvv
|
}
|
||||||
|
else if ((p->addr&0xF0000000) == 0x10000000){ // 0aaaaaaa 0000vvvv
|
||||||
memWrite16(p->addr&0x0FFFFFFF, (u16)p->data&0x0000FFFF);
|
memWrite16(p->addr&0x0FFFFFFF, (u16)p->data&0x0000FFFF);
|
||||||
PrevCheatType = 0;
|
PrevCheatType = 0;
|
||||||
}else if ((p->addr&0xF0000000) == 0x20000000){ // 0aaaaaaa vvvvvvvv
|
}
|
||||||
|
else if ((p->addr&0xF0000000) == 0x20000000){ // 0aaaaaaa vvvvvvvv
|
||||||
memWrite32(p->addr&0x0FFFFFFF, (u32)p->data);
|
memWrite32(p->addr&0x0FFFFFFF, (u32)p->data);
|
||||||
PrevCheatType = 0;
|
PrevCheatType = 0;
|
||||||
}else if ((p->addr&0xFFFF0000) == 0x30000000){ // 300000vv 0aaaaaaa Inc
|
}
|
||||||
|
else if ((p->addr&0xFFFF0000) == 0x30000000){ // 300000vv 0aaaaaaa Inc
|
||||||
memRead8((u32)p->data,&u8Val);
|
memRead8((u32)p->data,&u8Val);
|
||||||
memWrite8((u32)p->data, u8Val+(p->addr&0x000000FF));
|
memWrite8((u32)p->data, u8Val+(p->addr&0x000000FF));
|
||||||
PrevCheatType = 0;
|
PrevCheatType = 0;
|
||||||
}else if ((p->addr&0xFFFF0000) == 0x30100000){ // 301000vv 0aaaaaaa Dec
|
}
|
||||||
|
else if ((p->addr&0xFFFF0000) == 0x30100000){ // 301000vv 0aaaaaaa Dec
|
||||||
memRead8((u32)p->data,&u8Val);
|
memRead8((u32)p->data,&u8Val);
|
||||||
memWrite8((u32)p->data, u8Val-(p->addr&0x000000FF));
|
memWrite8((u32)p->data, u8Val-(p->addr&0x000000FF));
|
||||||
PrevCheatType = 0;
|
PrevCheatType = 0;
|
||||||
}else if ((p->addr&0xFFFF0000) == 0x30200000){ // 3020vvvv 0aaaaaaa Inc
|
}
|
||||||
|
else if ((p->addr&0xFFFF0000) == 0x30200000){ // 3020vvvv 0aaaaaaa Inc
|
||||||
memRead16((u32)p->data,&u16Val);
|
memRead16((u32)p->data,&u16Val);
|
||||||
memWrite16((u32)p->data, u16Val+(p->addr&0x0000FFFF));
|
memWrite16((u32)p->data, u16Val+(p->addr&0x0000FFFF));
|
||||||
PrevCheatType = 0;
|
PrevCheatType = 0;
|
||||||
}else if ((p->addr&0xFFFF0000) == 0x30300000){ // 3030vvvv 0aaaaaaa Dec
|
}
|
||||||
|
else if ((p->addr&0xFFFF0000) == 0x30300000){ // 3030vvvv 0aaaaaaa Dec
|
||||||
memRead16((u32)p->data,&u16Val);
|
memRead16((u32)p->data,&u16Val);
|
||||||
memWrite16((u32)p->data, u16Val-(p->addr&0x0000FFFF));
|
memWrite16((u32)p->data, u16Val-(p->addr&0x0000FFFF));
|
||||||
PrevCheatType = 0;
|
PrevCheatType = 0;
|
||||||
}else if ((p->addr&0xFFFF0000) == 0x30400000){ // 30400000 0aaaaaaa Inc + Another line
|
}
|
||||||
|
else if ((p->addr&0xFFFF0000) == 0x30400000){ // 30400000 0aaaaaaa Inc + Another line
|
||||||
PrevCheatType= 0x3040;
|
PrevCheatType= 0x3040;
|
||||||
PrevCheataddr= (u32)p->data;
|
PrevCheataddr= (u32)p->data;
|
||||||
}else if ((p->addr&0xFFFF0000) == 0x30500000){ // 30500000 0aaaaaaa Inc + Another line
|
}
|
||||||
|
else if ((p->addr&0xFFFF0000) == 0x30500000){ // 30500000 0aaaaaaa Inc + Another line
|
||||||
PrevCheatType= 0x3050;
|
PrevCheatType= 0x3050;
|
||||||
PrevCheataddr= (u32)p->data;
|
PrevCheataddr= (u32)p->data;
|
||||||
}else if ((p->addr&0xF0000000) == 0x40000000){ // 4aaaaaaa nnnnssss + Another line
|
}
|
||||||
|
else if ((p->addr&0xF0000000) == 0x40000000){ // 4aaaaaaa nnnnssss + Another line
|
||||||
IterationCount=((u32)p->data&0xFFFF0000)/0x10000;
|
IterationCount=((u32)p->data&0xFFFF0000)/0x10000;
|
||||||
IterationIncrement=((u32)p->data&0x0000FFFF)*4;
|
IterationIncrement=((u32)p->data&0x0000FFFF)*4;
|
||||||
PrevCheataddr=(u32)p->addr&0x0FFFFFFF;
|
PrevCheataddr=(u32)p->addr&0x0FFFFFFF;
|
||||||
PrevCheatType= 0x4000;
|
PrevCheatType= 0x4000;
|
||||||
}else if ((p->addr&0xF0000000) == 0x50000000){ // 5sssssss nnnnnnnn + Another line
|
}
|
||||||
|
else if ((p->addr&0xF0000000) == 0x50000000){ // 5sssssss nnnnnnnn + Another line
|
||||||
PrevCheataddr = (u32)p->addr&0x0FFFFFFF;
|
PrevCheataddr = (u32)p->addr&0x0FFFFFFF;
|
||||||
IterationCount=((u32)p->data);
|
IterationCount=((u32)p->data);
|
||||||
PrevCheatType= 0x5000;
|
PrevCheatType= 0x5000;
|
||||||
}else if ((p->addr&0xF0000000) == 0x60000000){ // 6aaaaaaa 000000vv + Another line/s
|
}
|
||||||
|
else if ((p->addr&0xF0000000) == 0x60000000){ // 6aaaaaaa 000000vv + Another line/s
|
||||||
PrevCheataddr = (u32)p->addr&0x0FFFFFFF;
|
PrevCheataddr = (u32)p->addr&0x0FFFFFFF;
|
||||||
IterationIncrement=((u32)p->data);
|
IterationIncrement=((u32)p->data);
|
||||||
IterationCount=0;
|
IterationCount=0;
|
||||||
PrevCheatType= 0x6000;
|
PrevCheatType= 0x6000;
|
||||||
}else if (((p->addr&0xF0000000) == 0x70000000)&&((p->data&0x00F00000) == 0x00000000)){ // 7aaaaaaa 000000vv
|
}
|
||||||
|
else if ((p->addr&0xF0000000) == 0x70000000) {
|
||||||
|
if ((p->data&0x00F00000) == 0x00000000){ // 7aaaaaaa 000000vv
|
||||||
memRead8((u32)p->addr&0x0FFFFFFF,&u8Val);
|
memRead8((u32)p->addr&0x0FFFFFFF,&u8Val);
|
||||||
memWrite8((u32)p->addr&0x0FFFFFFF,(u8)(u8Val|(p->data&0x000000FF)));
|
memWrite8((u32)p->addr&0x0FFFFFFF,(u8)(u8Val|(p->data&0x000000FF)));
|
||||||
}else if (((p->addr&0xF0000000) == 0x70000000)&&((p->data&0x00F00000) == 0x00100000)){ // 7aaaaaaa 0010vvvv
|
}else if ((p->data&0x00F00000) == 0x00100000){ // 7aaaaaaa 0010vvvv
|
||||||
memRead16((u32)p->addr&0x0FFFFFFF,&u16Val);
|
memRead16((u32)p->addr&0x0FFFFFFF,&u16Val);
|
||||||
memWrite16((u32)p->addr&0x0FFFFFFF,(u16)(u16Val|(p->data&0x0000FFFF)));
|
memWrite16((u32)p->addr&0x0FFFFFFF,(u16)(u16Val|(p->data&0x0000FFFF)));
|
||||||
}else if (((p->addr&0xF0000000) == 0x70000000)&&((p->data&0x00F00000) == 0x00200000)){ // 7aaaaaaa 002000vv
|
}else if ((p->data&0x00F00000) == 0x00200000){ // 7aaaaaaa 002000vv
|
||||||
memRead8((u32)p->addr&0x0FFFFFFF,&u8Val);
|
memRead8((u32)p->addr&0x0FFFFFFF,&u8Val);
|
||||||
memWrite8((u32)p->addr&0x0FFFFFFF,(u8)(u8Val&(p->data&0x000000FF)));
|
memWrite8((u32)p->addr&0x0FFFFFFF,(u8)(u8Val&(p->data&0x000000FF)));
|
||||||
}else if (((p->addr&0xF0000000) == 0x70000000)&&((p->data&0x00F00000) == 0x00300000)){ // 7aaaaaaa 0030vvvv
|
}else if ((p->data&0x00F00000) == 0x00300000){ // 7aaaaaaa 0030vvvv
|
||||||
memRead16((u32)p->addr&0x0FFFFFFF,&u16Val);
|
memRead16((u32)p->addr&0x0FFFFFFF,&u16Val);
|
||||||
memWrite16((u32)p->addr&0x0FFFFFFF,(u16)(u16Val&(p->data&0x0000FFFF)));
|
memWrite16((u32)p->addr&0x0FFFFFFF,(u16)(u16Val&(p->data&0x0000FFFF)));
|
||||||
}else if (((p->addr&0xF0000000) == 0x70000000)&&((p->data&0x00F00000) == 0x00400000)){ // 7aaaaaaa 004000vv
|
}else if ((p->data&0x00F00000) == 0x00400000){ // 7aaaaaaa 004000vv
|
||||||
memRead8((u32)p->addr&0x0FFFFFFF,&u8Val);
|
memRead8((u32)p->addr&0x0FFFFFFF,&u8Val);
|
||||||
memWrite8((u32)p->addr&0x0FFFFFFF,(u8)(u8Val^(p->data&0x000000FF)));
|
memWrite8((u32)p->addr&0x0FFFFFFF,(u8)(u8Val^(p->data&0x000000FF)));
|
||||||
}else if (((p->addr&0xF0000000) == 0x70000000)&&((p->data&0x00F00000) == 0x00500000)){ // 7aaaaaaa 0050vvvv
|
}else if ((p->data&0x00F00000) == 0x00500000){ // 7aaaaaaa 0050vvvv
|
||||||
memRead16((u32)p->addr&0x0FFFFFFF,&u16Val);
|
memRead16((u32)p->addr&0x0FFFFFFF,&u16Val);
|
||||||
memWrite16((u32)p->addr&0x0FFFFFFF,(u16)(u16Val^(p->data&0x0000FFFF)));
|
memWrite16((u32)p->addr&0x0FFFFFFF,(u16)(u16Val^(p->data&0x0000FFFF)));
|
||||||
}else if ((p->addr < 0xE0000000)&&(((u32)p->data&0xFFFF0000)==0x00000000)){
|
}
|
||||||
|
}
|
||||||
|
else if (p->addr < 0xE0000000) {
|
||||||
|
if ((((u32)p->data & 0xFFFF0000)==0x00000000) ||
|
||||||
|
(((u32)p->data & 0xFFFF0000)==0x00100000) ||
|
||||||
|
(((u32)p->data & 0xFFFF0000)==0x00200000) ||
|
||||||
|
(((u32)p->data & 0xFFFF0000)==0x00300000)) {
|
||||||
memRead16((u32)p->addr&0x0FFFFFFF,&u16Val);
|
memRead16((u32)p->addr&0x0FFFFFFF,&u16Val);
|
||||||
if (u16Val != (0x0000FFFF&(u32)p->data))
|
if (u16Val != (0x0000FFFF&(u32)p->data))
|
||||||
SkipCount = 1;
|
SkipCount = 1;
|
||||||
PrevCheatType= 0;
|
PrevCheatType= 0;
|
||||||
}else if ((p->addr < 0xE0000000)&&(((u32)p->data&0xFFFF0000)==0x00100000)){
|
}
|
||||||
memRead16((u32)p->addr&0x0FFFFFFF,&u16Val);
|
}
|
||||||
if (u16Val == (0x0000FFFF&(u32)p->data))
|
else if (p->addr < 0xF0000000) {
|
||||||
SkipCount = 1;
|
if ((((u32)p->data&0xF0000000)==0x00000000) ||
|
||||||
PrevCheatType= 0;
|
(((u32)p->data&0xF0000000)==0x10000000) ||
|
||||||
}else if ((p->addr < 0xE0000000)&&(((u32)p->data&0xFFFF0000)==0x00200000)){
|
(((u32)p->data&0xF0000000)==0x20000000) ||
|
||||||
memRead16((u32)p->addr&0x0FFFFFFF,&u16Val);
|
(((u32)p->data&0xF0000000)==0x30000000)) {
|
||||||
if (u16Val <= (0x0000FFFF&(u32)p->data))
|
|
||||||
SkipCount = 1;
|
|
||||||
PrevCheatType= 0;
|
|
||||||
}else if ((p->addr < 0xE0000000)&&(((u32)p->data&0xFFFF0000)==0x00300000)){
|
|
||||||
memRead16((u32)p->addr&0x0FFFFFFF,&u16Val);
|
|
||||||
if (u16Val >= (0x0000FFFF&(u32)p->data))
|
|
||||||
SkipCount = 1;
|
|
||||||
PrevCheatType= 0;
|
|
||||||
}else if ((p->addr < 0xF0000000)&&(((u32)p->data&0xF0000000)==0x00000000)){
|
|
||||||
memRead16((u32)p->data&0x0FFFFFFF,&u16Val);
|
memRead16((u32)p->data&0x0FFFFFFF,&u16Val);
|
||||||
if (u16Val != (0x0000FFFF&(u32)p->addr))
|
if (u16Val != (0x0000FFFF&(u32)p->addr))
|
||||||
SkipCount = ((u32)p->addr&0xFFF0000)/0x10000;
|
SkipCount = ((u32)p->addr&0xFFF0000)/0x10000;
|
||||||
PrevCheatType= 0;
|
PrevCheatType= 0;
|
||||||
}else if ((p->addr < 0xF0000000)&&(((u32)p->data&0xF0000000)==0x10000000)){
|
|
||||||
memRead16((u32)p->addr&0x0FFFFFFF,&u16Val);
|
|
||||||
if (u16Val == (0x0000FFFF&(u32)p->data))
|
|
||||||
SkipCount = ((u32)p->addr&0xFFF0000)/0x10000;
|
|
||||||
PrevCheatType= 0;
|
|
||||||
}else if ((p->addr < 0xF0000000)&&(((u32)p->data&0xF0000000)==0x20000000)){
|
|
||||||
memRead16((u32)p->addr&0x0FFFFFFF,&u16Val);
|
|
||||||
if (u16Val <= (0x0000FFFF&(u32)p->data))
|
|
||||||
SkipCount = ((u32)p->addr&0xFFF0000)/0x10000;
|
|
||||||
PrevCheatType= 0;
|
|
||||||
}else if ((p->addr < 0xF0000000)&&(((u32)p->data&0xF0000000)==0x30000000)){
|
|
||||||
memRead16((u32)p->addr&0x0FFFFFFF,&u16Val);
|
|
||||||
if (u16Val >= (0x0000FFFF&(u32)p->data))
|
|
||||||
SkipCount = ((u32)p->addr&0xFFF0000)/0x10000;
|
|
||||||
PrevCheatType= 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else
|
}
|
||||||
if (p->cpu == 2) { //IOP
|
}
|
||||||
if (p->type == 1) { //byte
|
break;
|
||||||
|
case IOP: {
|
||||||
|
switch (p->type) {
|
||||||
|
case BYTE_T:
|
||||||
psxMemWrite8(p->addr, (u8)p->data);
|
psxMemWrite8(p->addr, (u8)p->data);
|
||||||
} else
|
break;
|
||||||
if (p->type == 2) { //short
|
case SHORT_T:
|
||||||
psxMemWrite16(p->addr, (u16)p->data);
|
psxMemWrite16(p->addr, (u16)p->data);
|
||||||
} else
|
break;
|
||||||
if (p->type == 3) { //word
|
case WORD_T:
|
||||||
psxMemWrite32(p->addr, (u32)p->data);
|
psxMemWrite32(p->addr, (u32)p->data);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -355,7 +362,6 @@ void patchFunc_comment( char * text1, char * text2 )
|
||||||
SysPrintf( "comment: %s \n", text2 );
|
SysPrintf( "comment: %s \n", text2 );
|
||||||
}
|
}
|
||||||
|
|
||||||
char strgametitle[256] = {0};
|
|
||||||
|
|
||||||
void patchFunc_gametitle( char * text1, char * text2 )
|
void patchFunc_gametitle( char * text1, char * text2 )
|
||||||
{
|
{
|
||||||
|
@ -366,11 +372,8 @@ void patchFunc_gametitle( char * text1, char * text2 )
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
extern int RunExe;
|
|
||||||
|
|
||||||
void patchFunc_patch( char * cmd, char * param )
|
void patchFunc_patch( char * cmd, char * param )
|
||||||
{
|
{
|
||||||
//patch=placetopatch,cpucore,address,type,data
|
|
||||||
char * pText;
|
char * pText;
|
||||||
|
|
||||||
if ( patchnumber >= MAX_PATCH )
|
if ( patchnumber >= MAX_PATCH )
|
||||||
|
@ -381,10 +384,11 @@ void patchFunc_patch( char * cmd, char * param )
|
||||||
|
|
||||||
pText = strtok( param, "," );
|
pText = strtok( param, "," );
|
||||||
pText = param;
|
pText = param;
|
||||||
// inifile_trim( pText );
|
|
||||||
|
|
||||||
if(RunExe == 1) patch[ patchnumber ].placetopatch = 1;
|
if(RunExe == 1)
|
||||||
else patch[ patchnumber ].placetopatch = strtol( pText, (char **)NULL, 0 );
|
patch[ patchnumber ].placetopatch = 1;
|
||||||
|
else
|
||||||
|
patch[ patchnumber ].placetopatch = strtol( pText, (char **)NULL, 0 );
|
||||||
|
|
||||||
pText = strtok( NULL, "," );
|
pText = strtok( NULL, "," );
|
||||||
inifile_trim( pText );
|
inifile_trim( pText );
|
||||||
|
@ -417,7 +421,7 @@ void patchFunc_patch( char * cmd, char * param )
|
||||||
patchnumber++;
|
patchnumber++;
|
||||||
}
|
}
|
||||||
|
|
||||||
//this routine is for execute the commands of the ini file
|
//this routine is for executing the commands of the ini file
|
||||||
void inifile_command( char * cmd )
|
void inifile_command( char * cmd )
|
||||||
{
|
{
|
||||||
int code;
|
int code;
|
||||||
|
@ -431,8 +435,6 @@ void inifile_command( char * cmd )
|
||||||
{
|
{
|
||||||
// fastmemory doesn't have =
|
// fastmemory doesn't have =
|
||||||
pEqual = cmd+strlen(cmd);
|
pEqual = cmd+strlen(cmd);
|
||||||
// SysPrintf( "Ini file ERROR: unknow line: %s \n", cmd );
|
|
||||||
// return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
memset( command, 0, sizeof( command ) );
|
memset( command, 0, sizeof( command ) );
|
||||||
|
@ -551,8 +553,11 @@ int AddPatch(int Mode, int Place, int Address, int Size, u64 data)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(RunExe == 1) patch[patchnumber].placetopatch = 1;
|
if(RunExe == 1)
|
||||||
else patch[patchnumber].placetopatch = Mode;
|
patch[patchnumber].placetopatch = 1;
|
||||||
|
else
|
||||||
|
patch[patchnumber].placetopatch = Mode;
|
||||||
|
|
||||||
patch[patchnumber].cpu = Place;
|
patch[patchnumber].cpu = Place;
|
||||||
patch[patchnumber].addr=Address;
|
patch[patchnumber].addr=Address;
|
||||||
patch[patchnumber].type=Size;
|
patch[patchnumber].type=Size;
|
||||||
|
@ -560,6 +565,16 @@ int AddPatch(int Mode, int Place, int Address, int Size, u64 data)
|
||||||
return patchnumber++;
|
return patchnumber++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void patchFunc_ffxhack( char * cmd, char * param )
|
||||||
|
{
|
||||||
|
g_FFXHack = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
void patchFunc_xkickdelay( char * cmd, char * param )
|
||||||
|
{
|
||||||
|
g_VUGameFixes |= VUFIX_XGKICKDELAY2;
|
||||||
|
}
|
||||||
|
|
||||||
void patchFunc_fastmemory( char * cmd, char * param )
|
void patchFunc_fastmemory( char * cmd, char * param )
|
||||||
{
|
{
|
||||||
#ifndef PCSX2_NORECBUILD
|
#ifndef PCSX2_NORECBUILD
|
||||||
|
@ -568,7 +583,6 @@ void patchFunc_fastmemory( char * cmd, char * param )
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
extern void SetVUNanMode(int mode);
|
|
||||||
|
|
||||||
void patchFunc_vunanmode( char * cmd, char * param )
|
void patchFunc_vunanmode( char * cmd, char * param )
|
||||||
{
|
{
|
||||||
|
@ -578,7 +592,6 @@ void patchFunc_vunanmode( char * cmd, char * param )
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
extern int path3hack;
|
|
||||||
void patchFunc_path3hack( char * cmd, char * param )
|
void patchFunc_path3hack( char * cmd, char * param )
|
||||||
{
|
{
|
||||||
path3hack = 1;
|
path3hack = 1;
|
||||||
|
@ -586,7 +599,6 @@ void patchFunc_path3hack( char * cmd, char * param )
|
||||||
|
|
||||||
void patchFunc_roundmode( char * cmd, char * param )
|
void patchFunc_roundmode( char * cmd, char * param )
|
||||||
{
|
{
|
||||||
//roundmode = X,Y
|
|
||||||
int index;
|
int index;
|
||||||
char * pText;
|
char * pText;
|
||||||
|
|
||||||
|
@ -597,6 +609,7 @@ void patchFunc_roundmode( char * cmd, char * param )
|
||||||
pText = strtok( param, ", " );
|
pText = strtok( param, ", " );
|
||||||
while(pText != NULL) {
|
while(pText != NULL) {
|
||||||
u32 type = 0xffff;
|
u32 type = 0xffff;
|
||||||
|
|
||||||
if( stricmp(pText, "near") == 0 ) {
|
if( stricmp(pText, "near") == 0 ) {
|
||||||
type = 0x0000;
|
type = 0x0000;
|
||||||
}
|
}
|
||||||
|
@ -615,8 +628,10 @@ void patchFunc_roundmode( char * cmd, char * param )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( index == 0 ) eetype=type;
|
if( index == 0 )
|
||||||
else vutype=type;
|
eetype=type;
|
||||||
|
else
|
||||||
|
vutype=type;
|
||||||
|
|
||||||
if( index == 1 )
|
if( index == 1 )
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -31,6 +31,24 @@
|
||||||
while ( *param && ( *param == ' ' ) ) param++; \
|
while ( *param && ( *param == ' ' ) ) param++; \
|
||||||
if ( *param == 0 ) { SysPrintf( _( "Not enough params for inicommand\n" ) ); return; }
|
if ( *param == 0 ) { SysPrintf( _( "Not enough params for inicommand\n" ) ); return; }
|
||||||
|
|
||||||
|
//
|
||||||
|
// Enums
|
||||||
|
//
|
||||||
|
|
||||||
|
enum patch_cpu_type {
|
||||||
|
NO_CPU,
|
||||||
|
EE,
|
||||||
|
IOP
|
||||||
|
};
|
||||||
|
enum patch_data_type {
|
||||||
|
NO_TYPE,
|
||||||
|
BYTE_T,
|
||||||
|
SHORT_T,
|
||||||
|
WORD_T,
|
||||||
|
DOUBLE_T,
|
||||||
|
EXTENDED_T
|
||||||
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
// Typedefs
|
// Typedefs
|
||||||
//
|
//
|
||||||
|
@ -38,7 +56,7 @@ typedef void (*PATCHTABLEFUNC)( char * text1, char * text2 );
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
char * text;
|
char *text;
|
||||||
int code;
|
int code;
|
||||||
PATCHTABLEFUNC func;
|
PATCHTABLEFUNC func;
|
||||||
} PatchTextTable;
|
} PatchTextTable;
|
||||||
|
@ -47,8 +65,8 @@ typedef struct
|
||||||
{
|
{
|
||||||
int enabled;
|
int enabled;
|
||||||
int group;
|
int group;
|
||||||
int type;
|
enum patch_data_type type;
|
||||||
int cpu;
|
enum patch_cpu_type cpu;
|
||||||
int placetopatch;
|
int placetopatch;
|
||||||
u32 addr;
|
u32 addr;
|
||||||
u64 data;
|
u64 data;
|
||||||
|
@ -65,6 +83,8 @@ void patchFunc_path3hack( char * text1, char * text2 );
|
||||||
void patchFunc_roundmode( char * text1, char * text2 );
|
void patchFunc_roundmode( char * text1, char * text2 );
|
||||||
void patchFunc_zerogs( char * text1, char * text2 );
|
void patchFunc_zerogs( char * text1, char * text2 );
|
||||||
void patchFunc_vunanmode( char * text1, char * text2 );
|
void patchFunc_vunanmode( char * text1, char * text2 );
|
||||||
|
void patchFunc_ffxhack( char * text1, char * text2 );
|
||||||
|
void patchFunc_xkickdelay( char * text1, char * text2 );
|
||||||
|
|
||||||
void inifile_trim( char * buffer );
|
void inifile_trim( char * buffer );
|
||||||
|
|
||||||
|
@ -72,11 +92,8 @@ void inifile_trim( char * buffer );
|
||||||
// Variables
|
// Variables
|
||||||
//
|
//
|
||||||
extern PatchTextTable commands[];
|
extern PatchTextTable commands[];
|
||||||
|
|
||||||
extern PatchTextTable dataType[];
|
extern PatchTextTable dataType[];
|
||||||
|
|
||||||
extern PatchTextTable cpuCore[];
|
extern PatchTextTable cpuCore[];
|
||||||
|
|
||||||
extern IniPatch patch[ MAX_PATCH ];
|
extern IniPatch patch[ MAX_PATCH ];
|
||||||
extern int patchnumber;
|
extern int patchnumber;
|
||||||
|
|
||||||
|
@ -91,6 +108,11 @@ int AddPatch(int Mode, int Place, int Address, int Size, u64 data);
|
||||||
void SetFastMemory(int); // iR5900LoadStore.c
|
void SetFastMemory(int); // iR5900LoadStore.c
|
||||||
void SetVUNanMemory(int); // iVUmicro.c
|
void SetVUNanMemory(int); // iVUmicro.c
|
||||||
|
|
||||||
|
extern void SetVUNanMode(int mode);
|
||||||
|
|
||||||
|
extern int path3hack;
|
||||||
|
extern int g_FFXHack;
|
||||||
|
//extern int g_VUGameFixes;
|
||||||
extern u32 g_sseMXCSR;
|
extern u32 g_sseMXCSR;
|
||||||
extern u32 g_sseVUMXCSR;
|
extern u32 g_sseVUMXCSR;
|
||||||
void SetCPUState(u32 sseMXCSR, u32 sseVUMXCSR);
|
void SetCPUState(u32 sseMXCSR, u32 sseVUMXCSR);
|
||||||
|
|
|
@ -17,6 +17,7 @@ CXXFLAGS=
|
||||||
CCASFLAGS=
|
CCASFLAGS=
|
||||||
|
|
||||||
WARNING_FLAGS="-Wall -Wno-format -Wno-unused-value"
|
WARNING_FLAGS="-Wall -Wno-format -Wno-unused-value"
|
||||||
|
dnl EXTRA_FLAGS = " -Xlinker -zmuldefs -fpermissive "
|
||||||
NORMAL_FLAGS="-O3 -fomit-frame-pointer ${WARNING_FLAGS}"
|
NORMAL_FLAGS="-O3 -fomit-frame-pointer ${WARNING_FLAGS}"
|
||||||
DEBUG_FLAGS=" -g ${WARNING_FLAGS}"
|
DEBUG_FLAGS=" -g ${WARNING_FLAGS}"
|
||||||
|
|
||||||
|
|
|
@ -607,7 +607,7 @@ int ReadPatch(HWND hWnd, IniPatch &temp)
|
||||||
}
|
}
|
||||||
|
|
||||||
// CPU
|
// CPU
|
||||||
temp.cpu = SendMessage(GetDlgItem(hWnd, IDC_CPU), CB_GETCURSEL, 0, 0) + 1;
|
temp.cpu = (patch_cpu_type)(SendMessage(GetDlgItem(hWnd, IDC_CPU), CB_GETCURSEL, 0, 0) + 1);
|
||||||
if(temp.cpu < 1)
|
if(temp.cpu < 1)
|
||||||
{
|
{
|
||||||
MessageBox(hWnd, "CPU is not selected.", "Error", 0);
|
MessageBox(hWnd, "CPU is not selected.", "Error", 0);
|
||||||
|
@ -631,7 +631,7 @@ int ReadPatch(HWND hWnd, IniPatch &temp)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Type
|
// Type
|
||||||
temp.type = SendMessage(GetDlgItem(hWnd, IDC_TYPE), CB_GETCURSEL, 0, 0) + 1;
|
temp.type = (patch_data_type)(SendMessage(GetDlgItem(hWnd, IDC_TYPE), CB_GETCURSEL, 0, 0) + 1);
|
||||||
if(temp.type < 1)
|
if(temp.type < 1)
|
||||||
{
|
{
|
||||||
MessageBox(hWnd, "Type is not selected.", "Error", 0);
|
MessageBox(hWnd, "Type is not selected.", "Error", 0);
|
||||||
|
|
|
@ -657,7 +657,7 @@ void rpropSPECIAL(EEINST* prev, EEINST* pinst)
|
||||||
|
|
||||||
case 16: // mfhi
|
case 16: // mfhi
|
||||||
rpropSetWrite(_Rd_, EEINST_LIVE1);
|
rpropSetWrite(_Rd_, EEINST_LIVE1);
|
||||||
rpropSetRead(XMMGPR_HI, (pinst->regs[_Rd_]&EEINST_MMX|EEINST_REALXMM)|EEINST_LIVE1);
|
rpropSetRead(XMMGPR_HI, (pinst->regs[_Rd_]&(EEINST_MMX|EEINST_REALXMM))|EEINST_LIVE1);
|
||||||
break;
|
break;
|
||||||
case 17: // mthi
|
case 17: // mthi
|
||||||
rpropSetWrite(XMMGPR_HI, EEINST_LIVE1);
|
rpropSetWrite(XMMGPR_HI, EEINST_LIVE1);
|
||||||
|
@ -665,7 +665,7 @@ void rpropSPECIAL(EEINST* prev, EEINST* pinst)
|
||||||
break;
|
break;
|
||||||
case 18: // mflo
|
case 18: // mflo
|
||||||
rpropSetWrite(_Rd_, EEINST_LIVE1);
|
rpropSetWrite(_Rd_, EEINST_LIVE1);
|
||||||
rpropSetRead(XMMGPR_LO, (pinst->regs[_Rd_]&EEINST_MMX|EEINST_REALXMM)|EEINST_LIVE1);
|
rpropSetRead(XMMGPR_LO, (pinst->regs[_Rd_]&(EEINST_MMX|EEINST_REALXMM))|EEINST_LIVE1);
|
||||||
break;
|
break;
|
||||||
case 19: // mtlo
|
case 19: // mtlo
|
||||||
rpropSetWrite(XMMGPR_LO, EEINST_LIVE1);
|
rpropSetWrite(XMMGPR_LO, EEINST_LIVE1);
|
||||||
|
@ -687,6 +687,8 @@ void rpropSPECIAL(EEINST* prev, EEINST* pinst)
|
||||||
rpropSetWrite(XMMGPR_LO, EEINST_LIVE1);
|
rpropSetWrite(XMMGPR_LO, EEINST_LIVE1);
|
||||||
rpropSetWrite(XMMGPR_HI, EEINST_LIVE1);
|
rpropSetWrite(XMMGPR_HI, EEINST_LIVE1);
|
||||||
rpropSetWrite(_Rd_, EEINST_LIVE1);
|
rpropSetWrite(_Rd_, EEINST_LIVE1);
|
||||||
|
|
||||||
|
// fixme - temp is always 0, so I doubt the next three lines are right.
|
||||||
rpropSetRead(_Rs_, temp);
|
rpropSetRead(_Rs_, temp);
|
||||||
rpropSetRead(_Rt_, temp);
|
rpropSetRead(_Rt_, temp);
|
||||||
pinst->info |= temp;
|
pinst->info |= temp;
|
||||||
|
|
|
@ -335,11 +335,11 @@ int LoadGroup(TiXmlNode *group,int gParent)
|
||||||
|
|
||||||
if(strcmp(place,"EE")==0)
|
if(strcmp(place,"EE")==0)
|
||||||
{
|
{
|
||||||
patch[patchnumber].cpu=1;
|
patch[patchnumber].cpu= EE;
|
||||||
} else
|
} else
|
||||||
if(strcmp(place,"IOP")==0)
|
if(strcmp(place,"IOP")==0)
|
||||||
{
|
{
|
||||||
patch[patchnumber].cpu=2;
|
patch[patchnumber].cpu= IOP;
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
SysPrintf("XML Patch Loader: ERROR: Invalid place attribute.\n");
|
SysPrintf("XML Patch Loader: ERROR: Invalid place attribute.\n");
|
||||||
|
@ -349,19 +349,19 @@ int LoadGroup(TiXmlNode *group,int gParent)
|
||||||
|
|
||||||
if(strcmp(size,"64")==0)
|
if(strcmp(size,"64")==0)
|
||||||
{
|
{
|
||||||
patch[patchnumber].type=4;
|
patch[patchnumber].type = DOUBLE_T;
|
||||||
} else
|
} else
|
||||||
if(strcmp(size,"32")==0)
|
if(strcmp(size,"32")==0)
|
||||||
{
|
{
|
||||||
patch[patchnumber].type=3;
|
patch[patchnumber].type = WORD_T;
|
||||||
} else
|
} else
|
||||||
if(strcmp(size,"16")==0)
|
if(strcmp(size,"16")==0)
|
||||||
{
|
{
|
||||||
patch[patchnumber].type=2;
|
patch[patchnumber].type = SHORT_T;
|
||||||
} else
|
} else
|
||||||
if(strcmp(size,"8")==0)
|
if(strcmp(size,"8")==0)
|
||||||
{
|
{
|
||||||
patch[patchnumber].type=1;
|
patch[patchnumber].type = BYTE_T;
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
SysPrintf("XML Patch Loader: ERROR: Invalid size attribute.\n");
|
SysPrintf("XML Patch Loader: ERROR: Invalid size attribute.\n");
|
||||||
|
|
Loading…
Reference in New Issue