Re-re-re-re-fixed the BIOS skip hack saving on exit (plus lots of code cleanups and some API changes to saving/loading settings -- more to come).

Linux/GCC: Disabled __forceinlining in debug builds.  This is the intended design, fixes many GCC errors in debug builds, and also mimics MSVC behavior.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1854 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
Jake.Stine 2009-09-18 14:07:36 +00:00
parent 504082f52d
commit 3ccb4d3698
15 changed files with 226 additions and 156 deletions

View File

@ -227,7 +227,11 @@ This theoretically unoptimizes. Not having much luck so far.
# define __fastcall __attribute__((fastcall)) # define __fastcall __attribute__((fastcall))
# define __unused __attribute__((unused)) # define __unused __attribute__((unused))
# define _inline __inline__ __attribute__((unused)) # define _inline __inline__ __attribute__((unused))
# define __forceinline __attribute__((always_inline,unused)) # ifdef NDEBUG
# define __forceinline __attribute__((always_inline,unused))
# else
# define __forceinline // no forceinlines in debug builds
# endif
# define __noinline __attribute__((noinline)) # define __noinline __attribute__((noinline))
# define __hot __attribute__((hot)) # define __hot __attribute__((hot))
# define __cold __attribute__((cold)) # define __cold __attribute__((cold))

View File

@ -144,7 +144,7 @@ namespace Exception
explicit classname( const wxString& msg_eng ) { BaseException::InitBaseEx( msg_eng, wxEmptyString ); } explicit classname( const wxString& msg_eng ) { BaseException::InitBaseEx( msg_eng, wxEmptyString ); }
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
// Generalized Exceptions: RuntimeError / LogicError / AssertionFailure // Generalized Exceptions: RuntimeError / LogicError / ObjectIsNull
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
class RuntimeError : public virtual BaseException class RuntimeError : public virtual BaseException
@ -161,6 +161,24 @@ namespace Exception
DEFINE_LOGIC_EXCEPTION( LogicError, wxLt("An unhandled logic error has occurred.") ) DEFINE_LOGIC_EXCEPTION( LogicError, wxLt("An unhandled logic error has occurred.") )
}; };
class ObjectIsNull : public RuntimeError
{
public:
wxString ObjectName;
DEFINE_EXCEPTION_COPYTORS( ObjectIsNull )
explicit ObjectIsNull( const char* objname="unspecified" )
{
m_message_diag = wxString::FromUTF8( objname );
// overridden message formatters only use the diagnostic version...
}
virtual wxString FormatDisplayMessage() const;
virtual wxString FormatDiagnosticMessage() const;
};
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
// OutOfMemory / InvalidOperation / InvalidArgument / IndexBoundsFault / ParseError // OutOfMemory / InvalidOperation / InvalidArgument / IndexBoundsFault / ParseError
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------

View File

