From d106934336b3da2f5ec97f8f7d1ec794fde8138b Mon Sep 17 00:00:00 2001 From: Eladash Date: Tue, 19 Jul 2022 08:49:55 +0300 Subject: [PATCH] Savestates: Fix saving sys_mutex_unlock --- rpcs3/Emu/Cell/lv2/sys_mutex.cpp | 6 ++++++ rpcs3/Emu/Cell/lv2/sys_mutex.h | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/rpcs3/Emu/Cell/lv2/sys_mutex.cpp b/rpcs3/Emu/Cell/lv2/sys_mutex.cpp index e4f79e4f2e..3657e822e9 100644 --- a/rpcs3/Emu/Cell/lv2/sys_mutex.cpp +++ b/rpcs3/Emu/Cell/lv2/sys_mutex.cpp @@ -274,6 +274,12 @@ error_code sys_mutex_unlock(ppu_thread& ppu, u32 mutex_id) if (auto cpu = mutex->reown()) { + if (cpu->state & cpu_flag::again) + { + ppu.state += cpu_flag::again; + return {}; + } + mutex->awake(cpu); } } diff --git a/rpcs3/Emu/Cell/lv2/sys_mutex.h b/rpcs3/Emu/Cell/lv2/sys_mutex.h index 78ff9725cb..20909acef8 100644 --- a/rpcs3/Emu/Cell/lv2/sys_mutex.h +++ b/rpcs3/Emu/Cell/lv2/sys_mutex.h @@ -134,6 +134,11 @@ struct lv2_mutex final : lv2_obj { if (auto cpu = schedule(sq, protocol)) { + if (cpu->state & cpu_flag::again) + { + return static_cast(cpu); + } + owner = cpu->id << 1 | !sq.empty(); return static_cast(cpu); }