mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-21 21:30:19 -06:00
Tweaked the widescreen hack: It now "hacks" to and from any aspect ratio, not just from 4:3 to 16:9. When "Stretch to Window" is chosen, the aspect ratio will be adjusted to 5:4, 16:10, or anything (whatever the aspect ratio of the window is). Works for 4:3 and 16:9 games.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5280 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@ -35,6 +35,10 @@ VideoConfig::VideoConfig()
|
||||
{
|
||||
bRunning = false;
|
||||
bAllowSignedBytes = !IsD3D();
|
||||
|
||||
// Needed for the first frame, I think
|
||||
fAspectRatioHackW = 1;
|
||||
fAspectRatioHackH = 1;
|
||||
}
|
||||
|
||||
void VideoConfig::Load(const char *ini_file)
|
||||
@ -225,6 +229,52 @@ void ComputeDrawRectangle(int backbuffer_width, int backbuffer_height, bool flip
|
||||
// Handle aspect ratio.
|
||||
// Default to auto.
|
||||
bool use16_9 = g_VideoInitialize.bAutoAspectIs16_9;
|
||||
|
||||
// Update aspect ratio hack values
|
||||
// Won't take effect until next frame
|
||||
// Don't know if there is a better place for this code so there isn't a 1 frame delay
|
||||
if ( g_ActiveConfig.bWidescreenHack )
|
||||
{
|
||||
float source_aspect = use16_9 ? (16.0f / 9.0f) : (4.0f / 3.0f);
|
||||
float target_aspect;
|
||||
|
||||
switch ( g_ActiveConfig.iAspectRatio )
|
||||
{
|
||||
case ASPECT_FORCE_16_9 :
|
||||
target_aspect = 16.0f / 9.0f;
|
||||
break;
|
||||
case ASPECT_FORCE_4_3 :
|
||||
target_aspect = 4.0f / 3.0f;
|
||||
break;
|
||||
case ASPECT_STRETCH :
|
||||
target_aspect = WinWidth / WinHeight;
|
||||
break;
|
||||
default :
|
||||
// ASPECT_AUTO == no hacking
|
||||
target_aspect = source_aspect;
|
||||
break;
|
||||
}
|
||||
|
||||
float adjust = source_aspect / target_aspect;
|
||||
if ( adjust > 1 )
|
||||
{
|
||||
// Vert+
|
||||
g_Config.fAspectRatioHackW = 1;
|
||||
g_Config.fAspectRatioHackH = 1/adjust;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Hor+
|
||||
g_Config.fAspectRatioHackW = adjust;
|
||||
g_Config.fAspectRatioHackH = 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Hack is disabled
|
||||
g_Config.fAspectRatioHackW = 1;
|
||||
g_Config.fAspectRatioHackH = 1;
|
||||
}
|
||||
|
||||
// Check for force-settings and override.
|
||||
if (g_ActiveConfig.iAspectRatio == ASPECT_FORCE_16_9)
|
||||
|
Reference in New Issue
Block a user