mirror of https://github.com/PCSX2/pcsx2.git
GS: Clean up some code and correct heights when offset by 1
This commit is contained in:
parent
38fa137cfd
commit
d1470a9935
|
@ -380,7 +380,7 @@ GSVector4i GSState::GetFrameMagnifiedRect(int i)
|
|||
if (!IsEnabled(0) && !IsEnabled(1))
|
||||
return rectangle;
|
||||
|
||||
const GSVideoMode videomode = GetVideoMode();
|
||||
const int videomode = static_cast<int>(GetVideoMode()) - 1;
|
||||
const auto& DISP = m_regs->DISP[i].DISPLAY;
|
||||
const bool ignore_offset = !GSConfig.PCRTCOffsets;
|
||||
|
||||
|
@ -400,8 +400,8 @@ GSVector4i GSState::GetFrameMagnifiedRect(int i)
|
|||
}
|
||||
else
|
||||
{
|
||||
width = (DW / (VideoModeDividers[(int)videomode - 1].x + 1));
|
||||
height = (DH / (VideoModeDividers[(int)videomode - 1].y + 1));
|
||||
width = (DW / (VideoModeDividers[videomode].x + 1));
|
||||
height = (DH / (VideoModeDividers[videomode].y + 1));
|
||||
}
|
||||
|
||||
int res_multi = 1;
|
||||
|
@ -426,8 +426,8 @@ int GSState::GetDisplayHMagnification()
|
|||
}
|
||||
|
||||
// If neither DISPLAY is enabled, fallback to resolution offset (should never happen)
|
||||
const GSVideoMode videomode = GetVideoMode();
|
||||
return VideoModeDividers[(int)videomode - 1].x + 1;
|
||||
const int videomode = static_cast<int>(GetVideoMode()) - 1;
|
||||
return VideoModeDividers[videomode].x + 1;
|
||||
}
|
||||
|
||||
GSVector4i GSState::GetDisplayRect(int i)
|
||||
|
@ -454,7 +454,7 @@ GSVector4i GSState::GetDisplayRect(int i)
|
|||
const int width = DW / magnification.x;
|
||||
const int height = DH / magnification.y;
|
||||
|
||||
const GSVector2i offsets = GetResolutionOffset(i);
|
||||
GSVector2i offsets = GetResolutionOffset(i);
|
||||
|
||||
// Set up the display rectangle based on the values obtained from DISPLAY registers
|
||||
rectangle.left = offsets.x;
|
||||
|
@ -468,25 +468,25 @@ GSVector4i GSState::GetDisplayRect(int i)
|
|||
|
||||
GSVector2i GSState::GetResolutionOffset(int i)
|
||||
{
|
||||
const GSVideoMode videomode = GetVideoMode();
|
||||
const int videomode = static_cast<int>(GetVideoMode()) - 1;
|
||||
const auto& DISP = m_regs->DISP[i].DISPLAY;
|
||||
|
||||
const auto& SMODE2 = m_regs->SMODE2;
|
||||
const int res_multi = (SMODE2.INT + 1);
|
||||
GSVector2i offset;
|
||||
|
||||
offset.x = (((int)DISP.DX - VideoModeOffsets[(int)videomode - 1].z) / (VideoModeDividers[(int)videomode - 1].x + 1));
|
||||
offset.y = ((int)DISP.DY - (VideoModeOffsets[(int)videomode - 1].w * ((IsAnalogue() && res_multi) ? res_multi : 1))) / (VideoModeDividers[(int)videomode - 1].y + 1);
|
||||
offset.x = (static_cast<int>(DISP.DX) - VideoModeOffsets[videomode].z) / (VideoModeDividers[videomode].x + 1);
|
||||
offset.y = (static_cast<int>(DISP.DY) - (VideoModeOffsets[videomode].w * ((IsAnalogue() && res_multi) ? res_multi : 1))) / (VideoModeDividers[videomode].y + 1);
|
||||
|
||||
return offset;
|
||||
}
|
||||
|
||||
GSVector2i GSState::GetResolution()
|
||||
{
|
||||
const GSVideoMode videomode = GetVideoMode();
|
||||
const int videomode = static_cast<int>(GetVideoMode()) - 1;
|
||||
const bool ignore_offset = !GSConfig.PCRTCOffsets;
|
||||
|
||||
GSVector2i resolution(VideoModeOffsets[(int)videomode - 1].x, VideoModeOffsets[(int)videomode - 1].y);
|
||||
GSVector2i resolution(VideoModeOffsets[videomode].x, VideoModeOffsets[videomode].y);
|
||||
|
||||
if (isinterlaced() && !m_regs->SMODE2.FFMD)
|
||||
resolution.y *= 2;
|
||||
|
@ -497,7 +497,7 @@ GSVector2i GSState::GetResolution()
|
|||
// Some games (Mortal Kombat Armageddon) render the image at 834 pixels then shrink it to 624 pixels
|
||||
// which does fit, but when we ignore offsets we go on framebuffer size and some other games
|
||||
// such as Johnny Mosleys Mad Trix and Transformers render too much but design it to go off the screen.
|
||||
int magnified_width = (VideoModeDividers[static_cast<int>(videomode) - 1].z + 1) / GetDisplayHMagnification();
|
||||
int magnified_width = (VideoModeDividers[videomode].z + 1) / GetDisplayHMagnification();
|
||||
|
||||
GSVector4i total_rect = GetDisplayRect(0).runion(GetDisplayRect(1));
|
||||
total_rect.z = total_rect.z - total_rect.x;
|
||||
|
|
|
@ -193,7 +193,7 @@ bool GSRenderer::Merge(int field)
|
|||
|
||||
const bool slbg = m_regs->PMODE.SLBG;
|
||||
|
||||
const GSVector2i resolution(GetResolution());
|
||||
GSVector2i resolution(GetResolution());
|
||||
bool scanmask_frame = true;
|
||||
|
||||
for (int i = 0; i < 2; i++)
|
||||
|
@ -221,9 +221,8 @@ bool GSRenderer::Merge(int field)
|
|||
if (!ignore_offset)
|
||||
off.y &= ~1;
|
||||
}
|
||||
|
||||
// All the following code is literally just to try and fill the window as much as possible and reduce blur put in by gamedevs by offsetting the DISPLAY's.
|
||||
if (!ignore_offset && display_combined.y < (resolution.y-1) && display_combined.x < (resolution.x-1))
|
||||
if (!ignore_offset && display_combined.y < (resolution.y) && display_combined.x < (resolution.x))
|
||||
{
|
||||
float difference[2];
|
||||
difference[0] = resolution.x / (float)display_combined.x;
|
||||
|
@ -245,14 +244,18 @@ bool GSRenderer::Merge(int field)
|
|||
}
|
||||
}
|
||||
// Anti blur hax
|
||||
if (display_diff.x < 4)
|
||||
// Offset by DISPLAY setting
|
||||
if (samesrc)
|
||||
{
|
||||
off.x -= display_diff.x;
|
||||
}
|
||||
if (display_diff.x < 4)
|
||||
off.x -= display_diff.x;
|
||||
if (display_diff.y < 4)
|
||||
off.y -= display_diff.y;
|
||||
|
||||
if (display_diff.y < 4)
|
||||
{
|
||||
off.y -= display_diff.y;
|
||||
if (frame_diff.x == 1)
|
||||
off.x += 1;
|
||||
if (frame_diff.y == 1)
|
||||
off.y += 1;
|
||||
}
|
||||
}
|
||||
else if(ignore_offset) // Stretch to fit the window.
|
||||
|
@ -278,54 +281,62 @@ bool GSRenderer::Merge(int field)
|
|||
{
|
||||
r.bottom += height_change;
|
||||
}
|
||||
// Anti blur hax.
|
||||
if (!slbg || !feedback_merge)
|
||||
{
|
||||
const int videomode = static_cast<int>(GetVideoMode()) - 1;
|
||||
GSVector2i base_resolution(VideoModeOffsets[videomode].x, VideoModeOffsets[videomode].y);
|
||||
|
||||
if (isinterlaced() && !m_regs->SMODE2.FFMD)
|
||||
base_resolution.y *= 2;
|
||||
|
||||
if (display_diff.x >= 4)
|
||||
off.x = display_diff.x;
|
||||
|
||||
if (display_diff.y >= 4)
|
||||
off.y = display_diff.y;
|
||||
|
||||
// Anti blur hax.
|
||||
if (samesrc)
|
||||
{
|
||||
// Offset by DISPLAY setting
|
||||
if (display_diff.x < 4)
|
||||
{
|
||||
off.x = 0;
|
||||
if (base_resolution.x > resolution.x)
|
||||
resolution.x -= display_diff.x;
|
||||
}
|
||||
if (display_diff.y < 4)
|
||||
{
|
||||
off.y = 0;
|
||||
if (base_resolution.y > resolution.y)
|
||||
resolution.y -= display_diff.y;
|
||||
}
|
||||
|
||||
// Offset by DISPFB setting
|
||||
if (frame_diff.x == 1)
|
||||
off.x += 1;
|
||||
|
||||
if (frame_diff.y == 1)
|
||||
off.y += 1;
|
||||
}
|
||||
|
||||
if (display_diff.x > 4)
|
||||
off.x = display_diff.x;
|
||||
|
||||
if (display_diff.y > 4)
|
||||
off.y = display_diff.y;
|
||||
}
|
||||
|
||||
if (!slbg || !feedback_merge)
|
||||
{
|
||||
if (samesrc)
|
||||
{
|
||||
if (display_diff.x < 4 && off.x)
|
||||
off.x = 0;
|
||||
if (display_diff.y < 4)
|
||||
off.y = 0;
|
||||
|
||||
if (display_diff.x > 4)
|
||||
off.x = display_diff.x;
|
||||
|
||||
if (display_diff.y > 4)
|
||||
off.y = display_diff.y;
|
||||
|
||||
if (frame_diff.x == 1)
|
||||
off.x += 1;
|
||||
if (frame_diff.y == 1)
|
||||
off.y += 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (display_diff.x > 4)
|
||||
off.x = display_diff.x;
|
||||
|
||||
if (display_diff.y > 4)
|
||||
off.y = display_diff.y;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Anti blur hax.
|
||||
// Anti blur hax if the resolution matches
|
||||
else if (samesrc)
|
||||
{
|
||||
// Offset by DISPLAY setting
|
||||
if (display_diff.x < 4)
|
||||
off.x -= display_diff.x;
|
||||
if (display_diff.y < 4)
|
||||
off.y -= display_diff.y;
|
||||
|
||||
// Offset by DISPFB setting
|
||||
if (frame_diff.x == 1)
|
||||
off.x += 1;
|
||||
if (frame_diff.y == 1)
|
||||
|
|
Loading…
Reference in New Issue