mirror of https://github.com/PCSX2/pcsx2.git
gui: Replace ScopedPtr with unique_ptr
This commit is contained in:
parent
92bb849e7c
commit
8889f4fdcc
|
@ -19,6 +19,7 @@
|
|||
|
||||
#include <wx/fileconf.h>
|
||||
#include <wx/apptrait.h>
|
||||
#include <memory>
|
||||
|
||||
#include "pxEventThread.h"
|
||||
|
||||
|
@ -241,12 +242,12 @@ class pxAppResources
|
|||
public:
|
||||
AppImageIds ImageId;
|
||||
|
||||
ScopedPtr<wxImageList> ConfigImages;
|
||||
ScopedPtr<wxImageList> ToolbarImages;
|
||||
ScopedPtr<wxIconBundle> IconBundle;
|
||||
ScopedPtr<wxBitmap> Bitmap_Logo;
|
||||
ScopedPtr<wxBitmap> ScreenshotBitmap;
|
||||
ScopedPtr<AppGameDatabase> GameDB;
|
||||
std::unique_ptr<wxImageList> ConfigImages;
|
||||
std::unique_ptr<wxImageList> ToolbarImages;
|
||||
std::unique_ptr<wxIconBundle> IconBundle;
|
||||
std::unique_ptr<wxBitmap> Bitmap_Logo;
|
||||
std::unique_ptr<wxBitmap> ScreenshotBitmap;
|
||||
std::unique_ptr<AppGameDatabase> GameDB;
|
||||
|
||||
pxAppResources();
|
||||
virtual ~pxAppResources() throw();
|
||||
|
@ -469,28 +470,28 @@ protected:
|
|||
|
||||
public:
|
||||
FramerateManager FpsManager;
|
||||
ScopedPtr<CommandDictionary> GlobalCommands;
|
||||
ScopedPtr<AcceleratorDictionary> GlobalAccels;
|
||||
std::unique_ptr<CommandDictionary> GlobalCommands;
|
||||
std::unique_ptr<AcceleratorDictionary> GlobalAccels;
|
||||
|
||||
StartupOptions Startup;
|
||||
CommandlineOverrides Overrides;
|
||||
|
||||
ScopedPtr<wxTimer> m_timer_Termination;
|
||||
std::unique_ptr<wxTimer> m_timer_Termination;
|
||||
|
||||
protected:
|
||||
ScopedPtr<PipeRedirectionBase> m_StdoutRedirHandle;
|
||||
ScopedPtr<PipeRedirectionBase> m_StderrRedirHandle;
|
||||
std::unique_ptr<PipeRedirectionBase> m_StdoutRedirHandle;
|
||||
std::unique_ptr<PipeRedirectionBase> m_StderrRedirHandle;
|
||||
|
||||
ScopedPtr<RecentIsoList> m_RecentIsoList;
|
||||
ScopedPtr<pxAppResources> m_Resources;
|
||||
std::unique_ptr<RecentIsoList> m_RecentIsoList;
|
||||
std::unique_ptr<pxAppResources> 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<SysCpuProviderPack> m_CpuProviders;
|
||||
ScopedPtr<SysMainMemory> m_VmReserve;
|
||||
std::unique_ptr<SysCpuProviderPack> m_CpuProviders;
|
||||
std::unique_ptr<SysMainMemory> m_VmReserve;
|
||||
|
||||
protected:
|
||||
wxWindowID m_id_MainFrame;
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
|
||||
#include <wx/stdpaths.h>
|
||||
#include "DebugTools/Debug.h"
|
||||
#include <memory>
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// 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<AppConfig>(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<wxFileConfig> vmini( OpenFileConfig( GetVmSettingsFilename() ) );
|
||||
IniLoader vmloader( vmini );
|
||||
std::unique_ptr<wxFileConfig> 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<wxFileConfig> vmini( OpenFileConfig( GetVmSettingsFilename() ) );
|
||||
IniSaver vmsaver( vmini );
|
||||
std::unique_ptr<wxFileConfig> 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<wxConfigBase> conf_install;
|
||||
std::unique_ptr<wxConfigBase> 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<wxConfigBase>((*__app_).OpenInstallSettingsFile());
|
||||
conf_install->SetRecordDefaults(false);
|
||||
|
||||
App_SaveInstallSettings( conf_install );
|
||||
App_SaveInstallSettings( conf_install.get() );
|
||||
}
|
||||
|
||||
void AppSaveSettings()
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include "AppForwardDefs.h"
|
||||
#include "PathDefs.h"
|
||||
#include "CDVD/CDVDaccess.h"
|
||||
#include <memory>
|
||||
|
||||
enum DocsModeType
|
||||
{
|
||||
|
@ -383,4 +384,4 @@ extern void RelocateLogfile();
|
|||
extern void AppConfig_OnChangedSettingsFolder( bool overwrite = false );
|
||||
extern wxConfigBase* GetAppConfig();
|
||||
|
||||
extern ScopedPtr<AppConfig> g_Conf;
|
||||
extern std::unique_ptr<AppConfig> g_Conf;
|
||||
|
|
|
@ -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<wxArrayString> placebo;
|
||||
std::unique_ptr<wxArrayString> 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<wxArrayString>(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<VmStateBuffer> plugstore;
|
||||
std::unique_ptr<VmStateBuffer> 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<VmStateBuffer>(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.
|
||||
|
|
|
@ -702,13 +702,13 @@ void BaseScopedCoreThread::DoResume()
|
|||
// handle the code directly).
|
||||
bool BaseScopedCoreThread::PostToSysExec( BaseSysExecEvent_ScopedCore* msg )
|
||||
{
|
||||
ScopedPtr<BaseSysExecEvent_ScopedCore> smsg( msg );
|
||||
std::unique_ptr<BaseSysExecEvent_ScopedCore> 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<BaseScopedCoreThread>(new ScopedCoreThreadClose());
|
||||
else
|
||||
m_scoped_core = new ScopedCoreThreadPause();
|
||||
m_scoped_core = std::unique_ptr<BaseScopedCoreThread>(new ScopedCoreThreadPause());
|
||||
};
|
||||
|
||||
void ScopedCoreThreadPopup::AllowResume()
|
||||
|
|
|
@ -237,7 +237,7 @@ public:
|
|||
struct ScopedCoreThreadPopup : public IScopedCoreThread
|
||||
{
|
||||
protected:
|
||||
ScopedPtr<BaseScopedCoreThread> m_scoped_core;
|
||||
std::unique_ptr<BaseScopedCoreThread> m_scoped_core;
|
||||
|
||||
public:
|
||||
ScopedCoreThreadPopup();
|
||||
|
|
|
@ -229,10 +229,10 @@ AppGameDatabase* Pcsx2App::GetGameDatabase()
|
|||
ScopedLock lock( m_mtx_LoadingGameDB );
|
||||
if( !res.GameDB )
|
||||
{
|
||||
res.GameDB = new AppGameDatabase();
|
||||
res.GameDB = std::unique_ptr<AppGameDatabase>(new AppGameDatabase());
|
||||
res.GameDB->LoadFromFile();
|
||||
}
|
||||
return res.GameDB;
|
||||
return res.GameDB.get();
|
||||
}
|
||||
|
||||
IGameDatabase* AppHost_GetGameDatabase()
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include <wx/cmdline.h>
|
||||
#include <wx/intl.h>
|
||||
#include <wx/stdpaths.h>
|
||||
#include <memory>
|
||||
|
||||
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<SysCpuProviderPack>(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<AppConfig>(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<wxTimer>(new wxTimer( this, wxID_ANY ));
|
||||
Connect( m_timer_Termination->GetId(), wxEVT_TIMER, wxTimerEventHandler(Pcsx2App::OnScheduledTermination) );
|
||||
SetExitOnFrameDelete( false );
|
||||
|
||||
|
|
|
@ -71,7 +71,7 @@ DEFINE_EVENT_TYPE( pxEvt_LogicalVsync );
|
|||
|
||||
DEFINE_EVENT_TYPE( pxEvt_ThreadTaskTimeout_SysExec );
|
||||
|
||||
ScopedPtr<AppConfig> g_Conf;
|
||||
std::unique_ptr<AppConfig> 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<SysMainMemory>(new SysMainMemory());
|
||||
return *m_VmReserve;
|
||||
}
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#include <wx/zipstrm.h>
|
||||
#include <wx/wfstream.h>
|
||||
#include <wx/imaglist.h>
|
||||
#include <memory>
|
||||
|
||||
#include "MSWstuff.h"
|
||||
|
||||
|
@ -61,9 +62,9 @@ const wxImage& LoadImageAny(
|
|||
|
||||
RecentIsoList::RecentIsoList(int firstIdForMenuItems_or_wxID_ANY)
|
||||
{
|
||||
Menu = new wxMenu();
|
||||
Menu = std::unique_ptr<wxMenu>(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<RecentIsoManager>(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<RecentIsoList>(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<RecentIsoList>(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<pxAppResources>(new pxAppResources());
|
||||
|
||||
return *m_Resources;
|
||||
}
|
||||
|
||||
const wxIconBundle& Pcsx2App::GetIconBundle()
|
||||
{
|
||||
ScopedPtr<wxIconBundle>& bundle( GetResourceCache().IconBundle );
|
||||
std::unique_ptr<wxIconBundle>& bundle( GetResourceCache().IconBundle );
|
||||
if( !bundle )
|
||||
{
|
||||
bundle = new wxIconBundle();
|
||||
bundle = std::unique_ptr<wxIconBundle>(new wxIconBundle());
|
||||
bundle->AddIcon( EmbeddedImage<res_AppIcon32>().GetIcon() );
|
||||
bundle->AddIcon( EmbeddedImage<res_AppIcon64>().GetIcon() );
|
||||
bundle->AddIcon( EmbeddedImage<res_AppIcon16>().GetIcon() );
|
||||
|
@ -109,7 +110,7 @@ const wxIconBundle& Pcsx2App::GetIconBundle()
|
|||
|
||||
const wxBitmap& Pcsx2App::GetLogoBitmap()
|
||||
{
|
||||
ScopedPtr<wxBitmap>& logo( GetResourceCache().Bitmap_Logo );
|
||||
std::unique_ptr <wxBitmap>& logo(GetResourceCache().Bitmap_Logo);
|
||||
if( logo ) return *logo;
|
||||
|
||||
wxFileName themeDirectory;
|
||||
|
@ -137,14 +138,14 @@ const wxBitmap& Pcsx2App::GetLogoBitmap()
|
|||
EmbeddedImage<res_BackgroundLogo> 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<wxBitmap>(new wxBitmap(img.Scale(img.GetWidth() * scale, img.GetHeight() * scale, wxIMAGE_QUALITY_HIGH)));
|
||||
|
||||
return *logo;
|
||||
}
|
||||
|
||||
const wxBitmap& Pcsx2App::GetScreenshotBitmap()
|
||||
{
|
||||
ScopedPtr<wxBitmap>& screenshot(GetResourceCache().ScreenshotBitmap);
|
||||
std::unique_ptr<wxBitmap>& screenshot(GetResourceCache().ScreenshotBitmap);
|
||||
if (screenshot) return *screenshot;
|
||||
|
||||
wxFileName themeDirectory;
|
||||
|
@ -159,18 +160,18 @@ const wxBitmap& Pcsx2App::GetScreenshotBitmap()
|
|||
EmbeddedImage<res_ButtonIcon_Camera> 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<wxBitmap>(new wxBitmap(img.Scale(img.GetWidth() * scale, img.GetHeight() * scale, wxIMAGE_QUALITY_HIGH)));
|
||||
|
||||
return *screenshot;
|
||||
}
|
||||
|
||||
wxImageList& Pcsx2App::GetImgList_Config()
|
||||
{
|
||||
ScopedPtr<wxImageList>& images( GetResourceCache().ConfigImages );
|
||||
std::unique_ptr<wxImageList>& 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<wxImageList>(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<wxImageList>& images( GetResourceCache().ToolbarImages );
|
||||
std::unique_ptr<wxImageList>& images( GetResourceCache().ToolbarImages );
|
||||
|
||||
if( !images )
|
||||
{
|
||||
const int imgSize = g_Conf->Toolbar_ImageSize ? 64 : 32;
|
||||
images = new wxImageList( imgSize, imgSize );
|
||||
images = std::unique_ptr<wxImageList>(new wxImageList(imgSize, imgSize));
|
||||
wxFileName mess;
|
||||
bool useTheme = (g_Conf->DeskTheme != L"default");
|
||||
|
||||
|
|
|
@ -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<wxFileConfig> conf_portable( OpenFileConfig( portableIniFile.GetFullPath() ) );
|
||||
std::unique_ptr<wxFileConfig> 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<wxFileConfig> conf_portable( OpenFileConfig( portableIniFile.GetFullPath() ) );
|
||||
std::unique_ptr<wxFileConfig> conf_portable( OpenFileConfig( portableIniFile.GetFullPath() ) );
|
||||
conf_portable->DeleteEntry(L"RunWizard");
|
||||
}
|
||||
else
|
||||
{
|
||||
// Remove the registry entry "RunWizard" conforming to this instance of PCSX2.
|
||||
ScopedPtr<wxConfigBase> conf_install( OpenInstallSettingsFile() );
|
||||
std::unique_ptr<wxConfigBase> 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<wxConfigBase> conf_install;
|
||||
std::unique_ptr<wxConfigBase> conf_install;
|
||||
|
||||
#ifdef __WXMSW__
|
||||
conf_install = new wxRegConfig();
|
||||
conf_install = std::unique_ptr<wxConfigBase>(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<wxConfigBase>(OpenFileConfig( usermodefile.GetFullPath() ));
|
||||
#endif
|
||||
|
||||
return conf_install.DetachPtr();
|
||||
return conf_install.release();
|
||||
}
|
||||
|
||||
|
||||
void Pcsx2App::ForceFirstTimeWizardOnNextRun()
|
||||
{
|
||||
ScopedPtr<wxConfigBase> conf_install;
|
||||
std::unique_ptr<wxConfigBase> conf_install;
|
||||
|
||||
conf_install = TestForPortableInstall();
|
||||
conf_install = std::unique_ptr<wxConfigBase>(TestForPortableInstall());
|
||||
if (!conf_install)
|
||||
conf_install = OpenInstallSettingsFile();
|
||||
conf_install = std::unique_ptr<wxConfigBase>(OpenInstallSettingsFile());
|
||||
|
||||
conf_install->Write( L"RunWizard", true );
|
||||
}
|
||||
|
||||
void Pcsx2App::EstablishAppUserMode()
|
||||
{
|
||||
ScopedPtr<wxConfigBase> conf_install;
|
||||
std::unique_ptr<wxConfigBase> conf_install;
|
||||
|
||||
conf_install = TestForPortableInstall();
|
||||
conf_install = std::unique_ptr<wxConfigBase>(TestForPortableInstall());
|
||||
if (!conf_install)
|
||||
conf_install = OpenInstallSettingsFile();
|
||||
conf_install = std::unique_ptr<wxConfigBase>(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();
|
||||
|
||||
|
|
|
@ -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<PipeRedirectionBase>(NewPipeRedir(stdout));
|
||||
if( !m_StderrRedirHandle ) m_StderrRedirHandle = std::unique_ptr<PipeRedirectionBase>(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<PipeRedirectionBase>(NewPipeRedir(stdout));
|
||||
if (!m_StderrRedirHandle) m_StderrRedirHandle = std::unique_ptr<PipeRedirectionBase>(NewPipeRedir(stderr));
|
||||
newHandler = &ConsoleWriter_Window;
|
||||
}
|
||||
else
|
||||
|
|
|
@ -100,7 +100,7 @@ class pxLogTextCtrl : public wxTextCtrl,
|
|||
public EventListener_Plugins
|
||||
{
|
||||
protected:
|
||||
ScopedPtr<ScopedCoreThreadPause> m_IsPaused;
|
||||
std::unique_ptr<ScopedCoreThreadPause> 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<ConsoleTestThread> m_threadlogger;
|
||||
std::unique_ptr<ConsoleTestThread> m_threadlogger;
|
||||
|
||||
public:
|
||||
// ctor & dtor
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
#pragma once
|
||||
|
||||
#include "AppEventListeners.h"
|
||||
#include <memory>
|
||||
|
||||
class BaseCpuUsageProvider
|
||||
{
|
||||
|
@ -35,7 +36,7 @@ public:
|
|||
class CpuUsageProvider : public BaseCpuUsageProvider
|
||||
{
|
||||
protected:
|
||||
ScopedPtr<BaseCpuUsageProvider> m_Implementation;
|
||||
std::unique_ptr<BaseCpuUsageProvider> m_Implementation;
|
||||
|
||||
public:
|
||||
CpuUsageProvider();
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
|
||||
#include "PrecompiledHeader.h"
|
||||
#include "App.h"
|
||||
#include <memory>
|
||||
|
||||
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<SysExecEvent> deleteMe(*node);
|
||||
std::unique_ptr<SysExecEvent> 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<SysExecEvent> sevt( evt );
|
||||
std::unique_ptr<SysExecEvent> 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<SysExecEvent> deleteMe( evt );
|
||||
std::unique_ptr<SysExecEvent> 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<SysExecEvent> deleteMe( evt );
|
||||
std::unique_ptr<SysExecEvent> deleteMe(evt);
|
||||
deleteMe->_DoInvokeEvent();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include "MSWstuff.h"
|
||||
|
||||
#include <wx/utils.h>
|
||||
#include <memory>
|
||||
|
||||
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<AcceleratorDictionary>(new AcceleratorDictionary);
|
||||
|
||||
m_Accels->Map( AAC( WXK_F1 ), "States_FreezeCurrentSlot" );
|
||||
m_Accels->Map( AAC( WXK_F3 ), "States_DefrostCurrentSlot");
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
|
||||
#include "AppCommon.h"
|
||||
#include "CpuUsageProvider.h"
|
||||
#include <memory>
|
||||
|
||||
|
||||
enum LimiterModeType
|
||||
|
@ -39,7 +40,7 @@ class GSPanel : public wxWindow
|
|||
typedef wxWindow _parent;
|
||||
|
||||
protected:
|
||||
ScopedPtr<AcceleratorDictionary> m_Accels;
|
||||
std::unique_ptr<AcceleratorDictionary> m_Accels;
|
||||
|
||||
wxTimer m_HideMouseTimer;
|
||||
bool m_CursorShown;
|
||||
|
|
|
@ -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<CommandDictionary>(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<AcceleratorDictionary>(new AcceleratorDictionary);
|
||||
|
||||
// Why do we even have those here? all of them seem to be overridden
|
||||
// by GSPanel::m_Accels ( GSPanel::InitDefaultAccelerators() )
|
||||
|
|
|
@ -93,7 +93,7 @@ static void WipeSettings()
|
|||
//wxRmdir( GetSettingsFolder().ToString() );
|
||||
|
||||
wxGetApp().GetRecentIsoManager().Clear();
|
||||
g_Conf = new AppConfig();
|
||||
g_Conf = std::unique_ptr<AppConfig>(new AppConfig());
|
||||
sMainFrame.RemoveCdvdMenu();
|
||||
|
||||
sApp.WipeUserModeSettings();
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include <wx/dir.h>
|
||||
#include <wx/filepicker.h>
|
||||
#include <wx/listbox.h>
|
||||
#include <memory>
|
||||
|
||||
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<wxArrayString> bioslist( new wxArrayString() );
|
||||
std::unique_ptr<wxArrayString> 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;
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
|
||||
#include <wx/statline.h>
|
||||
#include <wx/dnd.h>
|
||||
#include <memory>
|
||||
|
||||
#include "AppCommon.h"
|
||||
#include "ApplyState.h"
|
||||
|
@ -492,9 +493,9 @@ namespace Panels
|
|||
typedef BaseSelectorPanel _parent;
|
||||
|
||||
protected:
|
||||
ScopedPtr<wxArrayString> m_ThemeList;
|
||||
wxListBox* m_ComboBox;
|
||||
DirPickerPanel* m_FolderPicker;
|
||||
std::unique_ptr<wxArrayString> m_ThemeList;
|
||||
wxListBox* m_ComboBox;
|
||||
DirPickerPanel* m_FolderPicker;
|
||||
|
||||
public:
|
||||
virtual ~ThemeSelectorPanel() throw();
|
||||
|
@ -513,9 +514,9 @@ namespace Panels
|
|||
class BiosSelectorPanel : public BaseSelectorPanel
|
||||
{
|
||||
protected:
|
||||
ScopedPtr<wxArrayString> m_BiosList;
|
||||
wxListBox* m_ComboBox;
|
||||
DirPickerPanel* m_FolderPicker;
|
||||
std::unique_ptr<wxArrayString> 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<wxArrayString> m_FileList; // list of potential plugin files
|
||||
ScopedPtr<EnumThread> m_EnumeratorThread;
|
||||
std::unique_ptr<wxArrayString> m_FileList; // list of potential plugin files
|
||||
std::unique_ptr<EnumThread> m_EnumeratorThread;
|
||||
|
||||
public:
|
||||
virtual ~PluginSelectorPanel() throw();
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
|
||||
#include <wx/dynlib.h>
|
||||
#include <wx/dir.h>
|
||||
#include <memory>
|
||||
|
||||
#include "App.h"
|
||||
#include "AppSaveStates.h"
|
||||
|
@ -256,7 +257,7 @@ void SysExecEvent_ApplyPlugins::InvokeEvent()
|
|||
{
|
||||
ScopedCoreThreadPause paused_core;
|
||||
|
||||
ScopedPtr< VmStateBuffer > buffer;
|
||||
std::unique_ptr<VmStateBuffer> 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<wxArrayString> pluginlist( new wxArrayString() );
|
||||
std::unique_ptr<wxArrayString> 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();
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include <wx/filepicker.h>
|
||||
#include <wx/listbox.h>
|
||||
#include <wx/zipstrm.h>
|
||||
#include <memory>
|
||||
|
||||
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<wxArrayString> themelist( new wxArrayString() );
|
||||
std::unique_ptr<wxArrayString> 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;
|
||||
}
|
||||
|
|
|
@ -72,8 +72,8 @@ protected:
|
|||
// --------------------------------------------------------------------------------------
|
||||
struct RecentIsoList
|
||||
{
|
||||
ScopedPtr<RecentIsoManager> Manager;
|
||||
ScopedPtr<wxMenu> Menu;
|
||||
std::unique_ptr<RecentIsoManager> Manager;
|
||||
std::unique_ptr<wxMenu> Menu;
|
||||
|
||||
RecentIsoList(int firstIdForMenuItems_or_wxID_ANY);
|
||||
virtual ~RecentIsoList() throw() { }
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include "Utilities/pxStreams.h"
|
||||
|
||||
#include <wx/wfstream.h>
|
||||
#include <memory>
|
||||
|
||||
// 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<ArchiveEntryList> elist( m_src_list );
|
||||
std::unique_ptr<ArchiveEntryList> elist(m_src_list);
|
||||
|
||||
wxString tempfile( m_filename + L".tmp" );
|
||||
|
||||
|
@ -437,7 +438,7 @@ protected:
|
|||
pxYield(4);
|
||||
|
||||
// Write the version and screenshot:
|
||||
ScopedPtr<pxOutputStream> out( new pxOutputStream(tempfile, new wxZipOutputStream(woot)) );
|
||||
std::unique_ptr<pxOutputStream> out(new pxOutputStream(tempfile, new wxZipOutputStream(woot)));
|
||||
wxZipOutputStream* gzfp = (wxZipOutputStream*)out->GetWxStreamBase();
|
||||
|
||||
{
|
||||
|
@ -448,7 +449,7 @@ protected:
|
|||
gzfp->CloseEntry();
|
||||
}
|
||||
|
||||
ScopedPtr<wxImage> m_screenshot;
|
||||
std::unique_ptr<wxImage> 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<wxFFileInputStream> woot( new wxFFileInputStream(m_filename) );
|
||||
std::unique_ptr<wxFFileInputStream> woot(new wxFFileInputStream(m_filename));
|
||||
if (!woot->IsOk())
|
||||
throw Exception::CannotCreateStream( m_filename ).SetDiagMsg(L"Cannot open file for reading.");
|
||||
|
||||
ScopedPtr<pxInputStream> reader( new pxInputStream(m_filename, new wxZipInputStream(woot)) );
|
||||
woot.DetachPtr();
|
||||
std::unique_ptr<pxInputStream> 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<wxZipEntry> foundInternal;
|
||||
ScopedPtr<wxZipEntry> foundEntry[NumSavestateEntries];
|
||||
std::unique_ptr<wxZipEntry> foundInternal;
|
||||
std::unique_ptr<wxZipEntry> foundEntry[NumSavestateEntries];
|
||||
|
||||
while(true)
|
||||
{
|
||||
Threading::pxTestCancel();
|
||||
|
||||
ScopedPtr<wxZipEntry> entry( gzreader->GetNextEntry() );
|
||||
std::unique_ptr<wxZipEntry> 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<ArchiveEntryList> ziplist (new ArchiveEntryList( new VmStateBuffer( L"Zippable Savestate" ) ));
|
||||
std::unique_ptr<ArchiveEntryList> 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 )
|
||||
|
|
|
@ -16,8 +16,8 @@
|
|||
#include "PrecompiledHeader.h"
|
||||
#include "i18n.h"
|
||||
#include "AppConfig.h"
|
||||
|
||||
#include "Utilities/SafeArray.h"
|
||||
#include <memory>
|
||||
|
||||
// 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<wxLocale> locale( new wxLocale( wxLangId, wxLOCALE_CONV_ENCODING ) );
|
||||
std::unique_ptr<wxLocale> locale(new wxLocale(wxLangId, wxLOCALE_CONV_ENCODING));
|
||||
#else
|
||||
ScopedPtr<wxLocale> locale( new wxLocale( wxLangId, 0 ) );
|
||||
std::unique_ptr<wxLocale> 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<wxLocale> locale( new wxLocale(info->Language) );
|
||||
std::unique_ptr<wxLocale> 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;
|
||||
}
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
#include "Utilities/PersistentThread.h"
|
||||
#include "Utilities/pxEvents.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
// 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<wxTimer> m_ExecutorTimer;
|
||||
ScopedPtr<pxEvtQueue> m_EvtHandler;
|
||||
std::unique_ptr<wxTimer> m_ExecutorTimer;
|
||||
std::unique_ptr<pxEvtQueue> m_EvtHandler;
|
||||
|
||||
public:
|
||||
ExecutorThread( pxEvtQueue* evtandler = NULL );
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#ifdef __WXMSW__
|
||||
# include <wx/msw/wrapwin.h> // needed for windows-specific rich text messages to make scrolling not lame
|
||||
#endif
|
||||
#include <memory>
|
||||
|
||||
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<ScopedCoreThreadPause>(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();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue