API change: Simplified handling of app/emu config defaults handling. Got rid of the mandatory "defaults" override -- LoadSave APIs for Pcsx2Config and EmuConfig now use the current settings of the class instead.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@4177 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
Jake.Stine 2011-01-04 22:49:58 +00:00
parent 83e09878b2
commit 267b3bd90d
5 changed files with 57 additions and 69 deletions

View File

@ -18,6 +18,7 @@
#include "Path.h" #include "Path.h"
#include "FixedPointTypes.h" #include "FixedPointTypes.h"
#include <wx/config.h> #include <wx/config.h>
#include <wx/gdicmn.h>
// -------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------
// IniInterface (abstract base class) // IniInterface (abstract base class)
@ -48,9 +49,9 @@ public:
virtual bool IsLoading() const=0; virtual bool IsLoading() const=0;
bool IsSaving() const { return !IsLoading(); } bool IsSaving() const { return !IsLoading(); }
virtual void Entry( const wxString& var, wxString& value, const wxString& defvalue=wxString() )=0; virtual void Entry( const wxString& var, wxString& value, const wxString defvalue=wxString() )=0;
virtual void Entry( const wxString& var, wxDirName& value, const wxDirName& defvalue=wxDirName() )=0; virtual void Entry( const wxString& var, wxDirName& value, const wxDirName defvalue=wxDirName() )=0;
virtual void Entry( const wxString& var, wxFileName& value, const wxFileName& defvalue=wxFileName() )=0; virtual void Entry( const wxString& var, wxFileName& value, const wxFileName defvalue=wxFileName() )=0;
virtual void Entry( const wxString& var, int& value, const int defvalue=0 )=0; virtual void Entry( const wxString& var, int& value, const int defvalue=0 )=0;
virtual void Entry( const wxString& var, uint& value, const uint defvalue=0 )=0; virtual void Entry( const wxString& var, uint& value, const uint defvalue=0 )=0;
virtual void Entry( const wxString& var, bool& value, const bool defvalue=false )=0; virtual void Entry( const wxString& var, bool& value, const bool defvalue=false )=0;
@ -59,11 +60,11 @@ public:
virtual bool EntryBitBool( const wxString& var, bool value, const bool defvalue=false )=0; virtual bool EntryBitBool( const wxString& var, bool value, const bool defvalue=false )=0;
virtual int EntryBitfield( const wxString& var, int value, const int defvalue=0 )=0; virtual int EntryBitfield( const wxString& var, int value, const int defvalue=0 )=0;
virtual void Entry( const wxString& var, Fixed100& value, const Fixed100& defvalue=Fixed100() )=0; virtual void Entry( const wxString& var, Fixed100& value, const Fixed100 defvalue=Fixed100() )=0;
virtual void Entry( const wxString& var, wxPoint& value, const wxPoint& defvalue=wxDefaultPosition )=0; virtual void Entry( const wxString& var, wxPoint& value, const wxPoint defvalue=wxDefaultPosition )=0;
virtual void Entry( const wxString& var, wxSize& value, const wxSize& defvalue=wxDefaultSize )=0; virtual void Entry( const wxString& var, wxSize& value, const wxSize defvalue=wxDefaultSize )=0;
virtual void Entry( const wxString& var, wxRect& value, const wxRect& defvalue=wxDefaultRect )=0; virtual void Entry( const wxString& var, wxRect& value, const wxRect defvalue=wxDefaultRect )=0;
template< typename T > template< typename T >
void EnumEntry( const wxString& var, T& value, const wxChar* const* enumArray=NULL, const T defvalue=(T)0 ) void EnumEntry( const wxString& var, T& value, const wxChar* const* enumArray=NULL, const T defvalue=(T)0 )
@ -111,9 +112,9 @@ public:
bool IsLoading() const { return true; } bool IsLoading() const { return true; }
void Entry( const wxString& var, wxString& value, const wxString& defvalue=wxEmptyString ); void Entry( const wxString& var, wxString& value, const wxString defvalue=wxEmptyString );
void Entry( const wxString& var, wxDirName& value, const wxDirName& defvalue=wxDirName() ); void Entry( const wxString& var, wxDirName& value, const wxDirName defvalue=wxDirName() );
void Entry( const wxString& var, wxFileName& value, const wxFileName& defvalue=wxFileName() ); void Entry( const wxString& var, wxFileName& value, const wxFileName defvalue=wxFileName() );
void Entry( const wxString& var, int& value, const int defvalue=0 ); void Entry( const wxString& var, int& value, const int defvalue=0 );
void Entry( const wxString& var, uint& value, const uint defvalue=0 ); void Entry( const wxString& var, uint& value, const uint defvalue=0 );
void Entry( const wxString& var, bool& value, const bool defvalue=false ); void Entry( const wxString& var, bool& value, const bool defvalue=false );
@ -121,11 +122,11 @@ public:
bool EntryBitBool( const wxString& var, bool value, const bool defvalue=false ); bool EntryBitBool( const wxString& var, bool value, const bool defvalue=false );
int EntryBitfield( const wxString& var, int value, const int defvalue=0 ); int EntryBitfield( const wxString& var, int value, const int defvalue=0 );
void Entry( const wxString& var, Fixed100& value, const Fixed100& defvalue=Fixed100() ); void Entry( const wxString& var, Fixed100& value, const Fixed100 defvalue=Fixed100() );
void Entry( const wxString& var, wxPoint& value, const wxPoint& defvalue=wxDefaultPosition ); void Entry( const wxString& var, wxPoint& value, const wxPoint defvalue=wxDefaultPosition );
void Entry( const wxString& var, wxSize& value, const wxSize& defvalue=wxDefaultSize ); void Entry( const wxString& var, wxSize& value, const wxSize defvalue=wxDefaultSize );
void Entry( const wxString& var, wxRect& value, const wxRect& defvalue=wxDefaultRect ); void Entry( const wxString& var, wxRect& value, const wxRect defvalue=wxDefaultRect );
protected: protected:
void _EnumEntry( const wxString& var, int& value, const wxChar* const* enumArray, int defvalue ); void _EnumEntry( const wxString& var, int& value, const wxChar* const* enumArray, int defvalue );
@ -149,9 +150,9 @@ public:
bool IsLoading() const { return false; } bool IsLoading() const { return false; }
void Entry( const wxString& var, wxString& value, const wxString& defvalue=wxString() ); void Entry( const wxString& var, wxString& value, const wxString defvalue=wxString() );
void Entry( const wxString& var, wxDirName& value, const wxDirName& defvalue=wxDirName() ); void Entry( const wxString& var, wxDirName& value, const wxDirName defvalue=wxDirName() );
void Entry( const wxString& var, wxFileName& value, const wxFileName& defvalue=wxFileName() ); void Entry( const wxString& var, wxFileName& value, const wxFileName defvalue=wxFileName() );
void Entry( const wxString& var, int& value, const int defvalue=0 ); void Entry( const wxString& var, int& value, const int defvalue=0 );
void Entry( const wxString& var, uint& value, const uint defvalue=0 ); void Entry( const wxString& var, uint& value, const uint defvalue=0 );
void Entry( const wxString& var, bool& value, const bool defvalue=false ); void Entry( const wxString& var, bool& value, const bool defvalue=false );
@ -159,11 +160,11 @@ public:
bool EntryBitBool( const wxString& var, bool value, const bool defvalue=false ); bool EntryBitBool( const wxString& var, bool value, const bool defvalue=false );
int EntryBitfield( const wxString& var, int value, const int defvalue=0 ); int EntryBitfield( const wxString& var, int value, const int defvalue=0 );
void Entry( const wxString& var, Fixed100& value, const Fixed100& defvalue=Fixed100() ); void Entry( const wxString& var, Fixed100& value, const Fixed100 defvalue=Fixed100() );
void Entry( const wxString& var, wxPoint& value, const wxPoint& defvalue=wxDefaultPosition ); void Entry( const wxString& var, wxPoint& value, const wxPoint defvalue=wxDefaultPosition );
void Entry( const wxString& var, wxSize& value, const wxSize& defvalue=wxDefaultSize ); void Entry( const wxString& var, wxSize& value, const wxSize defvalue=wxDefaultSize );
void Entry( const wxString& var, wxRect& value, const wxRect& defvalue=wxDefaultRect ); void Entry( const wxString& var, wxRect& value, const wxRect defvalue=wxDefaultRect );
protected: protected:
void _EnumEntry( const wxString& var, int& value, const wxChar* const* enumArray, int defvalue ); void _EnumEntry( const wxString& var, int& value, const wxChar* const* enumArray, int defvalue );
@ -173,9 +174,9 @@ protected:
// GCC Note: wxT() macro is required when using string token pasting. For some reason L generates // GCC Note: wxT() macro is required when using string token pasting. For some reason L generates
// syntax errors. >_< // syntax errors. >_<
// //
#define IniEntry( varname ) ini.Entry( wxT(#varname), varname, defaults.varname ) #define IniEntry( varname ) ini.Entry( wxT(#varname), varname, varname )
#define IniBitfield( varname ) varname = ini.EntryBitfield( wxT(#varname), varname, defaults.varname ) #define IniBitfield( varname ) varname = ini.EntryBitfield( wxT(#varname), varname, varname )
#define IniBitBool( varname ) varname = ini.EntryBitBool( wxT(#varname), !!varname, defaults.varname ) #define IniBitBool( varname ) varname = ini.EntryBitBool( wxT(#varname), !!varname, varname )
#define IniBitfieldEx( varname, textname ) varname = ini.EntryBitfield( wxT(textname), varname, defaults.varname ) #define IniBitfieldEx( varname, textname ) varname = ini.EntryBitfield( wxT(textname), varname, varname )
#define IniBitBoolEx( varname, textname ) varname = ini.EntryBitBool( wxT(textname), !!varname, defaults.varname ) #define IniBitBoolEx( varname, textname ) varname = ini.EntryBitBool( wxT(textname), !!varname, varname )

