Ge: Improve some logging and memchecks.

Explicitly trigger memchecks on readback.
This commit is contained in:
Unknown W. Brackets 2021-01-31 00:22:49 -08:00
parent 1eeebccd04
commit 5041a898a2
2 changed files with 9 additions and 6 deletions

View file

@ -563,12 +563,11 @@ static int sceGeGetMtx(int type, u32 matrixPtr) {
} }
static u32 sceGeGetCmd(int cmd) { static u32 sceGeGetCmd(int cmd) {
INFO_LOG(SCEGE, "sceGeGetCmd(%i)", cmd);
if (cmd >= 0 && cmd < (int)ARRAY_SIZE(gstate.cmdmem)) { if (cmd >= 0 && cmd < (int)ARRAY_SIZE(gstate.cmdmem)) {
return gstate.cmdmem[cmd]; // Does not mask away the high bits. // Does not mask away the high bits.
} else { return hleLogSuccessInfoX(SCEGE, gstate.cmdmem[cmd]);
return SCE_KERNEL_ERROR_INVALID_INDEX;
} }
return hleLogError(SCEGE, SCE_KERNEL_ERROR_INVALID_INDEX);
} }
static int sceGeGetStack(int index, u32 stackPtr) { static int sceGeGetStack(int index, u32 stackPtr) {

View file

@ -28,7 +28,9 @@
#include "Core/ConfigValues.h" #include "Core/ConfigValues.h"
#include "Core/Core.h" #include "Core/Core.h"
#include "Core/CoreParameter.h" #include "Core/CoreParameter.h"
#include "Core/Debugger/Breakpoints.h"
#include "Core/Host.h" #include "Core/Host.h"
#include "Core/MIPS/MIPS.h"
#include "Core/Reporting.h" #include "Core/Reporting.h"
#include "GPU/Common/DrawEngineCommon.h" #include "GPU/Common/DrawEngineCommon.h"
#include "GPU/Common/FramebufferManagerCommon.h" #include "GPU/Common/FramebufferManagerCommon.h"
@ -2146,9 +2148,10 @@ void FramebufferManagerCommon::PackFramebufferSync_(VirtualFramebuffer *vfb, int
const int dstBpp = (int)DataFormatSizeInBytes(destFormat); const int dstBpp = (int)DataFormatSizeInBytes(destFormat);
const int dstByteOffset = (y * vfb->fb_stride + x) * dstBpp; 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)) { if (!Memory::IsValidRange(fb_address + dstByteOffset, dstSize)) {
ERROR_LOG(G3D, "PackFramebufferSync_ would write outside of memory, ignoring"); ERROR_LOG_REPORT(G3D, "PackFramebufferSync_ would write outside of memory, ignoring");
return; return;
} }
@ -2160,6 +2163,7 @@ void FramebufferManagerCommon::PackFramebufferSync_(VirtualFramebuffer *vfb, int
if (destPtr) { if (destPtr) {
draw_->CopyFramebufferToMemorySync(vfb->fbo, Draw::FB_COLOR_BIT, x, y, w, h, destFormat, destPtr, vfb->fb_stride, "PackFramebufferSync_"); 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 { } else {
ERROR_LOG(G3D, "PackFramebufferSync_: Tried to readback to bad address %08x (stride = %d)", fb_address + dstByteOffset, vfb->fb_stride); ERROR_LOG(G3D, "PackFramebufferSync_: Tried to readback to bad address %08x (stride = %d)", fb_address + dstByteOffset, vfb->fb_stride);
} }