diff --git a/common/include/Pcsx2Defs.h b/common/include/Pcsx2Defs.h index 4b19386744..d1a2ee125f 100644 --- a/common/include/Pcsx2Defs.h +++ b/common/include/Pcsx2Defs.h @@ -227,7 +227,11 @@ This theoretically unoptimizes. Not having much luck so far. # define __fastcall __attribute__((fastcall)) # define __unused __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 __hot __attribute__((hot)) # define __cold __attribute__((cold)) diff --git a/common/include/Utilities/Exceptions.h b/common/include/Utilities/Exceptions.h index 6d9b0e39bf..e437d3260a 100644 --- a/common/include/Utilities/Exceptions.h +++ b/common/include/Utilities/Exceptions.h @@ -144,7 +144,7 @@ namespace Exception 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 @@ -161,6 +161,24 @@ namespace Exception 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 // --------------------------------------------------------------------------------------- diff --git a/common/src/Utilities/Exceptions.cpp b/common/src/Utilities/Exceptions.cpp index bbfe5d0d2d..b4201b8223 100644 --- a/common/src/Utilities/Exceptions.cpp +++ b/common/src/Utilities/Exceptions.cpp @@ -100,6 +100,23 @@ namespace Exception 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 { diff --git a/pcsx2/gui/App.h b/pcsx2/gui/App.h index fedcf73262..ae0d546efd 100644 --- a/pcsx2/gui/App.h +++ b/pcsx2/gui/App.h @@ -136,42 +136,9 @@ enum DialogIdentifiers DialogId_About, }; -////////////////////////////////////////////////////////////////////////////////////////// -// ScopedWindowDisable -// -// 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 - } -}; - -////////////////////////////////////////////////////////////////////////////////////////// -// +// -------------------------------------------------------------------------------------- +// AppImageIds - Config and Toolbar Images and Icons +// -------------------------------------------------------------------------------------- struct AppImageIds { struct ConfigIds @@ -214,7 +181,6 @@ struct AppImageIds } Toolbars; }; - struct MsgboxEventResult { Semaphore WaitForMe; @@ -260,34 +226,14 @@ public: void ReloadPlugins(); - void ApplySettings( const AppConfig* oldconf = NULL ); - void LoadSettings(); - void SaveSettings(); - void PostMenuAction( MenuIdentifiers menu_id ) const; int ThreadedModalDialog( DialogIdentifiers dialogId ); void Ping() const; bool PrepForExit(); - // Executes the emulator using a saved/existing virtual machine state and currently - // configured CDVD source device. - // Debug assertions: void SysExecute(); 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() { m_CoreThread.reset(); @@ -311,6 +257,22 @@ public: wxASSERT( m_MainFrame != NULL ); 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: @@ -434,3 +396,21 @@ extern bool pxIsValidWindowPosition( const wxWindow& window, const wxPoint& wind extern bool HandlePluginError( Exception::PluginError& ex ); 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 ); + diff --git a/pcsx2/gui/AppConfig.cpp b/pcsx2/gui/AppConfig.cpp index eeaea5c106..403772ada6 100644 --- a/pcsx2/gui/AppConfig.cpp +++ b/pcsx2/gui/AppConfig.cpp @@ -511,7 +511,7 @@ wxFileConfig* OpenFileConfig( const wxString& filename ) // overwrite - this option forces the current settings to overwrite any existing settings that might // be saved to the configured ini/settings folder. // -void AppConfig_ReloadGlobalSettings( bool overwrite ) +void AppConfig_OnChangedSettingsFolder( bool overwrite ) { PathDefs::GetDocuments().Mkdir(); PathDefs::GetSettings().Mkdir(); @@ -521,9 +521,9 @@ void AppConfig_ReloadGlobalSettings( bool overwrite ) wxConfigBase::Get()->SetRecordDefaults(); if( !overwrite ) - wxGetApp().LoadSettings(); + AppLoadSettings(); - wxGetApp().ApplySettings(); + AppApplySettings(); g_Conf->Folders.Logs.Mkdir(); wxString newlogname( Path::Combine( g_Conf->Folders.Logs.ToString(), L"emuLog.txt" ) ); diff --git a/pcsx2/gui/AppConfig.h b/pcsx2/gui/AppConfig.h index 30776fc07a..9f22dbaec2 100644 --- a/pcsx2/gui/AppConfig.h +++ b/pcsx2/gui/AppConfig.h @@ -163,11 +163,8 @@ public: void LoadSaveUserMode( IniInterface& ini, const wxString& cwdhash ); -protected: void LoadSave( IniInterface& ini ); void LoadSaveMemcards( IniInterface& ini ); - - friend class Pcsx2App; }; struct ConfigOverrides @@ -179,6 +176,6 @@ struct ConfigOverrides extern ConfigOverrides OverrideOptions; extern wxFileConfig* OpenFileConfig( const wxString& filename ); -extern void AppConfig_ReloadGlobalSettings( bool overwrite = false ); +extern void AppConfig_OnChangedSettingsFolder( bool overwrite = false ); extern wxScopedPtr g_Conf; diff --git a/pcsx2/gui/AppMain.cpp b/pcsx2/gui/AppMain.cpp index 04dfc0ebae..6b4377e62d 100644 --- a/pcsx2/gui/AppMain.cpp +++ b/pcsx2/gui/AppMain.cpp @@ -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() { return wxGetApp().EmuInProgress(); @@ -297,8 +259,8 @@ void Pcsx2App::ReadUserModeSettings() // Save user's new settings IniSaver saver( *conf_usermode ); g_Conf->LoadSaveUserMode( saver, groupname ); - AppConfig_ReloadGlobalSettings( true ); - wxGetApp().SaveSettings(); + AppConfig_OnChangedSettingsFolder( true ); + AppSaveSettings(); } else { @@ -322,8 +284,8 @@ void Pcsx2App::ReadUserModeSettings() // Save user's new settings IniSaver saver( *conf_usermode ); g_Conf->LoadSaveUserMode( saver, groupname ); - AppConfig_ReloadGlobalSettings( true ); - wxGetApp().SaveSettings(); + AppConfig_OnChangedSettingsFolder( true ); + AppSaveSettings(); } } } @@ -448,7 +410,7 @@ bool Pcsx2App::OnInit() delete wxLog::SetActiveTarget( new pxLogConsole() ); ReadUserModeSettings(); - AppConfig_ReloadGlobalSettings(); + AppConfig_OnChangedSettingsFolder(); m_MainFrame = new MainEmuFrame( NULL, L"PCSX2" ); @@ -465,7 +427,7 @@ bool Pcsx2App::OnInit() m_MainFrame->Show(); SysDetect(); - ApplySettings(); + AppApplySettings(); m_CoreAllocs.reset( new EmuCoreAllocations() ); @@ -697,7 +659,7 @@ int Pcsx2App::OnExit() PrepForExit(); if( g_Conf ) - SaveSettings(); + AppSaveSettings(); while( wxGetLocale() != NULL ) delete wxGetLocale(); @@ -726,7 +688,7 @@ Pcsx2App::~Pcsx2App() CleanupMess(); } -void Pcsx2App::ApplySettings( const AppConfig* oldconf ) +void AppApplySettings( const AppConfig* oldconf ) { DevAssert( wxThread::IsMain(), "ApplySettings valid from the GUI thread only." ); @@ -756,14 +718,11 @@ void Pcsx2App::ApplySettings( const AppConfig* oldconf ) } } - if( m_MainFrame != NULL ) - m_MainFrame->ApplySettings(); - - if( m_CoreThread ) - m_CoreThread->ApplySettings( g_Conf->EmuOptions ); + TryInvoke( MainFrame, ApplySettings() ); + TryInvoke( CoreThread, ApplySettings( g_Conf->EmuOptions ) ); } -void Pcsx2App::LoadSettings() +void AppLoadSettings() { wxConfigBase* conf = wxConfigBase::Get( false ); if( NULL == conf ) return; @@ -771,11 +730,10 @@ void Pcsx2App::LoadSettings() IniLoader loader( *conf ); g_Conf->LoadSave( loader ); - if( m_MainFrame != NULL && m_MainFrame->m_RecentIsoList ) - m_MainFrame->m_RecentIsoList->Load( *conf ); + TryInvoke( MainFrame, LoadRecentIsoList( *conf ) ); } -void Pcsx2App::SaveSettings() +void AppSaveSettings() { wxConfigBase* conf = wxConfigBase::Get( false ); if( NULL == conf ) return; @@ -783,6 +741,74 @@ void Pcsx2App::SaveSettings() IniSaver saver( *conf ); g_Conf->LoadSave( saver ); - if( m_MainFrame != NULL && m_MainFrame->m_RecentIsoList ) - m_MainFrame->m_RecentIsoList->Save( *conf ); + TryInvoke( MainFrame, SaveRecentIsoList( *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(); } diff --git a/pcsx2/gui/Dialogs/ConfigurationDialog.cpp b/pcsx2/gui/Dialogs/ConfigurationDialog.cpp index e4bb328b78..8f7dfd1a56 100644 --- a/pcsx2/gui/Dialogs/ConfigurationDialog.cpp +++ b/pcsx2/gui/Dialogs/ConfigurationDialog.cpp @@ -120,7 +120,7 @@ void Dialogs::ConfigurationDialog::OnOk_Click( wxCommandEvent& evt ) { FindWindow( wxID_APPLY )->Disable(); g_Conf->SettingsTabName = m_labels[m_listbook.GetSelection()]; - wxGetApp().SaveSettings(); + AppSaveSettings(); Close(); evt.Skip(); @@ -139,7 +139,7 @@ void Dialogs::ConfigurationDialog::OnApply_Click( wxCommandEvent& evt ) FindWindow( wxID_APPLY )->Disable(); g_Conf->SettingsTabName = m_labels[m_listbook.GetSelection()]; - wxGetApp().SaveSettings(); + AppSaveSettings(); } diff --git a/pcsx2/gui/Dialogs/ImportSettingsDialog.cpp b/pcsx2/gui/Dialogs/ImportSettingsDialog.cpp index 31796f2f0f..6cd165291f 100644 --- a/pcsx2/gui/Dialogs/ImportSettingsDialog.cpp +++ b/pcsx2/gui/Dialogs/ImportSettingsDialog.cpp @@ -55,14 +55,14 @@ Dialogs::ImportSettingsDialog::ImportSettingsDialog( wxWindow* parent ) : 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(); EndModal( wxID_OK ); } 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(); EndModal( wxID_OK ); } diff --git a/pcsx2/gui/MainFrame.cpp b/pcsx2/gui/MainFrame.cpp index 13691b0390..78e558e99e 100644 --- a/pcsx2/gui/MainFrame.cpp +++ b/pcsx2/gui/MainFrame.cpp @@ -88,6 +88,19 @@ void MainEmuFrame::UpdateIsoSrcFile() 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 // ------------------------------------------------------------------------ @@ -174,18 +187,15 @@ void MainEmuFrame::ConnectMenus() #define ConnectMenu( id, handler ) \ Connect( id, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainEmuFrame::handler) ) - #define ConnectMenuRange( id_start, inc, handler ) \ Connect( id_start, id_start + inc, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainEmuFrame::handler) ) ConnectMenu( MenuId_Config_Settings, Menu_ConfigSettings_Click ); ConnectMenu( MenuId_Config_BIOS, Menu_SelectBios_Click ); - ConnectMenuRange(wxID_FILE1, 20, Menu_IsoRecent_Click); - - ConnectMenuRange(MenuId_Config_GS, PluginId_Count, Menu_ConfigPlugin_Click); - - ConnectMenuRange(MenuId_Src_Iso, 3, Menu_CdvdSource_Click); + ConnectMenuRange(wxID_FILE1, 20, Menu_IsoRecent_Click); + ConnectMenuRange(MenuId_Config_GS, PluginId_Count, Menu_ConfigPlugin_Click); + ConnectMenuRange(MenuId_Src_Iso, 3, Menu_CdvdSource_Click); ConnectMenu( MenuId_Video_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_ELF, Menu_OpenELF_Click ); ConnectMenu( MenuId_IsoBrowse, Menu_IsoBrowse_Click ); + ConnectMenu( MenuId_SkipBiosToggle, Menu_SkipBiosToggle_Click ); ConnectMenu( MenuId_Exit, Menu_Exit_Click ); ConnectMenu( MenuId_Emu_Pause, Menu_EmuPause_Click ); @@ -440,6 +451,8 @@ MainEmuFrame::~MainEmuFrame() throw() 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 // 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. ;) @@ -452,7 +465,6 @@ void MainEmuFrame::ApplySettings() m_RecentIsoList.reset(); m_RecentIsoList.reset( new wxFileHistory( g_Conf->RecentFileCount ) ); m_RecentIsoList->Load( *cfg ); - UpdateIsoSrcFile(); cfg->Flush(); } diff --git a/pcsx2/gui/MainFrame.h b/pcsx2/gui/MainFrame.h index f5b115634c..149962f514 100644 --- a/pcsx2/gui/MainFrame.h +++ b/pcsx2/gui/MainFrame.h @@ -72,6 +72,9 @@ public: void UpdateIsoSrcFile(); void UpdateIsoSrcSelection(); void ApplySettings(); + + void LoadRecentIsoList( wxConfigBase& conf ); + void SaveRecentIsoList( wxConfigBase& conf ); protected: void InitLogBoxPosition( AppConfig::ConsoleLogOptions& conf ); @@ -85,6 +88,7 @@ protected: void Menu_RunIso_Click(wxCommandEvent &event); void Menu_IsoBrowse_Click(wxCommandEvent &event); void Menu_IsoRecent_Click(wxCommandEvent &event); + void Menu_SkipBiosToggle_Click(wxCommandEvent &event); void Menu_BootCdvd_Click(wxCommandEvent &event); void Menu_OpenELF_Click(wxCommandEvent &event); diff --git a/pcsx2/gui/MainMenuClicks.cpp b/pcsx2/gui/MainMenuClicks.cpp index de7e88c202..1bd644e52e 100644 --- a/pcsx2/gui/MainMenuClicks.cpp +++ b/pcsx2/gui/MainMenuClicks.cpp @@ -29,7 +29,7 @@ void MainEmuFrame::Menu_ConfigSettings_Click(wxCommandEvent &event) { if( Dialogs::ConfigurationDialog( this ).ShowModal() ) { - wxGetApp().SaveSettings(); + AppSaveSettings(); } } @@ -37,7 +37,7 @@ void MainEmuFrame::Menu_SelectBios_Click(wxCommandEvent &event) { if( Dialogs::BiosSelectorDialog( this ).ShowModal() ) { - wxGetApp().SaveSettings(); + AppSaveSettings(); } } @@ -52,7 +52,7 @@ void MainEmuFrame::Menu_CdvdSource_Click( wxCommandEvent &event ) jNO_DEFAULT } UpdateIsoSrcSelection(); - wxGetApp().SaveSettings(); + AppSaveSettings(); } // 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->CurrentIso = ctrl.GetPath(); - wxGetApp().SaveSettings(); + AppSaveSettings(); UpdateIsoSrcFile(); return true; @@ -82,13 +82,13 @@ bool MainEmuFrame::_DoSelectIsoBrowser() void MainEmuFrame::Menu_BootCdvd_Click( wxCommandEvent &event ) { - wxGetApp().SysSuspend(); + SysSuspend(); if( !wxFileExists( g_Conf->CurrentIso ) ) { if( !_DoSelectIsoBrowser() ) { - wxGetApp().SysResume(); + SysResume(); return; } } @@ -100,35 +100,35 @@ void MainEmuFrame::Menu_BootCdvd_Click( wxCommandEvent &event ) if( !result ) { - wxGetApp().SysResume(); + SysResume(); return; } } 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 ) { - wxGetApp().SysSuspend(); + SysSuspend(); _DoSelectIsoBrowser(); - wxGetApp().SysResume(); + SysResume(); } void MainEmuFrame::Menu_RunIso_Click( wxCommandEvent &event ) { - wxGetApp().SysSuspend(); + SysSuspend(); if( !_DoSelectIsoBrowser() ) { - wxGetApp().SysResume(); + SysResume(); return; } - wxGetApp().SysExecute( CDVDsrc_Iso ); + SysExecute( CDVDsrc_Iso ); } 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() ) ); } +#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) { } @@ -179,20 +191,20 @@ void MainEmuFrame::Menu_EmuClose_Click(wxCommandEvent &event) void MainEmuFrame::Menu_EmuPause_Click(wxCommandEvent &event) { if( event.IsChecked() ) - wxGetApp().SysSuspend(); + SysSuspend(); else - wxGetApp().SysResume(); + SysResume(); } void MainEmuFrame::Menu_EmuReset_Click(wxCommandEvent &event) { bool wasRunning = EmulationInProgress(); - wxGetApp().SysReset(); + SysReset(); GetMenuBar()->Check( MenuId_Emu_Pause, false ); if( !wasRunning ) return; - wxGetApp().SysExecute(); + SysExecute(); } void MainEmuFrame::Menu_ConfigPlugin_Click(wxCommandEvent &event) diff --git a/pcsx2/gui/Panels/MiscPanelStuff.cpp b/pcsx2/gui/Panels/MiscPanelStuff.cpp index d3e06149dd..8c5229f90c 100644 --- a/pcsx2/gui/Panels/MiscPanelStuff.cpp +++ b/pcsx2/gui/Panels/MiscPanelStuff.cpp @@ -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. // (conveniently skipping any option application! :D) - wxGetApp().ApplySettings( &confcopy ); + AppApplySettings( &confcopy ); if( saveOnSuccess ) - wxGetApp().SaveSettings(); + AppSaveSettings(); } catch( Exception::CannotApplySettings& ex ) { diff --git a/pcsx2/gui/Plugins.cpp b/pcsx2/gui/Plugins.cpp index aa76a67351..a396f2d6db 100644 --- a/pcsx2/gui/Plugins.cpp +++ b/pcsx2/gui/Plugins.cpp @@ -35,7 +35,7 @@ using namespace Threading; // non-NULL. If NULL, an error occurred and the thread loads the exception into either // Ex_PluginError or Ex_RuntimeError. // -class LoadPluginsTask : public Threading::PersistentThread +class LoadPluginsTask : public PersistentThread { public: Exception::PluginError* Ex_PluginError; diff --git a/pcsx2/gui/Saveslots.cpp b/pcsx2/gui/Saveslots.cpp index 9c46dbaaec..1aff8bf54a 100644 --- a/pcsx2/gui/Saveslots.cpp +++ b/pcsx2/gui/Saveslots.cpp @@ -62,7 +62,7 @@ void States_Load( const wxString& file ) StateRecovery::Recover(); } - wxGetApp().SysExecute(); + SysExecute(); } void States_Load(int num)