diff --git a/stepmania/src/DisplayResolutions.h b/stepmania/src/DisplayResolutions.h new file mode 100644 index 0000000000..3cdb354816 --- /dev/null +++ b/stepmania/src/DisplayResolutions.h @@ -0,0 +1,53 @@ +#ifndef DisplayResolutions_H +#define DisplayResolutions_H + +#include + +class DisplayResolution +{ +public: + int iWidth; + int iHeight; + + bool operator<( const DisplayResolution &other ) const + { +#define COMPARE(x) if( x < other.x ) return true; else if( x > other.x ) return false; + COMPARE( iWidth ); + COMPARE( iHeight ); +#undef COMPARE + return false; + } +}; + +class DisplayResolutions +{ +public: + set s; +}; + +#endif + +/* + * (c) 2001-2005 Chris Danford + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/stepmania/src/PrefsManager.cpp b/stepmania/src/PrefsManager.cpp index c389c2a35b..66489e15e6 100644 --- a/stepmania/src/PrefsManager.cpp +++ b/stepmania/src/PrefsManager.cpp @@ -225,7 +225,7 @@ PrefsManager::PrefsManager() : m_iMovieColorDepth ( "MovieColorDepth", 16 ), m_iMaxTextureResolution ( "MaxTextureResolution", 2048 ), m_iRefreshRate ( "RefreshRate", REFRESH_DEFAULT ), - m_fDisplayAspectRatio ( "DisplayAspectRatio", 4/3.0f ), + m_fDisplayAspectRatio ( "DisplayAspectRatio", ASPECT_AUTO ), m_bAllowMultitexture ( "AllowMultitexture", true ), m_bShowStats ( "ShowStats", TRUE_IF_DEBUG), m_bShowBanners ( "ShowBanners", true ), diff --git a/stepmania/src/PrefsManager.h b/stepmania/src/PrefsManager.h index f52f821864..ba11df130f 100644 --- a/stepmania/src/PrefsManager.h +++ b/stepmania/src/PrefsManager.h @@ -10,6 +10,7 @@ class IniFile; const int MAX_SONGS_PER_PLAY = 7; +#define ASPECT_AUTO -1 class PrefsManager { @@ -50,7 +51,7 @@ public: Preference m_iMovieColorDepth; Preference m_iMaxTextureResolution; Preference m_iRefreshRate; - Preference m_fDisplayAspectRatio; + Preference m_fDisplayAspectRatio; // -1 == auto Preference m_bAllowMultitexture; Preference m_bShowStats; Preference m_bShowBanners; diff --git a/stepmania/src/RageDisplay.h b/stepmania/src/RageDisplay.h index f174a37ded..a561b99549 100644 --- a/stepmania/src/RageDisplay.h +++ b/stepmania/src/RageDisplay.h @@ -5,6 +5,7 @@ #include "RageTypes.h" #include "ModelTypes.h" +class DisplayResolutions; const int REFRESH_DEFAULT = 0; struct RageSurface; @@ -63,8 +64,9 @@ enum PixelFormat }; const CString& PixelFormatToString( PixelFormat i ); -struct VideoModeParams +class VideoModeParams { +public: // Initialize with a constructor so to guarantee all paramters // are filled (in case new params are added). VideoModeParams( @@ -134,6 +136,7 @@ public: virtual ~RageDisplay() { } virtual CString GetApiDescription() const = 0; + virtual void GetDisplayResolutions( DisplayResolutions &out ) const = 0; // Don't override this. Override TryVideoMode() instead. // This will set the video mode to be as close as possible to params. @@ -249,7 +252,7 @@ protected: // return CString() if mode change was successful, an error message otherwise. // bNewDeviceOut is set true if a new device was created and textures // need to be reloaded. - virtual CString TryVideoMode( VideoModeParams params, bool &bNewDeviceOut ) = 0; + virtual CString TryVideoMode( const VideoModeParams &p, bool &bNewDeviceOut ) = 0; void DrawPolyLine( const RageSpriteVertex &p1, const RageSpriteVertex &p2, float LineWidth ); diff --git a/stepmania/src/RageDisplay_D3D.cpp b/stepmania/src/RageDisplay_D3D.cpp index b0f99f41d0..f047046c17 100644 --- a/stepmania/src/RageDisplay_D3D.cpp +++ b/stepmania/src/RageDisplay_D3D.cpp @@ -19,6 +19,7 @@ #include "RageSurface.h" #include "RageSurfaceUtils.h" #include "EnumHelper.h" +#include "DisplayResolutions.h" #if !defined(XBOX) #include "archutils/Win32/GraphicsWindow.h" @@ -302,6 +303,21 @@ RageDisplay_D3D::~RageDisplay_D3D() GraphicsWindow::Shutdown(); } +void RageDisplay_D3D::GetDisplayResolutions( DisplayResolutions &out ) const +{ + out.s.clear(); + int iCnt = g_pd3d->GetAdapterModeCount( D3DADAPTER_DEFAULT ); + + for( int i = 0; i < iCnt; ++i ) + { + D3DDISPLAYMODE mode; + g_pd3d->EnumAdapterModes( D3DADAPTER_DEFAULT, i, &mode ); + + DisplayResolution res = { mode.Width, mode.Height }; + out.s.insert( res ); + } +} + D3DFORMAT FindBackBufferType(bool bWindowed, int iBPP) { HRESULT hr; @@ -478,8 +494,10 @@ bool D3DReduceParams( D3DPRESENT_PARAMETERS *pp ) /* Set the video mode. */ -CString RageDisplay_D3D::TryVideoMode( VideoModeParams p, bool &bNewDeviceOut ) +CString RageDisplay_D3D::TryVideoMode( const VideoModeParams &_p, bool &bNewDeviceOut ) { + VideoModeParams p = _p; + //LOG->Warn( "RageDisplay_D3D::TryVideoMode( %d, %d, %d, %d, %d, %d )", p.windowed, p.width, p.height, p.bpp, p.rate, p.vsync ); if( FindBackBufferType( p.windowed, p.bpp ) == D3DFMT_UNKNOWN ) // no possible back buffer formats diff --git a/stepmania/src/RageDisplay_D3D.h b/stepmania/src/RageDisplay_D3D.h index d359206642..6475542e42 100644 --- a/stepmania/src/RageDisplay_D3D.h +++ b/stepmania/src/RageDisplay_D3D.h @@ -11,6 +11,7 @@ public: CString Init( VideoModeParams p ); virtual CString GetApiDescription() const { return "D3D"; } + virtual void GetDisplayResolutions( DisplayResolutions &out ) const; void ResolutionChanged(); const PixelFormatDesc *GetPixelFormatDesc(PixelFormat pf) const; @@ -77,7 +78,7 @@ protected: void DrawTrianglesInternal( const RageSpriteVertex v[], int iNumVerts ); void DrawCompiledGeometryInternal( const RageCompiledGeometry *p, int iMeshIndex ); - CString TryVideoMode( VideoModeParams params, bool &bNewDeviceOut ); + CString TryVideoMode( const VideoModeParams &p, bool &bNewDeviceOut ); RageSurface* CreateScreenshot(); void SetViewport(int shift_left, int shift_down); RageMatrix GetOrthoMatrix( float l, float r, float b, float t, float zn, float zf ); diff --git a/stepmania/src/RageDisplay_Null.cpp b/stepmania/src/RageDisplay_Null.cpp index b1e171cf7b..23841ce134 100644 --- a/stepmania/src/RageDisplay_Null.cpp +++ b/stepmania/src/RageDisplay_Null.cpp @@ -11,6 +11,7 @@ #include "RageTypes.h" #include "RageUtil.h" #include "RageSurface.h" +#include "DisplayResolutions.h" static RageDisplay::PixelFormatDesc PIXEL_FORMAT_DESC[NUM_PixelFormat] = { { @@ -77,6 +78,13 @@ RageDisplay_Null::RageDisplay_Null( VideoModeParams p ) SetVideoMode( p, bIgnore ); } +void RageDisplay_Null::GetDisplayResolutions( DisplayResolutions &out ) const +{ + out.s.clear(); + DisplayResolution res = { 640, 480 }; + out.s.insert( res ); +} + RageSurface* RageDisplay_Null::CreateScreenshot() { const PixelFormatDesc &desc = PIXEL_FORMAT_DESC[PixelFormat_RGB8]; diff --git a/stepmania/src/RageDisplay_Null.h b/stepmania/src/RageDisplay_Null.h index 9953e7eb52..08126acb2d 100644 --- a/stepmania/src/RageDisplay_Null.h +++ b/stepmania/src/RageDisplay_Null.h @@ -9,6 +9,7 @@ public: RageDisplay_Null( VideoModeParams p ); virtual CString GetApiDescription() const { return "Null"; } + virtual void GetDisplayResolutions( DisplayResolutions &out ) const; void ResolutionChanged() { } const PixelFormatDesc *GetPixelFormatDesc(PixelFormat pf) const; @@ -76,7 +77,7 @@ protected: void DrawLineStripInternal( const RageSpriteVertex v[], int iNumVerts, float LineWidth ) { } VideoModeParams m_Params; - CString TryVideoMode( VideoModeParams params, bool &bNewDeviceOut ) { m_Params = params; return CString(); } + CString TryVideoMode( const VideoModeParams &p, bool &bNewDeviceOut ) { m_Params = p; return CString(); } RageSurface* CreateScreenshot(); void SetViewport(int shift_left, int shift_down) { } RageMatrix GetOrthoMatrix( float l, float r, float b, float t, float zn, float zf ); diff --git a/stepmania/src/RageDisplay_OGL.cpp b/stepmania/src/RageDisplay_OGL.cpp index 71d09684e2..8e5b62dad3 100644 --- a/stepmania/src/RageDisplay_OGL.cpp +++ b/stepmania/src/RageDisplay_OGL.cpp @@ -47,6 +47,7 @@ #include "RageUtil.h" #include "EnumHelper.h" #include "ProductInfo.h" +#include "DisplayResolutions.h" #include "arch/LowLevelWindow/LowLevelWindow.h" @@ -439,6 +440,12 @@ RageDisplay_OGL::~RageDisplay_OGL() delete g_pWind; } +void RageDisplay_OGL::GetDisplayResolutions( DisplayResolutions &out ) const +{ + out.s.clear(); + g_pWind->GetDisplayResolutions( out ); +} + static void CheckPalettedTextures() { CString sError; @@ -610,7 +617,7 @@ void RageDisplay_OGL::ResolutionChanged() // Return true if mode change was successful. // bNewDeviceOut is set true if a new device was created and textures // need to be reloaded. -CString RageDisplay_OGL::TryVideoMode( VideoModeParams p, bool &bNewDeviceOut ) +CString RageDisplay_OGL::TryVideoMode( const VideoModeParams &p, bool &bNewDeviceOut ) { //LOG->Warn( "RageDisplay_OGL::TryVideoMode( %d, %d, %d, %d, %d, %d )", p.windowed, p.width, p.height, p.bpp, p.rate, p.vsync ); diff --git a/stepmania/src/RageDisplay_OGL.h b/stepmania/src/RageDisplay_OGL.h index a52260de74..73599119e4 100644 --- a/stepmania/src/RageDisplay_OGL.h +++ b/stepmania/src/RageDisplay_OGL.h @@ -11,6 +11,7 @@ public: CString Init( VideoModeParams p, bool bAllowUnacceleratedRenderer ); virtual CString GetApiDescription() const { return "OpenGL"; } + virtual void GetDisplayResolutions( DisplayResolutions &out ) const; void ResolutionChanged(); const PixelFormatDesc *GetPixelFormatDesc(PixelFormat pf) const; @@ -83,7 +84,7 @@ protected: void DrawCompiledGeometryInternal( const RageCompiledGeometry *p, int iMeshIndex ); void DrawLineStripInternal( const RageSpriteVertex v[], int iNumVerts, float LineWidth ); - CString TryVideoMode( VideoModeParams params, bool &bNewDeviceOut ); + CString TryVideoMode( const VideoModeParams &p, bool &bNewDeviceOut ); RageSurface* CreateScreenshot(); void SetViewport(int shift_left, int shift_down); PixelFormat GetImgPixelFormat( RageSurface* &img, bool &FreeImg, int width, int height, bool bPalettedTexture ); diff --git a/stepmania/src/ScreenDimensions.cpp b/stepmania/src/ScreenDimensions.cpp index c3d7d6a9ff..db94bdb83a 100644 --- a/stepmania/src/ScreenDimensions.cpp +++ b/stepmania/src/ScreenDimensions.cpp @@ -2,7 +2,6 @@ #include "ScreenDimensions.h" #include "PrefsManager.h" - ThemeMetric THEME_SCREEN_WIDTH("Common","ScreenWidth"); ThemeMetric THEME_SCREEN_HEIGHT("Common","ScreenHeight"); @@ -20,20 +19,30 @@ ThemeMetric THEME_SCREEN_HEIGHT("Common","ScreenHeight"); */ #define ASPECT_4_TO_3 (4/3.0f) +static float GetAspect() +{ + float fAspect = PREFSMAN->m_fDisplayAspectRatio; + if( fAspect == ASPECT_AUTO ) + fAspect = PREFSMAN->m_iDisplayWidth / (float)PREFSMAN->m_iDisplayHeight; + return fAspect; +} + float ScreenWidth() { + float fAspect = GetAspect(); float fScale = 1; - if( PREFSMAN->m_fDisplayAspectRatio > ASPECT_4_TO_3 ) - fScale = PREFSMAN->m_fDisplayAspectRatio / ASPECT_4_TO_3; + if( fAspect > ASPECT_4_TO_3 ) + fScale = fAspect / ASPECT_4_TO_3; ASSERT( fScale >= 1 ); return THEME_SCREEN_WIDTH * fScale; } float ScreenHeight() { + float fAspect = GetAspect(); float fScale = 1; - if( PREFSMAN->m_fDisplayAspectRatio < ASPECT_4_TO_3 ) - fScale = ASPECT_4_TO_3 / PREFSMAN->m_fDisplayAspectRatio; + if( fAspect < ASPECT_4_TO_3 ) + fScale = ASPECT_4_TO_3 / fAspect; ASSERT( fScale >= 1 ); return THEME_SCREEN_HEIGHT * fScale; } diff --git a/stepmania/src/ScreenOptionsMasterPrefs.cpp b/stepmania/src/ScreenOptionsMasterPrefs.cpp index c9a3331174..6c991c2754 100644 --- a/stepmania/src/ScreenOptionsMasterPrefs.cpp +++ b/stepmania/src/ScreenOptionsMasterPrefs.cpp @@ -14,6 +14,7 @@ #include "Game.h" #include "Foreach.h" #include "GameConstantsAndTypes.h" +#include "DisplayResolutions.h" static void GetPrefsDefaultModifiers( PlayerOptions &po, SongOptions &so ) { @@ -179,6 +180,18 @@ static void ThemeChoices( CStringArray &out ) THEME->GetThemeNames( out ); } +static void DisplayResolutionChoices( CStringArray &out ) +{ + DisplayResolutions d; + DISPLAY->GetDisplayResolutions( d ); + + FOREACHS_CONST( DisplayResolution, d.s, iter ) + { + CString s = ssprintf("%dx%d", iter->iWidth, iter->iHeight); + out.push_back( s ); + } +} + static void Theme( int &sel, bool ToSel, const ConfOption *pConfOption ) { CStringArray choices; @@ -200,7 +213,7 @@ static void Theme( int &sel, bool ToSel, const ConfOption *pConfOption ) static void AnnouncerChoices( CStringArray &out ) { ANNOUNCER->GetAnnouncerNames( out ); - out.insert( out.begin(), "OFF" ); + out.insert( out.begin(), "Off" ); } static void Announcer( int &sel, bool ToSel, const ConfOption *pConfOption ) @@ -429,21 +442,20 @@ struct res_t operator float() const { return w * 5000.0f + h; } }; -static void DisplayResolution( int &sel, bool ToSel, const ConfOption *pConfOption ) +static void DisplayResolutionM( int &sel, bool ToSel, const ConfOption *pConfOption ) { - const res_t mapping[] = + vector v; + + DisplayResolutions d; + DISPLAY->GetDisplayResolutions( d ); + + FOREACHS_CONST( DisplayResolution, d.s, iter ) { - res_t(320, 240), - res_t(400, 300), - res_t(512, 384), - res_t(640, 480), - res_t(800, 600), - res_t(1024, 768), - res_t(1280, 960), - res_t(1280, 1024) - }; + v.push_back( res_t(iter->iWidth, iter->iHeight) ); + } + res_t sel_res( PREFSMAN->m_iDisplayWidth, PREFSMAN->m_iDisplayHeight ); - MoveMap( sel, sel_res, ToSel, mapping, ARRAYSIZE(mapping) ); + MoveMap( sel, sel_res, ToSel, &v[0], v.size() ); if( !ToSel ) { PREFSMAN->m_iDisplayWidth.Set( sel_res.w ); @@ -483,7 +495,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) ); } @@ -522,100 +534,100 @@ static void InitializeConfOptions() ADD( ConfOption( "Announcer", Announcer, AnnouncerChoices ) ); ADD( ConfOption( "DefaultNoteSkin", DefaultNoteSkin, DefaultNoteSkinChoices ) ); - ADD( ConfOption( "ShowInstructions", MovePref, "SKIP","SHOW") ); - ADD( ConfOption( "ShowCaution", MovePref, "SKIP","SHOW") ); - ADD( ConfOption( "DancePointsForOni", MovePref, "PERCENT","DANCE POINTS") ); - ADD( ConfOption( "ShowSelectGroup", MovePref, "ALL MUSIC","CHOOSE") ); - ADD( ConfOption( "MusicWheelUsesSections", WheelSections, "NEVER","ALWAYS", "ABC ONLY") ); - ADD( ConfOption( "CourseSortOrder", MovePref, "# SONGS","AVG FEET","TOTAL FEET","RANKING") ); - ADD( ConfOption( "MoveRandomToEnd", MovePref, "NO","YES") ); - ADD( ConfOption( "ShowNativeLanguage", MovePref, "ROMANIZATION","NATIVE LANGUAGE") ); - ADD( ConfOption( "ShowLyrics", MovePref, "HIDE","SHOW") ); + ADD( ConfOption( "ShowInstructions", MovePref, "Skip","Show") ); + ADD( ConfOption( "ShowCaution", MovePref, "Skip","Show") ); + ADD( ConfOption( "DancePointsForOni", MovePref, "Percent","Dance Points") ); + ADD( ConfOption( "ShowSelectGroup", MovePref, "All Music","Choose") ); + ADD( ConfOption( "MusicWheelUsesSections", WheelSections, "Never","Always","Title Only") ); + ADD( ConfOption( "CourseSortOrder", MovePref, "# Songs","Average Feet","Total Feet","Ranking") ); + ADD( ConfOption( "MoveRandomToEnd", MovePref, "No","Yes") ); + ADD( ConfOption( "ShowNativeLanguage", MovePref, "Romanization","Native Language") ); + ADD( ConfOption( "ShowLyrics", MovePref, "Hide","Show") ); /* Misc options */ - ADD( ConfOption( "AutogenSteps", MovePref, "OFF","ON" ) ); + ADD( ConfOption( "AutogenSteps", MovePref, "Off","On" ) ); g_ConfOptions.back().m_iEffects = OPT_APPLY_SONG; - ADD( ConfOption( "AutogenGroupCourses", MovePref, "OFF","ON" ) ); - ADD( ConfOption( "FastLoad", MovePref, "OFF","ON" ) ); + ADD( ConfOption( "AutogenGroupCourses", MovePref, "Off","On" ) ); + ADD( ConfOption( "FastLoad", MovePref, "Off","On" ) ); /* Background options */ - ADD( ConfOption( "RandomBackgroundMode", MovePref, "OFF","ANIMATIONS","VISUALIZATIONS","RANDOM MOVIES" ) ); + ADD( ConfOption( "RandomBackgroundMode", MovePref, "Off","Animations","Visualizations","Random Movies" ) ); ADD( ConfOption( "BGBrightness", BGBrightness, "0%","10%","20%","30%","40%","50%","60%","70%","80%","90%","100%" ) ); ADD( ConfOption( "BGBrightnessNoZero", BGBrightnessNoZero, "10%","20%","30%","40%","50%","60%","70%","80%","90%","100%" ) ); - ADD( ConfOption( "BGBrightnessOrStatic", BGBrightnessOrStatic,"DISABLED","DIM","BRIGHT" ) ); - ADD( ConfOption( "ShowDanger", MovePref, "HIDE","SHOW" ) ); - ADD( ConfOption( "ShowDancingCharacters", MovePref, "DEFAULT TO OFF","DEFAULT TO RANDOM","SELECT" ) ); - ADD( ConfOption( "ShowBeginnerHelper", MovePref, "OFF","ON" ) ); + ADD( ConfOption( "BGBrightnessOrStatic", BGBrightnessOrStatic,"Disabled","Dim","Bright" ) ); + ADD( ConfOption( "ShowDanger", MovePref, "Hide","Show" ) ); + ADD( ConfOption( "ShowDancingCharacters", MovePref, "Default to Off","Default to Random","Select" ) ); + ADD( ConfOption( "ShowBeginnerHelper", MovePref, "Off","On" ) ); ADD( ConfOption( "NumBackgrounds", NumBackgrounds, "5","10","15","20" ) ); /* Input options */ - ADD( ConfOption( "AutoMapOnJoyChange", MovePref, "OFF","ON (recommended)" ) ); - ADD( ConfOption( "OnlyDedicatedMenuButtons", MovePref, "USE GAMEPLAY BUTTONS","ONLY DEDICATED BUTTONS" ) ); - ADD( ConfOption( "AutoPlay", MovePref, "OFF","ON","CPU-Controlled" ) ); - ADD( ConfOption( "DelayedBack", MovePref, "INSTANT","HOLD" ) ); - ADD( ConfOption( "ArcadeOptionsNavigation", MovePref, "SM STYLE","ARCADE STYLE" ) ); - ADD( ConfOption( "MusicWheelSwitchSpeed", MusicWheelSwitchSpeed, "SLOW","NORMAL","FAST","REALLY FAST" ) ); + ADD( ConfOption( "AutoMapOnJoyChange", MovePref, "Off","On (recommended)" ) ); + ADD( ConfOption( "OnlyDedicatedMenuButtons", MovePref, "Use Gameplay Buttons","Only Dedicated Buttons" ) ); + ADD( ConfOption( "AutoPlay", MovePref, "Off","On","CPU-Controlled" ) ); + ADD( ConfOption( "DelayedBack", MovePref, "Instant","Hold" ) ); + ADD( ConfOption( "ArcadeOptionsNavigation", MovePref, "StepMania Style","Arcade Style" ) ); + ADD( ConfOption( "MusicWheelSwitchSpeed", MusicWheelSwitchSpeed, "Slow","Normal","Fast","Really Fast" ) ); /* Gameplay options */ - ADD( ConfOption( "SoloSingle", MovePref, "OFF","ON" ) ); - ADD( ConfOption( "HiddenSongs", MovePref, "OFF","ON" ) ); - ADD( ConfOption( "EasterEggs", MovePref, "OFF","ON" ) ); - ADD( ConfOption( "AllowW1", AllowW1, "NEVER","COURSES ONLY","ALWAYS" ) ); - ADD( ConfOption( "AllowExtraStage", MovePref, "OFF","ON" ) ); - ADD( ConfOption( "PickExtraStage", MovePref, "OFF","ON" ) ); - ADD( ConfOption( "UseUnlockSystem", MovePref, "OFF","ON" ) ); + ADD( ConfOption( "SoloSingle", MovePref, "Off","On" ) ); + ADD( ConfOption( "HiddenSongs", MovePref, "Off","On" ) ); + ADD( ConfOption( "EasterEggs", MovePref, "Off","On" ) ); + ADD( ConfOption( "AllowW1", AllowW1, "Never","Courses Only","Always" ) ); + ADD( ConfOption( "AllowExtraStage", MovePref, "Off","On" ) ); + ADD( ConfOption( "PickExtraStage", MovePref, "Off","On" ) ); + ADD( ConfOption( "UseUnlockSystem", MovePref, "Off","On" ) ); /* Machine options */ - ADD( ConfOption( "MenuTimer", MovePref, "OFF","ON" ) ); - ADD( ConfOption( "CoinMode", CoinModeM, "HOME","PAY","FREE PLAY" ) ); - ADD( ConfOption( "CoinModeNoHome", CoinModeNoHome, "PAY","FREE PLAY" ) ); + ADD( ConfOption( "MenuTimer", MovePref, "Off","On" ) ); + ADD( ConfOption( "CoinMode", CoinModeM, "Home","Pay","Free Play" ) ); + ADD( ConfOption( "CoinModeNoHome", CoinModeNoHome, "Pay","Free Play" ) ); ADD( ConfOption( "SongsPerPlay", SongsPerPlay, "1","2","3","4","5" ) ); - ADD( ConfOption( "SongsPerPlayOrEvent", SongsPerPlayOrEventMode, "1","2","3","4","5","EVENT" ) ); - ADD( ConfOption( "EventMode", MovePref, "OFF","ON" ) ); - ADD( ConfOption( "ScoringType", MovePref, "NEW","OLD" ) ); - ADD( ConfOption( "TimingWindowScale", TimingWindowScale, "1","2","3","4","5","6","7","8","JUSTICE" ) ); + ADD( ConfOption( "SongsPerPlayOrEvent", SongsPerPlayOrEventMode, "1","2","3","4","5","Event" ) ); + ADD( ConfOption( "EventMode", MovePref, "Off","On" ) ); + ADD( ConfOption( "ScoringType", MovePref, "New","Old" ) ); + ADD( ConfOption( "TimingWindowScale", TimingWindowScale, "1","2","3","4","5","6","7","8","Justice" ) ); ADD( ConfOption( "LifeDifficulty", LifeDifficulty, "1","2","3","4","5","6","7" ) ); - ADD( ConfOption( "ProgressiveLifebar", MovePref, "OFF","1","2","3","4","5","6","7","8") ); - ADD( ConfOption( "ProgressiveStageLifebar", MovePref, "OFF","1","2","3","4","5","6","7","8","INSANITY") ); - ADD( ConfOption( "ProgressiveNonstopLifebar", MovePref, "OFF","1","2","3","4","5","6","7","8","INSANITY") ); - ADD( ConfOption( "DefaultFailType", DefaultFailType, "IMMEDIATE","END OF SONG","OFF" ) ); - ADD( ConfOption( "DefaultFailTypeNoOff", DefaultFailType, "IMMEDIATE","END OF SONG" ) ); + ADD( ConfOption( "ProgressiveLifebar", MovePref, "Off","1","2","3","4","5","6","7","8") ); + ADD( ConfOption( "ProgressiveStageLifebar", MovePref, "Off","1","2","3","4","5","6","7","8","Insanity") ); + ADD( ConfOption( "ProgressiveNonstopLifebar", MovePref, "Off","1","2","3","4","5","6","7","8","Insanity") ); + ADD( ConfOption( "DefaultFailType", DefaultFailType, "Immediate","End of Song","Off" ) ); + ADD( ConfOption( "DefaultFailTypeNoOff", DefaultFailType, "Immediate","End of Song" ) ); ADD( ConfOption( "CoinsPerCredit", CoinsPerCredit, "1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16" ) ); - ADD( ConfOption( "Premium", PremiumM, "OFF","DOUBLE FOR 1 CREDIT","JOINT PREMIUM" ) ); - ADD( ConfOption( "ShowSongOptions", ShowSongOptions, "HIDE","SHOW","ASK" ) ); - ADD( ConfOption( "GetRankingName", GetRankingName, "OFF", "ON", "RANKING SONGS" ) ); + ADD( ConfOption( "Premium", PremiumM, "Off","Double for 1 Credit","Joint Premium" ) ); + ADD( ConfOption( "ShowSongOptions", ShowSongOptions, "Hide","Show","Ask" ) ); + ADD( ConfOption( "GetRankingName", GetRankingName, "Off", "On", "Ranking Songs" ) ); /* Graphic options */ - ADD( ConfOption( "Windowed", MovePref, "FULLSCREEN", "WINDOWED" ) ); + ADD( ConfOption( "Windowed", MovePref, "Full Screen", "Windowed" ) ); g_ConfOptions.back().m_iEffects = OPT_APPLY_GRAPHICS; - ADD( ConfOption( "DisplayResolution", DisplayResolution, "320","400","512","640","800","1024","1280x960","1280x1024" ) ); - g_ConfOptions.back().m_iEffects = OPT_APPLY_GRAPHICS; - ADD( ConfOption( "DisplayColorDepth", DisplayColorDepth, "16BIT","32BIT" ) ); + ADD( ConfOption( "DisplayResolution", DisplayResolutionM, DisplayResolutionChoices ) ); + g_ConfOptions.back().m_iEffects = OPT_APPLY_GRAPHICS | OPT_APPLY_ASPECT_RATIO; + 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; ADD( ConfOption( "MaxTextureResolution", MaxTextureResolution,"256","512","1024","2048" ) ); g_ConfOptions.back().m_iEffects = OPT_APPLY_GRAPHICS; - ADD( ConfOption( "TextureColorDepth", TextureColorDepth, "16BIT","32BIT" ) ); + ADD( ConfOption( "TextureColorDepth", TextureColorDepth, "16bit","32bit" ) ); g_ConfOptions.back().m_iEffects = OPT_APPLY_GRAPHICS; - ADD( ConfOption( "MovieColorDepth", MovieColorDepth, "16BIT","32BIT" ) ); - ADD( ConfOption( "DelayedTextureDelete", MovePref, "OFF","ON" ) ); + ADD( ConfOption( "MovieColorDepth", MovieColorDepth, "16bit","32bit" ) ); + ADD( ConfOption( "DelayedTextureDelete", MovePref, "Off","On" ) ); g_ConfOptions.back().m_iEffects = OPT_APPLY_GRAPHICS; - ADD( ConfOption( "CelShadeModels", MovePref, "OFF","ON" ) ); - ADD( ConfOption( "SmoothLines", MovePref, "OFF","ON" ) ); + ADD( ConfOption( "CelShadeModels", MovePref, "Off","On" ) ); + ADD( ConfOption( "SmoothLines", MovePref, "Off","On" ) ); g_ConfOptions.back().m_iEffects = OPT_APPLY_GRAPHICS; - ADD( ConfOption( "RefreshRate", RefreshRate, "DEFAULT","60","70","72","75","80","85","90","100","120","150" ) ); + ADD( ConfOption( "RefreshRate", RefreshRate, "Default","60","70","72","75","80","85","90","100","120","150" ) ); g_ConfOptions.back().m_iEffects = OPT_APPLY_GRAPHICS; - 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; - ADD( ConfOption( "Vsync", MovePref, "NO", "YES" ) ); + ADD( ConfOption( "Vsync", MovePref, "No", "Yes" ) ); g_ConfOptions.back().m_iEffects = OPT_APPLY_GRAPHICS; - ADD( ConfOption( "ShowStats", MovePref, "OFF","ON" ) ); - ADD( ConfOption( "ShowBanners", MovePref, "OFF","ON" ) ); + ADD( ConfOption( "ShowStats", MovePref, "Off","On" ) ); + ADD( ConfOption( "ShowBanners", MovePref, "Off","On" ) ); /* Sound options */ - ADD( ConfOption( "SoundResampleQuality", MovePref, "FAST","NORMAL","HIGH QUALITY" ) ); - ADD( ConfOption( "AttractSoundFrequency", MovePref, "NEVER","ALWAYS","2 TIMES","3 TIMES","4 TIMES","5 TIMES" ) ); - ADD( ConfOption( "SoundVolume", SoundVolume, "SILENT","10%","20%","30%","40%","50%","60%","70%","80%","90%","100%" ) ); + ADD( ConfOption( "SoundResampleQuality", MovePref, "Fast","Normal","High Quality" ) ); + ADD( ConfOption( "AttractSoundFrequency", MovePref, "Never","Always","2 Times","3 Times","4 Times","5 Times" ) ); + ADD( ConfOption( "SoundVolume", SoundVolume, "Silent","10%","20%","30%","40%","50%","60%","70%","80%","90%","100%" ) ); g_ConfOptions.back().m_iEffects = OPT_APPLY_SOUND; { ConfOption c( "GlobalOffsetSeconds", GlobalOffsetSeconds ); @@ -625,7 +637,7 @@ static void InitializeConfOptions() } /* Editor options */ - ADD( ConfOption( "EditorShowBGChangesPlay", MovePref, "HIDE","SHOW") ); + ADD( ConfOption( "EditorShowBGChangesPlay", MovePref, "Hide","Show") ); } /* Get a mask of effects to apply if the given option changes. */ diff --git a/stepmania/src/StepMania.h b/stepmania/src/StepMania.h index 832eb73dc2..1964da0912 100644 --- a/stepmania/src/StepMania.h +++ b/stepmania/src/StepMania.h @@ -22,7 +22,7 @@ CString SaveScreenshot( CString sDir, bool bSaveCompressed, bool bMakeSignature, void InsertCoin( int iNum = 1, const RageTimer *pTime = NULL ); void InsertCredit(); -struct VideoModeParams; +class VideoModeParams; void GetPreferredVideoModeParams( VideoModeParams ¶msOut ); #endif diff --git a/stepmania/src/arch/LowLevelWindow/LowLevelWindow.h b/stepmania/src/arch/LowLevelWindow/LowLevelWindow.h index bdd573de9a..69c7bf82db 100644 --- a/stepmania/src/arch/LowLevelWindow/LowLevelWindow.h +++ b/stepmania/src/arch/LowLevelWindow/LowLevelWindow.h @@ -3,7 +3,8 @@ /* This handles low-level operations that OGL 1.x doesn't give us. */ -#include "RageDisplay.h" // for VideoModeParams +class DisplayResolutions; +class VideoModeParams; class LowLevelWindow { @@ -15,7 +16,8 @@ public: // Return "" if mode change was successful, otherwise an error message. // bNewDeviceOut is set true if a new device was created and textures // need to be reloaded. - virtual CString TryVideoMode( VideoModeParams p, bool &bNewDeviceOut ) = 0; + virtual CString TryVideoMode( const VideoModeParams &p, bool &bNewDeviceOut ) = 0; + virtual void GetDisplayResolutions( DisplayResolutions &out ) const = 0; virtual bool IsSoftwareRenderer( CString &sError ) { return false; } diff --git a/stepmania/src/arch/LowLevelWindow/LowLevelWindow_SDL.cpp b/stepmania/src/arch/LowLevelWindow/LowLevelWindow_SDL.cpp index b71e3920c7..d67bc53b85 100644 --- a/stepmania/src/arch/LowLevelWindow/LowLevelWindow_SDL.cpp +++ b/stepmania/src/arch/LowLevelWindow/LowLevelWindow_SDL.cpp @@ -44,7 +44,7 @@ void *LowLevelWindow_SDL::GetProcAddress(CString s) return SDL_GL_GetProcAddress(s); } -CString LowLevelWindow_SDL::TryVideoMode( VideoModeParams p, bool &bNewDeviceOut ) +CString LowLevelWindow_SDL::TryVideoMode( const VideoModeParams &p, bool &bNewDeviceOut ) { bool wasWindowed = CurrentParams.windowed; diff --git a/stepmania/src/arch/LowLevelWindow/LowLevelWindow_SDL.h b/stepmania/src/arch/LowLevelWindow/LowLevelWindow_SDL.h index a8bfdd375a..f00c7dae92 100644 --- a/stepmania/src/arch/LowLevelWindow/LowLevelWindow_SDL.h +++ b/stepmania/src/arch/LowLevelWindow/LowLevelWindow_SDL.h @@ -9,7 +9,7 @@ public: LowLevelWindow_SDL(); ~LowLevelWindow_SDL(); void *GetProcAddress(CString s); - CString TryVideoMode( VideoModeParams p, bool &bNewDeviceOut ); + CString TryVideoMode( const VideoModeParams &p, bool &bNewDeviceOut ); void SwapBuffers(); void Update(); diff --git a/stepmania/src/arch/LowLevelWindow/LowLevelWindow_Win32.cpp b/stepmania/src/arch/LowLevelWindow/LowLevelWindow_Win32.cpp index 2f348faf53..535b72ae29 100644 --- a/stepmania/src/arch/LowLevelWindow/LowLevelWindow_Win32.cpp +++ b/stepmania/src/arch/LowLevelWindow/LowLevelWindow_Win32.cpp @@ -4,6 +4,7 @@ #include "StepMania.h" #include "RageUtil.h" #include "RageLog.h" +#include "RageDisplay.h" #include @@ -46,8 +47,12 @@ LowLevelWindow_Win32::~LowLevelWindow_Win32() GraphicsWindow::Shutdown(); } +void LowLevelWindow_Win32::GetDisplayResolutions( DisplayResolutions &out ) const +{ + GraphicsWindow::GetDisplayResolutions( out ); +} -int ChooseWindowPixelFormat( VideoModeParams p, PIXELFORMATDESCRIPTOR *PixelFormat ) +int ChooseWindowPixelFormat( const VideoModeParams &p, PIXELFORMATDESCRIPTOR *PixelFormat ) { ASSERT( GraphicsWindow::GetHwnd() != NULL ); ASSERT( GraphicsWindow::GetHDC() != NULL ); @@ -98,7 +103,7 @@ void DumpPixelFormat( const PIXELFORMATDESCRIPTOR &pfd ) /* This function does not reset the video mode if it fails, because we might be trying * yet another video mode, so we'd just thrash the display. On fatal error, * LowLevelWindow_Win32::~LowLevelWindow_Win32 will call Shutdown(). */ -CString LowLevelWindow_Win32::TryVideoMode( VideoModeParams p, bool &bNewDeviceOut ) +CString LowLevelWindow_Win32::TryVideoMode( const VideoModeParams &p, bool &bNewDeviceOut ) { //LOG->Warn( "LowLevelWindow_Win32::TryVideoMode" ); diff --git a/stepmania/src/arch/LowLevelWindow/LowLevelWindow_Win32.h b/stepmania/src/arch/LowLevelWindow/LowLevelWindow_Win32.h index 19ec71faf9..b39d45e6db 100644 --- a/stepmania/src/arch/LowLevelWindow/LowLevelWindow_Win32.h +++ b/stepmania/src/arch/LowLevelWindow/LowLevelWindow_Win32.h @@ -9,7 +9,8 @@ public: LowLevelWindow_Win32(); ~LowLevelWindow_Win32(); void *GetProcAddress( CString s ); - CString TryVideoMode( VideoModeParams p, bool &bNewDeviceOut ); + CString TryVideoMode( const VideoModeParams &p, bool &bNewDeviceOut ); + void GetDisplayResolutions( DisplayResolutions &out ) const; bool IsSoftwareRenderer( CString &sError ); void SwapBuffers(); void Update(); diff --git a/stepmania/src/arch/LowLevelWindow/LowLevelWindow_X11.cpp b/stepmania/src/arch/LowLevelWindow/LowLevelWindow_X11.cpp index b4caa043bd..bf11c329ac 100644 --- a/stepmania/src/arch/LowLevelWindow/LowLevelWindow_X11.cpp +++ b/stepmania/src/arch/LowLevelWindow/LowLevelWindow_X11.cpp @@ -50,7 +50,7 @@ void *LowLevelWindow_X11::GetProcAddress( CString s ) return (void*) glXGetProcAddressARB( (const GLubyte*) s.c_str() ); } -CString LowLevelWindow_X11::TryVideoMode( VideoModeParams p, bool &bNewDeviceOut ) +CString LowLevelWindow_X11::TryVideoMode( const VideoModeParams &p, bool &bNewDeviceOut ) { #if defined(LINUX) /* nVidia cards: diff --git a/stepmania/src/archutils/Win32/GraphicsWindow.cpp b/stepmania/src/archutils/Win32/GraphicsWindow.cpp index b82aaf3e21..5000769ec8 100644 --- a/stepmania/src/archutils/Win32/GraphicsWindow.cpp +++ b/stepmania/src/archutils/Win32/GraphicsWindow.cpp @@ -6,6 +6,7 @@ #include "RageLog.h" #include "RageUtil.h" #include "RageDisplay.h" +#include "DisplayResolutions.h" #include "archutils/Win32/AppInstance.h" #include "archutils/Win32/WindowIcon.h" #include "archutils/Win32/GetFileInformation.h" @@ -468,6 +469,23 @@ HWND GraphicsWindow::GetHwnd() return g_hWndMain; } +void GraphicsWindow::GetDisplayResolutions( DisplayResolutions &out ) +{ + DEVMODE dm; + ZERO( dm ); + dm.dmSize = sizeof(dm); + int i=0; + while(EnumDisplaySettings(NULL, i++, &dm)) + { + if(ChangeDisplaySettings(&dm, CDS_TEST)==DISP_CHANGE_SUCCESSFUL) + { + DisplayResolution res = { dm.dmPelsWidth, dm.dmPelsHeight }; + out.s.insert( res ); + } + } +} + + /* * (c) 2004 Glenn Maynard * All rights reserved. diff --git a/stepmania/src/archutils/Win32/GraphicsWindow.h b/stepmania/src/archutils/Win32/GraphicsWindow.h index 35ddb816b7..b4187939bf 100644 --- a/stepmania/src/archutils/Win32/GraphicsWindow.h +++ b/stepmania/src/archutils/Win32/GraphicsWindow.h @@ -3,7 +3,8 @@ #define GRAPHICS_WINDOW_H #include -struct VideoModeParams; // for VideoModeParams +class VideoModeParams; +class DisplayResolutions; namespace GraphicsWindow { @@ -20,6 +21,8 @@ namespace GraphicsWindow void DestroyGraphicsWindow(); void ConfigureGraphicsWindow( const VideoModeParams &p ); + void GetDisplayResolutions( DisplayResolutions &out ); + LRESULT CALLBACK GraphicsWindow_WndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam ); void GetParams( VideoModeParams ¶msOut ); diff --git a/stepmania/src/archutils/Xbox/GraphicsWindow.h b/stepmania/src/archutils/Xbox/GraphicsWindow.h index e94be6bf00..4ab96ba6f2 100644 --- a/stepmania/src/archutils/Xbox/GraphicsWindow.h +++ b/stepmania/src/archutils/Xbox/GraphicsWindow.h @@ -4,7 +4,7 @@ #pragma once -#include "RageDisplay.h" +class VideoModeParams; namespace GraphicsWindow {