Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tiny fix of sys_event_flag_wait #10404

Merged
merged 2 commits into from Jun 5, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 12 additions & 8 deletions rpcs3/Emu/Cell/lv2/sys_event_flag.cpp
Expand Up @@ -102,7 +102,16 @@ error_code sys_event_flag_wait(ppu_thread& ppu, u32 id, u64 bitptn, u32 mode, vm
ppu.gpr[6] = 0;

// 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))
{
Expand Down Expand Up @@ -156,7 +165,7 @@ error_code sys_event_flag_wait(ppu_thread& ppu, u32 id, u64 bitptn, u32 mode, vm
}
else
{
if (result) *result = ppu.gpr[6];
store.val = ppu.gpr[6];
return CELL_OK;
}

Expand Down Expand Up @@ -201,12 +210,7 @@ error_code sys_event_flag_wait(ppu_thread& ppu, u32 id, u64 bitptn, u32 mode, vm
}
}

if (ppu.test_stopped())
{
return 0;
}

if (result) *result = ppu.gpr[6];
store.val = ppu.gpr[6];
return not_an_error(ppu.gpr[3]);
}

Expand Down