@ -100,6 +100,23 @@ namespace Exception
return m_message_diag + L"\n\n" + m_stacktrace; return m_message_diag + L"\n\n" + m_stacktrace;
} }
// ------------------------------------------------------------------------
wxString ObjectIsNull::FormatDiagnosticMessage() const
{
return wxsFormat(
L"An attempted reference to the %s has failed; the frame does not exist or it's handle is null.",
m_message_diag.c_str()
) + m_stacktrace;
}
wxString ObjectIsNull::FormatDisplayMessage() const
{
return wxsFormat(
L"An attempted reference to the %s has failed; the frame does not exist or it's handle is null.",
m_message_diag.c_str()
);
}
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
wxString Stream::FormatDiagnosticMessage() const wxString Stream::FormatDiagnosticMessage() const
{ {

View File

@ -136,42 +136,9 @@ enum DialogIdentifiers
DialogId_About, DialogId_About,
}; };
////////////////////////////////////////////////////////////////////////////////////////// // --------------------------------------------------------------------------------------
// ScopedWindowDisable // AppImageIds - Config and Toolbar Images and Icons
// // --------------------------------------------------------------------------------------
// This class is a fix helper for WXGTK ports of PCSX2, which need the current window to
// be disabled in order for plugin-created modal dialogs to receive messages. This disabling
// causes problems in Win32/MSW, where some plugins' modal dialogs will cause all PCSX2
// windows to minimize on closure.
//
class ScopedWindowDisable
{
DeclareNoncopyableObject( ScopedWindowDisable )
protected:
wxWindow& m_window;
public:
ScopedWindowDisable( wxWindow* whee ) :
m_window( *whee )
{
#ifdef __WXGTK__
wxASSERT( whee != NULL );
m_window.Disable();
#endif
}
~ScopedWindowDisable()
{
#ifdef __WXGTK__
m_window.Enable();
m_window.SetFocus();
#endif
}
};
//////////////////////////////////////////////////////////////////////////////////////////
//
struct AppImageIds struct AppImageIds
{ {
struct ConfigIds struct ConfigIds
@ -214,7 +181,6 @@ struct AppImageIds
} Toolbars; } Toolbars;
}; };
struct MsgboxEventResult struct MsgboxEventResult
{ {
Semaphore WaitForMe; Semaphore WaitForMe;
@ -260,34 +226,14 @@ public:
void ReloadPlugins(); void ReloadPlugins();
void ApplySettings( const AppConfig* oldconf = NULL );
void LoadSettings();
void SaveSettings();
void PostMenuAction( MenuIdentifiers menu_id ) const; void PostMenuAction( MenuIdentifiers menu_id ) const;
int ThreadedModalDialog( DialogIdentifiers dialogId ); int ThreadedModalDialog( DialogIdentifiers dialogId );
void Ping() const; void Ping() const;
bool PrepForExit(); bool PrepForExit();
// Executes the emulator using a saved/existing virtual machine state and currently
// configured CDVD source device.
// Debug assertions:
void SysExecute(); void SysExecute();
void SysExecute( CDVD_SourceType cdvdsrc ); void SysExecute( CDVD_SourceType cdvdsrc );
void SysResume()
{
if( !m_CoreThread ) return;
m_CoreThread->Resume();
}
void SysSuspend()
{
if( !m_CoreThread ) return;
m_CoreThread->Suspend();
}
void SysReset() void SysReset()
{ {
m_CoreThread.reset(); m_CoreThread.reset();
@ -311,6 +257,22 @@ public:
wxASSERT( m_MainFrame != NULL ); wxASSERT( m_MainFrame != NULL );
return *m_MainFrame; return *m_MainFrame;
} }
MainEmuFrame& GetMainFrameOrExcept() const
{
if( m_MainFrame == NULL )
throw Exception::ObjectIsNull( "main application frame" );
return *m_MainFrame;
}
CoreEmuThread& GetCoreThreadOrExcept() const
{
if( !m_CoreThread )
throw Exception::ObjectIsNull( "core emulation thread" );
return *m_CoreThread;
}
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
// Overrides of wxApp virtuals: // Overrides of wxApp virtuals:
@ -434,3 +396,21 @@ extern bool pxIsValidWindowPosition( const wxWindow& window, const wxPoint& wind
extern bool HandlePluginError( Exception::PluginError& ex ); extern bool HandlePluginError( Exception::PluginError& ex );
extern bool EmulationInProgress(); extern bool EmulationInProgress();
#define TryInvoke( obj, runme ) \
{ \
try { \
wxGetApp().Get##obj##OrExcept().runme; \
} \
catch( Exception::ObjectIsNull& ) { } \
}
extern void AppLoadSettings();
extern void AppSaveSettings();
extern void AppApplySettings( const AppConfig* oldconf=NULL );
extern void SysSuspend();
extern void SysResume();
extern void SysReset();
extern void SysExecute();
extern void SysExecute( CDVD_SourceType cdvdsrc );

View File

@ -511,7 +511,7 @@ wxFileConfig* OpenFileConfig( const wxString& filename )
// overwrite - this option forces the current settings to overwrite any existing settings that might // overwrite - this option forces the current settings to overwrite any existing settings that might
// be saved to the configured ini/settings folder. // be saved to the configured ini/settings folder.
// //
void AppConfig_ReloadGlobalSettings( bool overwrite ) void AppConfig_OnChangedSettingsFolder( bool overwrite )
{ {
PathDefs::GetDocuments().Mkdir(); PathDefs::GetDocuments().Mkdir();
PathDefs::GetSettings().Mkdir(); PathDefs::GetSettings().Mkdir();
@ -521,9 +521,9 @@ void AppConfig_ReloadGlobalSettings( bool overwrite )
wxConfigBase::Get()->SetRecordDefaults(); wxConfigBase::Get()->SetRecordDefaults();
if( !overwrite ) if( !overwrite )
wxGetApp().LoadSettings(); AppLoadSettings();
wxGetApp().ApplySettings(); AppApplySettings();
g_Conf->Folders.Logs.Mkdir(); g_Conf->Folders.Logs.Mkdir();
wxString newlogname( Path::Combine( g_Conf->Folders.Logs.ToString(), L"emuLog.txt" ) ); wxString newlogname( Path::Combine( g_Conf->Folders.Logs.ToString(), L"emuLog.txt" ) );

View File

@ -163,11 +163,8 @@ public:
void LoadSaveUserMode( IniInterface& ini, const wxString& cwdhash ); void LoadSaveUserMode( IniInterface& ini, const wxString& cwdhash );
protected:
void LoadSave( IniInterface& ini ); void LoadSave( IniInterface& ini );
void LoadSaveMemcards( IniInterface& ini ); void LoadSaveMemcards( IniInterface& ini );
friend class Pcsx2App;
}; };
struct ConfigOverrides struct ConfigOverrides
@ -179,6 +176,6 @@ struct ConfigOverrides
extern ConfigOverrides OverrideOptions; extern ConfigOverrides OverrideOptions;
extern wxFileConfig* OpenFileConfig( const wxString& filename ); extern wxFileConfig* OpenFileConfig( const wxString& filename );
extern void AppConfig_ReloadGlobalSettings( bool overwrite = false ); extern void AppConfig_OnChangedSettingsFolder( bool overwrite = false );
extern wxScopedPtr<AppConfig> g_Conf; extern wxScopedPtr<AppConfig> g_Conf;

View File

@ -132,44 +132,6 @@ void AppEmuThread::StateCheck()
} }
} }
// Executes the emulator using a saved/existing virtual machine state and currently
// configured CDVD source device.
void Pcsx2App::SysExecute()
{
SysReset();
LoadPluginsImmediate();
m_CoreThread.reset( new AppEmuThread( *m_CorePlugins ) );
m_CoreThread->Resume();
}
// Executes the specified cdvd source and optional elf file. This command performs a
// full closure of any existing VM state and starts a fresh VM with the requested
// sources.
void Pcsx2App::SysExecute( CDVD_SourceType cdvdsrc )
{
SysReset();
LoadPluginsImmediate();
CDVDsys_SetFile( CDVDsrc_Iso, g_Conf->CurrentIso );
CDVDsys_ChangeSource( cdvdsrc );
if( m_gsFrame == NULL && GSopen2 != NULL )
{
// Yay, we get to open and manage our OWN window!!!
// (work-in-progress)
m_gsFrame = new GSFrame( m_MainFrame, L"PCSX2" );
m_gsFrame->SetFocus();
pDsp = (uptr)m_gsFrame->GetHandle();
m_gsFrame->Show();
// The "in the main window" quickie hack...
//pDsp = (uptr)m_MainFrame->m_background.GetHandle();
}
m_CoreThread.reset( new AppEmuThread( *m_CorePlugins ) );
m_CoreThread->Resume();
}
__forceinline bool EmulationInProgress() __forceinline bool EmulationInProgress()
{ {
return wxGetApp().EmuInProgress(); return wxGetApp().EmuInProgress();
@ -297,8 +259,8 @@ void Pcsx2App::ReadUserModeSettings()
// Save user's new settings // Save user's new settings
IniSaver saver( *conf_usermode ); IniSaver saver( *conf_usermode );
g_Conf->LoadSaveUserMode( saver, groupname ); g_Conf->LoadSaveUserMode( saver, groupname );
AppConfig_ReloadGlobalSettings( true ); AppConfig_OnChangedSettingsFolder( true );
wxGetApp().SaveSettings(); AppSaveSettings();
} }
else else
{ {
@ -322,8 +284,8 @@ void Pcsx2App::ReadUserModeSettings()
// Save user's new settings // Save user's new settings
IniSaver saver( *conf_usermode ); IniSaver saver( *conf_usermode );
g_Conf->LoadSaveUserMode( saver, groupname ); g_Conf->LoadSaveUserMode( saver, groupname );
AppConfig_ReloadGlobalSettings( true ); AppConfig_OnChangedSettingsFolder( true );
wxGetApp().SaveSettings(); AppSaveSettings();
} }
} }
} }
@ -448,7 +410,7 @@ bool Pcsx2App::OnInit()
delete wxLog::SetActiveTarget( new pxLogConsole() ); delete wxLog::SetActiveTarget( new pxLogConsole() );
ReadUserModeSettings(); ReadUserModeSettings();
AppConfig_ReloadGlobalSettings(); AppConfig_OnChangedSettingsFolder();
m_MainFrame = new MainEmuFrame( NULL, L"PCSX2" ); m_MainFrame = new MainEmuFrame( NULL, L"PCSX2" );
@ -465,7 +427,7 @@ bool Pcsx2App::OnInit()
m_MainFrame->Show(); m_MainFrame->Show();
SysDetect(); SysDetect();
ApplySettings(); AppApplySettings();
m_CoreAllocs.reset( new EmuCoreAllocations() ); m_CoreAllocs.reset( new EmuCoreAllocations() );
@ -697,7 +659,7 @@ int Pcsx2App::OnExit()
PrepForExit(); PrepForExit();
if( g_Conf ) if( g_Conf )
SaveSettings(); AppSaveSettings();
while( wxGetLocale() != NULL ) while( wxGetLocale() != NULL )
delete wxGetLocale(); delete wxGetLocale();
@ -726,7 +688,7 @@ Pcsx2App::~Pcsx2App()
CleanupMess(); CleanupMess();
} }
void Pcsx2App::ApplySettings( const AppConfig* oldconf ) void AppApplySettings( const AppConfig* oldconf )
{ {
DevAssert( wxThread::IsMain(), "ApplySettings valid from the GUI thread only." ); DevAssert( wxThread::IsMain(), "ApplySettings valid from the GUI thread only." );
@ -756,14 +718,11 @@ void Pcsx2App::ApplySettings( const AppConfig* oldconf )
} }
} }
if( m_MainFrame != NULL ) TryInvoke( MainFrame, ApplySettings() );
m_MainFrame->ApplySettings(); TryInvoke( CoreThread, ApplySettings( g_Conf->EmuOptions ) );
if( m_CoreThread )
m_CoreThread->ApplySettings( g_Conf->EmuOptions );
} }
void Pcsx2App::LoadSettings() void AppLoadSettings()
{ {
wxConfigBase* conf = wxConfigBase::Get( false ); wxConfigBase* conf = wxConfigBase::Get( false );
if( NULL == conf ) return; if( NULL == conf ) return;
@ -771,11 +730,10 @@ void Pcsx2App::LoadSettings()
IniLoader loader( *conf ); IniLoader loader( *conf );
g_Conf->LoadSave( loader ); g_Conf->LoadSave( loader );
if( m_MainFrame != NULL && m_MainFrame->m_RecentIsoList ) TryInvoke( MainFrame, LoadRecentIsoList( *conf ) );
m_MainFrame->m_RecentIsoList->Load( *conf );
} }
void Pcsx2App::SaveSettings() void AppSaveSettings()
{ {
wxConfigBase* conf = wxConfigBase::Get( false ); wxConfigBase* conf = wxConfigBase::Get( false );
if( NULL == conf ) return; if( NULL == conf ) return;
@ -783,6 +741,74 @@ void Pcsx2App::SaveSettings()
IniSaver saver( *conf ); IniSaver saver( *conf );
g_Conf->LoadSave( saver ); g_Conf->LoadSave( saver );
if( m_MainFrame != NULL && m_MainFrame->m_RecentIsoList ) TryInvoke( MainFrame, SaveRecentIsoList( *conf ) );
m_MainFrame->m_RecentIsoList->Save( *conf ); }
// --------------------------------------------------------------------------------------
// Sys/Core API and Shortcuts (for wxGetApp())
// --------------------------------------------------------------------------------------
// Executes the emulator using a saved/existing virtual machine state and currently
// configured CDVD source device.
void Pcsx2App::SysExecute()
{
SysReset();
LoadPluginsImmediate();
m_CoreThread.reset( new AppEmuThread( *m_CorePlugins ) );
m_CoreThread->Resume();
}
// Executes the specified cdvd source and optional elf file. This command performs a
// full closure of any existing VM state and starts a fresh VM with the requested
// sources.
void Pcsx2App::SysExecute( CDVD_SourceType cdvdsrc )
{
SysReset();
LoadPluginsImmediate();
CDVDsys_SetFile( CDVDsrc_Iso, g_Conf->CurrentIso );
CDVDsys_ChangeSource( cdvdsrc );
if( m_gsFrame == NULL && GSopen2 != NULL )
{
// Yay, we get to open and manage our OWN window!!!
// (work-in-progress)
m_gsFrame = new GSFrame( m_MainFrame, L"PCSX2" );
m_gsFrame->SetFocus();
pDsp = (uptr)m_gsFrame->GetHandle();
m_gsFrame->Show();
// The "in the main window" quickie hack...
//pDsp = (uptr)m_MainFrame->m_background.GetHandle();
}
m_CoreThread.reset( new AppEmuThread( *m_CorePlugins ) );
m_CoreThread->Resume();
}
// Executes the emulator using a saved/existing virtual machine state and currently
// configured CDVD source device.
void SysExecute()
{
wxGetApp().SysExecute();
}
void SysExecute( CDVD_SourceType cdvdsrc )
{
wxGetApp().SysExecute( cdvdsrc );
}
void SysResume()
{
TryInvoke( CoreThread, Resume() );
}
void SysSuspend()
{
TryInvoke( CoreThread, Suspend() );
}
void SysReset()
{
wxGetApp().SysReset();
} }

