diff --git a/stepmania/src/ScreenReloadSongs.cpp b/stepmania/src/ScreenReloadSongs.cpp index bb20fd96cf..68b0b497e1 100644 --- a/stepmania/src/ScreenReloadSongs.cpp +++ b/stepmania/src/ScreenReloadSongs.cpp @@ -75,7 +75,7 @@ void ScreenReloadSongs::Update( float fDeltaTime ) return; ASSERT( !IsFirstUpdate() ); - SONGMAN->Reload( m_LoadingWindow ); + SONGMAN->Reload( false, m_LoadingWindow ); UNLOCKMAN->UpdateCachedPointers(); SCREENMAN->PostMessageToTopScreen( SM_GoToNextScreen, 0 ); diff --git a/stepmania/src/Song.cpp b/stepmania/src/Song.cpp index e71e8cc634..aa66641179 100644 --- a/stepmania/src/Song.cpp +++ b/stepmania/src/Song.cpp @@ -223,11 +223,11 @@ bool Song::LoadFromSongDir( RString sDir ) // // First look in the cache for this song (without loading NoteData) // - unsigned uDirHash = SONGINDEX->GetCacheHash(m_sSongDir); + unsigned uCacheHash = SONGINDEX->GetCacheHash(m_sSongDir); bool bUseCache = true; if( !DoesFileExist(GetCacheFilePath()) ) bUseCache = false; - if( !PREFSMAN->m_bFastLoad && GetHashForDirectory(m_sSongDir) != uDirHash ) + if( !PREFSMAN->m_bFastLoad && GetHashForDirectory(m_sSongDir) != uCacheHash ) bUseCache = false; // this cache is out of date if( bUseCache ) diff --git a/stepmania/src/SongCacheIndex.cpp b/stepmania/src/SongCacheIndex.cpp index 154ac6f22e..d4d43298f0 100644 --- a/stepmania/src/SongCacheIndex.cpp +++ b/stepmania/src/SongCacheIndex.cpp @@ -48,6 +48,11 @@ SongCacheIndex::~SongCacheIndex() } +void SongCacheIndex::ReadFromDisk() +{ + ReadCacheIndex(); +} + static void EmptyDir( RString dir ) { ASSERT(dir[dir.size()-1] == '/'); @@ -90,7 +95,7 @@ void SongCacheIndex::AddCacheIndex(const RString &path, unsigned hash) unsigned SongCacheIndex::GetCacheHash( const RString &path ) const { - unsigned iDirHash; + unsigned iDirHash = 0; if( !CacheIndex.GetValue( "Cache", MangleName(path), iDirHash ) ) return 0; if( iDirHash == 0 ) diff --git a/stepmania/src/SongCacheIndex.h b/stepmania/src/SongCacheIndex.h index afb372da4c..d33361044e 100644 --- a/stepmania/src/SongCacheIndex.h +++ b/stepmania/src/SongCacheIndex.h @@ -11,6 +11,7 @@ class SongCacheIndex public: SongCacheIndex(); ~SongCacheIndex(); + void ReadFromDisk(); static RString GetCacheFilePath( const RString &sGroup, const RString &sPath ); void ReadCacheIndex(); diff --git a/stepmania/src/SongManager.cpp b/stepmania/src/SongManager.cpp index 1be332daa2..84b4c8a77f 100644 --- a/stepmania/src/SongManager.cpp +++ b/stepmania/src/SongManager.cpp @@ -77,7 +77,7 @@ void SongManager::InitAll( LoadingWindow *ld ) } static LocalizedString RELOADING ( "SongManager", "Reloading..." ); -void SongManager::Reload( LoadingWindow *ld ) +void SongManager::Reload( bool bAllowFastLoad, LoadingWindow *ld ) { FlushDirCache(); @@ -90,9 +90,9 @@ void SongManager::Reload( LoadingWindow *ld ) FreeSongs(); FreeCourses(); - /* Always check songs for changes. */ const bool OldVal = PREFSMAN->m_bFastLoad; - PREFSMAN->m_bFastLoad.Set( false ); + if( !bAllowFastLoad ) + PREFSMAN->m_bFastLoad.Set( false ); InitAll( ld ); @@ -100,7 +100,8 @@ void SongManager::Reload( LoadingWindow *ld ) PROFILEMAN->LoadMachineProfile(); UNLOCKMAN->Reload(); - PREFSMAN->m_bFastLoad.Set( OldVal ); + if( !bAllowFastLoad ) + PREFSMAN->m_bFastLoad.Set( OldVal ); UpdatePreferredSort(); } diff --git a/stepmania/src/SongManager.h b/stepmania/src/SongManager.h index b4e37bfb4b..666481e70e 100644 --- a/stepmania/src/SongManager.h +++ b/stepmania/src/SongManager.h @@ -53,7 +53,7 @@ public: void InitAll( LoadingWindow *ld ); // songs, courses, groups - everything. - void Reload( LoadingWindow *ld=NULL ); // songs, courses, groups - everything. + void Reload( bool bAllowFastLoad, LoadingWindow *ld=NULL ); // songs, courses, groups - everything. void PreloadSongImages(); RString GetSongGroupBannerPath( RString sSongGroup );