From 9d1bb60ad798265f6ca2a52dca5d1a02b68ca2b4 Mon Sep 17 00:00:00 2001 From: Eladash Date: Fri, 31 Jan 2020 15:59:44 +0200 Subject: [PATCH] cellGcm HLE: fix cellGcmMapMainMemory Fix arguments order, softcode RsxReports::report offset. --- rpcs3/Emu/Cell/Modules/cellGcmSys.cpp | 16 +++++++++------- rpcs3/Emu/RSX/RSXThread.cpp | 2 +- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/rpcs3/Emu/Cell/Modules/cellGcmSys.cpp b/rpcs3/Emu/Cell/Modules/cellGcmSys.cpp index b08a1e66dd..c79604d85b 100644 --- a/rpcs3/Emu/Cell/Modules/cellGcmSys.cpp +++ b/rpcs3/Emu/Cell/Modules/cellGcmSys.cpp @@ -142,7 +142,7 @@ vm::ptr cellGcmGetReportDataAddressLocation(u32 index, u32 lo cellGcmSys.error("cellGcmGetReportDataAddressLocation: Wrong local index (%d)", index); } - return vm::ptr::make(g_fxo->get()->gcm_info.label_addr + 0x1400 + index * 0x10); + return vm::ptr::make(g_fxo->get()->gcm_info.label_addr + ::offset32(&RsxReports::report) + index * 0x10); } u64 cellGcmGetTimeStamp(u32 index) @@ -154,7 +154,7 @@ u64 cellGcmGetTimeStamp(u32 index) cellGcmSys.error("cellGcmGetTimeStamp: Wrong local index (%d)", index); } - return vm::read64(g_fxo->get()->gcm_info.label_addr + 0x1400 + index * 0x10); + return vm::read64(g_fxo->get()->gcm_info.label_addr + ::offset32(&RsxReports::report) + index * 0x10); } u32 cellGcmGetCurrentField() @@ -181,7 +181,7 @@ u32 cellGcmGetNotifyDataAddress(u32 index) */ vm::ptr _cellGcmFunc12() { - return vm::ptr::make(g_fxo->get()->gcm_info.label_addr + 0x1400); // TODO + return vm::ptr::make(g_fxo->get()->gcm_info.label_addr + ::offset32(&RsxReports::report)); // TODO } u32 cellGcmGetReport(u32 type, u32 index) @@ -210,7 +210,7 @@ u32 cellGcmGetReportDataAddress(u32 index) cellGcmSys.error("cellGcmGetReportDataAddress: Wrong local index (%d)", index); } - return g_fxo->get()->gcm_info.label_addr + 0x1400 + index * 0x10; + return g_fxo->get()->gcm_info.label_addr + ::offset32(&RsxReports::report) + index * 0x10; } u32 cellGcmGetReportDataLocation(u32 index, u32 location) @@ -230,7 +230,7 @@ u64 cellGcmGetTimeStampLocation(u32 index, u32 location) cellGcmSys.error("cellGcmGetTimeStampLocation: Wrong local index (%d)", index); return 0; } - return vm::read64(g_fxo->get()->gcm_info.label_addr + 0x1400 + index * 0x10); + return vm::read64(g_fxo->get()->gcm_info.label_addr + ::offset32(&RsxReports::report) + index * 0x10); } if (location == CELL_GCM_LOCATION_MAIN) { @@ -1049,12 +1049,14 @@ error_code cellGcmMapMainMemory(u32 ea, u32 size, vm::ptr offset) { if (unmap_count >= (size >> 20)) { - if (auto error = gcmMapEaIoAddress(io << 20, ea, size, false)) + io <<= 20; + + if (auto error = gcmMapEaIoAddress(ea, io, size, false)) { return error; } - *offset = io << 20; + *offset = io; return CELL_OK; } } diff --git a/rpcs3/Emu/RSX/RSXThread.cpp b/rpcs3/Emu/RSX/RSXThread.cpp index 23f2dda608..f637ea4b85 100644 --- a/rpcs3/Emu/RSX/RSXThread.cpp +++ b/rpcs3/Emu/RSX/RSXThread.cpp @@ -81,7 +81,7 @@ namespace rsx { if (offset < sizeof(RsxReports::report) /*&& (offset % 0x10) == 0*/) { - return render->label_addr + 0x1400 + offset; + return render->label_addr + ::offset32(&RsxReports::report) + offset; } msg = "Local RSX REPORT offset out of range!"sv;