diff --git a/pcsx2/CDVD/CDVD.cpp b/pcsx2/CDVD/CDVD.cpp index b3cec3b188..e1d3466a3b 100644 --- a/pcsx2/CDVD/CDVD.cpp +++ b/pcsx2/CDVD/CDVD.cpp @@ -541,7 +541,7 @@ void cdvdReset() cdvd.RTC.month = (u8)curtime.GetMonth(wxDateTime::GMT9) + 1; // WX returns Jan as "0" cdvd.RTC.year = (u8)(curtime.GetYear(wxDateTime::GMT9) - 2000); - GameDB = new DataBase_Loader("DataBase.dbf", "Serial"); + GameDB = new DataBase_Loader("DataBase.dbf"); } struct Freeze_v10Compat diff --git a/pcsx2/DataBase_Loader.h b/pcsx2/DataBase_Loader.h index db5c827315..1220ea0212 100644 --- a/pcsx2/DataBase_Loader.h +++ b/pcsx2/DataBase_Loader.h @@ -77,6 +77,20 @@ private: ss >> tString; return tString; } + string toLower(string s) { + for (uint i = 0; i < s.length(); i++) { + char& c = s[i]; + if (c >= 'A' && c <= 'Z') { + c += 'a' - 'A'; + } + } + return s; + } + bool strCompare(string& s1, string& s2) { + string t1 = toLower(s1); + string t2 = toLower(s2); + return !t1.compare(t2); + } bool isComment(string& s) { string sub = s.substr(0, 2); return (sub.compare("--") == 0) || (sub.compare("//") == 0); @@ -141,7 +155,7 @@ public: String_Stream header; // Header of the database string baseKey; // Key to separate games by ("Serial") - DataBase_Loader(string file, string key, string value = "") { + DataBase_Loader(string file, string key = "Serial", string value = "") { curGame = NULL; baseKey = key; if (!fileExists(file)) { @@ -191,8 +205,8 @@ public: bool setGame(string id) { deque::iterator it = gList.begin(); for ( ; it != gList.end(); ++it) { - if (!it[0]->id.compare(id)) { - curGame = it[0]; + if (strCompare(it[0]->id, id)) { + curGame = it[0]; return true; } } @@ -237,7 +251,7 @@ public: if (curGame) { deque::iterator it = curGame->kList.begin(); for ( ; it != curGame->kList.end(); ++it) { - if (!it[0].key.compare(key)) { + if (strCompare(it[0].key, key)) { return true; } } @@ -251,7 +265,7 @@ public: if (curGame) { deque::iterator it = curGame->kList.begin(); for ( ; it != curGame->kList.end(); ++it) { - if (!it[0].key.compare(key)) { + if (strCompare(it[0].key, key)) { return it[0].value; } } @@ -301,7 +315,7 @@ public: if (curGame) { deque::iterator it = curGame->kList.begin(); for ( ; it != curGame->kList.end(); ++it) { - if (!it[0].key.compare(key)) { + if (strCompare(it[0].key, key)) { it[0].value = value; return; } diff --git a/pcsx2/Patch.cpp b/pcsx2/Patch.cpp index ca88fa0009..5104e403c5 100644 --- a/pcsx2/Patch.cpp +++ b/pcsx2/Patch.cpp @@ -526,10 +526,11 @@ void ApplyPatch(int place) } } -void InitPatch(const wxString& crc) +int InitPatch(const wxString& crc) { inifile_read(crc); Console.WriteLn("patchnumber: %d", patchnumber); + return patchnumber; } void ResetPatch( void ) diff --git a/pcsx2/Patch.h b/pcsx2/Patch.h index 82b7389276..3f930897be 100644 --- a/pcsx2/Patch.h +++ b/pcsx2/Patch.h @@ -59,7 +59,7 @@ void inifile_read( const wxString& name ); void inifile_command( const wxString& cmd ); void inifile_trim( wxString& buffer ); -void InitPatch(const wxString& crc); +int InitPatch(const wxString& crc); int AddPatch(int Mode, int Place, int Address, int Size, u64 data); void ApplyPatch( int place = 1); void ResetPatch( void ); diff --git a/pcsx2/R5900.cpp b/pcsx2/R5900.cpp index 1dbeeeb80a..b3d212b53d 100644 --- a/pcsx2/R5900.cpp +++ b/pcsx2/R5900.cpp @@ -581,6 +581,7 @@ void __fastcall eeGameStarting() wxString gameName = L"Unknown Game (\?\?\?)"; wxString gameSerial = L" [" + DiscID + L"]"; wxString gameCompat = L" [Status = Unknown]"; + wxString gamePatch = L""; if (GameDB && GameDB->gameLoaded()) { int compat = GameDB->getInt("Compat"); @@ -588,11 +589,17 @@ void __fastcall eeGameStarting() gameName += L" (" + GameDB->getStringWX("Region") + L")"; gameCompat = L" [Status = "+compatToStringWX(compat)+L"]"; } - - // this title can be overwritten by patches if they set the gametitle key - Console.SetTitle(gameName + gameSerial + gameCompat); - - if (EmuConfig.EnablePatches) InitPatch(gameCRC); + + if (EmuConfig.EnablePatches) { + int patches = InitPatch(gameCRC); + if (patches) { + wxString pString( wxsFormat( L"%d", patches ) ); + gamePatch = L" [Patches = " + pString + L"]"; + } + } + + Console.SetTitle(gameName + gameSerial + gameCompat + gamePatch); + GetMTGS().SendGameCRC(ElfCRC); g_GameStarted = true; diff --git a/pcsx2/windows/VCprojects/pcsx2_2008.vcproj b/pcsx2/windows/VCprojects/pcsx2_2008.vcproj index e78c1fc0f2..48ea47bc81 100644 --- a/pcsx2/windows/VCprojects/pcsx2_2008.vcproj +++ b/pcsx2/windows/VCprojects/pcsx2_2008.vcproj @@ -320,6 +320,18 @@ > + + + + + + - - - - - -