On systems with less than 192 megs of memory, disable texture caching

by default.
This commit is contained in:
Glenn Maynard
2003-06-10 23:50:31 +00:00
parent 53a8e22689
commit fa3dddad4f
3 changed files with 56 additions and 3 deletions
+13 -3
View File
@@ -112,8 +112,12 @@ PrefsManager::PrefsManager()
m_bHiddenSongs = false;
m_bVsync = true;
m_sVideoRenderers = ""; // StepMania.cpp sets this on first run
m_sSoundDrivers = DEFAULT_SOUND_DRIVER_LIST;
// StepMania.cpp sets these on first run:
m_sVideoRenderers = "";
#if defined(WIN32)
m_iLastSeenMemory = 0;
#endif
m_fSoundVolume = DEFAULT_SOUND_VOLUME;
/* This is experimental: let's see if preloading helps people's skipping.
* If it doesn't do anything useful, it'll be removed. */
@@ -207,8 +211,11 @@ void PrefsManager::ReadGlobalPrefsFromDisk( bool bSwitchToLastPlayedGame )
ini.GetValueB( "Options", "UseUnlockSystem", m_bUseUnlockSystem );
ini.GetValueB( "Options", "FirstRun", m_bFirstRun );
ini.GetValueB( "Options", "AutoMapJoysticks", m_bAutoMapJoysticks );
ini.GetValue ( "Options", "LastSeenVideoDriver", m_sLastSeenVideoDriver );
ini.GetValue ( "Options", "VideoRenderers", m_sVideoRenderers );
ini.GetValue ( "Options", "LastSeenVideoDriver", m_sLastSeenVideoDriver );
#if defined(WIN32)
ini.GetValue ( "Options", "LastSeenMemory", m_iLastSeenMemory );
#endif
ini.GetValueB( "Options", "AntiAliasing", m_bAntiAliasing );
m_asAdditionalSongFolders.clear();
@@ -299,6 +306,9 @@ void PrefsManager::SaveGlobalPrefsToDisk()
ini.SetValueB( "Options", "AutoMapJoysticks", m_bAutoMapJoysticks );
ini.SetValue ( "Options", "VideoRenderers", m_sVideoRenderers );
ini.SetValue ( "Options", "LastSeenVideoDriver", m_sLastSeenVideoDriver );
#if defined(WIN32)
ini.SetValue ( "Options", "LastSeenMemory", m_iLastSeenMemory );
#endif
ini.SetValueB( "Options", "AntiAliasing", m_bAntiAliasing );
/* Only write these if they aren't the default. This ensures that we can change
+3
View File
@@ -89,6 +89,9 @@ public:
CString m_DWIPath;
CString m_sLastSeenVideoDriver;
#if defined(WIN32)
int m_iLastSeenMemory;
#endif
CString m_sVideoRenderers;
bool m_bAntiAliasing;
CString m_sSoundDrivers;
+40
View File
@@ -215,6 +215,43 @@ static void BoostAppPri()
#endif
}
static void CheckSettings()
{
#if defined(WIN32)
/* Has the amount of memory changed? */
MEMORYSTATUS mem;
GlobalMemoryStatus(&mem);
const int Memory = mem.dwTotalPhys / 1048576;
if( PREFSMAN->m_iLastSeenMemory == Memory )
return;
LOG->Trace( "Memory changed from %i to %i; settings changed", PREFSMAN->m_iLastSeenMemory, Memory );
PREFSMAN->m_iLastSeenMemory = Memory;
/* Let's consider 128-meg systems low-memory, and 256-meg systems high-memory.
* Cut off at 192. This is somewhat conservative; many 128-meg systems can
* deal with higher memory profile settings, but some can't.
*
* Actually, Windows lops off a meg or two; cut off a little lower to treat
* 192-meg systems as high-memory. */
const bool HighMemory = (Memory >= 190);
/* Two memory-consuming features that we can disable are texture caching and
* preloaded banners. Texture caching can use a lot of memory; disable it for
* low-memory systems. */
PREFSMAN->m_bDelayedTextureDelete = HighMemory;
/* Preloaded banners takes about 9k per song. That adds up with a lot of songs,
* though it's smaller than the actual song data that we preload anyway. Maybe
* we should disable it for 64-meg systems? */
// PREFSMAN->m_bPreloadBanners = !LowMemory;
PREFSMAN->SaveGlobalPrefsToDisk();
#endif
}
#if defined(WIN32)
#include "RageDisplay_D3D.h"
#endif
@@ -438,9 +475,12 @@ int main(int argc, char* argv[])
SONGMAN = new SongManager( loading_window ); // this takes a long time to load
delete loading_window; // destroy this before init'ing Display
/* XXX: Why do we reload global prefs? PREFSMAN loads them in the ctor. -glenn */
PREFSMAN->ReadGlobalPrefsFromDisk( true );
PREFSMAN->ReadGamePrefsFromDisk();
CheckSettings();
DISPLAY = CreateDisplay();
TEXTUREMAN = new RageTextureManager();
TEXTUREMAN->SetPrefs(