From 5041a898a273f7615f454aeaf95e6576f7f50df1 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sun, 31 Jan 2021 00:22:49 -0800 Subject: [PATCH] Ge: Improve some logging and memchecks. Explicitly trigger memchecks on readback. --- Core/HLE/sceGe.cpp | 7 +++---- GPU/Common/FramebufferManagerCommon.cpp | 8 ++++++-- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/Core/HLE/sceGe.cpp b/Core/HLE/sceGe.cpp index 8c27ed16c62b..04b2e40831bc 100644 --- a/Core/HLE/sceGe.cpp +++ b/Core/HLE/sceGe.cpp @@ -563,12 +563,11 @@ static int sceGeGetMtx(int type, u32 matrixPtr) { } static u32 sceGeGetCmd(int cmd) { - INFO_LOG(SCEGE, "sceGeGetCmd(%i)", cmd); if (cmd >= 0 && cmd < (int)ARRAY_SIZE(gstate.cmdmem)) { - return gstate.cmdmem[cmd]; // Does not mask away the high bits. - } else { - return SCE_KERNEL_ERROR_INVALID_INDEX; + // Does not mask away the high bits. + return hleLogSuccessInfoX(SCEGE, gstate.cmdmem[cmd]); } + return hleLogError(SCEGE, SCE_KERNEL_ERROR_INVALID_INDEX); } static int sceGeGetStack(int index, u32 stackPtr) { diff --git a/GPU/Common/FramebufferManagerCommon.cpp b/GPU/Common/FramebufferManagerCommon.cpp index 2e926f6c60d0..76b94ccbb1db 100644 --- a/GPU/Common/FramebufferManagerCommon.cpp +++ b/GPU/Common/FramebufferManagerCommon.cpp @@ -28,7 +28,9 @@ #include "Core/ConfigValues.h" #include "Core/Core.h" #include "Core/CoreParameter.h" +#include "Core/Debugger/Breakpoints.h" #include "Core/Host.h" +#include "Core/MIPS/MIPS.h" #include "Core/Reporting.h" #include "GPU/Common/DrawEngineCommon.h" #include "GPU/Common/FramebufferManagerCommon.h" @@ -2146,9 +2148,10 @@ void FramebufferManagerCommon::PackFramebufferSync_(VirtualFramebuffer *vfb, int const int dstBpp = (int)DataFormatSizeInBytes(destFormat); const int dstByteOffset = (y * vfb->fb_stride + x) * dstBpp; + const int dstSize = (h * vfb->fb_stride + w - 1) * dstBpp; - if (!Memory::IsValidRange(fb_address + dstByteOffset, ((h - 1) * vfb->fb_stride + w) * dstBpp)) { - ERROR_LOG(G3D, "PackFramebufferSync_ would write outside of memory, ignoring"); + if (!Memory::IsValidRange(fb_address + dstByteOffset, dstSize)) { + ERROR_LOG_REPORT(G3D, "PackFramebufferSync_ would write outside of memory, ignoring"); return; } @@ -2160,6 +2163,7 @@ void FramebufferManagerCommon::PackFramebufferSync_(VirtualFramebuffer *vfb, int if (destPtr) { draw_->CopyFramebufferToMemorySync(vfb->fbo, Draw::FB_COLOR_BIT, x, y, w, h, destFormat, destPtr, vfb->fb_stride, "PackFramebufferSync_"); + CBreakPoints::ExecMemCheck(fb_address + dstByteOffset, true, dstSize, currentMIPS->pc); } else { ERROR_LOG(G3D, "PackFramebufferSync_: Tried to readback to bad address %08x (stride = %d)", fb_address + dstByteOffset, vfb->fb_stride); }