From c4b0e9999eb97707ecdaca3332c47741e72c272a Mon Sep 17 00:00:00 2001 From: Sergey Lipskiy Date: Sun, 14 Feb 2016 12:45:25 +0600 Subject: [PATCH] Fix copy from RDRAM in widescreen mode. --- src/FrameBuffer.cpp | 4 ++-- src/OpenGL.cpp | 5 ++++- src/OpenGL.h | 6 +++--- src/gDP.cpp | 2 +- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/FrameBuffer.cpp b/src/FrameBuffer.cpp index 9ae08f6f..9d481bfc 100644 --- a/src/FrameBuffer.cpp +++ b/src/FrameBuffer.cpp @@ -900,7 +900,7 @@ void FrameBufferList::renderBuffer(u32 _address) glBindFramebuffer(GL_FRAMEBUFFER, 0); - OGLRender::TexturedRectParams params(0.0f, 0.0f, width, height, 0.0f, 0.0f, width - 1.0f, height - 1.0f, false, pBuffer); + OGLRender::TexturedRectParams params(0.0f, 0.0f, width, height, 0.0f, 0.0f, width - 1.0f, height - 1.0f, false, false, pBuffer); ogl.getRender().drawTexturedRect(params); glBindFramebuffer(GL_READ_FRAMEBUFFER, 0); @@ -1741,7 +1741,7 @@ void RDRAMtoFrameBuffer::CopyFromRDRAM(u32 _address, bool _bCFB) glBindFramebuffer(GL_DRAW_FRAMEBUFFER, m_pCurBuffer->m_FBO); OGLRender::TexturedRectParams params((float)x0, (float)y0, (float)width, (float)height, 0.0f, 0.0f, width - 1.0f, height - 1.0f, - false, m_pCurBuffer); + false, true, m_pCurBuffer); video().getRender().drawTexturedRect(params); glBindFramebuffer(GL_DRAW_FRAMEBUFFER, frameBufferList().getCurrent()->m_FBO); diff --git a/src/OpenGL.cpp b/src/OpenGL.cpp index 605e4faf..cc3f57ff 100644 --- a/src/OpenGL.cpp +++ b/src/OpenGL.cpp @@ -1181,7 +1181,10 @@ void OGLRender::drawTexturedRect(const TexturedRectParams & _params) m_rect[2].t1 = texST[1].t1; } - if (ogl.isAdjustScreen() && (gDP.colorImage.width > VI.width * 98 / 100) && (_params.lrx - _params.ulx < VI.width * 9 / 10)) { + if (ogl.isAdjustScreen() && + (_params.forceAjustScale || + ((gDP.colorImage.width > VI.width * 98 / 100) && (_params.lrx - _params.ulx < VI.width * 9 / 10)))) + { const float scale = ogl.getAdjustScale(); for (u32 i = 0; i < 4; ++i) m_rect[i].x *= scale; diff --git a/src/OpenGL.h b/src/OpenGL.h index ba113f9f..6db64bc0 100644 --- a/src/OpenGL.h +++ b/src/OpenGL.h @@ -86,14 +86,14 @@ public: { float ulx, uly, lrx, lry; float uls, ult, lrs, lrt; - bool flip; + bool flip, forceAjustScale; const FrameBuffer * pBuffer; TexturedRectParams(float _ulx, float _uly, float _lrx, float _lry, float _uls, float _ult, float _lrs, float _lrt, - bool _flip, const FrameBuffer * _pBuffer) : + bool _flip, bool _forceAjustScale, const FrameBuffer * _pBuffer) : ulx(_ulx), uly(_uly), lrx(_lrx), lry(_lry), uls(_uls), ult(_ult), lrs(_lrs), lrt(_lrt), - flip(_flip), pBuffer(_pBuffer) + flip(_flip), forceAjustScale(_forceAjustScale), pBuffer(_pBuffer) {} }; void drawTexturedRect(const TexturedRectParams & _params); diff --git a/src/gDP.cpp b/src/gDP.cpp index d3217aad..5e739fcd 100644 --- a/src/gDP.cpp +++ b/src/gDP.cpp @@ -848,7 +848,7 @@ void gDPTextureRectangle( f32 ulx, f32 uly, f32 lrx, f32 lry, s32 tile, f32 s, f lrt = t + (lry - uly - 1) * dtdy; } - OGLRender::TexturedRectParams params(ulx, uly, lrx, lry, s, t, lrs, lrt, (RSP.cmd == G_TEXRECTFLIP), frameBufferList().getCurrent()); + OGLRender::TexturedRectParams params(ulx, uly, lrx, lry, s, t, lrs, lrt, (RSP.cmd == G_TEXRECTFLIP), false, frameBufferList().getCurrent()); video().getRender().drawTexturedRect(params); gSP.textureTile[0] = textureTileOrg[0];