Skip to content

Commit

Permalink
Ge: Improve some logging and memchecks.
Browse files Browse the repository at this point in the history
Explicitly trigger memchecks on readback.
  • Loading branch information
unknownbrackets committed Jan 31, 2021
1 parent 1eeebcc commit 5041a89
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
7 changes: 3 additions & 4 deletions Core/HLE/sceGe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
8 changes: 6 additions & 2 deletions GPU/Common/FramebufferManagerCommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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;
}

Expand All @@ -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);
}
Expand Down

0 comments on commit 5041a89

Please sign in to comment.