From 57ef6dae91c7236bffdcf8002d97895cfee6b756 Mon Sep 17 00:00:00 2001 From: O1L Date: Sat, 4 Feb 2017 17:18:37 +0300 Subject: [PATCH] Implemented cellGcmSetDefaultCommandBufferAndSegmentWordSize --- rpcs3/Emu/Cell/Modules/cellGcmSys.cpp | 21 +++++++++++++++++---- rpcs3/Emu/RSX/GCM.h | 2 ++ 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/rpcs3/Emu/Cell/Modules/cellGcmSys.cpp b/rpcs3/Emu/Cell/Modules/cellGcmSys.cpp index 2ba525b44d..c2ce883a91 100644 --- a/rpcs3/Emu/Cell/Modules/cellGcmSys.cpp +++ b/rpcs3/Emu/Cell/Modules/cellGcmSys.cpp @@ -222,13 +222,13 @@ u32 cellGcmGetControlRegister() u32 cellGcmGetDefaultCommandWordSize() { cellGcmSys.trace("cellGcmGetDefaultCommandWordSize()"); - return 0x400; + return gcm_info.command_size; } u32 cellGcmGetDefaultSegmentWordSize() { cellGcmSys.trace("cellGcmGetDefaultSegmentWordSize()"); - return 0x100; + return gcm_info.segment_size; } s32 cellGcmInitDefaultFifoMode(s32 mode) @@ -1134,9 +1134,22 @@ void cellGcmSetDefaultCommandBuffer() vm::write32(fxm::get()->ctxt_addr, gcm_info.context_addr); } -s32 cellGcmSetDefaultCommandBufferAndSegmentWordSize() +s32 cellGcmSetDefaultCommandBufferAndSegmentWordSize(u32 bufferSize, u32 segmentSize) { - fmt::throw_exception("Unimplemented" HERE); + cellGcmSys.warning("cellGcmSetDefaultCommandBufferAndSegmentWordSize(bufferSize = 0x%x, segmentSize = 0x%x)", bufferSize, segmentSize); + + const auto& put = vm::_ref(gcm_info.control_addr).put; + const auto& get = vm::_ref(gcm_info.control_addr).get; + + if (put != 0x1000 || get != 0x1000 || bufferSize < segmentSize * 2) + { + return CELL_GCM_ERROR_FAILURE; + } + + gcm_info.command_size = bufferSize; + gcm_info.segment_size = segmentSize; + + return CELL_OK; } //------------------------------------------------------------------------ diff --git a/rpcs3/Emu/RSX/GCM.h b/rpcs3/Emu/RSX/GCM.h index a65b6c1ca5..99bce3daf7 100644 --- a/rpcs3/Emu/RSX/GCM.h +++ b/rpcs3/Emu/RSX/GCM.h @@ -40,6 +40,8 @@ struct gcmInfo u32 context_addr; u32 control_addr; u32 label_addr; + u32 command_size = 0x400; + u32 segment_size = 0x100; }; struct CellGcmSurface