From 072faead413065c3362eb8ccc8a2f9240021d3e3 Mon Sep 17 00:00:00 2001 From: GPUCode Date: Tue, 18 Jul 2023 11:51:52 +0300 Subject: [PATCH] gsp_gpu: Convert vaddr to paddr from GSP service --- src/core/PICA/regs.cpp | 4 ++-- src/core/services/gsp_gpu.cpp | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/core/PICA/regs.cpp b/src/core/PICA/regs.cpp index d245f8af..e816ec59 100644 --- a/src/core/PICA/regs.cpp +++ b/src/core/PICA/regs.cpp @@ -336,7 +336,7 @@ void GPU::writeInternalReg(u32 index, u32 value, u32 mask) { } void GPU::startCommandList(u32 addr, u32 size) { - cmdBuffStart = static_cast(mem.getReadPointer(addr)); + cmdBuffStart = getPointerPhys(addr); if (!cmdBuffStart) Helpers::panic("Couldn't get buffer for command list"); // TODO: This is very memory unsafe. We get a pointer to FCRAM and just keep writing without checking if we're gonna go OoB @@ -384,4 +384,4 @@ void GPU::startCommandList(u32 addr, u32 size) { writeInternalReg(id, param, mask); } } -} \ No newline at end of file +} diff --git a/src/core/services/gsp_gpu.cpp b/src/core/services/gsp_gpu.cpp index 5179aec8..b7108fcd 100644 --- a/src/core/services/gsp_gpu.cpp +++ b/src/core/services/gsp_gpu.cpp @@ -379,11 +379,11 @@ void GPUService::flushCacheRegions(u32* cmd) { void GPUService::processCommandList(u32* cmd) { const u32 address = cmd[1] & ~7; // Buffer address const u32 size = cmd[2] & ~3; // Buffer size in bytes - const bool updateGas = cmd[3] == 1; // Update gas additive blend results (0 = don't update, 1 = update) - const bool flushBuffer = cmd[7] == 1; // Flush buffer (0 = don't flush, 1 = flush) + [[maybe_unused]] const bool updateGas = cmd[3] == 1; // Update gas additive blend results (0 = don't update, 1 = update) + [[maybe_unused]] const bool flushBuffer = cmd[7] == 1; // Flush buffer (0 = don't flush, 1 = flush) log("GPU::GSP::processCommandList. Address: %08X, size in bytes: %08X\n", address, size); - gpu.startCommandList(address, size); + gpu.startCommandList(VaddrToPaddr(address), size); requestInterrupt(GPUInterrupt::P3D); // Send an IRQ when command list processing is over } @@ -394,4 +394,4 @@ void GPUService::triggerTextureCopy(u32* cmd) { // This uses the transfer engine and thus needs to fire a PPF interrupt. // NSMB2 relies on this requestInterrupt(GPUInterrupt::PPF); -} \ No newline at end of file +}