View File

@ -120,7 +120,7 @@ void Dialogs::ConfigurationDialog::OnOk_Click( wxCommandEvent& evt )
{ {
FindWindow( wxID_APPLY )->Disable(); FindWindow( wxID_APPLY )->Disable();
g_Conf->SettingsTabName = m_labels[m_listbook.GetSelection()]; g_Conf->SettingsTabName = m_labels[m_listbook.GetSelection()];
wxGetApp().SaveSettings(); AppSaveSettings();
Close(); Close();
evt.Skip(); evt.Skip();
@ -139,7 +139,7 @@ void Dialogs::ConfigurationDialog::OnApply_Click( wxCommandEvent& evt )
FindWindow( wxID_APPLY )->Disable(); FindWindow( wxID_APPLY )->Disable();
g_Conf->SettingsTabName = m_labels[m_listbook.GetSelection()]; g_Conf->SettingsTabName = m_labels[m_listbook.GetSelection()];
wxGetApp().SaveSettings(); AppSaveSettings();
} }

View File

@ -55,14 +55,14 @@ Dialogs::ImportSettingsDialog::ImportSettingsDialog( wxWindow* parent ) :
void Dialogs::ImportSettingsDialog::OnImport_Click( __unused wxCommandEvent& evt ) void Dialogs::ImportSettingsDialog::OnImport_Click( __unused wxCommandEvent& evt )
{ {
AppConfig_ReloadGlobalSettings( false ); // ... and import existing settings AppConfig_OnChangedSettingsFolder( false ); // ... and import existing settings
g_Conf->Folders.Bios.Mkdir(); g_Conf->Folders.Bios.Mkdir();
EndModal( wxID_OK ); EndModal( wxID_OK );
} }
void Dialogs::ImportSettingsDialog::OnOverwrite_Click( __unused wxCommandEvent& evt ) void Dialogs::ImportSettingsDialog::OnOverwrite_Click( __unused wxCommandEvent& evt )
{ {
AppConfig_ReloadGlobalSettings( true ); // ... and overwrite any existing settings AppConfig_OnChangedSettingsFolder( true ); // ... and overwrite any existing settings
g_Conf->Folders.Bios.Mkdir(); g_Conf->Folders.Bios.Mkdir();
EndModal( wxID_OK ); EndModal( wxID_OK );
} }

