allow songman->Reload with FastLoad
This commit is contained in:
@@ -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 );
|
||||||
|
|||||||
@@ -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 )
|
||||||
|
|||||||
@@ -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 )
|
||||||
|
|||||||
@@ -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();
|
||||||
|
|||||||
@@ -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,9 +90,9 @@ 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;
|
||||||
PREFSMAN->m_bFastLoad.Set( false );
|
if( !bAllowFastLoad )
|
||||||
|
PREFSMAN->m_bFastLoad.Set( false );
|
||||||
|
|
||||||
InitAll( ld );
|
InitAll( ld );
|
||||||
|
|
||||||
@@ -100,7 +100,8 @@ void SongManager::Reload( LoadingWindow *ld )
|
|||||||
PROFILEMAN->LoadMachineProfile();
|
PROFILEMAN->LoadMachineProfile();
|
||||||
UNLOCKMAN->Reload();
|
UNLOCKMAN->Reload();
|
||||||
|
|
||||||
PREFSMAN->m_bFastLoad.Set( OldVal );
|
if( !bAllowFastLoad )
|
||||||
|
PREFSMAN->m_bFastLoad.Set( OldVal );
|
||||||
|
|
||||||
UpdatePreferredSort();
|
UpdatePreferredSort();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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 );
|
||||||
|
|||||||
Reference in New Issue
Block a user