allow songman->Reload with FastLoad

This commit is contained in:
Chris Danford
2006-05-05 00:41:17 +00:00
parent f38a9f0af4
commit 0f9d78b06d
6 changed files with 16 additions and 9 deletions
+1 -1
View File
@@ -75,7 +75,7 @@ void ScreenReloadSongs::Update( float fDeltaTime )
return; return;
ASSERT( !IsFirstUpdate() ); ASSERT( !IsFirstUpdate() );
SONGMAN->Reload( m_LoadingWindow ); SONGMAN->Reload( false, m_LoadingWindow );
UNLOCKMAN->UpdateCachedPointers(); UNLOCKMAN->UpdateCachedPointers();
SCREENMAN->PostMessageToTopScreen( SM_GoToNextScreen, 0 ); SCREENMAN->PostMessageToTopScreen( SM_GoToNextScreen, 0 );
+2 -2
View File
@@ -223,11 +223,11 @@ bool Song::LoadFromSongDir( RString sDir )
// //
// First look in the cache for this song (without loading NoteData) // 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; bool bUseCache = true;
if( !DoesFileExist(GetCacheFilePath()) ) if( !DoesFileExist(GetCacheFilePath()) )
bUseCache = false; 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 bUseCache = false; // this cache is out of date
if( bUseCache ) if( bUseCache )
+6 -1
View File
@@ -48,6 +48,11 @@ SongCacheIndex::~SongCacheIndex()
} }
void SongCacheIndex::ReadFromDisk()
{
ReadCacheIndex();
}
static void EmptyDir( RString dir ) static void EmptyDir( RString dir )
{ {
ASSERT(dir[dir.size()-1] == '/'); 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 SongCacheIndex::GetCacheHash( const RString &path ) const
{ {
unsigned iDirHash; unsigned iDirHash = 0;
if( !CacheIndex.GetValue( "Cache", MangleName(path), iDirHash ) ) if( !CacheIndex.GetValue( "Cache", MangleName(path), iDirHash ) )
return 0; return 0;
if( iDirHash == 0 ) if( iDirHash == 0 )
+1
View File
@@ -11,6 +11,7 @@ class SongCacheIndex
public: public:
SongCacheIndex(); SongCacheIndex();
~SongCacheIndex(); ~SongCacheIndex();
void ReadFromDisk();
static RString GetCacheFilePath( const RString &sGroup, const RString &sPath ); static RString GetCacheFilePath( const RString &sGroup, const RString &sPath );
void ReadCacheIndex(); void ReadCacheIndex();
+3 -2
View File
@@ -77,7 +77,7 @@ void SongManager::InitAll( LoadingWindow *ld )
} }
static LocalizedString RELOADING ( "SongManager", "Reloading..." ); static LocalizedString RELOADING ( "SongManager", "Reloading..." );
void SongManager::Reload( LoadingWindow *ld ) void SongManager::Reload( bool bAllowFastLoad, LoadingWindow *ld )
{ {
FlushDirCache(); FlushDirCache();
@@ -90,8 +90,8 @@ void SongManager::Reload( LoadingWindow *ld )
FreeSongs(); FreeSongs();
FreeCourses(); FreeCourses();
/* Always check songs for changes. */
const bool OldVal = PREFSMAN->m_bFastLoad; const bool OldVal = PREFSMAN->m_bFastLoad;
if( !bAllowFastLoad )
PREFSMAN->m_bFastLoad.Set( false ); PREFSMAN->m_bFastLoad.Set( false );
InitAll( ld ); InitAll( ld );
@@ -100,6 +100,7 @@ void SongManager::Reload( LoadingWindow *ld )
PROFILEMAN->LoadMachineProfile(); PROFILEMAN->LoadMachineProfile();
UNLOCKMAN->Reload(); UNLOCKMAN->Reload();
if( !bAllowFastLoad )
PREFSMAN->m_bFastLoad.Set( OldVal ); PREFSMAN->m_bFastLoad.Set( OldVal );
UpdatePreferredSort(); UpdatePreferredSort();
+1 -1
View File
@@ -53,7 +53,7 @@ public:
void InitAll( LoadingWindow *ld ); // songs, courses, groups - everything. 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(); void PreloadSongImages();
RString GetSongGroupBannerPath( RString sSongGroup ); RString GetSongGroupBannerPath( RString sSongGroup );