diff --git a/pcsx2/CDVD/CDVD.cpp b/pcsx2/CDVD/CDVD.cpp index 9ab1788ce9..14cccd09fa 100644 --- a/pcsx2/CDVD/CDVD.cpp +++ b/pcsx2/CDVD/CDVD.cpp @@ -41,7 +41,7 @@ #endif #ifndef PCSX2_CORE -#include "System/SysThreads.h" +#include "gui/SysThreads.h" #else #include "VMManager.h" #endif @@ -373,8 +373,6 @@ s32 cdvdWriteConfig(const u8* config) return 0; } -static Threading::MutexRecursive Mutex_NewDiskCB; - // Sets ElfCRC to the CRC of the game bound to the CDVD source. static __fi ElfObject* loadElf(std::string filename, bool isPSXElf) { @@ -415,8 +413,6 @@ static __fi ElfObject* loadElf(std::string filename, bool isPSXElf) static __fi void _reloadElfInfo(std::string elfpath) { // Now's a good time to reload the ELF info... - Threading::ScopedLock locker(Mutex_NewDiskCB); - if (elfpath == LastELF) return; @@ -912,13 +908,6 @@ void SaveStateBase::cdvdFreeze() void cdvdNewDiskCB() { - Threading::ScopedTryLock lock(Mutex_NewDiskCB); - if (lock.Failed()) - { - DevCon.WriteLn(Color_Red, L"NewDiskCB Lock Failed"); - return; - } - DoCDVDresetDiskTypeCache(); cdvdDetectDisk(); diff --git a/pcsx2/CMakeLists.txt b/pcsx2/CMakeLists.txt index 1952f163ef..73a963620d 100644 --- a/pcsx2/CMakeLists.txt +++ b/pcsx2/CMakeLists.txt @@ -1139,7 +1139,9 @@ set(pcsx2GuiSources gui/pxWindowTextWriter.cpp gui/RecentIsoList.cpp gui/Saveslots.cpp + gui/SysCoreThread.cpp gui/SysState.cpp + gui/SysThreadBase.cpp gui/ThreadingDialogs.cpp gui/UpdateUI.cpp gui/wxAppWithHelpers.cpp @@ -1191,6 +1193,7 @@ set(pcsx2GuiHeaders gui/pxStaticText.h gui/RecentIsoList.h gui/Saveslots.h + gui/SysThreads.h gui/ThreadingDialogs.h gui/ThreadingDialogs.cpp gui/wxGuiTools.h @@ -1368,19 +1371,9 @@ set(pcsx2RecordingVirtualPadResources ${res_rec_vp_src}/upPressed.h ) -# System sources -set(pcsx2SystemSources - System/SysThreadBase.cpp) -if(NOT PCSX2_CORE) - list(APPEND pcsx2SystemSources - System/SysCoreThread.cpp - ) -endif() - # System headers set(pcsx2SystemHeaders - System/RecTypes.h - System/SysThreads.h) + System/RecTypes.h) # Utilities sources set(pcsx2UtilitiesSources @@ -1517,7 +1510,6 @@ target_sources(PCSX2 PRIVATE ${pcsx2FrontendHeaders} ${pcsx2ps2Sources} ${pcsx2ps2Headers} - ${pcsx2SystemSources} ${pcsx2SystemHeaders} ${pcsx2UtilitiesSources} ${pcsx2UtilitiesHeaders}) diff --git a/pcsx2/DebugTools/DebugInterface.cpp b/pcsx2/DebugTools/DebugInterface.cpp index ff9aebe269..412653e9dd 100644 --- a/pcsx2/DebugTools/DebugInterface.cpp +++ b/pcsx2/DebugTools/DebugInterface.cpp @@ -28,7 +28,7 @@ #include "SymbolMap.h" #ifndef PCSX2_CORE -#include "System/SysThreads.h" +#include "gui/SysThreads.h" #endif R5900DebugInterface r5900Debug; diff --git a/pcsx2/Gif_Unit.h b/pcsx2/Gif_Unit.h index 1c5161916b..60afb82bf0 100644 --- a/pcsx2/Gif_Unit.h +++ b/pcsx2/Gif_Unit.h @@ -15,7 +15,6 @@ #pragma once #include -#include "System/SysThreads.h" #include "Gif.h" #include "Vif.h" #include "GS.h" diff --git a/pcsx2/Interpreter.cpp b/pcsx2/Interpreter.cpp index f616808d24..25b9978251 100644 --- a/pcsx2/Interpreter.cpp +++ b/pcsx2/Interpreter.cpp @@ -20,7 +20,7 @@ #include "R5900OpcodeTables.h" #include "R5900Exceptions.h" #ifndef PCSX2_CORE -#include "System/SysThreads.h" +#include "gui/SysThreads.h" #else #include "VMManager.h" #endif diff --git a/pcsx2/MTVU.cpp b/pcsx2/MTVU.cpp index d8a13729a2..9f7029cd85 100644 --- a/pcsx2/MTVU.cpp +++ b/pcsx2/MTVU.cpp @@ -18,6 +18,7 @@ #include "MTVU.h" #include "newVif.h" #include "Gif_Unit.h" +#include "common/Threading.h" #include VU_Thread vu1Thread; diff --git a/pcsx2/PINE.cpp b/pcsx2/PINE.cpp index 8737669b5d..0b9be9804b 100644 --- a/pcsx2/PINE.cpp +++ b/pcsx2/PINE.cpp @@ -40,7 +40,7 @@ #include "Memory.h" #include "gui/AppSaveStates.h" #include "gui/AppCoreThread.h" -#include "System/SysThreads.h" +#include "gui/SysThreads.h" #include "svnrev.h" #include "PINE.h" diff --git a/pcsx2/PINE.h b/pcsx2/PINE.h index 18e9596e81..f23cdf78bf 100644 --- a/pcsx2/PINE.h +++ b/pcsx2/PINE.h @@ -28,7 +28,7 @@ #define PINE_EMULATOR_NAME "pcsx2" #include "common/PersistentThread.h" -#include "System/SysThreads.h" +#include "gui/SysThreads.h" #include #ifdef _WIN32 #include diff --git a/pcsx2/PerformanceMetrics.cpp b/pcsx2/PerformanceMetrics.cpp index eae2da62dc..96ff0c9938 100644 --- a/pcsx2/PerformanceMetrics.cpp +++ b/pcsx2/PerformanceMetrics.cpp @@ -23,7 +23,6 @@ #include "PerformanceMetrics.h" #include "System.h" -#include "System/SysThreads.h" #include "GS.h" #include "MTVU.h" @@ -177,9 +176,9 @@ void PerformanceMetrics::Update(bool gs_register_write, bool fb_blit) s_last_ticks = ticks; const double pct_divider = - 100.0 * (1.0 / ((static_cast(ticks_delta) * static_cast(GetThreadTicksPerSecond())) / + 100.0 * (1.0 / ((static_cast(ticks_delta) * static_cast(Threading::GetThreadTicksPerSecond())) / static_cast(GetTickFrequency()))); - const double time_divider = 1000.0 * (1.0 / static_cast(GetThreadTicksPerSecond())) * + const double time_divider = 1000.0 * (1.0 / static_cast(Threading::GetThreadTicksPerSecond())) * (1.0 / static_cast(s_frames_since_last_update)); const u64 cpu_time = s_cpu_thread_handle.GetCPUTime(); diff --git a/pcsx2/R3000AInterpreter.cpp b/pcsx2/R3000AInterpreter.cpp index 56ef430091..2a6c96e075 100644 --- a/pcsx2/R3000AInterpreter.cpp +++ b/pcsx2/R3000AInterpreter.cpp @@ -18,13 +18,16 @@ #include "R3000A.h" #include "Common.h" #include "Config.h" -#include "System/SysThreads.h" #include "R5900OpcodeTables.h" #include "DebugTools/Breakpoints.h" #include "IopBios.h" #include "IopHw.h" +#ifndef PCSX2_CORE +#include "gui/SysThreads.h" +#endif + using namespace R3000A; // Used to flag delay slot instructions when throwig exceptions. diff --git a/pcsx2/R5900.cpp b/pcsx2/R5900.cpp index 0064546f5b..61ed5c999d 100644 --- a/pcsx2/R5900.cpp +++ b/pcsx2/R5900.cpp @@ -27,7 +27,7 @@ #include "MTVU.h" #ifndef PCSX2_CORE -#include "System/SysThreads.h" +#include "gui/SysThreads.h" #else #include "VMManager.h" #endif diff --git a/pcsx2/SaveState.cpp b/pcsx2/SaveState.cpp index ceefcc47f0..05f058a6d0 100644 --- a/pcsx2/SaveState.cpp +++ b/pcsx2/SaveState.cpp @@ -34,7 +34,6 @@ #include "Elfheader.h" #include "Counters.h" #include "Patch.h" -#include "System/SysThreads.h" #include "DebugTools/Breakpoints.h" #include "Host.h" #include "GS.h" @@ -46,6 +45,7 @@ #ifndef PCSX2_CORE #include "gui/App.h" #include "gui/ConsoleLogger.h" +#include "gui/SysThreads.h" #else #include "VMManager.h" #endif diff --git a/pcsx2/VMManager.cpp b/pcsx2/VMManager.cpp index 5f6fba279c..3739fcd1fa 100644 --- a/pcsx2/VMManager.cpp +++ b/pcsx2/VMManager.cpp @@ -46,7 +46,6 @@ #include "R5900.h" #include "SPU2/spu2.h" #include "DEV9/DEV9.h" -#include "System/SysThreads.h" #include "USB/USB.h" #include "PAD/Host/PAD.h" #include "Sio.h" diff --git a/pcsx2/gui/App.h b/pcsx2/gui/App.h index 50110f4f63..7942683cb6 100644 --- a/pcsx2/gui/App.h +++ b/pcsx2/gui/App.h @@ -22,6 +22,7 @@ #include #include +#include "SysThreads.h" #include "pxEventThread.h" #include "AppCommon.h" @@ -38,7 +39,6 @@ struct HostKeyEvent; #include "GS.h" #include "System.h" -#include "System/SysThreads.h" // TODO: Not the best location for this, but it needs to be accessed by MTGS etc. extern WindowInfo g_gs_window_info; diff --git a/pcsx2/gui/AppCoreThread.h b/pcsx2/gui/AppCoreThread.h index 1269a9d18d..b7fe1dac15 100644 --- a/pcsx2/gui/AppCoreThread.h +++ b/pcsx2/gui/AppCoreThread.h @@ -15,7 +15,7 @@ #pragma once -#include "System/SysThreads.h" +#include "SysThreads.h" #include "pxEventThread.h" #include "AppCommon.h" diff --git a/pcsx2/gui/Dialogs/PINEDialog.cpp b/pcsx2/gui/Dialogs/PINEDialog.cpp index 1d542b0297..e8b9888dd0 100644 --- a/pcsx2/gui/Dialogs/PINEDialog.cpp +++ b/pcsx2/gui/Dialogs/PINEDialog.cpp @@ -20,7 +20,7 @@ #include "gui/Dialogs/ModalPopups.h" -#include "System/SysThreads.h" +#include "gui/SysThreads.h" #include "PathDefs.h" #include "gui/AppConfig.h" diff --git a/pcsx2/gui/MainMenuClicks.cpp b/pcsx2/gui/MainMenuClicks.cpp index c29a7e9e49..11f73f5307 100644 --- a/pcsx2/gui/MainMenuClicks.cpp +++ b/pcsx2/gui/MainMenuClicks.cpp @@ -21,7 +21,7 @@ #include "GSFrame.h" #include "IniInterface.h" #include "SPU2/spu2.h" -#include "System/SysThreads.h" +#include "SysThreads.h" #include "DEV9/DEV9.h" #include "USB/USB.h" #include "PAD/Gamepad.h" diff --git a/pcsx2/System/SysCoreThread.cpp b/pcsx2/gui/SysCoreThread.cpp similarity index 100% rename from pcsx2/System/SysCoreThread.cpp rename to pcsx2/gui/SysCoreThread.cpp diff --git a/pcsx2/gui/SysState.cpp b/pcsx2/gui/SysState.cpp index e49a5445c8..f6806de47e 100644 --- a/pcsx2/gui/SysState.cpp +++ b/pcsx2/gui/SysState.cpp @@ -17,7 +17,7 @@ #include "MemoryTypes.h" #include "App.h" -#include "System/SysThreads.h" +#include "SysThreads.h" #include "SaveState.h" #include "VUmicro.h" diff --git a/pcsx2/System/SysThreadBase.cpp b/pcsx2/gui/SysThreadBase.cpp similarity index 99% rename from pcsx2/System/SysThreadBase.cpp rename to pcsx2/gui/SysThreadBase.cpp index 7cdb66ff9d..6702aeb034 100644 --- a/pcsx2/System/SysThreadBase.cpp +++ b/pcsx2/gui/SysThreadBase.cpp @@ -332,13 +332,9 @@ bool SysThreadBase::StateCheckInThread() m_RunningLock.Acquire(); if (m_ExecMode != ExecMode_Closing) { -#ifndef PCSX2_CORE // AppCoreThread deals with Reseting CDVD OnResumeInThread(g_CDVDReset ? static_cast(systemsToTearDown & ~(System_CDVD)) : systemsToTearDown); g_CDVDReset = false; -#else - OnResumeInThread(systemsToTearDown); -#endif break; } m_sem_ChangingExecMode.Post(); @@ -361,9 +357,7 @@ bool SysThreadBase::StateCheckInThread() m_RunningLock.Acquire(); OnResumeInThread(static_cast(-1)); // All systems -#ifndef PCSX2_CORE g_CDVDReset = false; -#endif break; jNO_DEFAULT; diff --git a/pcsx2/System/SysThreads.h b/pcsx2/gui/SysThreads.h similarity index 99% rename from pcsx2/System/SysThreads.h rename to pcsx2/gui/SysThreads.h index 8153a68209..ba2251c9d2 100644 --- a/pcsx2/System/SysThreads.h +++ b/pcsx2/gui/SysThreads.h @@ -171,7 +171,6 @@ protected: virtual void OnResumeInThread(SystemsMask systemsToReinstate) = 0; }; -#ifndef PCSX2_CORE // -------------------------------------------------------------------------------------- // SysCoreThread class // -------------------------------------------------------------------------------------- @@ -289,5 +288,3 @@ namespace PINESettings { extern unsigned int slot; }; - -#endif diff --git a/pcsx2/pcsx2.vcxproj b/pcsx2/pcsx2.vcxproj index 16a45597a6..80f42d6bf5 100644 --- a/pcsx2/pcsx2.vcxproj +++ b/pcsx2/pcsx2.vcxproj @@ -549,9 +549,9 @@ - + - + @@ -1009,7 +1009,7 @@ - + diff --git a/pcsx2/pcsx2.vcxproj.filters b/pcsx2/pcsx2.vcxproj.filters index 01b4ca8371..5d119d02ba 100644 --- a/pcsx2/pcsx2.vcxproj.filters +++ b/pcsx2/pcsx2.vcxproj.filters @@ -452,13 +452,13 @@ System - + System System - + System @@ -1807,7 +1807,7 @@ System\Include - + System\Include diff --git a/pcsx2/pcsx2core.vcxproj b/pcsx2/pcsx2core.vcxproj index baf57929fb..35658da716 100644 --- a/pcsx2/pcsx2core.vcxproj +++ b/pcsx2/pcsx2core.vcxproj @@ -322,7 +322,6 @@ - diff --git a/pcsx2/pcsx2core.vcxproj.filters b/pcsx2/pcsx2core.vcxproj.filters index 7a0e10b31b..a9c280aa15 100644 --- a/pcsx2/pcsx2core.vcxproj.filters +++ b/pcsx2/pcsx2core.vcxproj.filters @@ -365,9 +365,6 @@ System - - System - System\ISO diff --git a/pcsx2/x86/iR3000A.cpp b/pcsx2/x86/iR3000A.cpp index f135df846e..0c40509251 100644 --- a/pcsx2/x86/iR3000A.cpp +++ b/pcsx2/x86/iR3000A.cpp @@ -24,7 +24,6 @@ #include "R3000A.h" #include "BaseblockEx.h" #include "System/RecTypes.h" -#include "System/SysThreads.h" #include "R5900OpcodeTables.h" #include "IopBios.h" #include "IopHw.h" @@ -43,6 +42,10 @@ #include "common/Perf.h" #include "DebugTools/Breakpoints.h" +#ifndef PCSX2_CORE +#include "gui/SysThreads.h" +#endif + using namespace x86Emitter; extern u32 g_iopNextEventCycle; diff --git a/pcsx2/x86/ix86-32/iR5900-32.cpp b/pcsx2/x86/ix86-32/iR5900-32.cpp index e64a883b86..9390d3ae9b 100644 --- a/pcsx2/x86/ix86-32/iR5900-32.cpp +++ b/pcsx2/x86/ix86-32/iR5900-32.cpp @@ -30,7 +30,7 @@ #include "Dump.h" #ifndef PCSX2_CORE -#include "System/SysThreads.h" +#include "gui/SysThreads.h" #else #include "VMManager.h" #endif