From 43dfbe3f2964a8ecb5f74a326682353be2db22ed Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Fri, 24 Sep 2021 18:21:51 +1000 Subject: [PATCH] Move more classes from common to gui --- common/CMakeLists.txt | 6 --- common/Darwin/DarwinSemaphore.cpp | 4 -- common/General.h | 48 ------------------- common/Mutex.cpp | 3 -- common/PathUtils.cpp | 29 ------------ common/Semaphore.cpp | 3 -- common/common.vcxproj | 6 --- common/common.vcxproj.filters | 18 ------- common/wxBaseTools.h | 6 --- pcsx2/CMakeLists.txt | 8 +++- pcsx2/gui/AppCommon.h | 4 +- pcsx2/gui/CheckedStaticBox.h | 2 +- pcsx2/gui/Dialogs/LogOptionsDialog.h | 2 +- pcsx2/gui/ThreadingDialogs.cpp | 2 +- pcsx2/gui/pxCheckBox.cpp | 2 +- pcsx2/gui/pxCheckBox.h | 2 +- pcsx2/gui/pxRadioPanel.cpp | 2 +- pcsx2/gui/pxRadioPanel.h | 2 +- {common => pcsx2/gui}/pxStaticText.cpp | 4 +- {common => pcsx2/gui}/pxStaticText.h | 0 {common => pcsx2/gui}/pxWindowTextWriter.cpp | 4 +- pcsx2/gui/wxAppWithHelpers.cpp | 34 ++++++++++++- pcsx2/gui/wxAppWithHelpers.h | 50 +++++++++++++++++++- {common => pcsx2/gui}/wxGuiTools.cpp | 37 +++++++++++++-- {common => pcsx2/gui}/wxGuiTools.h | 6 +++ {common => pcsx2/gui}/wxHelpers.cpp | 40 ++-------------- pcsx2/pcsx2.vcxproj | 6 +++ pcsx2/pcsx2.vcxproj.filters | 12 +++++ 28 files changed, 166 insertions(+), 176 deletions(-) rename {common => pcsx2/gui}/pxStaticText.cpp (99%) rename {common => pcsx2/gui}/pxStaticText.h (100%) rename {common => pcsx2/gui}/pxWindowTextWriter.cpp (98%) rename {common => pcsx2/gui}/wxGuiTools.cpp (94%) rename {common => pcsx2/gui}/wxGuiTools.h (99%) rename {common => pcsx2/gui}/wxHelpers.cpp (91%) diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index 0c55676185..b46668a409 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -23,18 +23,14 @@ target_sources(common PRIVATE PathUtils.cpp PrecompiledHeader.cpp Perf.cpp - pxStaticText.cpp pxStreams.cpp pxTranslate.cpp - pxWindowTextWriter.cpp RwMutex.cpp Semaphore.cpp SettingsWrapper.cpp StringHelpers.cpp StringUtil.cpp ThreadTools.cpp - wxGuiTools.cpp - wxHelpers.cpp emitter/bmi.cpp emitter/cpudetect.cpp emitter/fpu.cpp @@ -74,7 +70,6 @@ target_sources(common PRIVATE PageFaultSource.h PrecompiledHeader.h pxForwardDefs.h - pxStaticText.h pxStreams.h RedtapeWindows.h RwMutex.h @@ -88,7 +83,6 @@ target_sources(common PRIVATE Threading.h TraceLog.h wxBaseTools.h - wxGuiTools.h emitter/cpudetect_internal.h emitter/implement/dwshift.h emitter/implement/group1.h diff --git a/common/Darwin/DarwinSemaphore.cpp b/common/Darwin/DarwinSemaphore.cpp index 2a8135e241..d4124c3b40 100644 --- a/common/Darwin/DarwinSemaphore.cpp +++ b/common/Darwin/DarwinSemaphore.cpp @@ -28,7 +28,6 @@ #include "common/Threading.h" #include "common/ThreadingInternal.h" #include "common/wxBaseTools.h" -#include "common/wxGuiTools.h" // -------------------------------------------------------------------------------------- // Semaphore Implementation for Darwin/OSX @@ -167,7 +166,6 @@ void Threading::Semaphore::Wait() } else if (_WaitGui_RecursionGuard(L"Semaphore::Wait")) { - ScopedBusyCursor hourglass(Cursor_ReallyBusy); WaitWithoutYield(); } else @@ -200,12 +198,10 @@ bool Threading::Semaphore::Wait(const wxTimeSpan& timeout) } else if (_WaitGui_RecursionGuard(L"Semaphore::TimedWait")) { - ScopedBusyCursor hourglass(Cursor_ReallyBusy); return WaitWithoutYield(timeout); } else { - //ScopedBusyCursor hourglass( Cursor_KindaBusy ); wxTimeSpan countdown((timeout)); do diff --git a/common/General.h b/common/General.h index f8c102a976..16edec2bec 100644 --- a/common/General.h +++ b/common/General.h @@ -98,54 +98,6 @@ protected: virtual void DoDeletion() = 0; }; -// -------------------------------------------------------------------------------------- -// BaseDeletableObject -// -------------------------------------------------------------------------------------- -// Oh the fruits and joys of multithreaded C++ coding conundrums! This class provides a way -// to be deleted from arbitraty threads, or to delete themselves (which is considered unsafe -// in C++, though it does typically work). It also gives objects a second recourse for -// doing fully virtualized cleanup, something C++ also makes impossible because of how it -// implements it's destructor hierarchy. -// -// To utilize virtual destruction, override DoDeletion() and be sure to invoke the base class -// implementation of DoDeletion(). -// -// Assertions: -// This class generates an assertion of the destructor is called from anything other than -// the main/gui thread. -// -// Rationale: -// wxWidgets provides a pending deletion feature, but it's specific to wxCore (not wxBase) -// which means it requires wxApp and all that, which is bad for plugins and the possibility -// of linking PCSX2 core against a non-WX gui in the future. It's also not thread safe -// (sigh). And, finally, it requires quite a bit of red tape to implement wxObjects because -// of the wx-custom runtime type information. So I made my own. -// -class BaseDeletableObject : public virtual IDeletableObject -{ -protected: - std::atomic m_IsBeingDeleted; - -public: - BaseDeletableObject(); - virtual ~BaseDeletableObject(); - - void DeleteSelf(); - bool IsBeingDeleted() { return !!m_IsBeingDeleted; } - - // Returns FALSE if the object is already marked for deletion, or TRUE if the app - // should schedule the object for deletion. Only schedule if TRUE is returned, otherwise - // the object could get deleted twice if two threads try to schedule it at the same time. - bool MarkForDeletion(); - -protected: - // This function is GUI implementation dependent! It's implemented by PCSX2's AppHost, - // but if the SysCore is being linked to another front end, you'll need to implement this - // yourself. Most GUIs have built in message pumps. If a platform lacks one then you'll - // need to implement one yourself (yay?). - virtual void DoDeletion(); -}; - // -------------------------------------------------------------------------------------- // PageProtectionMode // -------------------------------------------------------------------------------------- diff --git a/common/Mutex.cpp b/common/Mutex.cpp index 6f0ef5fa43..b6e3c62cc0 100644 --- a/common/Mutex.cpp +++ b/common/Mutex.cpp @@ -15,7 +15,6 @@ #include "common/Threading.h" #include "common/wxBaseTools.h" -#include "common/wxGuiTools.h" #include "common/ThreadingInternal.h" namespace Threading @@ -205,7 +204,6 @@ void Threading::Mutex::Acquire() } else if (_WaitGui_RecursionGuard(L"Mutex::Acquire")) { - ScopedBusyCursor hourglass(Cursor_ReallyBusy); pthread_mutex_lock(&m_mutex); } else @@ -228,7 +226,6 @@ bool Threading::Mutex::Acquire(const wxTimeSpan& timeout) } else if (_WaitGui_RecursionGuard(L"Mutex::TimedAcquire")) { - ScopedBusyCursor hourglass(Cursor_ReallyBusy); return AcquireWithoutYield(timeout); } else diff --git a/common/PathUtils.cpp b/common/PathUtils.cpp index 1b410ba028..aaa2c8dfd8 100644 --- a/common/PathUtils.cpp +++ b/common/PathUtils.cpp @@ -191,32 +191,3 @@ wxString Path::GetRootDirectory(const wxString& src) else return wxString(src.begin(), src.begin() + pos); } - -// ------------------------------------------------------------------------ -// Launches the specified file according to its mime type -// -void pxLaunch(const wxString& filename) -{ - wxLaunchDefaultBrowser(filename); -} - -void pxLaunch(const char* filename) -{ - pxLaunch(fromUTF8(filename)); -} - -// ------------------------------------------------------------------------ -// Launches a file explorer window on the specified path. If the given path is not -// a qualified URI (with a prefix:// ), file:// is automatically prepended. This -// bypasses wxWidgets internal filename checking, which can end up launching things -// through browser more often than desired. -// -void pxExplore(const wxString& path) -{ - wxLaunchDefaultBrowser(!path.Contains(L"://") ? L"file://" + path : path); -} - -void pxExplore(const char* path) -{ - pxExplore(fromUTF8(path)); -} diff --git a/common/Semaphore.cpp b/common/Semaphore.cpp index ef3ad444da..2e1a5d3bf0 100644 --- a/common/Semaphore.cpp +++ b/common/Semaphore.cpp @@ -17,7 +17,6 @@ #include "common/Threading.h" #include "common/wxBaseTools.h" -#include "common/wxGuiTools.h" #include "common/ThreadingInternal.h" // -------------------------------------------------------------------------------------- @@ -87,7 +86,6 @@ void Threading::Semaphore::Wait() } else if (_WaitGui_RecursionGuard(L"Semaphore::Wait")) { - ScopedBusyCursor hourglass(Cursor_ReallyBusy); sem_wait(&m_sema); } else @@ -119,7 +117,6 @@ bool Threading::Semaphore::Wait(const wxTimeSpan& timeout) } else if (_WaitGui_RecursionGuard(L"Semaphore::TimedWait")) { - ScopedBusyCursor hourglass(Cursor_ReallyBusy); return WaitWithoutYield(timeout); } else diff --git a/common/common.vcxproj b/common/common.vcxproj index 2dcce1a3e6..d1afc0d505 100644 --- a/common/common.vcxproj +++ b/common/common.vcxproj @@ -51,7 +51,6 @@ - @@ -61,10 +60,7 @@ Create - - - @@ -115,12 +111,10 @@ - - diff --git a/common/common.vcxproj.filters b/common/common.vcxproj.filters index 163c6d5d76..79099f3206 100644 --- a/common/common.vcxproj.filters +++ b/common/common.vcxproj.filters @@ -67,18 +67,12 @@ Source Files - - Source Files - Source Files Source Files - - Source Files - Source Files @@ -109,12 +103,6 @@ Source Files - - Source Files - - - Source Files - Source Files @@ -210,9 +198,6 @@ Header Files - - Header Files - Header Files @@ -258,9 +243,6 @@ Header Files - - Header Files - Header Files diff --git a/common/wxBaseTools.h b/common/wxBaseTools.h index c55861d9a2..ff6a04e139 100644 --- a/common/wxBaseTools.h +++ b/common/wxBaseTools.h @@ -26,12 +26,6 @@ // which require wxCore, see wxGuiTools.h // -------------------------------------------------------------------------------------- -extern void pxExplore(const wxString& path); -extern void pxExplore(const char* path); - -extern void pxLaunch(const wxString& path); -extern void pxLaunch(const char* path); - // -------------------------------------------------------------------------------------- // wxDoNotLogInThisScope // -------------------------------------------------------------------------------------- diff --git a/pcsx2/CMakeLists.txt b/pcsx2/CMakeLists.txt index 03c4dc6904..350e3af0c5 100644 --- a/pcsx2/CMakeLists.txt +++ b/pcsx2/CMakeLists.txt @@ -1031,12 +1031,16 @@ set(pcsx2GuiSources gui/Panels/VideoPanel.cpp gui/pxCheckBox.cpp gui/pxRadioPanel.cpp + gui/pxStaticText.cpp + gui/pxWindowTextWriter.cpp gui/RecentIsoList.cpp gui/Saveslots.cpp gui/SysState.cpp gui/ThreadingDialogs.cpp gui/UpdateUI.cpp gui/wxAppWithHelpers.cpp + gui/wxGuiTools.cpp + gui/wxHelpers.cpp gui/wxSettingsInterface.cpp ) @@ -1079,11 +1083,13 @@ set(pcsx2GuiHeaders gui/pxEvents.h gui/pxEventThread.h gui/pxRadioPanel.h + gui/pxStaticText.h gui/RecentIsoList.h gui/Saveslots.h gui/ThreadingDialogs.h gui/ThreadingDialogs.cpp - gui/wxSettingsInterface.cpp + gui/wxGuiTools.h + gui/wxSettingsInterface.h ) # Warning: the declaration of the .h are mandatory in case of resources files. It will ensure the creation diff --git a/pcsx2/gui/AppCommon.h b/pcsx2/gui/AppCommon.h index 5766e6abb1..fc9e74b4ac 100644 --- a/pcsx2/gui/AppCommon.h +++ b/pcsx2/gui/AppCommon.h @@ -19,10 +19,10 @@ #include "common/EventSource.h" #include "common/PersistentThread.h" -#include "common/wxGuiTools.h" +#include "gui/wxGuiTools.h" #include "gui/pxRadioPanel.h" #include "gui/pxCheckBox.h" -#include "common/pxStaticText.h" +#include "gui/pxStaticText.h" #include "gui/CheckedStaticBox.h" #include "AppForwardDefs.h" diff --git a/pcsx2/gui/CheckedStaticBox.h b/pcsx2/gui/CheckedStaticBox.h index dbb9c254be..2fa3a14a64 100644 --- a/pcsx2/gui/CheckedStaticBox.h +++ b/pcsx2/gui/CheckedStaticBox.h @@ -15,7 +15,7 @@ #pragma once -#include "common/wxGuiTools.h" +#include "gui/wxGuiTools.h" class CheckedStaticBox : public wxPanelWithHelpers { diff --git a/pcsx2/gui/Dialogs/LogOptionsDialog.h b/pcsx2/gui/Dialogs/LogOptionsDialog.h index f291105074..e6ebe5e0b5 100644 --- a/pcsx2/gui/Dialogs/LogOptionsDialog.h +++ b/pcsx2/gui/Dialogs/LogOptionsDialog.h @@ -18,7 +18,7 @@ #include "gui/App.h" #include "ConfigurationDialog.h" -#include "common/wxGuiTools.h" +#include "gui/wxGuiTools.h" #include "gui/CheckedStaticBox.h" namespace Dialogs { diff --git a/pcsx2/gui/ThreadingDialogs.cpp b/pcsx2/gui/ThreadingDialogs.cpp index a65505e08e..5138049870 100644 --- a/pcsx2/gui/ThreadingDialogs.cpp +++ b/pcsx2/gui/ThreadingDialogs.cpp @@ -15,7 +15,7 @@ #include "PrecompiledHeader.h" #include "gui/ThreadingDialogs.h" -#include "common/pxStaticText.h" +#include "gui/pxStaticText.h" using namespace pxSizerFlags; diff --git a/pcsx2/gui/pxCheckBox.cpp b/pcsx2/gui/pxCheckBox.cpp index a1ea22b594..13edae381c 100644 --- a/pcsx2/gui/pxCheckBox.cpp +++ b/pcsx2/gui/pxCheckBox.cpp @@ -15,7 +15,7 @@ #include "PrecompiledHeader.h" #include "gui/pxCheckBox.h" -#include "common/pxStaticText.h" +#include "gui/pxStaticText.h" using namespace pxSizerFlags; diff --git a/pcsx2/gui/pxCheckBox.h b/pcsx2/gui/pxCheckBox.h index 667336b314..05262a9b80 100644 --- a/pcsx2/gui/pxCheckBox.h +++ b/pcsx2/gui/pxCheckBox.h @@ -16,7 +16,7 @@ #pragma once #include -#include "common/wxGuiTools.h" +#include "gui/wxGuiTools.h" // ------------------------------------------------------------------------------------- // pxCheckBox diff --git a/pcsx2/gui/pxRadioPanel.cpp b/pcsx2/gui/pxRadioPanel.cpp index 20f0a8187d..2035d4caf6 100644 --- a/pcsx2/gui/pxRadioPanel.cpp +++ b/pcsx2/gui/pxRadioPanel.cpp @@ -15,7 +15,7 @@ #include "PrecompiledHeader.h" #include "gui/pxRadioPanel.h" -#include "common/pxStaticText.h" +#include "gui/pxStaticText.h" #include "common/SafeArray.inl" template class SafeArray; diff --git a/pcsx2/gui/pxRadioPanel.h b/pcsx2/gui/pxRadioPanel.h index 516ad3232e..08828c0ce7 100644 --- a/pcsx2/gui/pxRadioPanel.h +++ b/pcsx2/gui/pxRadioPanel.h @@ -17,7 +17,7 @@ #include #include "common/SafeArray.h" -#include "common/wxGuiTools.h" +#include "gui/wxGuiTools.h" // -------------------------------------------------------------------------------------- // RadioPanelItem diff --git a/common/pxStaticText.cpp b/pcsx2/gui/pxStaticText.cpp similarity index 99% rename from common/pxStaticText.cpp rename to pcsx2/gui/pxStaticText.cpp index 71a91b5de0..536c3ecdc9 100644 --- a/common/pxStaticText.cpp +++ b/pcsx2/gui/pxStaticText.cpp @@ -13,9 +13,11 @@ * If not, see . */ +#include "PrecompiledHeader.h" + #include -#include "common/pxStaticText.h" #include "common/Assertions.h" +#include "gui/pxStaticText.h" // -------------------------------------------------------------------------------------- // pxStaticText (implementations) diff --git a/common/pxStaticText.h b/pcsx2/gui/pxStaticText.h similarity index 100% rename from common/pxStaticText.h rename to pcsx2/gui/pxStaticText.h diff --git a/common/pxWindowTextWriter.cpp b/pcsx2/gui/pxWindowTextWriter.cpp similarity index 98% rename from common/pxWindowTextWriter.cpp rename to pcsx2/gui/pxWindowTextWriter.cpp index 8378b9c122..1106399cc2 100644 --- a/common/pxWindowTextWriter.cpp +++ b/pcsx2/gui/pxWindowTextWriter.cpp @@ -13,9 +13,11 @@ * If not, see . */ +#include "PrecompiledHeader.h" + #include -#include "common/wxGuiTools.h" #include "common/StringHelpers.h" +#include "gui/wxGuiTools.h" // -------------------------------------------------------------------------------------- // pxWindowTextWriter Implementations diff --git a/pcsx2/gui/wxAppWithHelpers.cpp b/pcsx2/gui/wxAppWithHelpers.cpp index bd5f67c664..682bddd659 100644 --- a/pcsx2/gui/wxAppWithHelpers.cpp +++ b/pcsx2/gui/wxAppWithHelpers.cpp @@ -38,6 +38,39 @@ ConsoleLogSource_App::ConsoleLogSource_App() ConsoleLogSource_App pxConLog_App; +// -------------------------------------------------------------------------------------- +// BaseDeletableObject Implementation +// -------------------------------------------------------------------------------------- +// This code probably deserves a better home. It's general purpose non-GUI code (the single +// wxApp/Gui dependency is in wxGuiTools.cpp for now). +// +bool BaseDeletableObject::MarkForDeletion() +{ + return !m_IsBeingDeleted.exchange(true); +} + +void BaseDeletableObject::DeleteSelf() +{ + if (MarkForDeletion()) + DoDeletion(); +} + +BaseDeletableObject::BaseDeletableObject() +{ +#ifdef _MSC_VER + // Bleh, this fails because _CrtIsValidHeapPointer calls HeapValidate on the + // pointer, but the pointer is a virtual base class, so it's not a valid block. >_< + //pxAssertDev( _CrtIsValidHeapPointer( this ), "BaseDeletableObject types cannot be created on the stack or as temporaries!" ); +#endif + + m_IsBeingDeleted.store(false, std::memory_order_relaxed); +} + +BaseDeletableObject::~BaseDeletableObject() +{ + AffinityAssert_AllowFrom_MainUI(); +} + void BaseDeletableObject::DoDeletion() { wxAppWithHelpers* app = wxDynamicCast(wxApp::GetInstance(), wxAppWithHelpers); @@ -45,7 +78,6 @@ void BaseDeletableObject::DoDeletion() app->DeleteObject(*this); } - // -------------------------------------------------------------------------------------- // SynchronousActionState Implementations // -------------------------------------------------------------------------------------- diff --git a/pcsx2/gui/wxAppWithHelpers.h b/pcsx2/gui/wxAppWithHelpers.h index cec7c8f403..afc71dee41 100644 --- a/pcsx2/gui/wxAppWithHelpers.h +++ b/pcsx2/gui/wxAppWithHelpers.h @@ -18,14 +18,62 @@ #include #include "common/Threading.h" -#include "common/wxGuiTools.h" #include "gui/pxEvents.h" +#include "gui/wxGuiTools.h" #include "common/AppTrait.h" using namespace Threading; class pxSynchronousCommandEvent; +// -------------------------------------------------------------------------------------- +// BaseDeletableObject +// -------------------------------------------------------------------------------------- +// Oh the fruits and joys of multithreaded C++ coding conundrums! This class provides a way +// to be deleted from arbitraty threads, or to delete themselves (which is considered unsafe +// in C++, though it does typically work). It also gives objects a second recourse for +// doing fully virtualized cleanup, something C++ also makes impossible because of how it +// implements it's destructor hierarchy. +// +// To utilize virtual destruction, override DoDeletion() and be sure to invoke the base class +// implementation of DoDeletion(). +// +// Assertions: +// This class generates an assertion of the destructor is called from anything other than +// the main/gui thread. +// +// Rationale: +// wxWidgets provides a pending deletion feature, but it's specific to wxCore (not wxBase) +// which means it requires wxApp and all that, which is bad for plugins and the possibility +// of linking PCSX2 core against a non-WX gui in the future. It's also not thread safe +// (sigh). And, finally, it requires quite a bit of red tape to implement wxObjects because +// of the wx-custom runtime type information. So I made my own. +// +class BaseDeletableObject : public virtual IDeletableObject +{ +protected: + std::atomic m_IsBeingDeleted; + +public: + BaseDeletableObject(); + virtual ~BaseDeletableObject(); + + void DeleteSelf(); + bool IsBeingDeleted() { return !!m_IsBeingDeleted; } + + // Returns FALSE if the object is already marked for deletion, or TRUE if the app + // should schedule the object for deletion. Only schedule if TRUE is returned, otherwise + // the object could get deleted twice if two threads try to schedule it at the same time. + bool MarkForDeletion(); + +protected: + // This function is GUI implementation dependent! It's implemented by PCSX2's AppHost, + // but if the SysCore is being linked to another front end, you'll need to implement this + // yourself. Most GUIs have built in message pumps. If a platform lacks one then you'll + // need to implement one yourself (yay?). + virtual void DoDeletion(); +}; + // -------------------------------------------------------------------------------------- // pxAppLog / ConsoleLogSource_App // -------------------------------------------------------------------------------------- diff --git a/common/wxGuiTools.cpp b/pcsx2/gui/wxGuiTools.cpp similarity index 94% rename from common/wxGuiTools.cpp rename to pcsx2/gui/wxGuiTools.cpp index a5f6a2c283..a7d5c59493 100644 --- a/common/wxGuiTools.cpp +++ b/pcsx2/gui/wxGuiTools.cpp @@ -13,9 +13,10 @@ * If not, see . */ -#include "common/PrecompiledHeader.h" -#include "common/wxGuiTools.h" -#include "common/pxStaticText.h" +#include "PrecompiledHeader.h" + +#include "gui/wxGuiTools.h" +#include "gui/pxStaticText.h" #include #include @@ -649,3 +650,33 @@ wxString pxGetAppName() pxAssert(wxTheApp); return wxTheApp->GetAppName(); } + + +// ------------------------------------------------------------------------ +// Launches the specified file according to its mime type +// +void pxLaunch(const wxString& filename) +{ + wxLaunchDefaultBrowser(filename); +} + +void pxLaunch(const char* filename) +{ + pxLaunch(fromUTF8(filename)); +} + +// ------------------------------------------------------------------------ +// Launches a file explorer window on the specified path. If the given path is not +// a qualified URI (with a prefix:// ), file:// is automatically prepended. This +// bypasses wxWidgets internal filename checking, which can end up launching things +// through browser more often than desired. +// +void pxExplore(const wxString& path) +{ + wxLaunchDefaultBrowser(!path.Contains(L"://") ? L"file://" + path : path); +} + +void pxExplore(const char* path) +{ + pxExplore(fromUTF8(path)); +} diff --git a/common/wxGuiTools.h b/pcsx2/gui/wxGuiTools.h similarity index 99% rename from common/wxGuiTools.h rename to pcsx2/gui/wxGuiTools.h index 2688ef9b74..ebf59779be 100644 --- a/common/wxGuiTools.h +++ b/pcsx2/gui/wxGuiTools.h @@ -802,3 +802,9 @@ extern void pxSetToolTip(wxWindow& wind, const wxString& src); extern wxFont pxGetFixedFont(int ptsize = 8, wxFontWeight weight = wxFONTWEIGHT_NORMAL, bool underline = false); extern pxDialogCreationFlags pxDialogFlags(); + +extern void pxExplore(const wxString& path); +extern void pxExplore(const char* path); + +extern void pxLaunch(const wxString& path); +extern void pxLaunch(const char* path); diff --git a/common/wxHelpers.cpp b/pcsx2/gui/wxHelpers.cpp similarity index 91% rename from common/wxHelpers.cpp rename to pcsx2/gui/wxHelpers.cpp index a75b3699cc..4cdbddb818 100644 --- a/common/wxHelpers.cpp +++ b/pcsx2/gui/wxHelpers.cpp @@ -13,14 +13,16 @@ * If not, see . */ +#include "PrecompiledHeader.h" + #include #include #include #include "common/General.h" -#include "common/wxGuiTools.h" -#include "common/pxStaticText.h" #include "common/Threading.h" #include "common/IniInterface.h" +#include "gui/wxGuiTools.h" +#include "gui/pxStaticText.h" using namespace pxSizerFlags; @@ -30,40 +32,6 @@ pxDialogCreationFlags pxDialogFlags() } -// -------------------------------------------------------------------------------------- -// BaseDeletableObject Implementation -// -------------------------------------------------------------------------------------- -// This code probably deserves a better home. It's general purpose non-GUI code (the single -// wxApp/Gui dependency is in wxGuiTools.cpp for now). -// -bool BaseDeletableObject::MarkForDeletion() -{ - return !m_IsBeingDeleted.exchange(true); -} - -void BaseDeletableObject::DeleteSelf() -{ - if (MarkForDeletion()) - DoDeletion(); -} - -BaseDeletableObject::BaseDeletableObject() -{ -#ifdef _MSC_VER -// Bleh, this fails because _CrtIsValidHeapPointer calls HeapValidate on the -// pointer, but the pointer is a virtual base class, so it's not a valid block. >_< -//pxAssertDev( _CrtIsValidHeapPointer( this ), "BaseDeletableObject types cannot be created on the stack or as temporaries!" ); -#endif - - m_IsBeingDeleted.store(false, std::memory_order_relaxed); -} - -BaseDeletableObject::~BaseDeletableObject() -{ - AffinityAssert_AllowFrom_MainUI(); -} - - // -------------------------------------------------------------------------------------- diff --git a/pcsx2/pcsx2.vcxproj b/pcsx2/pcsx2.vcxproj index 10b40a1669..e5a4a5fde1 100644 --- a/pcsx2/pcsx2.vcxproj +++ b/pcsx2/pcsx2.vcxproj @@ -318,6 +318,8 @@ + + @@ -667,6 +669,8 @@ + + @@ -757,6 +761,7 @@ + @@ -1087,6 +1092,7 @@ + diff --git a/pcsx2/pcsx2.vcxproj.filters b/pcsx2/pcsx2.vcxproj.filters index 6b749d6548..754dc96aad 100644 --- a/pcsx2/pcsx2.vcxproj.filters +++ b/pcsx2/pcsx2.vcxproj.filters @@ -1664,6 +1664,14 @@ AppHost + + + + AppHost + + + AppHost + @@ -2767,6 +2775,10 @@ AppHost + + + AppHost +