- Console TitleBar mentions how much patches were loaded (if no patches loaded then it doesn't say anything)

- Database key searching is no-longer case-sensitive (so for example: [patch = A1B2C3D4] is the same as [Patch = a1b2c3d4])


git-svn-id: http://pcsx2.googlecode.com/svn/trunk@3024 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
cottonvibes 2010-05-16 03:51:49 +00:00
parent 9b4239d81a
commit ed9b0a3715
6 changed files with 48 additions and 26 deletions

View File

@ -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

View File

@ -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<Game_Data*>::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<key_pair>::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<key_pair>::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<key_pair>::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;
}

View File

@ -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 )

View File

@ -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 );

View File

@ -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;

View File

@ -320,6 +320,18 @@
>
</File>
</Filter>
<Filter
Name="Game DataBase"
>
<File
RelativePath="..\..\DataBase_Loader.h"
>
</File>
<File
RelativePath="..\..\File_Reader.h"
>
</File>
</Filter>
</Filter>
<Filter
Name="Docs"
@ -1281,18 +1293,6 @@
RelativePath="..\..\CDVD\IsoFileTools.h"
>
</File>
<Filter
Name="Game DataBase"
>
<File
RelativePath="..\..\DataBase_Loader.h"
>
</File>
<File
RelativePath="..\..\File_Reader.h"
>
</File>
</Filter>
</Filter>
</Filter>
<Filter