From 7fca980887644b3776f98a1b8d17ae13e6a1558a Mon Sep 17 00:00:00 2001 From: Nekotekina Date: Fri, 20 Jun 2014 23:54:04 +0400 Subject: [PATCH] sys_ppu_thread_create threadname workaround --- rpcs3/Emu/SysCalls/lv2/SC_PPU_Thread.cpp | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/rpcs3/Emu/SysCalls/lv2/SC_PPU_Thread.cpp b/rpcs3/Emu/SysCalls/lv2/SC_PPU_Thread.cpp index 9e31b63c62..94b9f9f969 100644 --- a/rpcs3/Emu/SysCalls/lv2/SC_PPU_Thread.cpp +++ b/rpcs3/Emu/SysCalls/lv2/SC_PPU_Thread.cpp @@ -147,10 +147,21 @@ int sys_ppu_thread_restart(u32 thread_id) int sys_ppu_thread_create(u32 thread_id_addr, u32 entry, u64 arg, int prio, u32 stacksize, u64 flags, u32 threadname_addr) { - sysPrxForUser->Log("sys_ppu_thread_create(thread_id_addr=0x%x, entry=0x%x, arg=0x%x, prio=%d, stacksize=0x%x, flags=0x%llx, threadname_addr=0x%x('%s'))", - thread_id_addr, entry, arg, prio, stacksize, flags, threadname_addr, Memory.ReadString(threadname_addr).c_str()); + std::string threadname = ""; + if (Memory.IsGoodAddr(threadname_addr)) + { + threadname = Memory.ReadString(threadname_addr); + sysPrxForUser->Log("sys_ppu_thread_create(thread_id_addr=0x%x, entry=0x%x, arg=0x%x, prio=%d, stacksize=0x%x, flags=0x%llx, threadname_addr=0x%x('%s'))", + thread_id_addr, entry, arg, prio, stacksize, flags, threadname_addr, threadname.c_str()); + } + else + { + sysPrxForUser->Log("sys_ppu_thread_create(thread_id_addr=0x%x, entry=0x%x, arg=0x%x, prio=%d, stacksize=0x%x, flags=0x%llx, threadname_addr=0x%x)", + thread_id_addr, entry, arg, prio, stacksize, flags, threadname_addr); + if (threadname_addr != 0) return CELL_EFAULT; + } - if(!Memory.IsGoodAddr(entry) || !Memory.IsGoodAddr(thread_id_addr) || !Memory.IsGoodAddr(threadname_addr)) + if(!Memory.IsGoodAddr(entry) || !Memory.IsGoodAddr(thread_id_addr)) { return CELL_EFAULT; } @@ -163,7 +174,7 @@ int sys_ppu_thread_create(u32 thread_id_addr, u32 entry, u64 arg, int prio, u32 new_thread.SetPrio(prio); new_thread.SetStackSize(stacksize); //new_thread.flags = flags; - new_thread.SetName(Memory.ReadString(threadname_addr)); + new_thread.SetName(threadname); ConLog.Write("*** New PPU Thread [%s] (): id = %d", new_thread.GetName().c_str(), new_thread.GetId());