View File

@ -88,6 +88,19 @@ void MainEmuFrame::UpdateIsoSrcFile()
GetMenuBar()->SetLabel( MenuId_Src_Iso, label ); GetMenuBar()->SetLabel( MenuId_Src_Iso, label );
} }
void MainEmuFrame::LoadRecentIsoList( wxConfigBase& conf )
{
if( m_RecentIsoList )
m_RecentIsoList->Load( conf );
}
void MainEmuFrame::SaveRecentIsoList( wxConfigBase& conf )
{
if( m_RecentIsoList )
m_RecentIsoList->Load( conf );
}
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
// Video / Audio / Pad "Extensible" Menus // Video / Audio / Pad "Extensible" Menus
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
@ -174,18 +187,15 @@ void MainEmuFrame::ConnectMenus()
#define ConnectMenu( id, handler ) \ #define ConnectMenu( id, handler ) \
Connect( id, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainEmuFrame::handler) ) Connect( id, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainEmuFrame::handler) )
#define ConnectMenuRange( id_start, inc, handler ) \ #define ConnectMenuRange( id_start, inc, handler ) \
Connect( id_start, id_start + inc, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainEmuFrame::handler) ) Connect( id_start, id_start + inc, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainEmuFrame::handler) )
ConnectMenu( MenuId_Config_Settings, Menu_ConfigSettings_Click ); ConnectMenu( MenuId_Config_Settings, Menu_ConfigSettings_Click );
ConnectMenu( MenuId_Config_BIOS, Menu_SelectBios_Click ); ConnectMenu( MenuId_Config_BIOS, Menu_SelectBios_Click );
ConnectMenuRange(wxID_FILE1, 20, Menu_IsoRecent_Click); ConnectMenuRange(wxID_FILE1, 20, Menu_IsoRecent_Click);
ConnectMenuRange(MenuId_Config_GS, PluginId_Count, Menu_ConfigPlugin_Click);
ConnectMenuRange(MenuId_Config_GS, PluginId_Count, Menu_ConfigPlugin_Click); ConnectMenuRange(MenuId_Src_Iso, 3, Menu_CdvdSource_Click);
ConnectMenuRange(MenuId_Src_Iso, 3, Menu_CdvdSource_Click);
ConnectMenu( MenuId_Video_Advanced, Menu_ConfigPlugin_Click); ConnectMenu( MenuId_Video_Advanced, Menu_ConfigPlugin_Click);
ConnectMenu( MenuId_Audio_Advanced, Menu_ConfigPlugin_Click); ConnectMenu( MenuId_Audio_Advanced, Menu_ConfigPlugin_Click);
@ -194,6 +204,7 @@ void MainEmuFrame::ConnectMenus()
ConnectMenu( MenuId_Boot_CDVD, Menu_BootCdvd_Click ); ConnectMenu( MenuId_Boot_CDVD, Menu_BootCdvd_Click );
ConnectMenu( MenuId_Boot_ELF, Menu_OpenELF_Click ); ConnectMenu( MenuId_Boot_ELF, Menu_OpenELF_Click );
ConnectMenu( MenuId_IsoBrowse, Menu_IsoBrowse_Click ); ConnectMenu( MenuId_IsoBrowse, Menu_IsoBrowse_Click );
ConnectMenu( MenuId_SkipBiosToggle, Menu_SkipBiosToggle_Click );
ConnectMenu( MenuId_Exit, Menu_Exit_Click ); ConnectMenu( MenuId_Exit, Menu_Exit_Click );
ConnectMenu( MenuId_Emu_Pause, Menu_EmuPause_Click ); ConnectMenu( MenuId_Emu_Pause, Menu_EmuPause_Click );
@ -440,6 +451,8 @@ MainEmuFrame::~MainEmuFrame() throw()
void MainEmuFrame::ApplySettings() void MainEmuFrame::ApplySettings()
{ {
GetMenuBar()->Check( MenuId_SkipBiosToggle, g_Conf->EmuOptions.SkipBiosSplash );
// Always perform delete and reload of the Recent Iso List. This handles cases where // Always perform delete and reload of the Recent Iso List. This handles cases where
// the recent file count has been changed, and it's a helluva lot easier than trying // the recent file count has been changed, and it's a helluva lot easier than trying
// to make a clone copy of this complex object. ;) // to make a clone copy of this complex object. ;)
@ -452,7 +465,6 @@ void MainEmuFrame::ApplySettings()
m_RecentIsoList.reset(); m_RecentIsoList.reset();
m_RecentIsoList.reset( new wxFileHistory( g_Conf->RecentFileCount ) ); m_RecentIsoList.reset( new wxFileHistory( g_Conf->RecentFileCount ) );
m_RecentIsoList->Load( *cfg ); m_RecentIsoList->Load( *cfg );
UpdateIsoSrcFile(); UpdateIsoSrcFile();
cfg->Flush(); cfg->Flush();
} }

