From 427206a97c2313175cbe073b9440297a9cece7e6 Mon Sep 17 00:00:00 2001 From: arcum42 Date: Sat, 15 May 2010 06:51:10 +0000 Subject: [PATCH] Fixed the database reader in Linux again (by moving the check into a better location). Got rid of some unused Patch code. git-svn-id: http://pcsx2.googlecode.com/svn/trunk@3013 96395faa-99c1-11dd-bbfe-3dabce05a288 --- pcsx2/DataBase_Loader.h | 16 +++++++++------- pcsx2/File_Reader.h | 9 +++++++-- pcsx2/Patch.cpp | 16 ++-------------- pcsx2/Patch.h | 3 --- 4 files changed, 18 insertions(+), 26 deletions(-) diff --git a/pcsx2/DataBase_Loader.h b/pcsx2/DataBase_Loader.h index 0bfbd61bf4..8d47c2a5ae 100644 --- a/pcsx2/DataBase_Loader.h +++ b/pcsx2/DataBase_Loader.h @@ -22,10 +22,12 @@ struct key_pair { key_pair(string _key, string _value) : key(_key) , value(_value) {} string toString() { - string t; + string t; + if (key[0] == '[') { t = key + "\n"; - t += value; + t += value; + stringstream ss(key); string t2; ss >> t2; @@ -92,15 +94,15 @@ private: keyPair.key = line; } for(;;) { - t = reader.getLine(); + t = reader.getLine(); + int eol = t.rfind("\r"); + if (eol != string::npos) t = t.substr(0, eol); + if (!t.compare(endString)) break; keyPair.value += t + "\n"; } } - void extract(string& line, key_pair& keyPair, File_Reader& reader) { - int eol = line.rfind("\r"); - if (eol != string::npos) line = line.substr(0, eol); - + void extract(string& line, key_pair& keyPair, File_Reader& reader) { stringstream ss(line); string t; keyPair.key = ""; diff --git a/pcsx2/File_Reader.h b/pcsx2/File_Reader.h index b7d651ff7b..5c21c0697c 100644 --- a/pcsx2/File_Reader.h +++ b/pcsx2/File_Reader.h @@ -61,8 +61,13 @@ public: string getLine() { if (fs->eof()) throw 1; fs->getline(buff, sizeof(buff)); - if (fs->fail()) throw 1; - return string(buff); + if (fs->fail()) throw 1; + + string ret(buff); + int eol = ret.rfind("\r"); + if (eol != string::npos) ret = ret.substr(0, eol); + + return ret; } template void readLine(T& str) { if (fs->eof()) throw 1; diff --git a/pcsx2/Patch.cpp b/pcsx2/Patch.cpp index 1b0d1ef5b7..ca88fa0009 100644 --- a/pcsx2/Patch.cpp +++ b/pcsx2/Patch.cpp @@ -27,7 +27,7 @@ u32 SkipCount = 0, IterationCount = 0; u32 IterationIncrement = 0, ValueIncrement = 0; u32 PrevCheatType = 0, PrevCheatAddr = 0,LastType = 0; -int g_ZeroGSOptions = 0, patchnumber; +int patchnumber; wxString strgametitle; @@ -43,17 +43,11 @@ static const PatchTextTable commands[] = { 1, L"comment", PatchFunc::comment }, { 2, L"gametitle", PatchFunc::gametitle }, { 3, L"patch", PatchFunc::patch }, - { 4, L"fastmemory", NULL }, // enable for faster but bugger mem (mvc2 is faster) - { 5, L"roundmode", PatchFunc::roundmode }, // changes rounding mode for floating point + { 4, L"roundmode", PatchFunc::roundmode }, // changes rounding mode for floating point // syntax: roundmode=X,Y // possible values for X,Y: NEAR, DOWN, UP, CHOP // X - EE rounding mode (default is NEAR) // Y - VU rounding mode (default is CHOP) - { 6, L"zerogs", PatchFunc::zerogs }, // zerogs=hex - { 7, L"vunanmode", NULL }, - { 8, L"ffxhack", NULL}, // *obsolete* - { 9, L"xkickdelay", NULL}, - { 0, wxEmptyString, NULL } // Array Terminator }; @@ -724,12 +718,6 @@ namespace PatchFunc SetRoundMode(eetype,vutype); } - - void zerogs(const wxString& cmd, const wxString& param) - { - DevCon.WriteLn( cmd + L" " + param); - g_ZeroGSOptions = StrToU32(param, 16); - } } void PrintRoundMode(SSE_RoundMode ee, SSE_RoundMode vu) diff --git a/pcsx2/Patch.h b/pcsx2/Patch.h index ed8898c820..82b7389276 100644 --- a/pcsx2/Patch.h +++ b/pcsx2/Patch.h @@ -53,7 +53,6 @@ namespace PatchFunc PATCHTABLEFUNC gametitle; PATCHTABLEFUNC patch; PATCHTABLEFUNC roundmode; - PATCHTABLEFUNC zerogs; } void inifile_read( const wxString& name ); @@ -65,8 +64,6 @@ int AddPatch(int Mode, int Place, int Address, int Size, u64 data); void ApplyPatch( int place = 1); void ResetPatch( void ); -extern int g_ZeroGSOptions; - void SetRoundMode(SSE_RoundMode ee, SSE_RoundMode vu); #endif /* __PATCH_H__ */