summaryrefslogtreecommitdiff
path: root/Source/Core/Common/Src/SysConf.cpp
diff options
context:
space:
mode:
authorShawn Hoffman <godisgovernment@gmail.com>2011-03-03 00:07:33 +0000
committerShawn Hoffman <godisgovernment@gmail.com>2011-03-03 00:07:33 +0000
commitbda0794adb19a0c2c2b4a387d8b0ace133ae7a85 (patch)
tree0cf73149ad51599305fbea52d63555ed45ec612f /Source/Core/Common/Src/SysConf.cpp
parentda4832ed7e05b2e2f3ee79b92a3331ece605d8d9 (diff)
Reload sysconf file on stop in order to preserve changes committed during emulation
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7277 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/Core/Common/Src/SysConf.cpp')
-rw-r--r--Source/Core/Common/Src/SysConf.cpp21
1 files changed, 18 insertions, 3 deletions
diff --git a/Source/Core/Common/Src/SysConf.cpp b/Source/Core/Common/Src/SysConf.cpp
index 9c7cd6bad7..96f6b46167 100644
--- a/Source/Core/Common/Src/SysConf.cpp
+++ b/Source/Core/Common/Src/SysConf.cpp
@@ -19,10 +19,10 @@
#include "SysConf.h"
SysConf::SysConf()
-: m_IsValid(false)
+ : m_IsValid(false)
{
- if (LoadFromFile(File::GetUserPath(F_WIISYSCONF_IDX).c_str()))
- m_IsValid = true;
+ m_FilenameDefault = File::GetUserPath(F_WIISYSCONF_IDX);
+ m_IsValid = LoadFromFile(m_FilenameDefault.c_str());
}
SysConf::~SysConf()
@@ -31,7 +31,11 @@ SysConf::~SysConf()
return;
Save();
+ Clear();
+}
+void SysConf::Clear()
+{
for (size_t i = 0; i < m_Entries.size() - 1; i++)
{
delete [] m_Entries.at(i).data;
@@ -167,3 +171,14 @@ bool SysConf::Save()
return false;
return SaveToFile(m_Filename.c_str());
}
+
+bool SysConf::Reload()
+{
+ if (m_IsValid)
+ Clear();
+
+ std::string& filename = m_Filename.empty() ? m_FilenameDefault : m_Filename;
+
+ m_IsValid = LoadFromFile(filename.c_str());
+ return m_IsValid;
+}