View File

@ -72,6 +72,9 @@ public:
void UpdateIsoSrcFile(); void UpdateIsoSrcFile();
void UpdateIsoSrcSelection(); void UpdateIsoSrcSelection();
void ApplySettings(); void ApplySettings();
void LoadRecentIsoList( wxConfigBase& conf );
void SaveRecentIsoList( wxConfigBase& conf );
protected: protected:
void InitLogBoxPosition( AppConfig::ConsoleLogOptions& conf ); void InitLogBoxPosition( AppConfig::ConsoleLogOptions& conf );
@ -85,6 +88,7 @@ protected:
void Menu_RunIso_Click(wxCommandEvent &event); void Menu_RunIso_Click(wxCommandEvent &event);
void Menu_IsoBrowse_Click(wxCommandEvent &event); void Menu_IsoBrowse_Click(wxCommandEvent &event);
void Menu_IsoRecent_Click(wxCommandEvent &event); void Menu_IsoRecent_Click(wxCommandEvent &event);
void Menu_SkipBiosToggle_Click(wxCommandEvent &event);
void Menu_BootCdvd_Click(wxCommandEvent &event); void Menu_BootCdvd_Click(wxCommandEvent &event);
void Menu_OpenELF_Click(wxCommandEvent &event); void Menu_OpenELF_Click(wxCommandEvent &event);

