diff options
| author | Jordan Woyak <jordan.woyak@gmail.com> | 2010-07-23 05:22:12 +0000 |
|---|---|---|
| committer | Jordan Woyak <jordan.woyak@gmail.com> | 2010-07-23 05:22:12 +0000 |
| commit | a3e31556787c87fd708dfd4a6a194a5d62a60c59 (patch) | |
| tree | 36913cbab1c961344ba44f04f4fed399902b3432 /Source/Core/Common | |
| parent | 2e6c5b36ab895fcdb5d62d3a04ac895d1797bb05 (diff) | |
Added a button to the "Gecko Codes" panel to download/parse codes from geckocodes.org. Codes that require modifiers (the XXXX business) will still not work properly, though they should load/save fine. A few more code types should work now. (All non-ASM type codes should at least attempt to run :p) Hacked a param into IniFile::GetLines to disable removal of text after # chars, so codes with # in the name/notes should load fine.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5949 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/Core/Common')
| -rw-r--r-- | Source/Core/Common/Src/IniFile.cpp | 20 | ||||
| -rw-r--r-- | Source/Core/Common/Src/IniFile.h | 2 |
2 files changed, 13 insertions, 9 deletions
diff --git a/Source/Core/Common/Src/IniFile.cpp b/Source/Core/Common/Src/IniFile.cpp index 325b87278a..85a88bc7fc 100644 --- a/Source/Core/Common/Src/IniFile.cpp +++ b/Source/Core/Common/Src/IniFile.cpp @@ -350,7 +350,7 @@ bool IniFile::GetKeys(const char* sectionName, std::vector<std::string>& keys) c } // Return a list of all lines in a section -bool IniFile::GetLines(const char* sectionName, std::vector<std::string>& lines) const +bool IniFile::GetLines(const char* sectionName, std::vector<std::string>& lines, const bool remove_comments) const { const Section* section = GetSection(sectionName); if (!section) @@ -360,15 +360,19 @@ bool IniFile::GetLines(const char* sectionName, std::vector<std::string>& lines) for (std::vector<std::string>::const_iterator iter = section->lines.begin(); iter != section->lines.end(); ++iter) { std::string line = StripSpaces(*iter); - int commentPos = (int)line.find('#'); - if (commentPos == 0) - { - continue; - } - if (commentPos != (int)std::string::npos) + if (remove_comments) { - line = StripSpaces(line.substr(0, commentPos)); + int commentPos = (int)line.find('#'); + if (commentPos == 0) + { + continue; + } + + if (commentPos != (int)std::string::npos) + { + line = StripSpaces(line.substr(0, commentPos)); + } } lines.push_back(line); diff --git a/Source/Core/Common/Src/IniFile.h b/Source/Core/Common/Src/IniFile.h index 05eff76cdd..3c4959f04b 100644 --- a/Source/Core/Common/Src/IniFile.h +++ b/Source/Core/Common/Src/IniFile.h @@ -123,7 +123,7 @@ public: bool GetKeys(const char* sectionName, std::vector<std::string>& keys) const; void SetLines(const char* sectionName, const std::vector<std::string> &lines); - bool GetLines(const char* sectionName, std::vector<std::string>& lines) const; + bool GetLines(const char* sectionName, std::vector<std::string>& lines, const bool remove_comments = true) const; bool DeleteKey(const char* sectionName, const char* key); bool DeleteSection(const char* sectionName); |
