More patch stuff. inifile_read gets passed a wxString now.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2138 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
arcum42 2009-11-06 05:50:21 +00:00
parent 0d68166b65
commit b687d4a10b
2 changed files with 7 additions and 22 deletions

View File

@ -487,35 +487,21 @@ void inifile_process( FILE * f1 )
// This routine creates a pnach filename from the games crc, // This routine creates a pnach filename from the games crc,
// loads it, and passes it to inisection_process to be parsed. // loads it, and passes it to inisection_process to be parsed.
void inifile_read( const char* name ) void inifile_read(wxString name )
{ {
FILE* f1; FILE* f1;
char buffer[ 1024 ]; wxCharBuffer buffer;
patchnumber = 0; patchnumber = 0;
#ifdef _WIN32 buffer = Path::Combine(L"patches", name + L".pnach").ToUTF8();
sprintf( buffer, "patches\\%s.pnach", name );
#else
sprintf( buffer, "patches/%s.pnach", name );
#endif
f1 = fopen( buffer, "rt" ); f1 = fopen( buffer, "rt" );
#ifndef _WIN32 #ifndef _WIN32
if( !f1 ) if( !f1 )
{ {
// try all upper case because linux is case sensitive name = name.MakeUpper();
char* pstart = buffer+8; buffer = Path::Combine(L"patches", name + L".pnach").ToUTF8();
char* pend = buffer+strlen(buffer);
while(pstart != pend )
{
// stop at the first . since we only want to update the hex
if( *pstart == '.' ) break;
*pstart = toupper(*pstart);
*pstart++;
}
f1 = fopen(buffer, "rt"); f1 = fopen(buffer, "rt");
} }
#endif #endif
@ -598,7 +584,7 @@ void ApplyPatch(int place)
void InitPatch(wxString crc) void InitPatch(wxString crc)
{ {
inifile_read(crc.ToUTF8()); inifile_read(crc);
Console.WriteLn("patchnumber: %d", patchnumber); Console.WriteLn("patchnumber: %d", patchnumber);
ApplyPatch(0); ApplyPatch(0);
} }

View File

@ -47,7 +47,6 @@ struct IniPatch
u64 data; u64 data;
}; };
namespace PatchFunc namespace PatchFunc
{ {
void comment( char* text1, char* text2 ); void comment( char* text1, char* text2 );