View File

@ -29,7 +29,7 @@ void MainEmuFrame::Menu_ConfigSettings_Click(wxCommandEvent &event)
{ {
if( Dialogs::ConfigurationDialog( this ).ShowModal() ) if( Dialogs::ConfigurationDialog( this ).ShowModal() )
{ {
wxGetApp().SaveSettings(); AppSaveSettings();
} }
} }
@ -37,7 +37,7 @@ void MainEmuFrame::Menu_SelectBios_Click(wxCommandEvent &event)
{ {
if( Dialogs::BiosSelectorDialog( this ).ShowModal() ) if( Dialogs::BiosSelectorDialog( this ).ShowModal() )
{ {
wxGetApp().SaveSettings(); AppSaveSettings();
} }
} }
@ -52,7 +52,7 @@ void MainEmuFrame::Menu_CdvdSource_Click( wxCommandEvent &event )
jNO_DEFAULT jNO_DEFAULT
} }
UpdateIsoSrcSelection(); UpdateIsoSrcSelection();
wxGetApp().SaveSettings(); AppSaveSettings();
} }
// Returns FALSE if the user cancelled the action. // Returns FALSE if the user cancelled the action.
@ -71,7 +71,7 @@ bool MainEmuFrame::_DoSelectIsoBrowser()
{ {
g_Conf->Folders.RunIso = wxFileName( ctrl.GetPath() ).GetPath(); g_Conf->Folders.RunIso = wxFileName( ctrl.GetPath() ).GetPath();
g_Conf->CurrentIso = ctrl.GetPath(); g_Conf->CurrentIso = ctrl.GetPath();
wxGetApp().SaveSettings(); AppSaveSettings();
UpdateIsoSrcFile(); UpdateIsoSrcFile();
return true; return true;
@ -82,13 +82,13 @@ bool MainEmuFrame::_DoSelectIsoBrowser()
void MainEmuFrame::Menu_BootCdvd_Click( wxCommandEvent &event ) void MainEmuFrame::Menu_BootCdvd_Click( wxCommandEvent &event )
{ {
wxGetApp().SysSuspend(); SysSuspend();
if( !wxFileExists( g_Conf->CurrentIso ) ) if( !wxFileExists( g_Conf->CurrentIso ) )
{ {
if( !_DoSelectIsoBrowser() ) if( !_DoSelectIsoBrowser() )
{ {
wxGetApp().SysResume(); SysResume();
return; return;
} }
} }
@ -100,35 +100,35 @@ void MainEmuFrame::Menu_BootCdvd_Click( wxCommandEvent &event )
if( !result ) if( !result )
{ {
wxGetApp().SysResume(); SysResume();
return; return;
} }
} }
g_Conf->EmuOptions.SkipBiosSplash = GetMenuBar()->IsChecked( MenuId_SkipBiosToggle ); g_Conf->EmuOptions.SkipBiosSplash = GetMenuBar()->IsChecked( MenuId_SkipBiosToggle );
wxGetApp().SaveSettings(); AppSaveSettings();
wxGetApp().SysExecute( g_Conf->CdvdSource ); SysExecute( g_Conf->CdvdSource );
} }
void MainEmuFrame::Menu_IsoBrowse_Click( wxCommandEvent &event ) void MainEmuFrame::Menu_IsoBrowse_Click( wxCommandEvent &event )
{ {
wxGetApp().SysSuspend(); SysSuspend();
_DoSelectIsoBrowser(); _DoSelectIsoBrowser();
wxGetApp().SysResume(); SysResume();
} }
void MainEmuFrame::Menu_RunIso_Click( wxCommandEvent &event ) void MainEmuFrame::Menu_RunIso_Click( wxCommandEvent &event )
{ {
wxGetApp().SysSuspend(); SysSuspend();
if( !_DoSelectIsoBrowser() ) if( !_DoSelectIsoBrowser() )
{ {
wxGetApp().SysResume(); SysResume();
return; return;
} }
wxGetApp().SysExecute( CDVDsrc_Iso ); SysExecute( CDVDsrc_Iso );
} }
void MainEmuFrame::Menu_IsoRecent_Click(wxCommandEvent &event) void MainEmuFrame::Menu_IsoRecent_Click(wxCommandEvent &event)
@ -137,6 +137,18 @@ void MainEmuFrame::Menu_IsoRecent_Click(wxCommandEvent &event)
//Console::WriteLn( Color_Magenta, g_RecentIsoList->GetHistoryFile( event.GetId() - g_RecentIsoList->GetBaseId() ) ); //Console::WriteLn( Color_Magenta, g_RecentIsoList->GetHistoryFile( event.GetId() - g_RecentIsoList->GetBaseId() ) );
} }
#include "IniInterface.h"
void MainEmuFrame::Menu_SkipBiosToggle_Click( wxCommandEvent &event )
{
g_Conf->EmuOptions.SkipBiosSplash = GetMenuBar()->IsChecked( MenuId_SkipBiosToggle );
wxConfigBase* conf = wxConfigBase::Get( false );
if( NULL == conf ) return;
IniSaver saver( *conf );
g_Conf->EmuOptions.LoadSave( saver );
}
void MainEmuFrame::Menu_OpenELF_Click(wxCommandEvent &event) void MainEmuFrame::Menu_OpenELF_Click(wxCommandEvent &event)
{ {
} }
@ -179,20 +191,20 @@ void MainEmuFrame::Menu_EmuClose_Click(wxCommandEvent &event)
void MainEmuFrame::Menu_EmuPause_Click(wxCommandEvent &event) void MainEmuFrame::Menu_EmuPause_Click(wxCommandEvent &event)
{ {
if( event.IsChecked() ) if( event.IsChecked() )
wxGetApp().SysSuspend(); SysSuspend();
else else
wxGetApp().SysResume(); SysResume();
} }
void MainEmuFrame::Menu_EmuReset_Click(wxCommandEvent &event) void MainEmuFrame::Menu_EmuReset_Click(wxCommandEvent &event)
{ {
bool wasRunning = EmulationInProgress(); bool wasRunning = EmulationInProgress();
wxGetApp().SysReset(); SysReset();
GetMenuBar()->Check( MenuId_Emu_Pause, false ); GetMenuBar()->Check( MenuId_Emu_Pause, false );
if( !wasRunning ) return; if( !wasRunning ) return;
wxGetApp().SysExecute(); SysExecute();
} }
void MainEmuFrame::Menu_ConfigPlugin_Click(wxCommandEvent &event) void MainEmuFrame::Menu_ConfigPlugin_Click(wxCommandEvent &event)

