re-add Auto AR. Tie it to the desktop resolution which does not change when toggling between fullscreen and windowed. This assumes that the desktop resolution is using square pixels. This assumption will hold true for all out-of-the-box machines with a widescreen display.
This commit is contained in:
@@ -154,7 +154,6 @@ PrefsManager::PrefsManager() :
|
||||
m_bWindowed ( "Windowed", TRUE_IF_DEBUG ),
|
||||
m_iDisplayWidth ( "DisplayWidth", 640 ),
|
||||
m_iDisplayHeight ( "DisplayHeight", 480 ),
|
||||
m_fDisplayAspectRatio ( "DisplayAspectRatio", 4/3.f ),
|
||||
m_iDisplayColorDepth ( "DisplayColorDepth", 16 ),
|
||||
m_iTextureColorDepth ( "TextureColorDepth", 16 ),
|
||||
m_iMovieColorDepth ( "MovieColorDepth", 16 ),
|
||||
@@ -431,8 +430,6 @@ void PrefsManager::ReadPrefsFromIni( const IniFile &ini, const RString &sSection
|
||||
IPreference::ReadAllPrefsFromNode( ini.GetChild(sSection) );
|
||||
|
||||
// validate
|
||||
if( m_fDisplayAspectRatio < 0 )
|
||||
m_fDisplayAspectRatio.Set( 4/3.f );
|
||||
m_iSongsPerPlay.Set( clamp(m_iSongsPerPlay.Get(),0,MAX_SONGS_PER_PLAY) );
|
||||
m_RandomBackgroundMode.Set( (RandomBackgroundMode)clamp((int)m_RandomBackgroundMode.Get(),0,(int)NUM_RandomBackgroundMode-1) );
|
||||
}
|
||||
|
||||
@@ -43,7 +43,6 @@ public:
|
||||
Preference<bool> m_bWindowed;
|
||||
Preference<int> m_iDisplayWidth;
|
||||
Preference<int> m_iDisplayHeight;
|
||||
Preference<float> m_fDisplayAspectRatio;
|
||||
Preference<int> m_iDisplayColorDepth;
|
||||
Preference<int> m_iTextureColorDepth;
|
||||
Preference<int> m_iMovieColorDepth;
|
||||
|
||||
@@ -139,6 +139,7 @@ public:
|
||||
|
||||
virtual RString GetApiDescription() const = 0;
|
||||
virtual void GetDisplayResolutions( DisplayResolutions &out ) const = 0;
|
||||
virtual float GetMonitorAspectRatio() const = 0;
|
||||
|
||||
// Don't override this. Override TryVideoMode() instead.
|
||||
// This will set the video mode to be as close as possible to params.
|
||||
|
||||
@@ -314,6 +314,16 @@ void RageDisplay_D3D::GetDisplayResolutions( DisplayResolutions &out ) const
|
||||
}
|
||||
}
|
||||
|
||||
float RageDisplay_D3D::GetMonitorAspectRatio() const
|
||||
{
|
||||
#if defined(XBOX)
|
||||
// FIXME
|
||||
return 4/3.f;
|
||||
#else
|
||||
return g_DesktopMode.Width / (float)g_DesktopMode.Height;
|
||||
#endif
|
||||
}
|
||||
|
||||
D3DFORMAT FindBackBufferType(bool bWindowed, int iBPP)
|
||||
{
|
||||
HRESULT hr;
|
||||
|
||||
@@ -12,6 +12,7 @@ public:
|
||||
|
||||
virtual RString GetApiDescription() const { return "D3D"; }
|
||||
virtual void GetDisplayResolutions( DisplayResolutions &out ) const;
|
||||
virtual float GetMonitorAspectRatio() const;
|
||||
void ResolutionChanged();
|
||||
const PixelFormatDesc *GetPixelFormatDesc(PixelFormat pf) const;
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ public:
|
||||
|
||||
virtual RString GetApiDescription() const { return "Null"; }
|
||||
virtual void GetDisplayResolutions( DisplayResolutions &out ) const;
|
||||
virtual float GetMonitorAspectRatio() const { return 4/3.f; }
|
||||
const PixelFormatDesc *GetPixelFormatDesc(PixelFormat pf) const;
|
||||
|
||||
bool BeginFrame() { return true; }
|
||||
|
||||
@@ -445,6 +445,11 @@ void RageDisplay_OGL::GetDisplayResolutions( DisplayResolutions &out ) const
|
||||
g_pWind->GetDisplayResolutions( out );
|
||||
}
|
||||
|
||||
float RageDisplay_OGL::GetMonitorAspectRatio() const
|
||||
{
|
||||
return g_pWind->GetMonitorAspectRatio();
|
||||
}
|
||||
|
||||
static void CheckPalettedTextures()
|
||||
{
|
||||
RString sError;
|
||||
|
||||
@@ -12,6 +12,7 @@ public:
|
||||
|
||||
virtual RString GetApiDescription() const { return "OpenGL"; }
|
||||
virtual void GetDisplayResolutions( DisplayResolutions &out ) const;
|
||||
virtual float GetMonitorAspectRatio() const;
|
||||
void ResolutionChanged();
|
||||
const PixelFormatDesc *GetPixelFormatDesc(PixelFormat pf) const;
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include "LuaFunctions.h"
|
||||
#include "ThemeManager.h"
|
||||
#include "ThemeMetric.h"
|
||||
#include "RageDisplay.h"
|
||||
|
||||
static ThemeMetric<float> THEME_SCREEN_WIDTH("Common","ScreenWidth");
|
||||
static ThemeMetric<float> THEME_SCREEN_HEIGHT("Common","ScreenHeight");
|
||||
@@ -26,6 +27,24 @@ static ThemeMetric<float> THEME_SCREEN_HEIGHT("Common","ScreenHeight");
|
||||
*/
|
||||
#define THEME_NATIVE_ASPECT (THEME_SCREEN_WIDTH/THEME_SCREEN_HEIGHT)
|
||||
|
||||
#define ASPECT_AUTO -1
|
||||
static Preference<float> g_fDisplayAspectRatio( "DisplayAspectRatio", ASPECT_AUTO );
|
||||
|
||||
float ScreenDimensions::GetScreenAspectRatio()
|
||||
{
|
||||
float fAspect = g_fDisplayAspectRatio;
|
||||
if( fAspect == ASPECT_AUTO )
|
||||
{
|
||||
// Lua values will be reloaded after the display is created, so any value we
|
||||
// return before DISPLAY is created will never be used.
|
||||
if( DISPLAY )
|
||||
fAspect = DISPLAY->GetMonitorAspectRatio();
|
||||
else
|
||||
fAspect = 4/3.f;
|
||||
}
|
||||
return fAspect;
|
||||
}
|
||||
|
||||
float ScreenDimensions::GetThemeAspectRatio()
|
||||
{
|
||||
return THEME_NATIVE_ASPECT;
|
||||
@@ -33,7 +52,7 @@ float ScreenDimensions::GetThemeAspectRatio()
|
||||
|
||||
float ScreenDimensions::GetScreenWidth()
|
||||
{
|
||||
float fAspect = PREFSMAN->m_fDisplayAspectRatio;
|
||||
float fAspect = GetScreenAspectRatio();
|
||||
float fScale = 1;
|
||||
if( fAspect > THEME_NATIVE_ASPECT )
|
||||
fScale = fAspect / THEME_NATIVE_ASPECT;
|
||||
@@ -43,7 +62,7 @@ float ScreenDimensions::GetScreenWidth()
|
||||
|
||||
float ScreenDimensions::GetScreenHeight()
|
||||
{
|
||||
float fAspect = PREFSMAN->m_fDisplayAspectRatio;
|
||||
float fAspect = GetScreenAspectRatio();
|
||||
float fScale = 1;
|
||||
if( fAspect < THEME_NATIVE_ASPECT )
|
||||
fScale = THEME_NATIVE_ASPECT / fAspect;
|
||||
@@ -67,7 +86,7 @@ void ScreenDimensions::ReloadScreenDimensions()
|
||||
LUA->SetGlobal( "SCREEN_CENTER_Y", (int) SCREEN_CENTER_Y );
|
||||
}
|
||||
|
||||
LuaFunction_NoArgs( GetScreenAspectRatio, PREFSMAN->m_fDisplayAspectRatio.Get() );
|
||||
LuaFunction_NoArgs( GetScreenAspectRatio, ScreenDimensions::GetScreenAspectRatio() );
|
||||
LuaFunction_NoArgs( GetThemeAspectRatio, ScreenDimensions::GetThemeAspectRatio() );
|
||||
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
namespace ScreenDimensions
|
||||
{
|
||||
float GetScreenAspectRatio();
|
||||
float GetThemeAspectRatio();
|
||||
float GetScreenWidth();
|
||||
float GetScreenHeight();
|
||||
|
||||
@@ -506,7 +506,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[] = { -1,3/4.f,1,4/3.0f,16/10.0f,16/9.f, 8/3.f };
|
||||
MoveMap( sel, pConfOption, ToSel, mapping, ARRAYSIZE(mapping) );
|
||||
}
|
||||
|
||||
@@ -614,7 +614,7 @@ static void InitializeConfOptions()
|
||||
g_ConfOptions.back().m_iEffects = OPT_APPLY_GRAPHICS;
|
||||
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" ) );
|
||||
ADD( ConfOption( "DisplayAspectRatio", DisplayAspectRatio, "Auto","|3:4","|1:1","|4:3","|16:10","|16:9","|8:3" ) );
|
||||
g_ConfOptions.back().m_iEffects = OPT_APPLY_ASPECT_RATIO;
|
||||
ADD( ConfOption( "DisplayColorDepth", DisplayColorDepth, "16bit","32bit" ) );
|
||||
g_ConfOptions.back().m_iEffects = OPT_APPLY_GRAPHICS;
|
||||
|
||||
@@ -102,7 +102,7 @@ void StepMania::GetPreferredVideoModeParams( VideoModeParams ¶msOut )
|
||||
CommonMetrics::WINDOW_TITLE,
|
||||
THEME->GetPathG("Common","window icon"),
|
||||
PREFSMAN->m_bPAL,
|
||||
PREFSMAN->m_fDisplayAspectRatio
|
||||
ScreenDimensions::GetScreenAspectRatio()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user