cellAdec: savestate fixup

This commit is contained in:
capriots 2024-12-01 00:29:40 +01:00
parent 68b7e5971d
commit f9cc83c285
No known key found for this signature in database
2 changed files with 14 additions and 9 deletions

View file

@ -800,6 +800,15 @@ error_code adecOpen(ppu_thread& ppu, vm::ptr<CellAdecType> type, vm::cptr<CellAd
const auto core_ops = get_core_ops(type->audioCodecType);
// Block savestate creation during ppu_thread::fast_call()
std::unique_lock savestate_lock{g_fxo->get<hle_locks_t>(), 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<CellAdecType> type, vm::cptr<CellAd
const auto notifyError = vm::ptr<AdecNotifyError>::make(g_fxo->get<ppu_function_manager>().func_addr(FIND_FUNC(adecNotifyError)));
const auto notifySeqDone = vm::ptr<AdecNotifySeqDone>::make(g_fxo->get<ppu_function_manager>().func_addr(FIND_FUNC(adecNotifySeqDone)));
// Block savestate creation during ppu_thread::fast_call()
std::unique_lock savestate_lock{g_fxo->get<hle_locks_t>(), 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);

View file

@ -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