New GCPad/Wiimote: Enabled SDL 1.2 on the Windows build to support some gamepads that weren't working with DirectInput. Made DirectInput use (and prefer) buffered data rather than polled data (some gamepads should work better). In GUI: Changed all numeric wxChoice to wxSpinCtrl (config dialog opens much faster), removed "+" buttons, made UI more compact. Fixed a few problems that were introduced with the IniFile change. Made minor changes to IniFile.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5619 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Jordan Woyak
2010-06-05 05:30:23 +00:00
parent 6b872bb81c
commit 656ff26ed8
12 changed files with 257 additions and 196 deletions

View File

@ -60,21 +60,6 @@ static void ParseLine(const std::string& line, std::string* keyOut, std::string*
}
IniFile::Section::Section()
: lines(), name(""), comment("") {}
IniFile::Section::Section(const std::string& _name)
: lines(), name(_name), comment("") {}
IniFile::Section::Section(const Section& other)
{
name = other.name;
comment = other.comment;
lines = other.lines;
}
std::string* IniFile::Section::GetLine(const char* key, std::string* valueOut, std::string* commentOut)
{
for (std::vector<std::string>::iterator iter = lines.begin(); iter != lines.end(); ++iter)
@ -104,6 +89,14 @@ void IniFile::Section::Set(const char* key, const char* newValue)
}
}
void IniFile::Section::Set(const char* key, const std::string& newValue, const std::string& defaultValue)
{
if (newValue != defaultValue)
Set(key, newValue);
else
Delete(key);
}
bool IniFile::Section::Get(const char* key, std::string* value, const char* defaultValue)
{
std::string* line = GetLine(key, value, 0);
@ -118,6 +111,14 @@ bool IniFile::Section::Get(const char* key, std::string* value, const char* defa
return true;
}
void IniFile::Section::Set(const char* key, const float newValue, const float defaultValue)
{
if (newValue != defaultValue)
Set(key, newValue);
else
Delete(key);
}
void IniFile::Section::Set(const char* key, const std::vector<std::string>& newValues)
{
std::string temp;
@ -222,12 +223,22 @@ bool IniFile::Section::Exists(const char *key) const
return false;
}
bool IniFile::Section::Delete(const char *key)
{
std::string* line = GetLine(key, 0, 0);
for (std::vector<std::string>::iterator liter = lines.begin(); liter != lines.end(); ++liter)
{
if (line == &*liter)
{
lines.erase(liter);
return true;
}
}
return false;
}
// IniFile
IniFile::IniFile() {}
IniFile::~IniFile() {}
const IniFile::Section* IniFile::GetSection(const char* sectionName) const
{
for (std::vector<Section>::const_iterator iter = sections.begin(); iter != sections.end(); ++iter)