From 64bfae6648a3113388c48eeabb59bc7e62b4c49e Mon Sep 17 00:00:00 2001 From: elisha464 Date: Thu, 23 Jan 2014 19:03:43 +0200 Subject: [PATCH 1/3] fix stop when trying to run two games in a row --- rpcs3/Emu/SysCalls/Modules/cellGcmSys.cpp | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/rpcs3/Emu/SysCalls/Modules/cellGcmSys.cpp b/rpcs3/Emu/SysCalls/Modules/cellGcmSys.cpp index eb12d007a1..3384ca053b 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellGcmSys.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellGcmSys.cpp @@ -4,7 +4,9 @@ #include "Emu/GS/GCM.h" void cellGcmSys_init(); -Module cellGcmSys(0x0010, cellGcmSys_init); +void cellGcmSys_Load(); +void cellGcmSys_Unload(); +Module cellGcmSys(0x0010, cellGcmSys_init, cellGcmSys_Load, cellGcmSys_Unload); u32 local_size = 0; u32 local_addr = NULL; @@ -54,6 +56,9 @@ int cellGcmInit(u32 context_addr, u32 cmdSize, u32 ioSize, u32 ioAddress) { cellGcmSys.Warning("cellGcmInit(context_addr=0x%x,cmdSize=0x%x,ioSize=0x%x,ioAddress=0x%x)", context_addr, cmdSize, ioSize, ioAddress); + if(!cellGcmSys.IsLoaded()) + cellGcmSys.Load(); + if(!local_size && !local_addr) { local_size = 0xf900000; //TODO @@ -799,9 +804,6 @@ int32_t cellGcmUnreserveIoMapSize(u32 size) void cellGcmSys_init() { - current_config.ioAddress = NULL; - current_config.localAddress = NULL; - cellGcmSys.AddFunc(0x055bd74d, cellGcmGetTiledPitchSize); cellGcmSys.AddFunc(0x06edea9e, cellGcmSetUserHandler); cellGcmSys.AddFunc(0x15bae46b, cellGcmInit); @@ -861,3 +863,15 @@ void cellGcmSys_init() cellGcmSys.AddFunc(0xdb23e867, cellGcmUnmapIoAddress); cellGcmSys.AddFunc(0x3b9bd5bd, cellGcmUnreserveIoMapSize); } + +void cellGcmSys_Load() +{ + current_config.ioAddress = NULL; + current_config.localAddress = NULL; + local_size = 0; + local_addr = NULL; +} + +void cellGcmSys_Unload() +{ +} \ No newline at end of file From 8a3835bcef4d717955cb68518217c8c907ac6e18 Mon Sep 17 00:00:00 2001 From: elisha464 Date: Thu, 23 Jan 2014 21:37:59 +0200 Subject: [PATCH 2/3] fix thread exit crash --- rpcs3/Emu/CPU/CPUThread.cpp | 5 +++++ rpcs3/Emu/SysCalls/SysCalls.h | 2 +- rpcs3/Emu/SysCalls/lv2/SC_PPU_Thread.cpp | 4 ++-- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/rpcs3/Emu/CPU/CPUThread.cpp b/rpcs3/Emu/CPU/CPUThread.cpp index b5ab265758..a0a1cdfed1 100644 --- a/rpcs3/Emu/CPU/CPUThread.cpp +++ b/rpcs3/Emu/CPU/CPUThread.cpp @@ -351,6 +351,11 @@ void CPUThread::Task() { ConLog.Error("Exception: %s", e); } + catch(int exitcode) + { + ConLog.Success("Exit Code: %d", exitcode); + return; + } //ConLog.Write("%s leave", CPUThread::GetFName()); diff --git a/rpcs3/Emu/SysCalls/SysCalls.h b/rpcs3/Emu/SysCalls/SysCalls.h index 21885708cc..4d5307d115 100644 --- a/rpcs3/Emu/SysCalls/SysCalls.h +++ b/rpcs3/Emu/SysCalls/SysCalls.h @@ -169,7 +169,7 @@ extern int sys_mutex_trylock(u32 mutex_id); extern int sys_mutex_unlock(u32 mutex_id); //ppu_thread -extern int sys_ppu_thread_exit(int errorcode); +extern void sys_ppu_thread_exit(int errorcode); extern int sys_ppu_thread_yield(); extern int sys_ppu_thread_join(u32 thread_id, u32 vptr_addr); extern int sys_ppu_thread_detach(u32 thread_id); diff --git a/rpcs3/Emu/SysCalls/lv2/SC_PPU_Thread.cpp b/rpcs3/Emu/SysCalls/lv2/SC_PPU_Thread.cpp index 092d5102a2..277f7f21a1 100644 --- a/rpcs3/Emu/SysCalls/lv2/SC_PPU_Thread.cpp +++ b/rpcs3/Emu/SysCalls/lv2/SC_PPU_Thread.cpp @@ -10,7 +10,7 @@ enum SYS_PPU_THREAD_DONE_INIT, }; -int sys_ppu_thread_exit(int errorcode) +void sys_ppu_thread_exit(int errorcode) { if(errorcode == 0) { @@ -25,7 +25,7 @@ int sys_ppu_thread_exit(int errorcode) thr.SetExitStatus(errorcode); Emu.GetCPU().RemoveThread(thr.GetId()); - return CELL_OK; + throw errorcode; } int sys_ppu_thread_yield() From 4ee90e1f90a0a5af76ac6c4e19da3a1ef884ca5f Mon Sep 17 00:00:00 2001 From: elisha464 Date: Thu, 23 Jan 2014 21:38:26 +0200 Subject: [PATCH 3/3] changed warning of cellGcmAddressToOffset to Log --- rpcs3/Emu/SysCalls/Modules/cellGcmSys.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rpcs3/Emu/SysCalls/Modules/cellGcmSys.cpp b/rpcs3/Emu/SysCalls/Modules/cellGcmSys.cpp index 3384ca053b..c9db1fe8ab 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellGcmSys.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellGcmSys.cpp @@ -596,7 +596,7 @@ void InitOffsetTable() int32_t cellGcmAddressToOffset(u64 address, mem32_t offset) { - cellGcmSys.Warning("cellGcmAddressToOffset(address=0x%x,offset_addr=0x%x)", address, offset.GetAddr()); + cellGcmSys.Log("cellGcmAddressToOffset(address=0x%x,offset_addr=0x%x)", address, offset.GetAddr()); if(address >= 0xD0000000/*not on main memory or local*/) return CELL_GCM_ERROR_FAILURE;