Savestates: Fix saving sys_mutex_unlock

This commit is contained in:
Eladash 2022-07-19 08:49:55 +03:00 committed by Ivan
parent 68718361a7
commit d106934336
2 changed files with 11 additions and 0 deletions

View File

@ -274,6 +274,12 @@ error_code sys_mutex_unlock(ppu_thread& ppu, u32 mutex_id)
if (auto cpu = mutex->reown<ppu_thread>())
{
if (cpu->state & cpu_flag::again)
{
ppu.state += cpu_flag::again;
return {};
}
mutex->awake(cpu);
}
}

View File

@ -134,6 +134,11 @@ struct lv2_mutex final : lv2_obj
{
if (auto cpu = schedule<T>(sq, protocol))
{
if (cpu->state & cpu_flag::again)
{
return static_cast<T*>(cpu);
}
owner = cpu->id << 1 | !sq.empty();
return static_cast<T*>(cpu);
}