From 45b07cbdcd97f2015dca5873c7949e9991ce23d4 Mon Sep 17 00:00:00 2001 From: comex Date: Mon, 20 Apr 2015 22:24:21 -0400 Subject: 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... --- Source/Core/Common/SysConf.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'Source/Core/Common/SysConf.cpp') 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; } -- cgit v1.2.3