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:
parent
675fc84255
commit
758bcf17cb
|
@ -289,13 +289,13 @@ void VertexShaderManager::SetConstants()
|
||||||
{
|
{
|
||||||
// Perspective
|
// Perspective
|
||||||
|
|
||||||
g_fProjectionMatrix[0] = xfregs.rawProjection[0] * (g_ActiveConfig.bWidescreenHack ? 0.75f : 1.0f);
|
g_fProjectionMatrix[0] = xfregs.rawProjection[0] * g_ActiveConfig.fAspectRatioHackW;
|
||||||
g_fProjectionMatrix[1] = 0.0f;
|
g_fProjectionMatrix[1] = 0.0f;
|
||||||
g_fProjectionMatrix[2] = xfregs.rawProjection[1];
|
g_fProjectionMatrix[2] = xfregs.rawProjection[1];
|
||||||
g_fProjectionMatrix[3] = 0.0f;
|
g_fProjectionMatrix[3] = 0.0f;
|
||||||
|
|
||||||
g_fProjectionMatrix[4] = 0.0f;
|
g_fProjectionMatrix[4] = 0.0f;
|
||||||
g_fProjectionMatrix[5] = xfregs.rawProjection[2];
|
g_fProjectionMatrix[5] = xfregs.rawProjection[2] * g_ActiveConfig.fAspectRatioHackH;
|
||||||
g_fProjectionMatrix[6] = xfregs.rawProjection[3];
|
g_fProjectionMatrix[6] = xfregs.rawProjection[3];
|
||||||
g_fProjectionMatrix[7] = 0.0f;
|
g_fProjectionMatrix[7] = 0.0f;
|
||||||
|
|
||||||
|
|
|
@ -35,6 +35,10 @@ VideoConfig::VideoConfig()
|
||||||
{
|
{
|
||||||
bRunning = false;
|
bRunning = false;
|
||||||
bAllowSignedBytes = !IsD3D();
|
bAllowSignedBytes = !IsD3D();
|
||||||
|
|
||||||
|
// Needed for the first frame, I think
|
||||||
|
fAspectRatioHackW = 1;
|
||||||
|
fAspectRatioHackH = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void VideoConfig::Load(const char *ini_file)
|
void VideoConfig::Load(const char *ini_file)
|
||||||
|
@ -225,6 +229,52 @@ void ComputeDrawRectangle(int backbuffer_width, int backbuffer_height, bool flip
|
||||||
// Handle aspect ratio.
|
// Handle aspect ratio.
|
||||||
// Default to auto.
|
// Default to auto.
|
||||||
bool use16_9 = g_VideoInitialize.bAutoAspectIs16_9;
|
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.
|
// Check for force-settings and override.
|
||||||
if (g_ActiveConfig.iAspectRatio == ASPECT_FORCE_16_9)
|
if (g_ActiveConfig.iAspectRatio == ASPECT_FORCE_16_9)
|
||||||
|
|
|
@ -126,6 +126,7 @@ struct VideoConfig
|
||||||
bool bPhackvalue1, bPhackvalue2;
|
bool bPhackvalue1, bPhackvalue2;
|
||||||
float fhackvalue1, fhackvalue2;
|
float fhackvalue1, fhackvalue2;
|
||||||
bool bProjHack1;
|
bool bProjHack1;
|
||||||
|
float fAspectRatioHackW, fAspectRatioHackH;
|
||||||
|
|
||||||
int iLog; // CONF_ bits
|
int iLog; // CONF_ bits
|
||||||
int iSaveTargetId;
|
int iSaveTargetId;
|
||||||
|
|
Loading…
Reference in New Issue