summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/BPStructs.cpp
diff options
context:
space:
mode:
authorJMC47 <JMC4789@gmail.com>2021-09-16 21:04:03 -0400
committerGitHub <noreply@github.com>2021-09-16 21:04:03 -0400
commit2d1ec6332b6335107e4e1fbd9c6735840117623e (patch)
tree6b2a0c7aaad751a3fccb451ad360feb922fb4b41 /Source/Core/VideoCommon/BPStructs.cpp
parenta0f7e3110da16b4835cf9de5c34507c5b5b40504 (diff)
parent7c7609f5b94e681bce278b1bc0259c7243828377 (diff)
Merge pull request #10106 from phire/fix-negative-efb-copies
BPStructs: Ignore malformed efb copies
Diffstat (limited to 'Source/Core/VideoCommon/BPStructs.cpp')
-rw-r--r--Source/Core/VideoCommon/BPStructs.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/Source/Core/VideoCommon/BPStructs.cpp b/Source/Core/VideoCommon/BPStructs.cpp
index 57a418e8d0..42ca1545a5 100644
--- a/Source/Core/VideoCommon/BPStructs.cpp
+++ b/Source/Core/VideoCommon/BPStructs.cpp
@@ -244,6 +244,15 @@ static void BPWritten(const BPCmd& bp)
WARN_LOG_FMT(VIDEO, "Oversized EFB copy: {}x{} (offset {},{} stride {})", srcRect.GetWidth(),
srcRect.GetHeight(), srcRect.left, srcRect.top, destStride);
+ if (u32(srcRect.left) >= EFB_WIDTH || u32(srcRect.top) >= EFB_HEIGHT)
+ {
+ // This is not a sane src rectangle, it doesn't touch any valid image data at all
+ // Just ignore it
+ // Apparently Mario Kart Wii in wifi mode can generate a deformed EFB copy of size 4x4
+ // at offset (328,1020)
+ return;
+ }
+
// Clamp the copy region to fit within EFB. So that we don't end up with a stretched image.
srcRect.right = std::clamp<int>(srcRect.right, 0, EFB_WIDTH);
srcRect.bottom = std::clamp<int>(srcRect.bottom, 0, EFB_HEIGHT);