From 7ccb66e7937496c5556bc9a47e04ab5ee0afb460 Mon Sep 17 00:00:00 2001 From: Eladash Date: Tue, 6 Jun 2023 14:05:07 +0300 Subject: [PATCH] PPU: Sleep after returning from thread entry function --- rpcs3/Emu/Cell/PPUThread.cpp | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/rpcs3/Emu/Cell/PPUThread.cpp b/rpcs3/Emu/Cell/PPUThread.cpp index 3ff8664085db..70a596f658a4 100644 --- a/rpcs3/Emu/Cell/PPUThread.cpp +++ b/rpcs3/Emu/Cell/PPUThread.cpp @@ -2055,12 +2055,7 @@ void ppu_thread::fast_call(u32 addr, u64 rtoc) auto at_ret = [&]() { - if (std::uncaught_exceptions()) - { - cpu_on_stop(); - current_function = old_func; - } - else if (old_cia) + if (old_cia) { if (state & cpu_flag::again) { @@ -2071,6 +2066,18 @@ void ppu_thread::fast_call(u32 addr, u64 rtoc) gpr[2] = old_rtoc; lr = old_lr; } + else if (state & cpu_flag::ret && cia == g_fxo->get().func_addr(1, true) + 4) + { + std::string ret; + dump_all(ret); + + ppu_log.error("Returning from the thread entry function! (func=0x%x)", entry_func.addr); + ppu_log.notice("Thread context: %s", ret); + + lv2_obj::sleep(*this); + + state += cpu_flag::again; // For savestates + } current_function = old_func; g_tls_log_prefix = old_fmt;