From a3e31556787c87fd708dfd4a6a194a5d62a60c59 Mon Sep 17 00:00:00 2001 From: Jordan Woyak Date: Fri, 23 Jul 2010 05:22:12 +0000 Subject: 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 --- Source/Core/Common/Src/IniFile.cpp | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'Source/Core/Common/Src/IniFile.cpp') 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& keys) c } // Return a list of all lines in a section -bool IniFile::GetLines(const char* sectionName, std::vector& lines) const +bool IniFile::GetLines(const char* sectionName, std::vector& 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& lines) for (std::vector::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); -- cgit v1.2.3