mirror of https://github.com/PCSX2/pcsx2.git
A few more changes to the patch code.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2137 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
parent
6a7c617a65
commit
0d68166b65
|
@ -30,10 +30,7 @@
|
|||
using namespace Threading;
|
||||
|
||||
extern u8 psxhblankgate;
|
||||
|
||||
// The two functions needed for patches.
|
||||
extern void ApplyPatch( int place );
|
||||
extern void inifile_read( const char* name );
|
||||
extern void ApplyPatch( int place = 1);
|
||||
|
||||
static const uint EECNT_FUTURE_TARGET = 0x10000000;
|
||||
|
||||
|
@ -361,7 +358,7 @@ static __forceinline void VSyncStart(u32 sCycle)
|
|||
psxVBlankStart();
|
||||
|
||||
if (gates) rcntStartGate(true, sCycle); // Counters Start Gate code
|
||||
if (EmuConfig.EnablePatches) ApplyPatch(1); // fixme - Apply patches
|
||||
if (EmuConfig.EnablePatches) ApplyPatch(); // fixme - Apply patches
|
||||
|
||||
// INTC - VB Blank Start Hack --
|
||||
// Hack fix! This corrects a freezeup in Granda 2 where it decides to spin
|
||||
|
|
|
@ -21,10 +21,7 @@
|
|||
#include "GS.h" // for sending game crc to mtgs
|
||||
|
||||
using namespace std;
|
||||
|
||||
// The two functions needed for patches.
|
||||
extern void ApplyPatch( int place );
|
||||
extern void inifile_read( const char* name );
|
||||
extern void InitPatch(wxString crc);
|
||||
|
||||
u32 ElfCRC;
|
||||
|
||||
|
@ -500,8 +497,7 @@ void ElfApplyPatches()
|
|||
|
||||
if( !EmuConfig.EnablePatches ) return;
|
||||
|
||||
inifile_read( filename.ToUTF8() );
|
||||
ApplyPatch( 0 );
|
||||
InitPatch(filename);
|
||||
}
|
||||
|
||||
// Fetches the CRC of the game bound to the CDVD plugin.
|
||||
|
|
|
@ -115,16 +115,16 @@ void handle_extended_t( IniPatch *p)
|
|||
}
|
||||
else switch (PrevCheatType)
|
||||
{
|
||||
case 0x3040:
|
||||
{ // vvvvvvvv 00000000 Inc
|
||||
case 0x3040: // vvvvvvvv 00000000 Inc
|
||||
{
|
||||
u32 mem = memRead32(PrevCheatAddr);
|
||||
memWrite32(PrevCheatAddr, mem + (p->addr));
|
||||
PrevCheatType = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
case 0x3050:
|
||||
{ // vvvvvvvv 00000000 Dec
|
||||
case 0x3050: // vvvvvvvv 00000000 Dec
|
||||
{
|
||||
u32 mem = memRead32(PrevCheatAddr);
|
||||
memWrite32(PrevCheatAddr, mem - (p->addr));
|
||||
PrevCheatType = 0;
|
||||
|
@ -366,8 +366,7 @@ void handle_extended_t( IniPatch *p)
|
|||
}
|
||||
else if (p->addr < 0xF0000000)
|
||||
{
|
||||
// We might be able to substitute:
|
||||
// if (((u32)p->data & 0xC0000000) == 0x00000000)
|
||||
if (((u32)p->data & 0xC0000000) == 0x00000000)
|
||||
if ((((u32)p->data & 0xF0000000) == 0x00000000) ||
|
||||
(((u32)p->data & 0xF0000000) == 0x10000000) ||
|
||||
(((u32)p->data & 0xF0000000) == 0x20000000) ||
|
||||
|
@ -474,7 +473,9 @@ void inifile_trim( wxString& buffer )
|
|||
|
||||
#endif
|
||||
|
||||
void inisection_process( FILE * f1 )
|
||||
// This routine recieves a file from inifile_read, trims it,
|
||||
// Then sends the command to be parsed.
|
||||
void inifile_process( FILE * f1 )
|
||||
{
|
||||
char buffer[ 1024 ];
|
||||
while( fgets( buffer, sizeof( buffer ), f1 ) )
|
||||
|
@ -484,8 +485,8 @@ void inisection_process( FILE * f1 )
|
|||
}
|
||||
}
|
||||
|
||||
//this routine is for reading the ini file
|
||||
|
||||
// This routine creates a pnach filename from the games crc,
|
||||
// loads it, and passes it to inisection_process to be parsed.
|
||||
void inifile_read( const char* name )
|
||||
{
|
||||
FILE* f1;
|
||||
|
@ -525,7 +526,7 @@ void inifile_read( const char* name )
|
|||
return;
|
||||
}
|
||||
|
||||
inisection_process( f1 );
|
||||
inifile_process( f1 );
|
||||
fclose( f1 );
|
||||
}
|
||||
|
||||
|
@ -588,17 +589,20 @@ void _ApplyPatch(IniPatch *p)
|
|||
//this is for applying patches directly to memory
|
||||
void ApplyPatch(int place)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (place == 0) Console.WriteLn(" patchnumber: %d", patchnumber);
|
||||
|
||||
for (i = 0; i < patchnumber; i++)
|
||||
for (int i = 0; i < patchnumber; i++)
|
||||
{
|
||||
if (Patch[i].placetopatch == place)
|
||||
_ApplyPatch(&Patch[i]);
|
||||
}
|
||||
}
|
||||
|
||||
void InitPatch(wxString crc)
|
||||
{
|
||||
inifile_read(crc.ToUTF8());
|
||||
Console.WriteLn("patchnumber: %d", patchnumber);
|
||||
ApplyPatch(0);
|
||||
}
|
||||
|
||||
void ResetPatch( void )
|
||||
{
|
||||
patchnumber = 0;
|
||||
|
|
|
@ -62,7 +62,7 @@ void inifile_command( char* cmd );
|
|||
void inifile_trim( char* buffer );
|
||||
|
||||
int AddPatch(int Mode, int Place, int Address, int Size, u64 data);
|
||||
void ApplyPatch( int place );
|
||||
void ApplyPatch( int place = 1);
|
||||
void ResetPatch( void );
|
||||
|
||||
extern int g_ZeroGSOptions;
|
||||
|
|
Loading…
Reference in New Issue