From 8debe785b895fcd46061b8b400afd128fceb90f9 Mon Sep 17 00:00:00 2001 From: sum2012 Date: Tue, 29 Dec 2015 04:10:18 +0800 Subject: [PATCH 1/2] Revert "Fix Yu-Gi-Oh 6 crash with edit card in Android version" This reverts commit f659e60c8d57df90d74a944b904a898a1b271f2b. The crash is correctly fixed --- Core/MIPS/JitCommon/JitBlockCache.cpp | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/Core/MIPS/JitCommon/JitBlockCache.cpp b/Core/MIPS/JitCommon/JitBlockCache.cpp index 9fa6ceb040..26b458274d 100644 --- a/Core/MIPS/JitCommon/JitBlockCache.cpp +++ b/Core/MIPS/JitCommon/JitBlockCache.cpp @@ -404,20 +404,19 @@ void JitBlockCache::LinkBlockExits(int i) { int destinationBlock = GetBlockNumberFromStartAddress(b.exitAddress[e]); if (destinationBlock != -1) { #if defined(ARM) - //break Yu-Gi-Oh 6 crash with edit card in Android version - //const u8 *nextExit = b.exitPtrs[e + 1]; - //if (!nextExit) { - // nextExit = b.normalEntry + b.codeSize; - //} + const u8 *nextExit = b.exitPtrs[e + 1]; + if (!nextExit) { + nextExit = b.normalEntry + b.codeSize; + } ARMXEmitter emit(b.exitPtrs[e]); emit.B(blocks_[destinationBlock].checkedEntry); - //u32 op = *((const u32 *)emit.GetCodePtr()); - //// Overwrite with nops until the next unconditional branch. - //while ((op & 0xFF000000) != 0xEA000000) { - // emit.BKPT(1); - // op = *((const u32 *)emit.GetCodePtr()); - //} - //emit.BKPT(1); + u32 op = *((const u32 *)emit.GetCodePtr()); + // Overwrite with nops until the next unconditional branch. + while ((op & 0xFF000000) != 0xEA000000) { + emit.BKPT(1); + op = *((const u32 *)emit.GetCodePtr()); + } + emit.BKPT(1); emit.FlushIcache(); b.linkStatus[e] = true; #elif defined(_M_IX86) || defined(_M_X64) From 842ff4000fc077b37a274ceebe3d03f21a625d84 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Mon, 28 Dec 2015 22:23:07 -0800 Subject: [PATCH 2/2] Skip CopyImageSubData when blit is outside FBO. Otherwise, it will simply fail. See #7525 (comments in 2015-12.) --- GPU/GLES/Framebuffer.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/GPU/GLES/Framebuffer.cpp b/GPU/GLES/Framebuffer.cpp index cfb16f7525..30827e7e3a 100644 --- a/GPU/GLES/Framebuffer.cpp +++ b/GPU/GLES/Framebuffer.cpp @@ -1375,8 +1375,12 @@ void FramebufferManager::BlitFramebuffer(VirtualFramebuffer *dst, int dstX, int int dstY2 = (dstY + h) * dstYFactor; if (gstate_c.Supports(GPU_SUPPORTS_ANY_COPY_IMAGE)) { - // Only if it's the same size. - if (dstX2 - dstX1 == srcX2 - srcX1 && dstY2 - dstY1 == srcY2 - srcY1) { + // glBlitFramebuffer can clip, but glCopyImageSubData is more restricted. + // In case the src goes outside, we just skip the optimization in that case. + const bool sameSize = dstX2 - dstX1 == srcX2 - srcX1 && dstY2 - dstY1 == srcY2 - srcY1; + const bool srcInsideBounds = srcX2 <= src->renderWidth && srcY2 <= src->renderHeight; + const bool dstInsideBounds = dstX2 <= dst->renderWidth && dstY2 <= dst->renderHeight; + if (sameSize && srcInsideBounds && dstInsideBounds) { #if defined(USING_GLES2) #ifndef IOS glCopyImageSubDataOES(