Skip to content

Commit

Permalink
exception throwing fix in sys_lwmutex_create
Browse files Browse the repository at this point in the history
arg6 doesnt exist, if arg4 is not negative name is discarded and treated as 0.
  • Loading branch information
elad335 committed Feb 22, 2019
1 parent 02bb4d0 commit dda53d2
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion rpcs3/Emu/Cell/Modules/sys_lwmutex_.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ error_code sys_lwmutex_create(vm::ptr<sys_lwmutex_t> lwmutex, vm::ptr<sys_lwmute
attrs->flags = 0;
attrs->name_u64 = attr->name_u64;

if (error_code res = g_cfg.core.hle_lwmutex ? sys_mutex_create(out_id, attrs) : _sys_lwmutex_create(out_id, protocol, lwmutex, 0x80000001, attr->name_u64, 0))
if (error_code res = g_cfg.core.hle_lwmutex ? sys_mutex_create(out_id, attrs) : _sys_lwmutex_create(out_id, protocol, lwmutex, 0x80000001, attr->name_u64))
{
return res;
}
Expand Down
8 changes: 4 additions & 4 deletions rpcs3/Emu/Cell/lv2/sys_lwmutex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ LOG_CHANNEL(sys_lwmutex);

extern u64 get_system_time();

error_code _sys_lwmutex_create(vm::ptr<u32> lwmutex_id, u32 protocol, vm::ptr<sys_lwmutex_t> control, u32 arg4, u64 name, u32 arg6)
error_code _sys_lwmutex_create(vm::ptr<u32> lwmutex_id, u32 protocol, vm::ptr<sys_lwmutex_t> control, s32 has_name, u64 name)
{
sys_lwmutex.warning("_sys_lwmutex_create(lwmutex_id=*0x%x, protocol=0x%x, control=*0x%x, arg4=0x%x, name=0x%llx, arg6=0x%x)", lwmutex_id, protocol, control, arg4, name, arg6);
sys_lwmutex.warning("_sys_lwmutex_create(lwmutex_id=*0x%x, protocol=0x%x, control=*0x%x, arg4=0x%x, name=0x%llx, arg6=0x%x)", lwmutex_id, protocol, control, has_name, name);

if (protocol == SYS_SYNC_RETRY)
sys_lwmutex.todo("_sys_lwmutex_create(): SYS_SYNC_RETRY");
Expand All @@ -26,9 +26,9 @@ error_code _sys_lwmutex_create(vm::ptr<u32> lwmutex_id, u32 protocol, vm::ptr<sy
return CELL_EINVAL;
}

if (arg4 != 0x80000001 || arg6)
if (!(has_name < 0))
{
fmt::throw_exception("Unknown arguments (arg4=0x%x, arg6=0x%x)" HERE, arg4, arg6);
name = 0;
}

if (const u32 id = idm::make<lv2_obj, lv2_lwmutex>(protocol, control, name))
Expand Down
2 changes: 1 addition & 1 deletion rpcs3/Emu/Cell/lv2/sys_lwmutex.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class ppu_thread;

// Syscalls

error_code _sys_lwmutex_create(vm::ptr<u32> lwmutex_id, u32 protocol, vm::ptr<sys_lwmutex_t> control, u32 arg4, u64 name, u32 arg6);
error_code _sys_lwmutex_create(vm::ptr<u32> lwmutex_id, u32 protocol, vm::ptr<sys_lwmutex_t> control, s32 has_name, u64 name);
error_code _sys_lwmutex_destroy(u32 lwmutex_id);
error_code _sys_lwmutex_lock(ppu_thread& ppu, u32 lwmutex_id, u64 timeout);
error_code _sys_lwmutex_trylock(u32 lwmutex_id);
Expand Down

0 comments on commit dda53d2

Please sign in to comment.