allow songman->Reload with FastLoad
This commit is contained in:
@@ -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 );
|
||||
|
||||
@@ -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 )
|
||||
|
||||
@@ -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 )
|
||||
|
||||
@@ -11,6 +11,7 @@ class SongCacheIndex
|
||||
public:
|
||||
SongCacheIndex();
|
||||
~SongCacheIndex();
|
||||
void ReadFromDisk();
|
||||
static RString GetCacheFilePath( const RString &sGroup, const RString &sPath );
|
||||
|
||||
void ReadCacheIndex();
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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 );
|
||||
|
||||
Reference in New Issue
Block a user