diff --git a/rpcs3/Emu/Cell/Modules/cellAdec.cpp b/rpcs3/Emu/Cell/Modules/cellAdec.cpp index 43c5f7989b..24a4504cb7 100644 --- a/rpcs3/Emu/Cell/Modules/cellAdec.cpp +++ b/rpcs3/Emu/Cell/Modules/cellAdec.cpp @@ -800,6 +800,15 @@ error_code adecOpen(ppu_thread& ppu, vm::ptr type, vm::cptraudioCodecType); + // Block savestate creation during ppu_thread::fast_call() + std::unique_lock savestate_lock{g_fxo->get(), std::try_to_lock}; + + if (!savestate_lock.owns_lock()) + { + ppu.state += cpu_flag::again; + return {}; + } + const s32 pcm_handle_num = core_ops->getPcmHandleNum(ppu); const u32 bitstream_info_size = core_ops->getBsiInfoSize(ppu); @@ -862,15 +871,6 @@ error_code adecOpen(ppu_thread& ppu, vm::ptr type, vm::cptr::make(g_fxo->get().func_addr(FIND_FUNC(adecNotifyError))); const auto notifySeqDone = vm::ptr::make(g_fxo->get().func_addr(FIND_FUNC(adecNotifySeqDone))); - // Block savestate creation during ppu_thread::fast_call() - std::unique_lock savestate_lock{g_fxo->get(), std::try_to_lock}; - - if (!savestate_lock.owns_lock()) - { - ppu.state += cpu_flag::again; - return {}; - } - if (spursRes) { return core_ops->openExt(ppu, _this->core_handle, notifyAuDone, _this, notifyPcmOut, _this, notifyError, _this, notifySeqDone, _this, res, spursRes); diff --git a/rpcs3/Emu/Cell/Modules/cellAdec.h b/rpcs3/Emu/Cell/Modules/cellAdec.h index 1cbeca08b8..49f749dc94 100644 --- a/rpcs3/Emu/Cell/Modules/cellAdec.h +++ b/rpcs3/Emu/Cell/Modules/cellAdec.h @@ -562,6 +562,11 @@ public: { ensure(sys_mutex_lock(ppu, mutex, 0) == CELL_OK); // Error code isn't checked on LLE + if (ppu.state & cpu_flag::again) // Savestate was created while waiting on the mutex + { + return {}; + } + if (entries[front].state == 0xff) { ensure(sys_mutex_unlock(ppu, mutex) == CELL_OK); // Error code isn't checked on LLE