Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PCRTC: Proper handling for 720P/1080P video modes. #1137

Merged
merged 4 commits into from Feb 1, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions plugins/GSdx/GS.h
Original file line number Diff line number Diff line change
Expand Up @@ -1284,3 +1284,7 @@ enum stateType {ST_WRITE, ST_TRANSFER, ST_VSYNC};
// default gs config settings
#define DEFAULT_EXTRA_RENDERING_THREADS 2

// GS Video modes macros
#define Vmode_VESA (m_regs->SMODE1.CMOD == 0)
#define Vmode_NTSC (m_regs->SMODE1.CMOD == 2)
#define Vmode_PAL (m_regs->SMODE1.CMOD == 3)
1 change: 0 additions & 1 deletion plugins/GSdx/GSRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,6 @@ bool GSRenderer::Merge(int field)
if(dr[i].height() > 512) // hmm
{
int y = GetDeviceSize(i).y;
if(m_regs->SMODE2.INT && m_regs->SMODE2.FFMD) y /= 2;
r.bottom = r.top + y;
}

Expand Down
20 changes: 11 additions & 9 deletions plugins/GSdx/GSState.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -349,22 +349,24 @@ void GSState::ResetHandlers()
GSVector4i GSState::GetDisplayRect(int i)
{
if(i < 0) i = IsEnabled(1) ? 1 : 0;
int height = m_regs->DISP[i].DISPLAY.DH + 1;
int width = m_regs->DISP[i].DISPLAY.DW + 1;
int height = (m_regs->DISP[i].DISPLAY.DH + 1) / (m_regs->DISP[i].DISPLAY.MAGV + 1);
int width = (m_regs->DISP[i].DISPLAY.DW + 1) / (m_regs->DISP[i].DISPLAY.MAGH + 1);
GSVector4i r;

//Some games (such as Pool Paradise) use alternate line reading and provide a massive height which is really half.
if (height > 640)
if (height > 640 && !Vmode_VESA)
{
height /= 2;
}


r.left = m_regs->DISP[i].DISPLAY.DX / (m_regs->DISP[i].DISPLAY.MAGH + 1);
r.top = m_regs->DISP[i].DISPLAY.DY / (m_regs->DISP[i].DISPLAY.MAGV + 1);
r.right = r.left + width / (m_regs->DISP[i].DISPLAY.MAGH + 1);
r.bottom = r.top + height / (m_regs->DISP[i].DISPLAY.MAGV + 1);

r.right = r.left + width;
r.bottom = r.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);

return r;
}

Expand All @@ -383,7 +385,7 @@ GSVector4i GSState::GetFrameRect(int i)
// Some NTSC mode games request higher height values for accurate display size / position when width is 640
// Testcases : PS logo (640x512) , Resident Evil:CVX (640x480). potentially more test cases...

if (m_regs->SMODE1.CMOD == 2 && h > 448 && w < 640)
if (Vmode_NTSC && h > 448 && w < 640)
h = 448;

if (m_regs->SMODE2.INT && m_regs->SMODE2.FFMD && h > 1)
Expand Down Expand Up @@ -468,7 +470,7 @@ float GSState::GetTvRefreshRate()
// TODO: Frequencies for VESA / DTV : http://users.neoscientists.org/~blue/ps2videomodes.txt
// SMODE1 PLL Loop divider (LC) could be used for detection of other video modes. CMOD's only useful for NTSC/PAL.(2/3)

return (m_regs->SMODE1.CMOD & 1) ? 50 : (60/1.001f);
return (Vmode_PAL) ? 50 : (60/1.001f);
}

// GIFPackedRegHandler*
Expand Down