write Catalog.xml only after loading songs
get rid of try/catch in SongManager get rid of try/catch in PrefsManager
This commit is contained in:
@@ -31,7 +31,6 @@
|
||||
#include "ScoreKeeperMAX2.h"
|
||||
#include "crypto/CryptRand.h"
|
||||
#include "UnlockSystem.h"
|
||||
#include "CatalogXml.h"
|
||||
#include "XmlFile.h"
|
||||
#include "Foreach.h"
|
||||
|
||||
@@ -1257,8 +1256,6 @@ void Profile::SaveStatsWebPageToDir( CString sDir ) const
|
||||
PROFILEMAN->GetMachineProfile(),
|
||||
bThisIsMachineProfile ? HTML_TYPE_MACHINE : HTML_TYPE_PLAYER
|
||||
);
|
||||
if( bThisIsMachineProfile )
|
||||
SaveCatalogXml( sDir );
|
||||
}
|
||||
|
||||
void Profile::SaveMachinePublicKeyToDir( CString sDir ) const
|
||||
|
||||
@@ -42,18 +42,6 @@ ProfileManager* PROFILEMAN = NULL; // global and accessable from anywhere in our
|
||||
|
||||
ProfileManager::ProfileManager()
|
||||
{
|
||||
PROFILEMAN = this;
|
||||
|
||||
try
|
||||
{
|
||||
FOREACH_PlayerNumber( p )
|
||||
m_bWasLoadedFromMemoryCard[p] = false;
|
||||
|
||||
LoadMachineProfile();
|
||||
} catch(...) {
|
||||
PROFILEMAN = NULL;
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
ProfileManager::~ProfileManager()
|
||||
@@ -61,6 +49,14 @@ ProfileManager::~ProfileManager()
|
||||
SaveMachineProfile();
|
||||
}
|
||||
|
||||
void ProfileManager::Init()
|
||||
{
|
||||
FOREACH_PlayerNumber( p )
|
||||
m_bWasLoadedFromMemoryCard[p] = false;
|
||||
|
||||
LoadMachineProfile();
|
||||
}
|
||||
|
||||
void ProfileManager::GetLocalProfileIDs( vector<CString> &asProfileIDsOut ) const
|
||||
{
|
||||
GetDirListing( USER_PROFILES_DIR "*", asProfileIDsOut, true, false );
|
||||
@@ -76,7 +72,7 @@ void ProfileManager::GetLocalProfileNames( vector<CString> &asNamesOut ) const
|
||||
CString sProfileID = vsProfileIDs[i];
|
||||
CString sProfileDir = USER_PROFILES_DIR + sProfileID + "/";
|
||||
CString sDisplayName = Profile::GetProfileDisplayNameFromDir( sProfileDir );
|
||||
LOG->Trace(" '%s'", sDisplayName.c_str());
|
||||
LOG->Trace(" '%s'", sDisplayName.c_str());
|
||||
asNamesOut.push_back( sDisplayName );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,6 +26,8 @@ public:
|
||||
ProfileManager();
|
||||
~ProfileManager();
|
||||
|
||||
void Init();
|
||||
|
||||
bool CreateLocalProfile( CString sName );
|
||||
bool RenameLocalProfile( CString sProfileID, CString sNewName );
|
||||
bool DeleteLocalProfile( CString sProfileID );
|
||||
|
||||
@@ -38,11 +38,13 @@
|
||||
#include "CourseUtil.h"
|
||||
#include "RageFileManager.h"
|
||||
#include "UnlockSystem.h"
|
||||
#include "CatalogXml.h"
|
||||
|
||||
SongManager* SONGMAN = NULL; // global and accessable from anywhere in our program
|
||||
|
||||
#define SONGS_DIR "Songs/"
|
||||
#define COURSES_DIR "Courses/"
|
||||
#define DATA_DIR "Data/"
|
||||
|
||||
#define MAX_EDITS_PER_PROFILE 200
|
||||
|
||||
@@ -80,24 +82,10 @@ static void UpdateMetrics()
|
||||
EXTRA_COLOR_METER.Refresh();
|
||||
}
|
||||
|
||||
SongManager::SongManager( LoadingWindow *ld )
|
||||
SongManager::SongManager()
|
||||
{
|
||||
g_LastMetricUpdate.SetZero();
|
||||
UpdateMetrics();
|
||||
|
||||
/* We initialize things that assume they can get at SONGMAN; we only
|
||||
* init one of these, so hook us up to it immediately. */
|
||||
SONGMAN = this;
|
||||
try
|
||||
{
|
||||
InitSongsFromDisk( ld );
|
||||
InitCoursesFromDisk( ld );
|
||||
InitAutogenCourses();
|
||||
|
||||
} catch(...) {
|
||||
SONGMAN = NULL;
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
SongManager::~SongManager()
|
||||
@@ -106,6 +94,14 @@ SongManager::~SongManager()
|
||||
FreeCourses();
|
||||
}
|
||||
|
||||
void SongManager::InitAll( LoadingWindow *ld )
|
||||
{
|
||||
InitSongsFromDisk( ld );
|
||||
InitCoursesFromDisk( ld );
|
||||
InitAutogenCourses();
|
||||
SaveCatalogXml( DATA_DIR );
|
||||
}
|
||||
|
||||
void SongManager::Reload( LoadingWindow *ld )
|
||||
{
|
||||
FlushDirCache();
|
||||
@@ -126,9 +122,7 @@ void SongManager::Reload( LoadingWindow *ld )
|
||||
const bool OldVal = PREFSMAN->m_bFastLoad;
|
||||
PREFSMAN->m_bFastLoad = false;
|
||||
|
||||
InitSongsFromDisk( ld );
|
||||
InitCoursesFromDisk( ld );
|
||||
InitAutogenCourses();
|
||||
InitAll( ld );
|
||||
|
||||
// reload scores afterward
|
||||
PROFILEMAN->LoadMachineProfile();
|
||||
|
||||
@@ -29,7 +29,7 @@ struct PlayerOptions;
|
||||
class SongManager
|
||||
{
|
||||
public:
|
||||
SongManager( LoadingWindow *ld );
|
||||
SongManager();
|
||||
~SongManager();
|
||||
|
||||
void InitSongsFromDisk( LoadingWindow *ld );
|
||||
@@ -45,6 +45,7 @@ public:
|
||||
void InitAutogenCourses();
|
||||
void FreeCourses();
|
||||
|
||||
void InitAll( LoadingWindow *ld ); // songs, courses, groups - everything.
|
||||
void Reload( LoadingWindow *ld=NULL ); // songs, courses, groups - everything.
|
||||
void PreloadSongImages();
|
||||
|
||||
|
||||
@@ -1052,10 +1052,12 @@ int main(int argc, char* argv[])
|
||||
BANNERCACHE = new BannerCache;
|
||||
|
||||
/* depends on SONGINDEX: */
|
||||
SONGMAN = new SongManager( loading_window ); // this takes a long time to load
|
||||
SONGMAN = new SongManager();
|
||||
SONGMAN->InitAll( loading_window ); // this takes a long time
|
||||
CRYPTMAN = new CryptManager; // need to do this before ProfileMan
|
||||
MEMCARDMAN = new MemoryCardManager;
|
||||
PROFILEMAN = new ProfileManager; // must load after SONGMAN
|
||||
PROFILEMAN = new ProfileManager;
|
||||
PROFILEMAN->Init(); // must load after SONGMAN
|
||||
UNLOCKMAN = new UnlockSystem;
|
||||
MODELMAN = new ModelManager;
|
||||
delete loading_window; // destroy this before init'ing Display
|
||||
|
||||
Reference in New Issue
Block a user