mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-26 23:10:38 +00:00
Fix faulty formula for block transfer size-check.
This commit is contained in:
parent
359b4fe1cf
commit
70ae4a35c1
@ -337,6 +337,7 @@ inline u32 ValidSize(const u32 address, const u32 requested_size) {
|
||||
return requested_size;
|
||||
}
|
||||
|
||||
// NOTE: If size == 0, any address will be accepted. This may not be ideal for all cases.
|
||||
inline bool IsValidRange(const u32 address, const u32 size) {
|
||||
return ValidSize(address, size) == size;
|
||||
}
|
||||
|
@ -1675,11 +1675,12 @@ void GPUCommon::DoBlockTransfer(u32 skipDrawReason) {
|
||||
if ((dstBasePtr & 0x04800000) == 0x04800000)
|
||||
dstBasePtr &= ~0x00800000;
|
||||
|
||||
// Use height less one to account for width, which can be greater or less than stride.
|
||||
// Use height less one to account for width, which can be greater or less than stride, and then add it on for the last line.
|
||||
// NOTE: The sizes are only used for validity checks and memory info tracking.
|
||||
const uint32_t src = srcBasePtr + (srcY * srcStride + srcX) * bpp;
|
||||
const uint32_t srcSize = (height - 1) * (srcStride + width) * bpp;
|
||||
const uint32_t dst = dstBasePtr + (dstY * dstStride + dstX) * bpp;
|
||||
const uint32_t dstSize = (height - 1) * (dstStride + width) * bpp;
|
||||
const uint32_t srcSize = ((height - 1) * srcStride) + width * bpp;
|
||||
const uint32_t dstSize = ((height - 1) * dstStride) + width * bpp;
|
||||
|
||||
bool srcDstOverlap = src + srcSize > dst && dst + dstSize > src;
|
||||
bool srcValid = Memory::IsValidRange(src, srcSize);
|
||||
|
Loading…
Reference in New Issue
Block a user