From af115bab906a0d45874f711fe06112ca663c60a3 Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Thu, 10 Nov 2005 10:22:15 +0000 Subject: [PATCH] handle sentinel values for refresh rate instead of asserting --- stepmania/src/RageDisplay_D3D.cpp | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/stepmania/src/RageDisplay_D3D.cpp b/stepmania/src/RageDisplay_D3D.cpp index a788dbc2bd..52bfc9954c 100644 --- a/stepmania/src/RageDisplay_D3D.cpp +++ b/stepmania/src/RageDisplay_D3D.cpp @@ -582,7 +582,26 @@ CString RageDisplay_D3D::TryVideoMode( VideoModeParams p, bool &bNewDeviceOut ) dm.dmSize = sizeof(dm); if( EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &dm) ) { - g_iActualRefreshRateInHz = dm.dmDisplayFrequency; + /* + * On a nForce 2 IGP on Windows 98, dm.dmDisplayFrequency sometimes + * (but not always) is 0. + * + * MSDN: When you call the EnumDisplaySettings function, the + * dmDisplayFrequency member may return with the value 0 or 1. + * These values represent the display hardware's default refresh rate. + * This default rate is typically set by switches on a display card or + * computer motherboard, or by a configuration program that does not + * use Win32 display functions such as ChangeDisplaySettings. + */ + if( dm.dmDisplayFrequency == 0 || dm.dmDisplayFrequency == 1 ) + { + g_iActualRefreshRateInHz = 60; + LOG->Warn( "EnumDisplaySettings doesn't know what the refresh rate is. %d %d %d", dm.dmPelsWidth, dm.dmPelsHeight, dm.dmBitsPerPel ); + } + else + { + g_iActualRefreshRateInHz = dm.dmDisplayFrequency; + } } else {