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
This commit is contained in:
parent
da4832ed7e
commit
bda0794adb
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -78,12 +78,6 @@ struct SSysConfEntry
|
|||
|
||||
class SysConf
|
||||
{
|
||||
private:
|
||||
SSysConfHeader m_Header;
|
||||
std::string m_Filename;
|
||||
std::vector<SSysConfEntry> m_Entries;
|
||||
bool m_IsValid;
|
||||
|
||||
public:
|
||||
SysConf();
|
||||
~SysConf();
|
||||
|
@ -182,8 +176,17 @@ public:
|
|||
bool Save();
|
||||
bool SaveToFile(const char* filename);
|
||||
bool LoadFromFile(const char* filename);
|
||||
bool Reload();
|
||||
|
||||
private:
|
||||
bool LoadFromFileInternal(FILE *f);
|
||||
void Clear();
|
||||
|
||||
SSysConfHeader m_Header;
|
||||
std::string m_Filename;
|
||||
std::string m_FilenameDefault;
|
||||
std::vector<SSysConfEntry> m_Entries;
|
||||
bool m_IsValid;
|
||||
};
|
||||
|
||||
#endif // __SYSCONF_MANAGER_h__
|
||||
|
|
|
@ -324,6 +324,10 @@ void Stop() // - Hammertime!
|
|||
Wiimote::Shutdown();
|
||||
g_video_backend->Shutdown();
|
||||
|
||||
// Reload sysconf file in order to see changes committed during emulation
|
||||
if (_CoreParameter.bWii)
|
||||
SConfig::GetInstance().m_SYSCONF->Reload();
|
||||
|
||||
INFO_LOG(CONSOLE, "Stop [Main Thread]\t\t---- Shutdown complete ----");
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue