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