Prevented that an empty SYSCONF file is saved if it's missing from the config dir.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1228 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
John Peterson
2008-11-20 15:29:35 +00:00
parent 12a8174446
commit 748da8b464
2 changed files with 30 additions and 21 deletions

View File

@ -69,10 +69,12 @@ CConfigMain::CConfigMain(wxWindow* parent, wxWindowID id, const wxString& title,
{ {
fread(m_SYSCONF, 1, 0x4000, pStream); fread(m_SYSCONF, 1, 0x4000, pStream);
fclose(pStream); fclose(pStream);
m_bSysconfOK = true;
} }
else else
{ {
PanicAlert("Could not read " FULL_CONFIG_DIR "SYSCONF"); PanicAlert("Could not read " FULL_CONFIG_DIR "SYSCONF. Please recover the SYSCONF file to that location.");
m_bSysconfOK = false;
} }
CreateGUIControls(); CreateGUIControls();
@ -301,6 +303,10 @@ void CConfigMain::OnClose(wxCloseEvent& WXUNUSED (event))
{ {
Destroy(); Destroy();
/* First check that we did successfully populate m_SYSCONF earlier, otherwise don't
save anything, it will be a corrupted file */
if(m_bSysconfOK)
{
// Save Wii SYSCONF twice so that we can keep game specific settings for it // Save Wii SYSCONF twice so that we can keep game specific settings for it
pStream = NULL; pStream = NULL;
pStream = fopen(FULL_CONFIG_DIR "SYSCONF", "wb"); pStream = fopen(FULL_CONFIG_DIR "SYSCONF", "wb");
@ -324,6 +330,7 @@ void CConfigMain::OnClose(wxCloseEvent& WXUNUSED (event))
{ {
PanicAlert("Could not write to shared2/sys/SYSCONF"); PanicAlert("Could not write to shared2/sys/SYSCONF");
} }
}
// save the config... dolphin crashes by far to often to save the settings on closing only // save the config... dolphin crashes by far to often to save the settings on closing only
SConfig::GetInstance().SaveSettings(); SConfig::GetInstance().SaveSettings();

View File

@ -88,6 +88,8 @@ class CConfigMain
FILE* pStream; FILE* pStream;
u8 m_SYSCONF[0x4000]; u8 m_SYSCONF[0x4000];
bool m_bSysconfOK;
enum enum
{ {
BT_DINF = 0x0044, BT_DINF = 0x0044,