From 571bdfc82863a4afa35b4730fc1145ddddd3cf2e Mon Sep 17 00:00:00 2001 From: Nekotekina Date: Sun, 27 Jun 2021 13:18:48 +0300 Subject: [PATCH] Fixup for #10490 Restore explicit signaling of RSX thread for now. --- rpcs3/Emu/CPU/CPUThread.h | 10 +++++----- rpcs3/Emu/Cell/PPUThread.h | 2 ++ rpcs3/Emu/Cell/SPUThread.h | 2 ++ rpcs3/Emu/System.cpp | 5 +++++ 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/rpcs3/Emu/CPU/CPUThread.h b/rpcs3/Emu/CPU/CPUThread.h index 26148ba6ef..6172432bb3 100644 --- a/rpcs3/Emu/CPU/CPUThread.h +++ b/rpcs3/Emu/CPU/CPUThread.h @@ -6,7 +6,7 @@ #include template -concept derived_from = std::is_base_of_v && +concept DerivedFrom = std::is_base_of_v && std::is_convertible_v; // Thread state flags @@ -111,7 +111,7 @@ public: return id >> 24; } - template T> + template T> T* try_get() { if constexpr (std::is_same_v, cpu_thread>) @@ -129,7 +129,7 @@ public: } } - template T> + template T> const T* try_get() const { return const_cast(this)->try_get(); @@ -270,7 +270,7 @@ public: // Send signal to the profiler(s) to flush results static void flush_profilers() noexcept; - template T = cpu_thread> + template T = cpu_thread> static inline T* get_current() noexcept { if (const auto cpu = g_tls_this_thread) @@ -285,7 +285,7 @@ private: static thread_local cpu_thread* g_tls_this_thread; }; -template T = cpu_thread> +template T = cpu_thread> inline T* get_current_cpu_thread() noexcept { return cpu_thread::get_current(); diff --git a/rpcs3/Emu/Cell/PPUThread.h b/rpcs3/Emu/Cell/PPUThread.h index 9a1b123fac..201d72feb1 100644 --- a/rpcs3/Emu/Cell/PPUThread.h +++ b/rpcs3/Emu/Cell/PPUThread.h @@ -144,6 +144,8 @@ public: ppu_thread(const ppu_thread&) = delete; ppu_thread& operator=(const ppu_thread&) = delete; + using cpu_thread::operator=; + u64 gpr[32] = {}; // General-Purpose Registers f64 fpr[32] = {}; // Floating Point Registers v128 vr[32] = {}; // Vector Registers diff --git a/rpcs3/Emu/Cell/SPUThread.h b/rpcs3/Emu/Cell/SPUThread.h index f3d810878e..2607f7d5d3 100644 --- a/rpcs3/Emu/Cell/SPUThread.h +++ b/rpcs3/Emu/Cell/SPUThread.h @@ -644,6 +644,8 @@ public: spu_thread(const spu_thread&) = delete; spu_thread& operator=(const spu_thread&) = delete; + using cpu_thread::operator=; + u32 pc = 0; u32 dbg_step_pc = 0; diff --git a/rpcs3/Emu/System.cpp b/rpcs3/Emu/System.cpp index 895a30f3eb..d589db3410 100644 --- a/rpcs3/Emu/System.cpp +++ b/rpcs3/Emu/System.cpp @@ -1535,6 +1535,11 @@ void Emulator::Stop(bool restart) }); // Signal threads + if (auto rsx = g_fxo->try_get()) + { + *static_cast(rsx) = thread_state::aborting; + } + for (const auto& [type, data] : *g_fxo) { if (type.stop)