summaryrefslogtreecommitdiff
path: root/Source/Core/Common/SysConf.cpp
diff options
context:
space:
mode:
authorcomex <comexk@gmail.com>2015-04-20 22:24:21 -0400
committercomex <comexk@gmail.com>2015-05-28 19:19:00 -0400
commit45b07cbdcd97f2015dca5873c7949e9991ce23d4 (patch)
treeefc8338ec5b14e22ed0c7498abf88787a343ff74 /Source/Core/Common/SysConf.cpp
parent0d257b9e88faf63b28b5f1a25bf86447e6d095ae (diff)
Fix determinism issues with Wiimote netplay.
- Change the Wiimote emulation SYSCONF R/W to use the temporary NAND if in use. - Fix up SysConf API so this actually works. Kind of a hack. Like I said, this can be cleaned up when configuration is synced...
Diffstat (limited to 'Source/Core/Common/SysConf.cpp')
-rw-r--r--Source/Core/Common/SysConf.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/Source/Core/Common/SysConf.cpp b/Source/Core/Common/SysConf.cpp
index a0d3aa1f04..047114774a 100644
--- a/Source/Core/Common/SysConf.cpp
+++ b/Source/Core/Common/SysConf.cpp
@@ -38,6 +38,10 @@ void SysConf::Clear()
bool SysConf::LoadFromFile(const std::string& filename)
{
+ if (m_IsValid)
+ Clear();
+ m_IsValid = false;
+
// Basic check
if (!File::Exists(filename))
{
@@ -67,6 +71,7 @@ bool SysConf::LoadFromFile(const std::string& filename)
if (LoadFromFileInternal(f.ReleaseHandle()))
{
m_Filename = filename;
+ m_IsValid = true;
return true;
}
}
@@ -107,6 +112,7 @@ bool SysConf::LoadFromFileInternal(FILE *fh)
f.ReadArray(curEntry.name, curEntry.nameLength);
curEntry.name[curEntry.nameLength] = '\0';
// Get length of data
+ curEntry.data = nullptr;
curEntry.dataLength = 0;
switch (curEntry.type)
{
@@ -362,6 +368,7 @@ void SysConf::GenerateSysConf()
g.WriteBytes("SCed", 4);
m_Filename = m_FilenameDefault;
+ m_IsValid = true;
}
bool SysConf::SaveToFile(const std::string& filename)
@@ -418,11 +425,8 @@ void SysConf::UpdateLocation()
bool SysConf::Reload()
{
- if (m_IsValid)
- Clear();
-
std::string& filename = m_Filename.empty() ? m_FilenameDefault : m_Filename;
- m_IsValid = LoadFromFile(filename);
+ LoadFromFile(filename);
return m_IsValid;
}