diff --git a/plugins/GSdx/GSState.cpp b/plugins/GSdx/GSState.cpp index 00016372e0..319cf8a8c2 100644 --- a/plugins/GSdx/GSState.cpp +++ b/plugins/GSdx/GSState.cpp @@ -405,7 +405,7 @@ GSVideoMode GSState::GetVideoMode() return videomode; } -GSVector4i GSState::GetDisplayRect(int i) +GSVector4i GSState::GetDisplayRect(int i, bool merged_rect) { if(i < 0) i = IsEnabled(1) ? 1 : 0; @@ -433,8 +433,16 @@ GSVector4i GSState::GetDisplayRect(int i) rectangle.right = rectangle.left + width; rectangle.bottom = rectangle.top + height; - // Useful for debugging games: - //printf("DW: %d , DH: %d , left: %d , right: %d , top: %d , down: %d , MAGH: %d , MAGV: %d\n", m_regs->DISP[i].DISPLAY.DW, m_regs->DISP[i].DISPLAY.DH, r.left, r.right, r.top, r.bottom , m_regs->DISP[i].DISPLAY.MAGH,m_regs->DISP[i].DISPLAY.MAGV); + if ((m_regs->PMODE.EN1 & m_regs->PMODE.EN2) && merged_rect) + { + GSVector4i opposite_output = GetDisplayRect(!i); + GSVector4i r_intersect = opposite_output.rintersect(rectangle); + GSVector4i r_union = opposite_output.runion_ordered(rectangle); + + if(!(r_intersect.width() && r_intersect.height()) || + r_intersect.xyxy().eq(r_union.xyxy())) + return r_union; + } return rectangle; } diff --git a/plugins/GSdx/GSState.h b/plugins/GSdx/GSState.h index 2fad88beb3..d60e684c13 100644 --- a/plugins/GSdx/GSState.h +++ b/plugins/GSdx/GSState.h @@ -242,7 +242,7 @@ public: void ResetHandlers(); - GSVector4i GetDisplayRect(int i = -1); + GSVector4i GetDisplayRect(int i = -1, bool merged_rect = false); GSVector4i GetFrameRect(int i = -1); GSVideoMode GetVideoMode(); diff --git a/plugins/GSdx/GSTextureCache.cpp b/plugins/GSdx/GSTextureCache.cpp index 58ba33786a..c7cc57a64a 100644 --- a/plugins/GSdx/GSTextureCache.cpp +++ b/plugins/GSdx/GSTextureCache.cpp @@ -414,13 +414,8 @@ void GSTextureCache::ScaleTexture(GSTexture* texture) if (custom_resolution) { - int width = m_renderer->GetDisplayRect().width(); - int height = m_renderer->GetDisplayRect().height(); - int real_height = static_cast(round(m_renderer->GetInternalResolution().y / texture->GetScale().y)); - - // Fixes offset issues on Persona 3 (512x511) where real value of height is 512 - if (real_height % height == 1) - height = real_height; + int width = m_renderer->GetDisplayRect(-1, true).width(); + int height = m_renderer->GetDisplayRect(-1, true).height(); GSVector2i requested_resolution = m_renderer->GetCustomResolution(); scale_factor.x = static_cast(requested_resolution.x) / width;