When applying video defaults, set the aspect ratio to the monitor's. In windowed mode, automatically adjust the window width to make pixels square.
This commit is contained in:
@@ -556,7 +556,7 @@ static void RefreshRate( int &sel, bool ToSel, const ConfOption *pConfOption )
|
||||
|
||||
static void DisplayAspectRatio( int &sel, bool ToSel, const ConfOption *pConfOption )
|
||||
{
|
||||
const float mapping[] = { 3/4.f,1,4/3.0f,16/10.0f,16/9.f, 8/3.f };
|
||||
const float mapping[] = { 3/4.f, 1, 4/3.0f, 16/10.0f, 16/9.f, 8/3.f };
|
||||
MoveMap( sel, pConfOption, ToSel, mapping, ARRAYLEN(mapping) );
|
||||
}
|
||||
|
||||
@@ -701,7 +701,7 @@ static void InitializeConfOptions()
|
||||
ADD( ConfOption( "DisplayResolution", DisplayResolutionM, DisplayResolutionChoices ) );
|
||||
g_ConfOptions.back().m_iEffects = OPT_APPLY_GRAPHICS | OPT_APPLY_ASPECT_RATIO;
|
||||
ADD( ConfOption( "DisplayAspectRatio", DisplayAspectRatio, "|3:4","|1:1","|4:3","|16:10","|16:9","|8:3" ) );
|
||||
g_ConfOptions.back().m_iEffects = OPT_APPLY_ASPECT_RATIO;
|
||||
g_ConfOptions.back().m_iEffects = OPT_APPLY_GRAPHICS | OPT_APPLY_ASPECT_RATIO; // need OPT_APPLY_GRAPHICS because if windowed the width may change to make square pixels
|
||||
ADD( ConfOption( "WideScreen16_10", WideScreen16_10, "Off", "On" ) );
|
||||
g_ConfOptions.back().m_sPrefName = "DisplayAspectRatio";
|
||||
g_ConfOptions.back().m_iEffects = OPT_APPLY_ASPECT_RATIO;
|
||||
|
||||
+41
-17
@@ -84,21 +84,34 @@ static Preference<bool> g_bAllowMultipleInstances( "AllowMultipleInstances", fal
|
||||
|
||||
void StepMania::GetPreferredVideoModeParams( VideoModeParams ¶msOut )
|
||||
{
|
||||
/*
|
||||
* We can't rely on there being full-screen video modes that give us square pixels
|
||||
* at non-4:3 aspects. The lowest non-4:3 resolution my new laptop with Radeon supports is 1280x720.
|
||||
* In most cases, we'll using a 4:3 resolution when full-screen let the monitor stretch to the correct
|
||||
* aspect. When windowed (no monitor stretching), we will tweak the width so that we get square pixels.
|
||||
* -Chris
|
||||
*/
|
||||
int iWidth = PREFSMAN->m_iDisplayWidth;
|
||||
if( PREFSMAN->m_bWindowed )
|
||||
{
|
||||
iWidth = PREFSMAN->m_iDisplayHeight * PREFSMAN->m_fDisplayAspectRatio;
|
||||
}
|
||||
|
||||
paramsOut = VideoModeParams(
|
||||
PREFSMAN->m_bWindowed,
|
||||
PREFSMAN->m_iDisplayWidth,
|
||||
PREFSMAN->m_iDisplayHeight,
|
||||
PREFSMAN->m_iDisplayColorDepth,
|
||||
PREFSMAN->m_iRefreshRate,
|
||||
PREFSMAN->m_bVsync,
|
||||
PREFSMAN->m_bInterlaced,
|
||||
PREFSMAN->m_bSmoothLines,
|
||||
PREFSMAN->m_bTrilinearFiltering,
|
||||
PREFSMAN->m_bAnisotropicFiltering,
|
||||
CommonMetrics::WINDOW_TITLE,
|
||||
THEME->GetPathG("Common","window icon"),
|
||||
PREFSMAN->m_bPAL,
|
||||
PREFSMAN->m_fDisplayAspectRatio
|
||||
PREFSMAN->m_bWindowed,
|
||||
iWidth,
|
||||
PREFSMAN->m_iDisplayHeight,
|
||||
PREFSMAN->m_iDisplayColorDepth,
|
||||
PREFSMAN->m_iRefreshRate,
|
||||
PREFSMAN->m_bVsync,
|
||||
PREFSMAN->m_bInterlaced,
|
||||
PREFSMAN->m_bSmoothLines,
|
||||
PREFSMAN->m_bTrilinearFiltering,
|
||||
PREFSMAN->m_bAnisotropicFiltering,
|
||||
CommonMetrics::WINDOW_TITLE,
|
||||
THEME->GetPathG("Common","window icon"),
|
||||
PREFSMAN->m_bPAL,
|
||||
PREFSMAN->m_fDisplayAspectRatio
|
||||
);
|
||||
}
|
||||
|
||||
@@ -131,11 +144,21 @@ static RString GetActualGraphicOptionsString()
|
||||
|
||||
static void StoreActualGraphicOptions()
|
||||
{
|
||||
// find out what we actually have
|
||||
/* Store the settings that RageDisplay was actually able to use so that
|
||||
* we don't go through the process of auto-detecting a usable video mode
|
||||
* every time.
|
||||
*/
|
||||
const VideoModeParams ¶ms = DISPLAY->GetActualVideoModeParams();
|
||||
PREFSMAN->m_bWindowed .Set( params.windowed );
|
||||
PREFSMAN->m_iDisplayWidth .Set( params.width );
|
||||
PREFSMAN->m_iDisplayHeight .Set( params.height );
|
||||
|
||||
/* If we're windowed, we may have tweaked the width based on the aspect ratio.
|
||||
* Don't save this new value over the preferred value.
|
||||
*/
|
||||
if( !PREFSMAN->m_bWindowed )
|
||||
{
|
||||
PREFSMAN->m_iDisplayWidth .Set( params.width );
|
||||
PREFSMAN->m_iDisplayHeight .Set( params.height );
|
||||
}
|
||||
PREFSMAN->m_iDisplayColorDepth .Set( params.bpp );
|
||||
if( PREFSMAN->m_iRefreshRate != REFRESH_DEFAULT )
|
||||
PREFSMAN->m_iRefreshRate.Set( params.rate );
|
||||
@@ -649,6 +672,7 @@ found_defaults:
|
||||
PREFSMAN->m_iMovieColorDepth.Set( defaults.iMovieColor );
|
||||
PREFSMAN->m_iMaxTextureResolution.Set( defaults.iTextureSize );
|
||||
PREFSMAN->m_bSmoothLines.Set( defaults.bSmoothLines );
|
||||
PREFSMAN->m_fDisplayAspectRatio.Set( HOOKS->GetDisplayAspectRatio() );
|
||||
|
||||
// Update last seen video card
|
||||
PREFSMAN->m_sLastSeenVideoDriver.Set( GetVideoDriverName() );
|
||||
|
||||
@@ -113,6 +113,8 @@ public:
|
||||
*/
|
||||
virtual bool GoToURL( RString sUrl );
|
||||
|
||||
virtual float GetDisplayAspectRatio() = 0;
|
||||
|
||||
private:
|
||||
/* This are helpers for GetMicrosecondsSinceStart on systems with a timer
|
||||
* that may loop or move backwards. */
|
||||
|
||||
@@ -183,6 +183,16 @@ bool ArchHooks_Win32::GoToURL( RString sUrl )
|
||||
return ::GotoURL( sUrl );
|
||||
}
|
||||
|
||||
float ArchHooks_Win32::GetDisplayAspectRatio()
|
||||
{
|
||||
DEVMODE dm;
|
||||
ZERO( dm );
|
||||
dm.dmSize = sizeof(dm);
|
||||
BOOL bResult = EnumDisplaySettings( NULL, ENUM_REGISTRY_SETTINGS, &dm );
|
||||
ASSERT( bResult );
|
||||
return dm.dmPelsWidth / (float)dm.dmPelsHeight;
|
||||
}
|
||||
|
||||
/*
|
||||
* (c) 2003-2004 Glenn Maynard, Chris Danford
|
||||
* All rights reserved.
|
||||
|
||||
@@ -22,6 +22,7 @@ public:
|
||||
void SetupConcurrentRenderingThread();
|
||||
|
||||
bool GoToURL( RString sUrl );
|
||||
virtual float GetDisplayAspectRatio();
|
||||
};
|
||||
|
||||
#ifdef ARCH_HOOKS
|
||||
|
||||
Reference in New Issue
Block a user