mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-05 22:41:25 +12:00
Fix sys_event_flag_wait result set (#10404)
Set result upon syscall exit, not at the beginning.
This commit is contained in:
parent
baa422e65b
commit
11ab9b7fa9
1 changed files with 12 additions and 8 deletions
|
@ -102,7 +102,16 @@ error_code sys_event_flag_wait(ppu_thread& ppu, u32 id, u64 bitptn, u32 mode, vm
|
||||||
ppu.gpr[6] = 0;
|
ppu.gpr[6] = 0;
|
||||||
|
|
||||||
// Always set result
|
// Always set result
|
||||||
if (result) *result = 0;
|
struct store_result
|
||||||
|
{
|
||||||
|
vm::ptr<u64> ptr;
|
||||||
|
u64 val = 0;
|
||||||
|
|
||||||
|
~store_result() noexcept
|
||||||
|
{
|
||||||
|
if (ptr) *ptr = val;
|
||||||
|
}
|
||||||
|
} store{result};
|
||||||
|
|
||||||
if (!lv2_event_flag::check_mode(mode))
|
if (!lv2_event_flag::check_mode(mode))
|
||||||
{
|
{
|
||||||
|
@ -156,7 +165,7 @@ error_code sys_event_flag_wait(ppu_thread& ppu, u32 id, u64 bitptn, u32 mode, vm
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (result) *result = ppu.gpr[6];
|
store.val = ppu.gpr[6];
|
||||||
return CELL_OK;
|
return CELL_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -201,12 +210,7 @@ error_code sys_event_flag_wait(ppu_thread& ppu, u32 id, u64 bitptn, u32 mode, vm
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ppu.test_stopped())
|
store.val = ppu.gpr[6];
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (result) *result = ppu.gpr[6];
|
|
||||||
return not_an_error(ppu.gpr[3]);
|
return not_an_error(ppu.gpr[3]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue