move "video driver database" to text file

This commit is contained in:
Chris Danford
2003-05-31 21:34:07 +00:00
parent 379aca13c7
commit f1cc708710
4 changed files with 108 additions and 70 deletions
+28
View File
@@ -0,0 +1,28 @@
[VideoCards]
NumEntries=3
[0000]
DriverRegex=Voodoo3
Renderers=d3d
Width=640
Height=480
DisplayColor=16
TextureColor=16
[0001]
DriverRegex=GeForce|Radeon
Renderers=opengl,d3d
Width=640
Height=480
DisplayColor=32
TextureColor=32
// Default graphics settings used for all cards that don't match above.
// This must be the very last entry!
[0002]
DriverRegex=
Renderers=opengl,d3d
Width=640
Height=480
DisplayColor=16
TextureColor=16
+6 -5
View File
@@ -63,7 +63,7 @@ PrefsManager::PrefsManager()
m_fJudgeWindowGreatSeconds = 0.090f;
m_fJudgeWindowGoodSeconds = 0.135f;
m_fJudgeWindowBooSeconds = 0.180f;
m_fJudgeWindowOKSeconds = 0.140f;
m_fJudgeWindowOKSeconds = 0.250f; // allow enough time to take foot off and put back on
m_fLifeDifficultyScale = 1.0f;
m_iMovieDecodeMS = 2;
m_bUseBGIfNoBanner = false;
@@ -112,7 +112,7 @@ PrefsManager::PrefsManager()
m_bHiddenSongs = false;
m_bVsync = true;
m_sRenderer = "";
m_sVideoRenderers = "";
m_sSoundDrivers = DEFAULT_SOUND_DRIVER_LIST;
m_fSoundVolume = DEFAULT_SOUND_VOLUME;
/* This is experimental: let's see if preloading helps people's skipping.
@@ -178,7 +178,8 @@ void PrefsManager::ReadGlobalPrefsFromDisk( bool bSwitchToLastPlayedGame )
ini.GetValueB( "Options", "DelayedScreenLoad", m_bDelayedScreenLoad );
ini.GetValueI( "Options", "MusicWheelUsesSections", (int&)m_MusicWheelUsesSections );
ini.GetValueI( "Options", "MusicWheelSwitchSpeed", m_iMusicWheelSwitchSpeed );
ini.GetValue ( "Options", "Renderer", m_sRenderer );
ini.GetValue ( "Options", "VideoRenderers", m_sVideoRenderers );
ini.GetValue ( "Options", "LastSeenVideoDriver", m_sLastSeenVideoDriver );
ini.GetValue ( "Options", "SoundDrivers", m_sSoundDrivers );
ini.GetValueB( "Options", "EasterEggs", m_bEasterEggs );
ini.GetValueB( "Options", "MarvelousTiming", m_bMarvelousTiming );
@@ -306,8 +307,8 @@ void PrefsManager::SaveGlobalPrefsToDisk()
ini.SetValue ( "Options", "SoundDrivers", m_sSoundDrivers );
if(m_fSoundVolume != DEFAULT_SOUND_VOLUME)
ini.SetValueF( "Options", "SoundVolume", m_fSoundVolume );
if(m_sRenderer != "")
ini.SetValue ( "Options", "Renderer", m_sRenderer );
if(m_sVideoRenderers != "")
ini.SetValue ( "Options", "Renderer", m_sVideoRenderers );
ini.SetValue( "Options", "AdditionalSongFolders", join(",", m_asAdditionalSongFolders) );
+2 -1
View File
@@ -91,7 +91,8 @@ public:
CStringArray m_asAdditionalSongFolders;
CString m_DWIPath;
CString m_sRenderer;
CString m_sVideoRenderers;
CString m_sLastSeenVideoDriver;
CString m_sSoundDrivers;
float m_fSoundVolume;
bool m_bSoundPreloadAll;
+72 -64
View File
@@ -293,80 +293,88 @@ RageDisplay *CreateDisplay()
* #2 is the only case that's actually a bug.
*
* Actually, right now we're falling back. I'm not sure which behavior is better.
*
* This should probably be exported into an INI.
*/
bool NeedsD3D = false;
if( PREFSMAN->m_sRenderer != "" )
// Video card changed since last run
CString sVideoDriver = GetPrimaryVideoDriverName();
if( PREFSMAN->m_sLastSeenVideoDriver != sVideoDriver )
{
LOG->Warn("Forcing renderer: %s", PREFSMAN->m_sRenderer.c_str() );
if( !PREFSMAN->m_sRenderer.CompareNoCase("opengl") )
NeedsD3D = false;
else if( !PREFSMAN->m_sRenderer.CompareNoCase("d3d") )
NeedsD3D = true;
else
RageException::Throw("Unknown Renderer value: %s", PREFSMAN->m_sRenderer.c_str() );
// Apply default graphic settings for this card
IniFile ini;
ini.SetPath( "Data/VideoCards.ini" );
ini.ReadFile();
int iNumEntries = 0;
ini.GetValueI( "VideoCards", "NumEntries", iNumEntries );
for( int i=0; i<iNumEntries; i++ )
{
CString sKey = ssprintf("%04d",i);
CString sDriverRegex;
ini.GetValue( sKey, "DriverRegex", sDriverRegex );
Regex regex( sDriverRegex );
if( !regex.Compare(sVideoDriver) )
continue; // skip
LOG->Trace( "Using default graphics settings for '%s'.", sDriverRegex.c_str() );
ini.GetValue( sKey, "Renderers", PREFSMAN->m_sVideoRenderers );
ini.GetValueI( sKey, "Width", PREFSMAN->m_iDisplayWidth );
ini.GetValueI( sKey, "Height", PREFSMAN->m_iDisplayHeight );
ini.GetValueI( sKey, "DisplayColor", PREFSMAN->m_iDisplayColorDepth );
ini.GetValueI( sKey, "TextureColor", PREFSMAN->m_iTextureColorDepth );
// Update last seen video card
PREFSMAN->m_sLastSeenVideoDriver = GetPrimaryVideoDriverName();
break; // stop looking
}
}
if( CardRequiresD3D() )
NeedsD3D = true;
CString error = "There was an error while initializing your video card.\n\n"
" PLEASE DO NOT FILE THIS ERROR AS A BUG!\n\n"
"Video Driver: "+sVideoDriver+"\n\n";
CString error = "There was an error while initializing your video card.\n\n";
if( PREFSMAN->m_sRenderer != "" )
error = "(WARNING: Renderer was forced)\n\n";
error += " PLEASE DO NOT FILE THIS ERROR AS A BUG!\n\n";
if( NeedsD3D )
CStringArray asRenderers;
split( PREFSMAN->m_sVideoRenderers, ",", asRenderers, true );
for( int i=0; i<asRenderers.size(); i++ )
{
/* We require D3D. Try to start it. */
error += "Your display adapter, \"" + GetPrimaryVideoDriverName() + "\", requires Direct3D 8 (or "
"higher), but ";
CString sRenderer = asRenderers[i];
try {
return CreateDisplay_D3D();
} catch(RageException_D3DNotInstalled e) {
error +=
"it is not installed. You can download it from:\n" +
D3DURL;
} catch(RageException_D3DNoAcceleration e) {
error +=
"your system is reporting that hardware acceleration is not available. "
"You can download an updated driver from your card's manufacturer.";
};
if( sRenderer.CompareNoCase("opengl")==0 )
{
/* Try to create an OpenGL renderer. This should always succeed. (Actually,
* SDL may throw, but that only happens with broken driver installations, and
* we probably don't want to fall back on D3D in that case anyway.) */
error += "Initializing OpenGL...\n";
/* This card is listed as having problems in OpenGL, so don't try it; it'll
* just generate bug reports. */
RageException::Throw( error );
RageDisplay *ret = CreateDisplay_OGL();
if( PREFSMAN->m_bAllowUnacceleratedRenderer || !ret->IsSoftwareRenderer() )
return ret;
else
{
error += "Your system is reporting that OpenGL hardware acceleration is not available. "
"Please obtain an updated driver from your video card manufacturer.";
delete ret;
}
}
else if( sRenderer.CompareNoCase("d3d")==0 )
{
error += "Initializing Direct3D...\n";
try {
return CreateDisplay_D3D();
} catch(RageException_D3DNotInstalled e) {
error += "DirectX 8.1 or greater is not installed. You can download it from:\n"+D3DURL;
} catch(RageException_D3DNoAcceleration e) {
error += "Your system is reporting that Direct3D hardware acceleration is not available. "
"Please obtain an updated driver from your video card manufacturer.";
};
}
else
RageException::Throw("Unknown video renderer value: %s", sRenderer.c_str() );
}
/* Try to create an OpenGL renderer. This should always succeed. (Actually,
* SDL may throw, but that only happens with broken driver installations, and
* we probably don't want to fall back on D3D in that case anyway.) */
RageDisplay *ret = CreateDisplay_OGL();
if( PREFSMAN->m_bAllowUnacceleratedRenderer || !ret->IsSoftwareRenderer() )
return ret;
/* OpenGL is unaccelerated. Try D3D. */
delete ret;
try {
return CreateDisplay_D3D();
} catch(RageException_D3DNotInstalled e) {
/* Eek. We don't know if we need newer drivers, D3D8 or both. */
error +=
"OpenGL hardware acceleration is not available on your system, and "
"Direct3D 8 (or higher) is not installed. You can download it from:\n" +
D3DURL + "\n\n"
"You may also need updated drivers from your card's manufacturer.";
} catch(RageException_D3DNoAcceleration e) {
error +=
"Neither OpenGL nor Direct3D hardware acceleration is available on your "
"system. Please install the latest video drivers from your graphics "
"card vendor.";
};
RageException::Throw( error );
}