View File

@ -94,7 +94,7 @@ IniLoader::IniLoader() : IniInterface() {}
IniLoader::~IniLoader() throw() {} IniLoader::~IniLoader() throw() {}
void IniLoader::Entry( const wxString& var, wxString& value, const wxString& defvalue ) void IniLoader::Entry( const wxString& var, wxString& value, const wxString defvalue )
{ {
if( m_Config ) if( m_Config )
m_Config->Read( var, &value, defvalue ); m_Config->Read( var, &value, defvalue );
@ -102,7 +102,7 @@ void IniLoader::Entry( const wxString& var, wxString& value, const wxString& def
value = defvalue; value = defvalue;
} }
void IniLoader::Entry( const wxString& var, wxDirName& value, const wxDirName& defvalue ) void IniLoader::Entry( const wxString& var, wxDirName& value, const wxDirName defvalue )
{ {
wxString dest; wxString dest;
if( m_Config ) m_Config->Read( var, &dest, wxEmptyString ); if( m_Config ) m_Config->Read( var, &dest, wxEmptyString );
@ -113,7 +113,7 @@ void IniLoader::Entry( const wxString& var, wxDirName& value, const wxDirName& d
value = dest; value = dest;
} }
void IniLoader::Entry( const wxString& var, wxFileName& value, const wxFileName& defvalue ) void IniLoader::Entry( const wxString& var, wxFileName& value, const wxFileName defvalue )
{ {
wxString dest( defvalue.GetFullPath() ); wxString dest( defvalue.GetFullPath() );
if( m_Config ) m_Config->Read( var, &dest, defvalue.GetFullPath() ); if( m_Config ) m_Config->Read( var, &dest, defvalue.GetFullPath() );
@ -159,7 +159,7 @@ int IniLoader::EntryBitfield( const wxString& var, int value, const int defvalue
return result; return result;
} }
void IniLoader::Entry( const wxString& var, Fixed100& value, const Fixed100& defvalue ) void IniLoader::Entry( const wxString& var, Fixed100& value, const Fixed100 defvalue )
{ {
// Note: the "easy" way would be to convert to double and load/save that, but floating point // Note: the "easy" way would be to convert to double and load/save that, but floating point
// has way too much rounding error so we really need to do things out manually.. >_< // has way too much rounding error so we really need to do things out manually.. >_<
@ -169,7 +169,7 @@ void IniLoader::Entry( const wxString& var, Fixed100& value, const Fixed100& def
value = Fixed100::FromString( readval, value ); value = Fixed100::FromString( readval, value );
} }
void IniLoader::Entry( const wxString& var, wxPoint& value, const wxPoint& defvalue ) void IniLoader::Entry( const wxString& var, wxPoint& value, const wxPoint defvalue )
{ {
if( !m_Config ) if( !m_Config )
{ {
@ -178,7 +178,7 @@ void IniLoader::Entry( const wxString& var, wxPoint& value, const wxPoint& defva
TryParse( value, m_Config->Read( var, ToString( defvalue ) ), defvalue ); TryParse( value, m_Config->Read( var, ToString( defvalue ) ), defvalue );
} }
void IniLoader::Entry( const wxString& var, wxSize& value, const wxSize& defvalue ) void IniLoader::Entry( const wxString& var, wxSize& value, const wxSize defvalue )
{ {
if( !m_Config ) if( !m_Config )
{ {
@ -187,7 +187,7 @@ void IniLoader::Entry( const wxString& var, wxSize& value, const wxSize& defvalu
TryParse( value, m_Config->Read( var, ToString( defvalue ) ), defvalue ); TryParse( value, m_Config->Read( var, ToString( defvalue ) ), defvalue );
} }
void IniLoader::Entry( const wxString& var, wxRect& value, const wxRect& defvalue ) void IniLoader::Entry( const wxString& var, wxRect& value, const wxRect defvalue )
{ {
if( !m_Config ) if( !m_Config )
{ {
@ -243,13 +243,13 @@ IniSaver::IniSaver( wxConfigBase* config ) : IniInterface( config ) { }
IniSaver::IniSaver() : IniInterface() {} IniSaver::IniSaver() : IniInterface() {}
IniSaver::~IniSaver() {} IniSaver::~IniSaver() {}
void IniSaver::Entry( const wxString& var, wxString& value, const wxString& defvalue ) void IniSaver::Entry( const wxString& var, wxString& value, const wxString defvalue )
{ {
if( !m_Config ) return; if( !m_Config ) return;
m_Config->Write( var, value ); m_Config->Write( var, value );
} }
void IniSaver::Entry( const wxString& var, wxDirName& value, const wxDirName& defvalue ) void IniSaver::Entry( const wxString& var, wxDirName& value, const wxDirName defvalue )
{ {
if( !m_Config ) return; if( !m_Config ) return;
@ -259,7 +259,7 @@ void IniSaver::Entry( const wxString& var, wxDirName& value, const wxDirName& de
m_Config->Write( var, value.ToString() ); m_Config->Write( var, value.ToString() );
} }
void IniSaver::Entry( const wxString& var, wxFileName& value, const wxFileName& defvalue ) void IniSaver::Entry( const wxString& var, wxFileName& value, const wxFileName defvalue )
{ {
if( !m_Config ) return; if( !m_Config ) return;
m_Config->Write( var, value.GetFullPath() ); m_Config->Write( var, value.GetFullPath() );
@ -295,7 +295,7 @@ int IniSaver::EntryBitfield( const wxString& var, int value, const int defvalue
return value; return value;
} }
void IniSaver::Entry( const wxString& var, Fixed100& value, const Fixed100& defvalue ) void IniSaver::Entry( const wxString& var, Fixed100& value, const Fixed100 defvalue )
{ {
if( !m_Config ) return; if( !m_Config ) return;
@ -305,19 +305,19 @@ void IniSaver::Entry( const wxString& var, Fixed100& value, const Fixed100& defv
m_Config->Write( var, value.ToString() ); m_Config->Write( var, value.ToString() );
} }
void IniSaver::Entry( const wxString& var, wxPoint& value, const wxPoint& defvalue ) void IniSaver::Entry( const wxString& var, wxPoint& value, const wxPoint defvalue )
{ {
if( !m_Config ) return; if( !m_Config ) return;
m_Config->Write( var, ToString( value ) ); m_Config->Write( var, ToString( value ) );
} }
void IniSaver::Entry( const wxString& var, wxSize& value, const wxSize& defvalue ) void IniSaver::Entry( const wxString& var, wxSize& value, const wxSize defvalue )
{ {
if( !m_Config ) return; if( !m_Config ) return;
m_Config->Write( var, ToString( value ) ); m_Config->Write( var, ToString( value ) );
} }
void IniSaver::Entry( const wxString& var, wxRect& value, const wxRect& defvalue ) void IniSaver::Entry( const wxString& var, wxRect& value, const wxRect defvalue )
{ {
if( !m_Config ) return; if( !m_Config ) return;
m_Config->Write( var, ToString( value ) ); m_Config->Write( var, ToString( value ) );

View File

@ -23,7 +23,6 @@
void TraceLogFilters::LoadSave( IniInterface& ini ) void TraceLogFilters::LoadSave( IniInterface& ini )
{ {
TraceLogFilters defaults;
ScopedIniGroup path( ini, L"TraceLog" ); ScopedIniGroup path( ini, L"TraceLog" );
IniEntry( Enabled ); IniEntry( Enabled );
@ -56,7 +55,6 @@ Pcsx2Config::SpeedhackOptions& Pcsx2Config::SpeedhackOptions::DisableAll()
void Pcsx2Config::SpeedhackOptions::LoadSave( IniInterface& ini ) void Pcsx2Config::SpeedhackOptions::LoadSave( IniInterface& ini )
{ {
SpeedhackOptions defaults;
ScopedIniGroup path( ini, L"Speedhacks" ); ScopedIniGroup path( ini, L"Speedhacks" );
IniBitfield( EECycleRate ); IniBitfield( EECycleRate );
@ -71,7 +69,6 @@ void Pcsx2Config::SpeedhackOptions::LoadSave( IniInterface& ini )
void Pcsx2Config::ProfilerOptions::LoadSave( IniInterface& ini ) void Pcsx2Config::ProfilerOptions::LoadSave( IniInterface& ini )
{ {
ProfilerOptions defaults;
ScopedIniGroup path( ini, L"Profiler" ); ScopedIniGroup path( ini, L"Profiler" );
IniBitBool( Enabled ); IniBitBool( Enabled );
@ -144,7 +141,6 @@ void Pcsx2Config::RecompilerOptions::ApplySanityCheck()
void Pcsx2Config::RecompilerOptions::LoadSave( IniInterface& ini ) void Pcsx2Config::RecompilerOptions::LoadSave( IniInterface& ini )
{ {
RecompilerOptions defaults;
ScopedIniGroup path( ini, L"Recompiler" ); ScopedIniGroup path( ini, L"Recompiler" );
IniBitBool( EnableEE ); IniBitBool( EnableEE );
@ -185,7 +181,6 @@ void Pcsx2Config::CpuOptions::ApplySanityCheck()
void Pcsx2Config::CpuOptions::LoadSave( IniInterface& ini ) void Pcsx2Config::CpuOptions::LoadSave( IniInterface& ini )
{ {
CpuOptions defaults;
ScopedIniGroup path( ini, L"CPU" ); ScopedIniGroup path( ini, L"CPU" );
IniBitBoolEx( sseMXCSR.DenormalsAreZero, "FPU.DenormalsAreZero" ); IniBitBoolEx( sseMXCSR.DenormalsAreZero, "FPU.DenormalsAreZero" );
@ -221,7 +216,6 @@ Pcsx2Config::GSOptions::GSOptions()
void Pcsx2Config::GSOptions::LoadSave( IniInterface& ini ) void Pcsx2Config::GSOptions::LoadSave( IniInterface& ini )
{ {
GSOptions defaults;
ScopedIniGroup path( ini, L"GS" ); ScopedIniGroup path( ini, L"GS" );
IniEntry( SynchronousMTGS ); IniEntry( SynchronousMTGS );
@ -237,7 +231,7 @@ void Pcsx2Config::GSOptions::LoadSave( IniInterface& ini )
IniEntry( FrameratePAL ); IniEntry( FrameratePAL );
static const wxChar * const ntsc_pal_str[2] = { L"ntsc", L"pal" }; static const wxChar * const ntsc_pal_str[2] = { L"ntsc", L"pal" };
ini.EnumEntry( L"DefaultRegionMode", DefaultRegionMode, ntsc_pal_str, defaults.DefaultRegionMode ); ini.EnumEntry( L"DefaultRegionMode", DefaultRegionMode, ntsc_pal_str, DefaultRegionMode );
IniEntry( FramesToDraw ); IniEntry( FramesToDraw );
IniEntry( FramesToSkip ); IniEntry( FramesToSkip );
@ -339,7 +333,6 @@ bool Pcsx2Config::GamefixOptions::Get( GamefixId id ) const
void Pcsx2Config::GamefixOptions::LoadSave( IniInterface& ini ) void Pcsx2Config::GamefixOptions::LoadSave( IniInterface& ini )
{ {
GamefixOptions defaults;
ScopedIniGroup path( ini, L"Gamefixes" ); ScopedIniGroup path( ini, L"Gamefixes" );
IniBitBool( VuAddSubHack ); IniBitBool( VuAddSubHack );
@ -364,7 +357,6 @@ Pcsx2Config::Pcsx2Config()
void Pcsx2Config::LoadSave( IniInterface& ini ) void Pcsx2Config::LoadSave( IniInterface& ini )
{ {
Pcsx2Config defaults;
ScopedIniGroup path( ini, L"EmuCore" ); ScopedIniGroup path( ini, L"EmuCore" );
IniBitBool( CdvdVerboseReads ); IniBitBool( CdvdVerboseReads );

View File

@ -437,15 +437,14 @@ void AppConfig::LoadSaveUserMode( IniInterface& ini, const wxString& cwdhash )
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
void AppConfig::LoadSaveMemcards( IniInterface& ini ) void AppConfig::LoadSaveMemcards( IniInterface& ini )
{ {
AppConfig defaults;
ScopedIniGroup path( ini, L"MemoryCards" ); ScopedIniGroup path( ini, L"MemoryCards" );
for( uint slot=0; slot<2; ++slot ) for( uint slot=0; slot<2; ++slot )
{ {
ini.Entry( wxsFormat( L"Slot%u_Enable", slot+1 ), ini.Entry( pxsFmt( L"Slot%u_Enable", slot+1 ),
Mcd[slot].Enabled, defaults.Mcd[slot].Enabled ); Mcd[slot].Enabled, Mcd[slot].Enabled );
ini.Entry( wxsFormat( L"Slot%u_Filename", slot+1 ), ini.Entry( pxsFmt( L"Slot%u_Filename", slot+1 ),
Mcd[slot].Filename, defaults.Mcd[slot].Filename ); Mcd[slot].Filename, Mcd[slot].Filename );
} }
for( uint slot=2; slot<8; ++slot ) for( uint slot=2; slot<8; ++slot )
@ -453,24 +452,22 @@ void AppConfig::LoadSaveMemcards( IniInterface& ini )
int mtport = FileMcd_GetMtapPort(slot)+1; int mtport = FileMcd_GetMtapPort(slot)+1;
int mtslot = FileMcd_GetMtapSlot(slot)+1; int mtslot = FileMcd_GetMtapSlot(slot)+1;
ini.Entry( wxsFormat( L"Multitap%u_Slot%u_Enable", mtport, mtslot ), ini.Entry( pxsFmt( L"Multitap%u_Slot%u_Enable", mtport, mtslot ),
Mcd[slot].Enabled, defaults.Mcd[slot].Enabled ); Mcd[slot].Enabled, Mcd[slot].Enabled );
ini.Entry( wxsFormat( L"Multitap%u_Slot%u_Filename", mtport, mtslot ), ini.Entry( pxsFmt( L"Multitap%u_Slot%u_Filename", mtport, mtslot ),
Mcd[slot].Filename, defaults.Mcd[slot].Filename ); Mcd[slot].Filename, Mcd[slot].Filename );
} }
} }
void AppConfig::LoadSaveRootItems( IniInterface& ini ) void AppConfig::LoadSaveRootItems( IniInterface& ini )
{ {
AppConfig defaults;
IniEntry( MainGuiPosition ); IniEntry( MainGuiPosition );
IniEntry( SysSettingsTabName ); IniEntry( SysSettingsTabName );
IniEntry( McdSettingsTabName ); IniEntry( McdSettingsTabName );
IniEntry( ComponentsTabName ); IniEntry( ComponentsTabName );
IniEntry( AppSettingsTabName ); IniEntry( AppSettingsTabName );
IniEntry( GameDatabaseTabName ); IniEntry( GameDatabaseTabName );
ini.EnumEntry( L"LanguageId", LanguageId, NULL, defaults.LanguageId ); ini.EnumEntry( L"LanguageId", LanguageId, NULL, LanguageId );
IniEntry( LanguageCode ); IniEntry( LanguageCode );
IniEntry( RecentIsoCount ); IniEntry( RecentIsoCount );
IniEntry( DeskTheme ); IniEntry( DeskTheme );
@ -488,7 +485,7 @@ void AppConfig::LoadSaveRootItems( IniInterface& ini )
IniEntry( McdCompressNTFS ); IniEntry( McdCompressNTFS );
#endif #endif
ini.EnumEntry( L"CdvdSource", CdvdSource, CDVD_SourceLabels, defaults.CdvdSource ); ini.EnumEntry( L"CdvdSource", CdvdSource, CDVD_SourceLabels, CdvdSource );
} }
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
@ -528,7 +525,6 @@ AppConfig::ConsoleLogOptions::ConsoleLogOptions()
void AppConfig::ConsoleLogOptions::LoadSave( IniInterface& ini, const wxChar* logger ) void AppConfig::ConsoleLogOptions::LoadSave( IniInterface& ini, const wxChar* logger )
{ {
ConsoleLogOptions defaults;
ScopedIniGroup path( ini, logger ); ScopedIniGroup path( ini, logger );
IniEntry( Visible ); IniEntry( Visible );
@ -566,7 +562,6 @@ AppConfig::FolderOptions::FolderOptions()
void AppConfig::FolderOptions::LoadSave( IniInterface& ini ) void AppConfig::FolderOptions::LoadSave( IniInterface& ini )
{ {
FolderOptions defaults;
ScopedIniGroup path( ini, L"Folders" ); ScopedIniGroup path( ini, L"Folders" );
if( ini.IsSaving() ) if( ini.IsSaving() )
@ -662,7 +657,6 @@ void AppConfig::GSWindowOptions::SanityCheck()
void AppConfig::GSWindowOptions::LoadSave( IniInterface& ini ) void AppConfig::GSWindowOptions::LoadSave( IniInterface& ini )
{ {
ScopedIniGroup path( ini, L"GSWindow" ); ScopedIniGroup path( ini, L"GSWindow" );
GSWindowOptions defaults;
IniEntry( CloseOnEsc ); IniEntry( CloseOnEsc );
IniEntry( DefaultToFullscreen ); IniEntry( DefaultToFullscreen );
@ -682,7 +676,7 @@ void AppConfig::GSWindowOptions::LoadSave( IniInterface& ini )
L"16:9", L"16:9",
}; };
ini.EnumEntry( L"AspectRatio", AspectRatio, AspectRatioNames, defaults.AspectRatio ); ini.EnumEntry( L"AspectRatio", AspectRatio, AspectRatioNames, AspectRatio );
if( ini.IsLoading() ) SanityCheck(); if( ini.IsLoading() ) SanityCheck();
} }
@ -710,7 +704,6 @@ void AppConfig::FramerateOptions::SanityCheck()
void AppConfig::FramerateOptions::LoadSave( IniInterface& ini ) void AppConfig::FramerateOptions::LoadSave( IniInterface& ini )
{ {
ScopedIniGroup path( ini, L"Framerate" ); ScopedIniGroup path( ini, L"Framerate" );
FramerateOptions defaults;
IniEntry( NominalScalar ); IniEntry( NominalScalar );
IniEntry( TurboScalar ); IniEntry( TurboScalar );
@ -864,6 +857,8 @@ void AppLoadSettings()
AppIniLoader loader; AppIniLoader loader;
ConLog_LoadSaveSettings( loader ); ConLog_LoadSaveSettings( loader );
SysTraceLog_LoadSaveSettings( loader ); SysTraceLog_LoadSaveSettings( loader );
g_Conf = new AppConfig();
g_Conf->LoadSave( loader ); g_Conf->LoadSave( loader );
if( !wxFile::Exists( g_Conf->CurrentIso ) ) if( !wxFile::Exists( g_Conf->CurrentIso ) )

View File

@ -227,9 +227,9 @@ void AppCorePlugins::Load( PluginsEnum_t pid, const wxString& srcfile )
{ {
if( !wxThread::IsMain() ) if( !wxThread::IsMain() )
{ {
Sleep( 5 );
LoadSinglePluginEvent evt( pid, srcfile ); LoadSinglePluginEvent evt( pid, srcfile );
wxGetApp().ProcessAction( evt); wxGetApp().ProcessAction( evt);
Sleep( 5 );
return; return;
} }
@ -240,9 +240,9 @@ void AppCorePlugins::Unload( PluginsEnum_t pid )
{ {
if( !wxThread::IsMain() ) if( !wxThread::IsMain() )
{ {
Sleep( 5 );
SinglePluginMethodEvent evt( &AppCorePlugins::Unload, pid ); SinglePluginMethodEvent evt( &AppCorePlugins::Unload, pid );
wxGetApp().ProcessAction( evt ); wxGetApp().ProcessAction( evt );
Sleep( 5 );
return; return;
} }