From 26d47afec64ebf8dc974bee4464b175283d0e5fa Mon Sep 17 00:00:00 2001 From: eladash Date: Sat, 29 Dec 2018 13:15:43 +0200 Subject: [PATCH] hle gcm: Fix cellGcmGetReportDataAddressLocation * Never return NULL (also apllies to similar functions) * Base offset is 0x0e000000 for main location * Default location is LOCAL Info was taken from disasm of gcm --- rpcs3/Emu/Cell/Modules/cellGcmSys.cpp | 42 ++++++++++++++------------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/rpcs3/Emu/Cell/Modules/cellGcmSys.cpp b/rpcs3/Emu/Cell/Modules/cellGcmSys.cpp index e451fb8cba..86b44cc20c 100644 --- a/rpcs3/Emu/Cell/Modules/cellGcmSys.cpp +++ b/rpcs3/Emu/Cell/Modules/cellGcmSys.cpp @@ -104,34 +104,35 @@ vm::ptr cellGcmGetReportDataAddressLocation(u32 index, u32 lo { cellGcmSys.warning("cellGcmGetReportDataAddressLocation(index=%d, location=%d)", index, location); - if (location == CELL_GCM_LOCATION_LOCAL) { - if (index >= 2048) { - cellGcmSys.error("cellGcmGetReportDataAddressLocation: Wrong local index (%d)", index); - return vm::null; - } - return vm::ptr::make(fxm::get()->gcm_info.label_addr + 0x1400 + index * 0x10); - } - - if (location == CELL_GCM_LOCATION_MAIN) { - if (index >= 1024 * 1024) { + if (location == CELL_GCM_LOCATION_MAIN) + { + if (index >= 1024 * 1024) + { cellGcmSys.error("cellGcmGetReportDataAddressLocation: Wrong main index (%d)", index); - return vm::null; } - return vm::ptr::make(RSXIOMem.RealAddr(index * 0x10)); + + return vm::ptr::make(RSXIOMem.RealAddr(0x0e000000 + index * 0x10)); } - cellGcmSys.error("cellGcmGetReportDataAddressLocation: Wrong location (%d)", location); - return vm::null; + // Anything else is Local + + if (index >= 2048) + { + cellGcmSys.error("cellGcmGetReportDataAddressLocation: Wrong local index (%d)", index); + } + + return vm::ptr::make(fxm::get()->gcm_info.label_addr + 0x1400 + index * 0x10); } u64 cellGcmGetTimeStamp(u32 index) { cellGcmSys.trace("cellGcmGetTimeStamp(index=%d)", index); - if (index >= 2048) { + if (index >= 2048) + { cellGcmSys.error("cellGcmGetTimeStamp: Wrong local index (%d)", index); - return 0; } + return vm::read64(fxm::get()->gcm_info.label_addr + 0x1400 + index * 0x10); } @@ -166,9 +167,9 @@ u32 cellGcmGetReport(u32 type, u32 index) { cellGcmSys.warning("cellGcmGetReport(type=%d, index=%d)", type, index); - if (index >= 2048) { + if (index >= 2048) + { cellGcmSys.error("cellGcmGetReport: Wrong local index (%d)", index); - return -1; } if (type < 1 || type > 5) { @@ -183,10 +184,11 @@ u32 cellGcmGetReportDataAddress(u32 index) { cellGcmSys.warning("cellGcmGetReportDataAddress(index=%d)", index); - if (index >= 2048) { + if (index >= 2048) + { cellGcmSys.error("cellGcmGetReportDataAddress: Wrong local index (%d)", index); - return 0; } + return fxm::get()->gcm_info.label_addr + 0x1400 + index * 0x10; }