diff --git a/pcsx2/gui/App.h b/pcsx2/gui/App.h index 03cf7476f8..2adeb87bd3 100644 --- a/pcsx2/gui/App.h +++ b/pcsx2/gui/App.h @@ -19,6 +19,7 @@ #include #include +#include #include "pxEventThread.h" @@ -241,12 +242,12 @@ class pxAppResources public: AppImageIds ImageId; - ScopedPtr ConfigImages; - ScopedPtr ToolbarImages; - ScopedPtr IconBundle; - ScopedPtr Bitmap_Logo; - ScopedPtr ScreenshotBitmap; - ScopedPtr GameDB; + std::unique_ptr ConfigImages; + std::unique_ptr ToolbarImages; + std::unique_ptr IconBundle; + std::unique_ptr Bitmap_Logo; + std::unique_ptr ScreenshotBitmap; + std::unique_ptr GameDB; pxAppResources(); virtual ~pxAppResources() throw(); @@ -469,28 +470,28 @@ protected: public: FramerateManager FpsManager; - ScopedPtr GlobalCommands; - ScopedPtr GlobalAccels; + std::unique_ptr GlobalCommands; + std::unique_ptr GlobalAccels; StartupOptions Startup; CommandlineOverrides Overrides; - ScopedPtr m_timer_Termination; + std::unique_ptr m_timer_Termination; protected: - ScopedPtr m_StdoutRedirHandle; - ScopedPtr m_StderrRedirHandle; + std::unique_ptr m_StdoutRedirHandle; + std::unique_ptr m_StderrRedirHandle; - ScopedPtr m_RecentIsoList; - ScopedPtr m_Resources; + std::unique_ptr m_RecentIsoList; + std::unique_ptr m_Resources; public: // Executor Thread for complex VM/System tasks. This thread is used to execute such tasks // in parallel to the main message pump, to allow the main pump to run without fear of // blocked threads stalling the GUI. ExecutorThread SysExecutorThread; - ScopedPtr m_CpuProviders; - ScopedPtr m_VmReserve; + std::unique_ptr m_CpuProviders; + std::unique_ptr m_VmReserve; protected: wxWindowID m_id_MainFrame; diff --git a/pcsx2/gui/AppConfig.cpp b/pcsx2/gui/AppConfig.cpp index 061c26cd3e..285dcee342 100644 --- a/pcsx2/gui/AppConfig.cpp +++ b/pcsx2/gui/AppConfig.cpp @@ -24,6 +24,7 @@ #include #include "DebugTools/Debug.h" +#include ////////////////////////////////////////////////////////////////////////////////////////// // PathDefs Namespace -- contains default values for various pcsx2 path names and locations. @@ -1242,7 +1243,7 @@ static void LoadUiSettings() ConLog_LoadSaveSettings( loader ); SysTraceLog_LoadSaveSettings( loader ); - g_Conf = new AppConfig(); + g_Conf = std::unique_ptr(new AppConfig()); g_Conf->LoadSave( loader ); if( !wxFile::Exists( g_Conf->CurrentIso ) ) @@ -1256,8 +1257,8 @@ static void LoadVmSettings() // Load virtual machine options and apply some defaults overtop saved items, which // are regulated by the PCSX2 UI. - ScopedPtr vmini( OpenFileConfig( GetVmSettingsFilename() ) ); - IniLoader vmloader( vmini ); + std::unique_ptr vmini( OpenFileConfig( GetVmSettingsFilename() ) ); + IniLoader vmloader( vmini.get() ); g_Conf->EmuOptions.LoadSave( vmloader ); g_Conf->EmuOptions.GS.LimitScalar = g_Conf->Framerate.NominalScalar; @@ -1293,8 +1294,8 @@ static void SaveUiSettings() static void SaveVmSettings() { - ScopedPtr vmini( OpenFileConfig( GetVmSettingsFilename() ) ); - IniSaver vmsaver( vmini ); + std::unique_ptr vmini( OpenFileConfig( GetVmSettingsFilename() ) ); + IniSaver vmsaver( vmini.get() ); g_Conf->EmuOptions.LoadSave( vmsaver ); sApp.DispatchVmSettingsEvent( vmsaver ); @@ -1302,15 +1303,15 @@ static void SaveVmSettings() static void SaveRegSettings() { - ScopedPtr conf_install; + std::unique_ptr conf_install; if (InstallationMode == InstallMode_Portable) return; // sApp. macro cannot be use because you need the return value of OpenInstallSettingsFile method - if( Pcsx2App* __app_ = (Pcsx2App*)wxApp::GetInstance() ) conf_install = (*__app_).OpenInstallSettingsFile(); + if( Pcsx2App* __app_ = (Pcsx2App*)wxApp::GetInstance() ) conf_install = std::unique_ptr((*__app_).OpenInstallSettingsFile()); conf_install->SetRecordDefaults(false); - App_SaveInstallSettings( conf_install ); + App_SaveInstallSettings( conf_install.get() ); } void AppSaveSettings() diff --git a/pcsx2/gui/AppConfig.h b/pcsx2/gui/AppConfig.h index 750bc09755..b432225af5 100644 --- a/pcsx2/gui/AppConfig.h +++ b/pcsx2/gui/AppConfig.h @@ -18,6 +18,7 @@ #include "AppForwardDefs.h" #include "PathDefs.h" #include "CDVD/CDVDaccess.h" +#include enum DocsModeType { @@ -383,4 +384,4 @@ extern void RelocateLogfile(); extern void AppConfig_OnChangedSettingsFolder( bool overwrite = false ); extern wxConfigBase* GetAppConfig(); -extern ScopedPtr g_Conf; +extern std::unique_ptr g_Conf; diff --git a/pcsx2/gui/AppCorePlugins.cpp b/pcsx2/gui/AppCorePlugins.cpp index ebcdb0da67..0f10491874 100644 --- a/pcsx2/gui/AppCorePlugins.cpp +++ b/pcsx2/gui/AppCorePlugins.cpp @@ -416,14 +416,17 @@ protected: // Public API / Interface // -------------------------------------------------------------------------------------- -int EnumeratePluginsInFolder( const wxDirName& searchpath, wxArrayString* dest ) +int EnumeratePluginsInFolder(const wxDirName& searchpath, wxArrayString* dest) { if (!searchpath.Exists()) return 0; - ScopedPtr placebo; + std::unique_ptr placebo; wxArrayString* realdest = dest; - if( realdest == NULL ) - placebo = realdest = new wxArrayString(); // placebo is our /dev/null -- gets deleted when done + if (realdest == NULL) + { + placebo = std::unique_ptr(new wxArrayString()); + realdest = placebo.get(); + } #ifdef __WXMSW__ // Windows pretty well has a strict "must end in .dll" rule. @@ -558,12 +561,13 @@ void SysExecEvent_SaveSinglePlugin::InvokeEvent() if( CorePlugins.AreLoaded() ) { - ScopedPtr plugstore; + std::unique_ptr plugstore; if( CoreThread.HasActiveMachine() ) { Console.WriteLn( Color_Green, L"Suspending single plugin: " + tbl_PluginInfo[m_pid].GetShortname() ); - memSavingState save( plugstore=new VmStateBuffer(L"StateCopy_SinglePlugin") ); + plugstore = std::unique_ptr(new VmStateBuffer(L"StateCopy_SinglePlugin")); + memSavingState save( plugstore.get() ); GetCorePlugins().Freeze( m_pid, save ); } @@ -573,7 +577,7 @@ void SysExecEvent_SaveSinglePlugin::InvokeEvent() if( plugstore ) { Console.WriteLn( Color_Green, L"Recovering single plugin: " + tbl_PluginInfo[m_pid].GetShortname() ); - memLoadingState load( plugstore ); + memLoadingState load( plugstore.get() ); GetCorePlugins().Freeze( m_pid, load ); // GS plugin suspend / resume hack. Removed in r4363, hopefully never to return :p //GetCorePlugins().Close( m_pid ); // hack for stupid GS plugins. diff --git a/pcsx2/gui/AppCoreThread.cpp b/pcsx2/gui/AppCoreThread.cpp index ff41edc8cf..20589b2d07 100644 --- a/pcsx2/gui/AppCoreThread.cpp +++ b/pcsx2/gui/AppCoreThread.cpp @@ -702,13 +702,13 @@ void BaseScopedCoreThread::DoResume() // handle the code directly). bool BaseScopedCoreThread::PostToSysExec( BaseSysExecEvent_ScopedCore* msg ) { - ScopedPtr smsg( msg ); + std::unique_ptr smsg( msg ); if( !smsg || GetSysExecutorThread().IsSelf()) return false; msg->SetSyncState(m_sync); msg->SetResumeStates(m_sync_resume, m_mtx_resume); - GetSysExecutorThread().PostEvent( smsg.DetachPtr() ); + GetSysExecutorThread().PostEvent( smsg.release() ); m_sync.WaitForResult(); m_sync.RethrowException(); @@ -781,9 +781,9 @@ ScopedCoreThreadPopup::ScopedCoreThreadPopup() // is maximized or fullscreen. if( !GSopen2 ) - m_scoped_core = new ScopedCoreThreadClose(); + m_scoped_core = std::unique_ptr(new ScopedCoreThreadClose()); else - m_scoped_core = new ScopedCoreThreadPause(); + m_scoped_core = std::unique_ptr(new ScopedCoreThreadPause()); }; void ScopedCoreThreadPopup::AllowResume() diff --git a/pcsx2/gui/AppCoreThread.h b/pcsx2/gui/AppCoreThread.h index 895fb635e4..6e49661953 100644 --- a/pcsx2/gui/AppCoreThread.h +++ b/pcsx2/gui/AppCoreThread.h @@ -237,7 +237,7 @@ public: struct ScopedCoreThreadPopup : public IScopedCoreThread { protected: - ScopedPtr m_scoped_core; + std::unique_ptr m_scoped_core; public: ScopedCoreThreadPopup(); diff --git a/pcsx2/gui/AppGameDatabase.cpp b/pcsx2/gui/AppGameDatabase.cpp index e51b4e4bcb..180e19878a 100644 --- a/pcsx2/gui/AppGameDatabase.cpp +++ b/pcsx2/gui/AppGameDatabase.cpp @@ -229,10 +229,10 @@ AppGameDatabase* Pcsx2App::GetGameDatabase() ScopedLock lock( m_mtx_LoadingGameDB ); if( !res.GameDB ) { - res.GameDB = new AppGameDatabase(); + res.GameDB = std::unique_ptr(new AppGameDatabase()); res.GameDB->LoadFromFile(); } - return res.GameDB; + return res.GameDB.get(); } IGameDatabase* AppHost_GetGameDatabase() diff --git a/pcsx2/gui/AppInit.cpp b/pcsx2/gui/AppInit.cpp index 93658d614e..284129b06d 100644 --- a/pcsx2/gui/AppInit.cpp +++ b/pcsx2/gui/AppInit.cpp @@ -29,6 +29,7 @@ #include #include #include +#include using namespace pxSizerFlags; @@ -128,7 +129,7 @@ void Pcsx2App::AllocateCoreStuffs() // FIXME : Some or all of SysCpuProviderPack should be run from the SysExecutor thread, // so that the thread is safely blocked from being able to start emulation. - m_CpuProviders = new SysCpuProviderPack(); + m_CpuProviders = std::unique_ptr(new SysCpuProviderPack()); if( m_CpuProviders->HadSomeFailures( g_Conf->EmuOptions.Cpu.Recompiler ) ) { @@ -422,7 +423,7 @@ bool Pcsx2App::OnInit() pxDoAssert = AppDoAssert; pxDoOutOfMemory = SysOutOfMemory_EmergencyResponse; - g_Conf = new AppConfig(); + g_Conf = std::unique_ptr(new AppConfig()); wxInitAllImageHandlers(); Console.WriteLn("Applying operating system default language..."); @@ -472,7 +473,7 @@ bool Pcsx2App::OnInit() // PCSX2 has a lot of event handling logistics, so we *cannot* depend on wxWidgets automatic event // loop termination code. We have a much safer system in place that continues to process messages // until all "important" threads are closed out -- not just until the main frame is closed(-ish). - m_timer_Termination = new wxTimer( this, wxID_ANY ); + m_timer_Termination = std::unique_ptr(new wxTimer( this, wxID_ANY )); Connect( m_timer_Termination->GetId(), wxEVT_TIMER, wxTimerEventHandler(Pcsx2App::OnScheduledTermination) ); SetExitOnFrameDelete( false ); diff --git a/pcsx2/gui/AppMain.cpp b/pcsx2/gui/AppMain.cpp index 854566e7b8..b42717852a 100644 --- a/pcsx2/gui/AppMain.cpp +++ b/pcsx2/gui/AppMain.cpp @@ -71,7 +71,7 @@ DEFINE_EVENT_TYPE( pxEvt_LogicalVsync ); DEFINE_EVENT_TYPE( pxEvt_ThreadTaskTimeout_SysExec ); -ScopedPtr g_Conf; +std::unique_ptr g_Conf; static bool HandlePluginError( BaseException& ex ) { @@ -904,7 +904,7 @@ void Pcsx2App::PostIdleAppMethod( FnPtr_Pcsx2App method ) SysMainMemory& Pcsx2App::GetVmReserve() { - if (!m_VmReserve) m_VmReserve = new SysMainMemory(); + if (!m_VmReserve) m_VmReserve = std::unique_ptr(new SysMainMemory()); return *m_VmReserve; } diff --git a/pcsx2/gui/AppRes.cpp b/pcsx2/gui/AppRes.cpp index 1bb548ad1f..b35506ffea 100644 --- a/pcsx2/gui/AppRes.cpp +++ b/pcsx2/gui/AppRes.cpp @@ -20,6 +20,7 @@ #include #include #include +#include #include "MSWstuff.h" @@ -61,9 +62,9 @@ const wxImage& LoadImageAny( RecentIsoList::RecentIsoList(int firstIdForMenuItems_or_wxID_ANY) { - Menu = new wxMenu(); + Menu = std::unique_ptr(new wxMenu()); Menu->Append( MenuId_IsoBrowse, _("Browse..."), _("Browse for an Iso that is not in your recent history.") ); - Manager = new RecentIsoManager( Menu, firstIdForMenuItems_or_wxID_ANY ); + Manager = std::unique_ptr(new RecentIsoManager( Menu.get(), firstIdForMenuItems_or_wxID_ANY )); } pxAppResources::pxAppResources() @@ -74,13 +75,13 @@ pxAppResources::~pxAppResources() throw() {} wxMenu& Pcsx2App::GetRecentIsoMenu() { - if (!m_RecentIsoList) m_RecentIsoList = new RecentIsoList( MenuId_RecentIsos_reservedStart ); + if (!m_RecentIsoList) m_RecentIsoList = std::unique_ptr(new RecentIsoList( MenuId_RecentIsos_reservedStart )); return *m_RecentIsoList->Menu; } RecentIsoManager& Pcsx2App::GetRecentIsoManager() { - if (!m_RecentIsoList) m_RecentIsoList = new RecentIsoList( MenuId_RecentIsos_reservedStart ); + if (!m_RecentIsoList) m_RecentIsoList = std::unique_ptr(new RecentIsoList( MenuId_RecentIsos_reservedStart )); return *m_RecentIsoList->Manager; } @@ -88,17 +89,17 @@ pxAppResources& Pcsx2App::GetResourceCache() { ScopedLock lock( m_mtx_Resources ); if( !m_Resources ) - m_Resources = new pxAppResources(); + m_Resources = std::unique_ptr(new pxAppResources()); return *m_Resources; } const wxIconBundle& Pcsx2App::GetIconBundle() { - ScopedPtr& bundle( GetResourceCache().IconBundle ); + std::unique_ptr& bundle( GetResourceCache().IconBundle ); if( !bundle ) { - bundle = new wxIconBundle(); + bundle = std::unique_ptr(new wxIconBundle()); bundle->AddIcon( EmbeddedImage().GetIcon() ); bundle->AddIcon( EmbeddedImage().GetIcon() ); bundle->AddIcon( EmbeddedImage().GetIcon() ); @@ -109,7 +110,7 @@ const wxIconBundle& Pcsx2App::GetIconBundle() const wxBitmap& Pcsx2App::GetLogoBitmap() { - ScopedPtr& logo( GetResourceCache().Bitmap_Logo ); + std::unique_ptr & logo(GetResourceCache().Bitmap_Logo); if( logo ) return *logo; wxFileName themeDirectory; @@ -137,14 +138,14 @@ const wxBitmap& Pcsx2App::GetLogoBitmap() EmbeddedImage temp; // because gcc can't allow non-const temporaries. LoadImageAny(img, useTheme, themeDirectory, L"BackgroundLogo", temp); float scale = MSW_GetDPIScale(); // 1.0 for non-Windows - logo = new wxBitmap(img.Scale(img.GetWidth() * scale, img.GetHeight() * scale, wxIMAGE_QUALITY_HIGH)); + logo = std::unique_ptr(new wxBitmap(img.Scale(img.GetWidth() * scale, img.GetHeight() * scale, wxIMAGE_QUALITY_HIGH))); return *logo; } const wxBitmap& Pcsx2App::GetScreenshotBitmap() { - ScopedPtr& screenshot(GetResourceCache().ScreenshotBitmap); + std::unique_ptr& screenshot(GetResourceCache().ScreenshotBitmap); if (screenshot) return *screenshot; wxFileName themeDirectory; @@ -159,18 +160,18 @@ const wxBitmap& Pcsx2App::GetScreenshotBitmap() EmbeddedImage temp; // because gcc can't allow non-const temporaries. LoadImageAny(img, useTheme, themeDirectory, L"ButtonIcon_Camera", temp); float scale = MSW_GetDPIScale(); // 1.0 for non-Windows - screenshot = new wxBitmap(img.Scale(img.GetWidth() * scale, img.GetHeight() * scale, wxIMAGE_QUALITY_HIGH)); + screenshot = std::unique_ptr(new wxBitmap(img.Scale(img.GetWidth() * scale, img.GetHeight() * scale, wxIMAGE_QUALITY_HIGH))); return *screenshot; } wxImageList& Pcsx2App::GetImgList_Config() { - ScopedPtr& images( GetResourceCache().ConfigImages ); + std::unique_ptr& images( GetResourceCache().ConfigImages ); if( !images ) { int image_size = MSW_GetDPIScale() * g_Conf->Listbook_ImageSize; - images = new wxImageList(image_size, image_size); + images = std::unique_ptr(new wxImageList(image_size, image_size)); wxFileName themeDirectory; bool useTheme = (g_Conf->DeskTheme != L"default"); @@ -213,12 +214,12 @@ wxImageList& Pcsx2App::GetImgList_Config() // This stuff seems unused? wxImageList& Pcsx2App::GetImgList_Toolbars() { - ScopedPtr& images( GetResourceCache().ToolbarImages ); + std::unique_ptr& images( GetResourceCache().ToolbarImages ); if( !images ) { const int imgSize = g_Conf->Toolbar_ImageSize ? 64 : 32; - images = new wxImageList( imgSize, imgSize ); + images = std::unique_ptr(new wxImageList(imgSize, imgSize)); wxFileName mess; bool useTheme = (g_Conf->DeskTheme != L"default"); diff --git a/pcsx2/gui/AppUserMode.cpp b/pcsx2/gui/AppUserMode.cpp index 348624e2c1..f05d2a2927 100644 --- a/pcsx2/gui/AppUserMode.cpp +++ b/pcsx2/gui/AppUserMode.cpp @@ -129,7 +129,7 @@ wxConfigBase* Pcsx2App::TestForPortableInstall() // mode. In order to determine our read/write permissions to the PCSX2, we must try to // modify the configured documents folder, and catch any ensuing error. - ScopedPtr conf_portable( OpenFileConfig( portableIniFile.GetFullPath() ) ); + std::unique_ptr conf_portable( OpenFileConfig( portableIniFile.GetFullPath() ) ); conf_portable->SetRecordDefaults(false); while( true ) @@ -187,7 +187,7 @@ wxConfigBase* Pcsx2App::TestForPortableInstall() InstallationMode = InstallMode_Portable; DocsFolderMode = DocsFolder_Custom; CustomDocumentsFolder = portableDocsFolder; - return conf_portable.DetachPtr(); + return conf_portable.release(); } return NULL; @@ -200,13 +200,13 @@ void Pcsx2App::WipeUserModeSettings() { // Remove the portable.ini entry "RunWizard" conforming to this instance of PCSX2. wxFileName portableIniFile( GetPortableIniPath() ); - ScopedPtr conf_portable( OpenFileConfig( portableIniFile.GetFullPath() ) ); + std::unique_ptr conf_portable( OpenFileConfig( portableIniFile.GetFullPath() ) ); conf_portable->DeleteEntry(L"RunWizard"); } else { // Remove the registry entry "RunWizard" conforming to this instance of PCSX2. - ScopedPtr conf_install( OpenInstallSettingsFile() ); + std::unique_ptr conf_install( OpenInstallSettingsFile() ); conf_install->DeleteEntry(L"RunWizard"); } } @@ -237,10 +237,10 @@ wxConfigBase* Pcsx2App::OpenInstallSettingsFile() // the old system (CWD-based ini file mess) in favor of a system that simply stores // most core application-level settings in the registry. - ScopedPtr conf_install; + std::unique_ptr conf_install; #ifdef __WXMSW__ - conf_install = new wxRegConfig(); + conf_install = std::unique_ptr(new wxRegConfig()); #else // FIXME!! Linux / Mac // Where the heck should this information be stored? @@ -255,31 +255,31 @@ wxConfigBase* Pcsx2App::OpenInstallSettingsFile() wxFileName usermodefile( GetAppName() + L"-reg.ini" ); usermodefile.SetPath( usrlocaldir.ToString() ); - conf_install = OpenFileConfig( usermodefile.GetFullPath() ); + conf_install = std::unique_ptr(OpenFileConfig( usermodefile.GetFullPath() )); #endif - return conf_install.DetachPtr(); + return conf_install.release(); } void Pcsx2App::ForceFirstTimeWizardOnNextRun() { - ScopedPtr conf_install; + std::unique_ptr conf_install; - conf_install = TestForPortableInstall(); + conf_install = std::unique_ptr(TestForPortableInstall()); if (!conf_install) - conf_install = OpenInstallSettingsFile(); + conf_install = std::unique_ptr(OpenInstallSettingsFile()); conf_install->Write( L"RunWizard", true ); } void Pcsx2App::EstablishAppUserMode() { - ScopedPtr conf_install; + std::unique_ptr conf_install; - conf_install = TestForPortableInstall(); + conf_install = std::unique_ptr(TestForPortableInstall()); if (!conf_install) - conf_install = OpenInstallSettingsFile(); + conf_install = std::unique_ptr(OpenInstallSettingsFile()); conf_install->SetRecordDefaults(false); @@ -292,7 +292,7 @@ void Pcsx2App::EstablishAppUserMode() bool runWiz; conf_install->Read( L"RunWizard", &runWiz, true ); - App_LoadInstallSettings( conf_install ); + App_LoadInstallSettings( conf_install.get() ); if( !Startup.ForceWizard && !runWiz ) { @@ -303,7 +303,7 @@ void Pcsx2App::EstablishAppUserMode() DoFirstTimeWizard(); // Save user's new settings - App_SaveInstallSettings( conf_install ); + App_SaveInstallSettings( conf_install.get() ); AppConfig_OnChangedSettingsFolder( true ); AppSaveSettings(); diff --git a/pcsx2/gui/ConsoleLogger.cpp b/pcsx2/gui/ConsoleLogger.cpp index d81da96e75..0d2a80ccca 100644 --- a/pcsx2/gui/ConsoleLogger.cpp +++ b/pcsx2/gui/ConsoleLogger.cpp @@ -1174,16 +1174,16 @@ void Pcsx2App::EnableAllLogging() if( emuLog ) { - if( !m_StdoutRedirHandle ) m_StdoutRedirHandle = NewPipeRedir(stdout); - if( !m_StderrRedirHandle ) m_StderrRedirHandle = NewPipeRedir(stderr); + if( !m_StdoutRedirHandle ) m_StdoutRedirHandle = std::unique_ptr(NewPipeRedir(stdout)); + if( !m_StderrRedirHandle ) m_StderrRedirHandle = std::unique_ptr(NewPipeRedir(stderr)); newHandler = logBoxOpen ? (IConsoleWriter*)&ConsoleWriter_WindowAndFile : (IConsoleWriter*)&ConsoleWriter_File; } else { if( logBoxOpen ) { - if( !m_StdoutRedirHandle ) m_StdoutRedirHandle = NewPipeRedir(stdout); - if( !m_StderrRedirHandle ) m_StderrRedirHandle = NewPipeRedir(stderr); + if (!m_StdoutRedirHandle) m_StdoutRedirHandle = std::unique_ptr(NewPipeRedir(stdout)); + if (!m_StderrRedirHandle) m_StderrRedirHandle = std::unique_ptr(NewPipeRedir(stderr)); newHandler = &ConsoleWriter_Window; } else diff --git a/pcsx2/gui/ConsoleLogger.h b/pcsx2/gui/ConsoleLogger.h index 62bd2aefb7..674e401723 100644 --- a/pcsx2/gui/ConsoleLogger.h +++ b/pcsx2/gui/ConsoleLogger.h @@ -100,7 +100,7 @@ class pxLogTextCtrl : public wxTextCtrl, public EventListener_Plugins { protected: - ScopedPtr m_IsPaused; + std::unique_ptr m_IsPaused; bool m_FreezeWrites; public: @@ -213,7 +213,7 @@ protected: // Threaded log spammer, useful for testing console logging performance. // (alternatively you can enable Disasm logging in any recompiler and achieve // a similar effect) - ScopedPtr m_threadlogger; + std::unique_ptr m_threadlogger; public: // ctor & dtor diff --git a/pcsx2/gui/CpuUsageProvider.h b/pcsx2/gui/CpuUsageProvider.h index 18528dcf0e..a52c55be5c 100644 --- a/pcsx2/gui/CpuUsageProvider.h +++ b/pcsx2/gui/CpuUsageProvider.h @@ -16,6 +16,7 @@ #pragma once #include "AppEventListeners.h" +#include class BaseCpuUsageProvider { @@ -35,7 +36,7 @@ public: class CpuUsageProvider : public BaseCpuUsageProvider { protected: - ScopedPtr m_Implementation; + std::unique_ptr m_Implementation; public: CpuUsageProvider(); diff --git a/pcsx2/gui/ExecutorThread.cpp b/pcsx2/gui/ExecutorThread.cpp index 2ab3a07b66..30f326f2d4 100644 --- a/pcsx2/gui/ExecutorThread.cpp +++ b/pcsx2/gui/ExecutorThread.cpp @@ -15,6 +15,7 @@ #include "PrecompiledHeader.h" #include "App.h" +#include using namespace pxSizerFlags; @@ -197,7 +198,7 @@ void pxEvtQueue::ProcessEvents( pxEvtList& list, bool isIdle ) pxEvtList::iterator node; while( node = list.begin(), node != list.end() ) { - ScopedPtr deleteMe(*node); + std::unique_ptr deleteMe(*node); list.erase( node ); if( !m_Quitting || deleteMe->IsCriticalEvent() ) @@ -210,7 +211,7 @@ void pxEvtQueue::ProcessEvents( pxEvtList& list, bool isIdle ) synclock.Release(); - pxEvtLog.Write( this, deleteMe, wxsFormat(L"Executing... [%s]%s", + pxEvtLog.Write( this, deleteMe.get(), wxsFormat(L"Executing... [%s]%s", deleteMe->AllowCancelOnExit() ? L"Cancelable" : L"Noncancelable", isIdle ? L"(Idle)" : wxEmptyString).wc_str() ); @@ -223,7 +224,7 @@ void pxEvtQueue::ProcessEvents( pxEvtList& list, bool isIdle ) } u64 qpc_end = GetCPUTicks(); - pxEvtLog.Write( this, deleteMe, wxsFormat(L"Event completed in %ums", + pxEvtLog.Write( this, deleteMe.get(), wxsFormat(L"Event completed in %ums", (u32)(((qpc_end-m_qpc_Start)*1000) / GetTickFrequency())).wc_str() ); @@ -232,7 +233,7 @@ void pxEvtQueue::ProcessEvents( pxEvtList& list, bool isIdle ) } else { - pxEvtLog.Write( this, deleteMe, L"Skipping Event: %s" ); + pxEvtLog.Write( this, deleteMe.get(), L"Skipping Event: %s" ); deleteMe->PostResult(); } } @@ -263,7 +264,7 @@ void pxEvtQueue::AddPendingEvent( SysExecEvent& evt ) // void pxEvtQueue::PostEvent( SysExecEvent* evt ) { - ScopedPtr sevt( evt ); + std::unique_ptr sevt(evt); if( !sevt ) return; if( m_Quitting ) @@ -276,7 +277,7 @@ void pxEvtQueue::PostEvent( SysExecEvent* evt ) pxEvtLog.Write( this, evt, pxsFmt(L"Posting event! (pending=%d, idle=%d)", m_pendingEvents.size(), m_idleEvents.size()) ); - m_pendingEvents.push_back( sevt.DetachPtr() ); + m_pendingEvents.push_back( sevt.release() ); if( m_pendingEvents.size() == 1) m_wakeup.Post(); } @@ -340,7 +341,7 @@ void pxEvtQueue::ProcessEvent( SysExecEvent* evt ) } else { - ScopedPtr deleteMe( evt ); + std::unique_ptr deleteMe(evt); deleteMe->_DoInvokeEvent(); } } @@ -452,9 +453,9 @@ void WaitingForThreadedTaskDialog::OnTerminateApp_Clicked( wxCommandEvent& evt ) // -------------------------------------------------------------------------------------- // ExecutorThread Implementations // -------------------------------------------------------------------------------------- -ExecutorThread::ExecutorThread( pxEvtQueue* evthandler ) +ExecutorThread::ExecutorThread(pxEvtQueue* evthandler) + : m_EvtHandler(evthandler) { - m_EvtHandler = evthandler; } bool ExecutorThread::IsRunning() const @@ -507,7 +508,7 @@ void ExecutorThread::ProcessEvent( SysExecEvent* evt ) m_EvtHandler->ProcessEvent( evt ); else { - ScopedPtr deleteMe( evt ); + std::unique_ptr deleteMe(evt); deleteMe->_DoInvokeEvent(); } } diff --git a/pcsx2/gui/FrameForGS.cpp b/pcsx2/gui/FrameForGS.cpp index 2928c7089f..e44df5c55f 100644 --- a/pcsx2/gui/FrameForGS.cpp +++ b/pcsx2/gui/FrameForGS.cpp @@ -23,6 +23,7 @@ #include "MSWstuff.h" #include +#include static const KeyAcceleratorCode FULLSCREEN_TOGGLE_ACCELERATOR_GSPANEL=KeyAcceleratorCode( WXK_RETURN ).Alt(); @@ -37,7 +38,7 @@ void GSPanel::InitDefaultAccelerators() typedef KeyAcceleratorCode AAC; - if( !m_Accels ) m_Accels = new AcceleratorDictionary; + if (!m_Accels) m_Accels = std::unique_ptr(new AcceleratorDictionary); m_Accels->Map( AAC( WXK_F1 ), "States_FreezeCurrentSlot" ); m_Accels->Map( AAC( WXK_F3 ), "States_DefrostCurrentSlot"); diff --git a/pcsx2/gui/GSFrame.h b/pcsx2/gui/GSFrame.h index bff1e4bd37..59f664fb73 100644 --- a/pcsx2/gui/GSFrame.h +++ b/pcsx2/gui/GSFrame.h @@ -18,6 +18,7 @@ #include "AppCommon.h" #include "CpuUsageProvider.h" +#include enum LimiterModeType @@ -39,7 +40,7 @@ class GSPanel : public wxWindow typedef wxWindow _parent; protected: - ScopedPtr m_Accels; + std::unique_ptr m_Accels; wxTimer m_HideMouseTimer; bool m_CursorShown; diff --git a/pcsx2/gui/GlobalCommands.cpp b/pcsx2/gui/GlobalCommands.cpp index 389591c11b..f462878d01 100644 --- a/pcsx2/gui/GlobalCommands.cpp +++ b/pcsx2/gui/GlobalCommands.cpp @@ -711,7 +711,7 @@ void AcceleratorDictionary::Map( const KeyAcceleratorCode& _acode, const char *s void Pcsx2App::BuildCommandHash() { - if( !GlobalCommands ) GlobalCommands = new CommandDictionary; + if( !GlobalCommands ) GlobalCommands = std::unique_ptr(new CommandDictionary); const GlobalCommandDescriptor* curcmd = CommandDeclarations; while( curcmd->Invoke != NULL ) @@ -725,7 +725,7 @@ void Pcsx2App::InitDefaultGlobalAccelerators() { typedef KeyAcceleratorCode AAC; - if( !GlobalAccels ) GlobalAccels = new AcceleratorDictionary; + if( !GlobalAccels ) GlobalAccels = std::unique_ptr(new AcceleratorDictionary); // Why do we even have those here? all of them seem to be overridden // by GSPanel::m_Accels ( GSPanel::InitDefaultAccelerators() ) diff --git a/pcsx2/gui/MainMenuClicks.cpp b/pcsx2/gui/MainMenuClicks.cpp index 937c5b7f67..5e2ed8be81 100644 --- a/pcsx2/gui/MainMenuClicks.cpp +++ b/pcsx2/gui/MainMenuClicks.cpp @@ -93,7 +93,7 @@ static void WipeSettings() //wxRmdir( GetSettingsFolder().ToString() ); wxGetApp().GetRecentIsoManager().Clear(); - g_Conf = new AppConfig(); + g_Conf = std::unique_ptr(new AppConfig()); sMainFrame.RemoveCdvdMenu(); sApp.WipeUserModeSettings(); diff --git a/pcsx2/gui/Panels/BiosSelectorPanel.cpp b/pcsx2/gui/Panels/BiosSelectorPanel.cpp index dd8a1a401d..24d9a4b1ce 100644 --- a/pcsx2/gui/Panels/BiosSelectorPanel.cpp +++ b/pcsx2/gui/Panels/BiosSelectorPanel.cpp @@ -22,6 +22,7 @@ #include #include #include +#include using namespace pxSizerFlags; @@ -150,17 +151,17 @@ bool Panels::BiosSelectorPanel::ValidateEnumerationStatus() { bool validated = true; - // Impl Note: ScopedPtr used so that resources get cleaned up if an exception + // Impl Note: unique_ptr used so that resources get cleaned up if an exception // occurs during file enumeration. - ScopedPtr bioslist( new wxArrayString() ); + std::unique_ptr bioslist(new wxArrayString()); if( m_FolderPicker->GetPath().Exists() ) - wxDir::GetAllFiles( m_FolderPicker->GetPath().ToString(), bioslist, L"*.*", wxDIR_FILES ); + wxDir::GetAllFiles(m_FolderPicker->GetPath().ToString(), bioslist.get(), L"*.*", wxDIR_FILES); if( !m_BiosList || (*bioslist != *m_BiosList) ) validated = false; - m_BiosList.SwapPtr( bioslist ); + m_BiosList.swap(bioslist); return validated; } diff --git a/pcsx2/gui/Panels/ConfigurationPanels.h b/pcsx2/gui/Panels/ConfigurationPanels.h index 6994310520..beac5c48a4 100644 --- a/pcsx2/gui/Panels/ConfigurationPanels.h +++ b/pcsx2/gui/Panels/ConfigurationPanels.h @@ -23,6 +23,7 @@ #include #include +#include #include "AppCommon.h" #include "ApplyState.h" @@ -492,9 +493,9 @@ namespace Panels typedef BaseSelectorPanel _parent; protected: - ScopedPtr m_ThemeList; - wxListBox* m_ComboBox; - DirPickerPanel* m_FolderPicker; + std::unique_ptr m_ThemeList; + wxListBox* m_ComboBox; + DirPickerPanel* m_FolderPicker; public: virtual ~ThemeSelectorPanel() throw(); @@ -513,9 +514,9 @@ namespace Panels class BiosSelectorPanel : public BaseSelectorPanel { protected: - ScopedPtr m_BiosList; - wxListBox* m_ComboBox; - DirPickerPanel* m_FolderPicker; + std::unique_ptr m_BiosList; + wxListBox* m_ComboBox; + DirPickerPanel* m_FolderPicker; public: BiosSelectorPanel( wxWindow* parent ); @@ -620,8 +621,8 @@ namespace Panels ComboBoxPanel* m_ComponentBoxes; bool m_Canceled; - ScopedPtr m_FileList; // list of potential plugin files - ScopedPtr m_EnumeratorThread; + std::unique_ptr m_FileList; // list of potential plugin files + std::unique_ptr m_EnumeratorThread; public: virtual ~PluginSelectorPanel() throw(); diff --git a/pcsx2/gui/Panels/GameFixesPanel.cpp b/pcsx2/gui/Panels/GameFixesPanel.cpp index e64bd5f0d2..1093b2cdf2 100644 --- a/pcsx2/gui/Panels/GameFixesPanel.cpp +++ b/pcsx2/gui/Panels/GameFixesPanel.cpp @@ -147,7 +147,7 @@ void Panels::GameFixesPanel::Apply() void Panels::GameFixesPanel::EnableStuff( AppConfig* configToUse ) { - if( !configToUse ) configToUse = g_Conf; + if (!configToUse) configToUse = g_Conf.get(); for (GamefixId i=GamefixId_FIRST; i < pxEnumEnd; ++i) m_checkbox[i]->Enable(m_check_Enable->GetValue() && !configToUse->EnablePresets); diff --git a/pcsx2/gui/Panels/PluginSelectorPanel.cpp b/pcsx2/gui/Panels/PluginSelectorPanel.cpp index 37532ffe22..7f5bf61606 100644 --- a/pcsx2/gui/Panels/PluginSelectorPanel.cpp +++ b/pcsx2/gui/Panels/PluginSelectorPanel.cpp @@ -17,6 +17,7 @@ #include #include +#include #include "App.h" #include "AppSaveStates.h" @@ -256,7 +257,7 @@ void SysExecEvent_ApplyPlugins::InvokeEvent() { ScopedCoreThreadPause paused_core; - ScopedPtr< VmStateBuffer > buffer; + std::unique_ptr buffer; if( SysHasValidState() ) { @@ -268,7 +269,8 @@ void SysExecEvent_ApplyPlugins::InvokeEvent() // FIXME : We only actually have to save plugins here, except the recovery code // in SysCoreThread isn't quite set up yet to handle that (I think...) --air - memSavingState saveme( *(buffer.Reassign(new VmStateBuffer(L"StateBuffer_ApplyNewPlugins"))) ); + buffer.reset(new VmStateBuffer(L"StateBuffer_ApplyNewPlugins")); + memSavingState saveme(buffer.get()); saveme.FreezeAll(); } @@ -546,7 +548,7 @@ void Panels::PluginSelectorPanel::DoRefresh() wxCommandEvent evt( pxEVT_ShowStatusBar ); GetEventHandler()->AddPendingEvent( evt ); - m_EnumeratorThread.Reassign(new EnumThread( *this )); + m_EnumeratorThread.reset(new EnumThread(*this)); if( DisableThreading ) m_EnumeratorThread->DoNextPlugin( 0 ); @@ -563,11 +565,11 @@ bool Panels::PluginSelectorPanel::ValidateEnumerationStatus() // re-enumerate plugins, and if anything changed then we need to wipe // the contents of the combo boxes and re-enumerate everything. - // Impl Note: ScopedPtr used so that resources get cleaned up if an exception + // Impl Note: unique_ptr used so that resources get cleaned up if an exception // occurs during file enumeration. - ScopedPtr pluginlist( new wxArrayString() ); + std::unique_ptr pluginlist(new wxArrayString()); - int pluggers = EnumeratePluginsInFolder( m_ComponentBoxes->GetPluginsPath(), pluginlist ); + int pluggers = EnumeratePluginsInFolder(m_ComponentBoxes->GetPluginsPath(), pluginlist.get()); if( !m_FileList || (*pluginlist != *m_FileList) ) validated = false; @@ -578,7 +580,7 @@ bool Panels::PluginSelectorPanel::ValidateEnumerationStatus() return validated; } - m_FileList.SwapPtr( pluginlist ); + m_FileList.swap(pluginlist); // set the gague length a little shorter than the plugin count. 2 reasons: // * some of the plugins might be duds. @@ -699,7 +701,7 @@ void Panels::PluginSelectorPanel::OnProgress( wxCommandEvent& evt ) // The thread can get canceled and replaced with a new thread, which means all // pending messages should be ignored. - if( m_EnumeratorThread != (EnumThread*)evt.GetClientData() ) return; + if (m_EnumeratorThread.get() != (EnumThread*)evt.GetClientData()) return; const size_t evtidx = evt.GetExtraLong(); diff --git a/pcsx2/gui/Panels/SpeedhacksPanel.cpp b/pcsx2/gui/Panels/SpeedhacksPanel.cpp index 5aa8abf2b0..a726aac43c 100644 --- a/pcsx2/gui/Panels/SpeedhacksPanel.cpp +++ b/pcsx2/gui/Panels/SpeedhacksPanel.cpp @@ -251,7 +251,7 @@ Panels::SpeedHacksPanel::SpeedHacksPanel( wxWindow* parent ) // Doesn't modify values - only locks(gray out)/unlocks as necessary. void Panels::SpeedHacksPanel::EnableStuff( AppConfig* configToUse ) { - if( !configToUse ) configToUse = g_Conf; + if (!configToUse) configToUse = g_Conf.get(); bool hasPreset = configToUse->EnablePresets; bool hacksEnabled = configToUse->EnableSpeedHacks; diff --git a/pcsx2/gui/Panels/ThemeSelectorPanel.cpp b/pcsx2/gui/Panels/ThemeSelectorPanel.cpp index e9044824f6..187ee198a3 100644 --- a/pcsx2/gui/Panels/ThemeSelectorPanel.cpp +++ b/pcsx2/gui/Panels/ThemeSelectorPanel.cpp @@ -21,6 +21,7 @@ #include #include #include +#include using namespace pxSizerFlags; @@ -73,20 +74,20 @@ bool Panels::ThemeSelectorPanel::ValidateEnumerationStatus() { bool validated = true; - // Impl Note: ScopedPtr used so that resources get cleaned up if an exception + // Impl Note: unique_ptr used so that resources get cleaned up if an exception // occurs during file enumeration. - ScopedPtr themelist( new wxArrayString() ); + std::unique_ptr themelist(new wxArrayString()); if( m_FolderPicker->GetPath().Exists() ) { - wxDir::GetAllFiles( m_FolderPicker->GetPath().ToString(), themelist, L"*.zip;*.p2ui", wxDIR_FILES ); - wxDir::GetAllFiles( m_FolderPicker->GetPath().ToString(), themelist, L"*.*", wxDIR_DIRS ); + wxDir::GetAllFiles(m_FolderPicker->GetPath().ToString(), themelist.get(), L"*.zip;*.p2ui", wxDIR_FILES); + wxDir::GetAllFiles(m_FolderPicker->GetPath().ToString(), themelist.get(), L"*.*", wxDIR_DIRS); } if( !m_ThemeList || (*themelist != *m_ThemeList) ) validated = false; - m_ThemeList.SwapPtr( themelist ); + m_ThemeList.swap(themelist); return validated; } diff --git a/pcsx2/gui/RecentIsoList.h b/pcsx2/gui/RecentIsoList.h index e339542370..fd61759cb5 100644 --- a/pcsx2/gui/RecentIsoList.h +++ b/pcsx2/gui/RecentIsoList.h @@ -72,8 +72,8 @@ protected: // -------------------------------------------------------------------------------------- struct RecentIsoList { - ScopedPtr Manager; - ScopedPtr Menu; + std::unique_ptr Manager; + std::unique_ptr Menu; RecentIsoList(int firstIdForMenuItems_or_wxID_ANY); virtual ~RecentIsoList() throw() { } diff --git a/pcsx2/gui/SysState.cpp b/pcsx2/gui/SysState.cpp index 2c43fed888..bb862cd618 100644 --- a/pcsx2/gui/SysState.cpp +++ b/pcsx2/gui/SysState.cpp @@ -25,6 +25,7 @@ #include "Utilities/pxStreams.h" #include +#include // Used to hold the current state backup (fullcopy of PS2 memory and plugin states). //static VmStateBuffer state_buffer( L"Public Savestate Buffer" ); @@ -422,7 +423,7 @@ protected: void InvokeEvent() { // Provisionals for scoped cleanup, in case of exception: - ScopedPtr elist( m_src_list ); + std::unique_ptr elist(m_src_list); wxString tempfile( m_filename + L".tmp" ); @@ -437,7 +438,7 @@ protected: pxYield(4); // Write the version and screenshot: - ScopedPtr out( new pxOutputStream(tempfile, new wxZipOutputStream(woot)) ); + std::unique_ptr out(new pxOutputStream(tempfile, new wxZipOutputStream(woot))); wxZipOutputStream* gzfp = (wxZipOutputStream*)out->GetWxStreamBase(); { @@ -448,7 +449,7 @@ protected: gzfp->CloseEntry(); } - ScopedPtr m_screenshot; + std::unique_ptr m_screenshot; if (m_screenshot) { @@ -460,14 +461,14 @@ protected: } (*new VmStateCompressThread()) - .SetSource(elist) - .SetOutStream(out) + .SetSource(elist.get()) + .SetOutStream(out.get()) .SetFinishedPath(m_filename) .Start(); // No errors? Release cleanup handlers: - elist.DetachPtr(); - out.DetachPtr(); + elist.release(); + out.release(); } void CleanupEvent() @@ -506,12 +507,12 @@ protected: // Ugh. Exception handling made crappy because wxWidgets classes don't support scoped pointers yet. - ScopedPtr woot( new wxFFileInputStream(m_filename) ); + std::unique_ptr woot(new wxFFileInputStream(m_filename)); if (!woot->IsOk()) throw Exception::CannotCreateStream( m_filename ).SetDiagMsg(L"Cannot open file for reading."); - ScopedPtr reader( new pxInputStream(m_filename, new wxZipInputStream(woot)) ); - woot.DetachPtr(); + std::unique_ptr reader(new pxInputStream(m_filename, new wxZipInputStream(woot.get()))); + woot.release(); if (!reader->IsOk()) { @@ -528,14 +529,14 @@ protected: //bool foundScreenshot = false; //bool foundEntry[numSavestateEntries] = false; - ScopedPtr foundInternal; - ScopedPtr foundEntry[NumSavestateEntries]; + std::unique_ptr foundInternal; + std::unique_ptr foundEntry[NumSavestateEntries]; while(true) { Threading::pxTestCancel(); - ScopedPtr entry( gzreader->GetNextEntry() ); + std::unique_ptr entry(gzreader->GetNextEntry()); if (!entry) break; if (entry->GetName().CmpNoCase(EntryFilename_StateVersion) == 0) @@ -549,7 +550,7 @@ protected: if (entry->GetName().CmpNoCase(EntryFilename_InternalStructures) == 0) { DevCon.WriteLn( Color_Green, L" ... found '%s'", EntryFilename_InternalStructures); - foundInternal = entry.DetachPtr(); + foundInternal = std::move(entry); continue; } @@ -565,7 +566,7 @@ protected: if (entry->GetName().CmpNoCase(SavestateEntries[i]->GetFilename()) == 0) { DevCon.WriteLn( Color_Green, L" ... found '%s'", WX_STR(SavestateEntries[i]->GetFilename()) ); - foundEntry[i] = entry.DetachPtr(); + foundEntry[i] = std::move(entry); break; } } @@ -633,12 +634,12 @@ void StateCopy_SaveToFile( const wxString& file ) { UI_DisableStateActions(); - ScopedPtr ziplist (new ArchiveEntryList( new VmStateBuffer( L"Zippable Savestate" ) )); + std::unique_ptr ziplist(new ArchiveEntryList(new VmStateBuffer(L"Zippable Savestate"))); - GetSysExecutorThread().PostEvent(new SysExecEvent_DownloadState ( ziplist )); - GetSysExecutorThread().PostEvent(new SysExecEvent_ZipToDisk ( ziplist, file )); + GetSysExecutorThread().PostEvent(new SysExecEvent_DownloadState(ziplist.get())); + GetSysExecutorThread().PostEvent(new SysExecEvent_ZipToDisk(ziplist.get(), file)); - ziplist.DetachPtr(); + ziplist.release(); } void StateCopy_LoadFromFile( const wxString& file ) diff --git a/pcsx2/gui/i18n.cpp b/pcsx2/gui/i18n.cpp index 96c96071aa..25a5887da8 100644 --- a/pcsx2/gui/i18n.cpp +++ b/pcsx2/gui/i18n.cpp @@ -16,8 +16,8 @@ #include "PrecompiledHeader.h" #include "i18n.h" #include "AppConfig.h" - #include "Utilities/SafeArray.h" +#include // Some of the codes provided by wxWidgets are 'obsolete' -- effectively replaced by more specific // region-qualified language codes. This function can be used to filter them out. @@ -80,9 +80,9 @@ static void i18n_DoPackageCheck( wxLanguage wxLangId, LangPackList& langs, bool& // note: wx preserves the current locale for us, so creating a new locale and deleting // will not affect program status. #if wxMAJOR_VERSION < 3 - ScopedPtr locale( new wxLocale( wxLangId, wxLOCALE_CONV_ENCODING ) ); + std::unique_ptr locale(new wxLocale(wxLangId, wxLOCALE_CONV_ENCODING)); #else - ScopedPtr locale( new wxLocale( wxLangId, 0 ) ); + std::unique_ptr locale(new wxLocale(wxLangId, 0)); #endif // Force the msgIdLanguage param to wxLANGUAGE_UNKNOWN to disable wx's automatic english @@ -304,7 +304,7 @@ bool i18n_SetLanguage( wxLanguage wxLangId, const wxString& langCode ) if (!info) return false; if (wxGetLocale() && (info->Language == wxGetLocale()->GetLanguage())) return true; - ScopedPtr locale( new wxLocale(info->Language) ); + std::unique_ptr locale(new wxLocale(info->Language)); if( !locale->IsOk() ) { @@ -325,7 +325,7 @@ bool i18n_SetLanguage( wxLanguage wxLangId, const wxString& langCode ) // English/US is built in, so no need to load MO/PO files. if( pxIsEnglish(wxLangId) ) { - locale.DetachPtr(); + locale.release(); return true; } @@ -356,7 +356,7 @@ bool i18n_SetLanguage( wxLanguage wxLangId, const wxString& langCode ) return false; } - locale.DetachPtr(); + locale.release(); return true; } diff --git a/pcsx2/gui/pxEventThread.h b/pcsx2/gui/pxEventThread.h index 304021df97..56f4ca973c 100644 --- a/pcsx2/gui/pxEventThread.h +++ b/pcsx2/gui/pxEventThread.h @@ -17,7 +17,7 @@ #include "Utilities/PersistentThread.h" #include "Utilities/pxEvents.h" - +#include // TODO!! Make the system defined in this header system a bit more generic, and then move // it to the Utilities library. @@ -266,8 +266,8 @@ class ExecutorThread : public Threading::pxThread typedef Threading::pxThread _parent; protected: - ScopedPtr m_ExecutorTimer; - ScopedPtr m_EvtHandler; + std::unique_ptr m_ExecutorTimer; + std::unique_ptr m_EvtHandler; public: ExecutorThread( pxEvtQueue* evtandler = NULL ); diff --git a/pcsx2/gui/pxLogTextCtrl.cpp b/pcsx2/gui/pxLogTextCtrl.cpp index f7a2bc9327..6ec310ff23 100644 --- a/pcsx2/gui/pxLogTextCtrl.cpp +++ b/pcsx2/gui/pxLogTextCtrl.cpp @@ -20,6 +20,7 @@ #ifdef __WXMSW__ # include // needed for windows-specific rich text messages to make scrolling not lame #endif +#include void pxLogTextCtrl::DispatchEvent( const CoreThreadStatus& status ) { @@ -65,7 +66,7 @@ void pxLogTextCtrl::OnThumbTrack(wxScrollWinEvent& evt) //Console.Warning( "Thumb Tracking!!!" ); m_FreezeWrites = true; if( !m_IsPaused ) - m_IsPaused = new ScopedCoreThreadPause(); + m_IsPaused = std::unique_ptr(new ScopedCoreThreadPause()); evt.Skip(); } @@ -77,7 +78,7 @@ void pxLogTextCtrl::OnThumbRelease(wxScrollWinEvent& evt) if( m_IsPaused ) { m_IsPaused->AllowResume(); - m_IsPaused.Delete(); + m_IsPaused = nullptr; } evt.Skip(); }