From b687d4a10b8fb714faeff989c80f1561172cb7cf Mon Sep 17 00:00:00 2001 From: arcum42 Date: Fri, 6 Nov 2009 05:50:21 +0000 Subject: [PATCH] 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 --- pcsx2/Patch.cpp | 28 +++++++--------------------- pcsx2/Patch.h | 1 - 2 files changed, 7 insertions(+), 22 deletions(-) diff --git a/pcsx2/Patch.cpp b/pcsx2/Patch.cpp index a3f8950b1c..aec7b2e413 100644 --- a/pcsx2/Patch.cpp +++ b/pcsx2/Patch.cpp @@ -487,36 +487,22 @@ void inifile_process( FILE * f1 ) // 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 ) +void inifile_read(wxString name ) { FILE* f1; - char buffer[ 1024 ]; + wxCharBuffer buffer; patchnumber = 0; -#ifdef _WIN32 - sprintf( buffer, "patches\\%s.pnach", name ); -#else - sprintf( buffer, "patches/%s.pnach", name ); -#endif - + buffer = Path::Combine(L"patches", name + L".pnach").ToUTF8(); f1 = fopen( buffer, "rt" ); #ifndef _WIN32 if( !f1 ) { - // try all upper case because linux is case sensitive - char* pstart = buffer+8; - 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"); + name = name.MakeUpper(); + buffer = Path::Combine(L"patches", name + L".pnach").ToUTF8(); + f1 = fopen(buffer, "rt"); } #endif @@ -598,7 +584,7 @@ void ApplyPatch(int place) void InitPatch(wxString crc) { - inifile_read(crc.ToUTF8()); + inifile_read(crc); Console.WriteLn("patchnumber: %d", patchnumber); ApplyPatch(0); } diff --git a/pcsx2/Patch.h b/pcsx2/Patch.h index e4aa6fec1d..6ea4e8c1f5 100644 --- a/pcsx2/Patch.h +++ b/pcsx2/Patch.h @@ -47,7 +47,6 @@ struct IniPatch u64 data; }; - namespace PatchFunc { void comment( char* text1, char* text2 );