mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-22 22:00:39 -06:00
Changed the aspect ratio settings to account for NTSC/PAL pixel aspect ratios and VI scaling.
This commit is contained in:
@ -436,6 +436,57 @@ u32 GetXFBAddressBottom()
|
||||
return m_XFBInfoBottom.FBB;
|
||||
}
|
||||
|
||||
float GetAspectRatio(bool wide)
|
||||
{
|
||||
u32 multiplier = static_cast<u32>(m_PictureConfiguration.STD / m_PictureConfiguration.WPL);
|
||||
int height = (multiplier * m_VerticalTimingRegister.ACV);
|
||||
int width = ((2 * m_HTiming0.HLW) - (m_HTiming0.HLW - m_HTiming1.HBS640)
|
||||
- m_HTiming1.HBE640);
|
||||
float pixelAR;
|
||||
if (m_DisplayControlRegister.FMT == 1)
|
||||
{
|
||||
//PAL active frame is 702*576
|
||||
//In square pixels, 1024*576 is 16:9, and 768*576 is 4:3
|
||||
//Therefore a 16:9 TV would have a "pixel" aspect ratio of 1024/702
|
||||
//Similarly a 4:3 TV would have a ratio of 768/702
|
||||
if (wide)
|
||||
{
|
||||
pixelAR = 1024.0f / 702.0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
pixelAR = 768.0f / 702.0f;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//NTSC active frame is 710.85*486
|
||||
//In square pixels, 864*486 is 16:9, and 648*486 is 4:3
|
||||
//Therefore a 16:9 TV would have a "pixel" aspect ratio of 864/710.85
|
||||
//Similarly a 4:3 TV would have a ratio of 648/710.85
|
||||
if (wide)
|
||||
{
|
||||
pixelAR = 864.0f / 710.85f;
|
||||
}
|
||||
else
|
||||
{
|
||||
pixelAR = 648.0f / 710.85f;
|
||||
}
|
||||
}
|
||||
if (width == 0 || height == 0)
|
||||
{
|
||||
if (wide)
|
||||
{
|
||||
return 16.0f/9.0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 4.0f/3.0f;
|
||||
}
|
||||
}
|
||||
return ((float)width / (float)height) * pixelAR;
|
||||
}
|
||||
|
||||
void UpdateParameters()
|
||||
{
|
||||
fields = m_DisplayControlRegister.NIN ? 2 : 1;
|
||||
|
@ -353,4 +353,7 @@ union UVIHorizontalStepping
|
||||
|
||||
unsigned int GetTicksPerLine();
|
||||
unsigned int GetTicksPerFrame();
|
||||
|
||||
//For VI Scaling and Aspect Ratio Correction
|
||||
float GetAspectRatio(bool);
|
||||
}
|
||||
|
Reference in New Issue
Block a user