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;
ASSERT( !IsFirstUpdate() );
SONGMAN->Reload( m_LoadingWindow );
SONGMAN->Reload( false, m_LoadingWindow );
UNLOCKMAN->UpdateCachedPointers();
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)
//
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 )
+6 -1
View File
@@ -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 )
+1
View File
@@ -11,6 +11,7 @@ class SongCacheIndex
public:
SongCacheIndex();
~SongCacheIndex();
void ReadFromDisk();
static RString GetCacheFilePath( const RString &sGroup, const RString &sPath );
void ReadCacheIndex();
+5 -4
View File
@@ -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();
}
+1 -1
View File
@@ -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 );