View File

@ -83,9 +83,9 @@ bool Panels::StaticApplyState::ApplyPage( int pageid, bool saveOnSuccess )
// If an exception is thrown above, this code below won't get run. // If an exception is thrown above, this code below won't get run.
// (conveniently skipping any option application! :D) // (conveniently skipping any option application! :D)
wxGetApp().ApplySettings( &confcopy ); AppApplySettings( &confcopy );
if( saveOnSuccess ) if( saveOnSuccess )
wxGetApp().SaveSettings(); AppSaveSettings();
} }
catch( Exception::CannotApplySettings& ex ) catch( Exception::CannotApplySettings& ex )
{ {

View File

@ -35,7 +35,7 @@ using namespace Threading;
// non-NULL. If NULL, an error occurred and the thread loads the exception into either // non-NULL. If NULL, an error occurred and the thread loads the exception into either
// Ex_PluginError or Ex_RuntimeError. // Ex_PluginError or Ex_RuntimeError.
// //
class LoadPluginsTask : public Threading::PersistentThread class LoadPluginsTask : public PersistentThread
{ {
public: public:
Exception::PluginError* Ex_PluginError; Exception::PluginError* Ex_PluginError;

View File

@ -62,7 +62,7 @@ void States_Load( const wxString& file )
StateRecovery::Recover(); StateRecovery::Recover();
} }
wxGetApp().SysExecute(); SysExecute();
} }
void States_Load(int num) void States_Load(int num)