combine all profile score data to one file
move user-editable data to a separate, unsigned file
This commit is contained in:
@@ -1185,7 +1185,7 @@ StyleDef g_StyleDefs[NUM_STYLES] =
|
||||
GAME_DANCE, // m_Game
|
||||
false, // m_bUsedForGameplay
|
||||
true, // m_bUsedForEdit
|
||||
"couple (edit)", // m_szName
|
||||
"couple-edit", // m_szName
|
||||
STEPS_TYPE_DANCE_COUPLE, // m_StepsType
|
||||
StyleDef::ONE_PLAYER_ONE_CREDIT, // m_StyleType
|
||||
{ 160, 480 }, // m_iCenterX
|
||||
@@ -1405,7 +1405,7 @@ StyleDef g_StyleDefs[NUM_STYLES] =
|
||||
GAME_PUMP, // m_Game
|
||||
false, // m_bUsedForGameplay
|
||||
true, // m_bUsedForEdit
|
||||
"couple (edit)", // m_szName
|
||||
"couple-edit", // m_szName
|
||||
STEPS_TYPE_PUMP_COUPLE, // m_StepsType
|
||||
StyleDef::ONE_PLAYER_ONE_CREDIT, // m_StyleType
|
||||
{ 160, 480 }, // m_iCenterX
|
||||
@@ -1912,7 +1912,7 @@ StyleDef g_StyleDefs[NUM_STYLES] =
|
||||
GAME_IIDX, // m_Game
|
||||
false, // m_bUsedForGameplay
|
||||
true, // m_bUsedForEdit
|
||||
"single5 (edit)", // m_szName
|
||||
"single5-edit", // m_szName
|
||||
STEPS_TYPE_IIDX_SINGLE5, // m_StepsType
|
||||
StyleDef::ONE_PLAYER_ONE_CREDIT, // m_StyleType
|
||||
{ 160, 480 }, // m_iCenterX
|
||||
@@ -1947,7 +1947,7 @@ StyleDef g_StyleDefs[NUM_STYLES] =
|
||||
GAME_IIDX, // m_Game
|
||||
false, // m_bUsedForGameplay
|
||||
true, // m_bUsedForEdit
|
||||
"double5 (edit)", // m_szName
|
||||
"double5-edit", // m_szName
|
||||
STEPS_TYPE_IIDX_DOUBLE5, // m_StepsType
|
||||
StyleDef::ONE_PLAYER_TWO_CREDITS, // m_StyleType
|
||||
{ 320, 320 }, // m_iCenterX
|
||||
|
||||
+12
-12
@@ -54,19 +54,19 @@ XNode* HighScore::CreateNode() const
|
||||
return pNode;
|
||||
}
|
||||
|
||||
void HighScore::LoadFromNode( XNode* pNode )
|
||||
void HighScore::LoadFromNode( const XNode* pNode )
|
||||
{
|
||||
ASSERT( pNode->name == "HighScore" );
|
||||
XNodes childs = pNode->GetChilds();
|
||||
for( unsigned i = 0 ; i < childs.size(); i++)
|
||||
for( XNodes::const_iterator child = pNode->childs.begin();
|
||||
child != pNode->childs.end();
|
||||
child++ )
|
||||
{
|
||||
XNode* pChild = childs[i];
|
||||
if( pChild->name == "Name" ) pChild->GetValue( sName );
|
||||
else if( pChild->name == "Grade" ) pChild->GetValue( (int&)grade );
|
||||
else if( pChild->name == "Score" ) pChild->GetValue( iScore );
|
||||
else if( pChild->name == "PercentDP" ) pChild->GetValue( fPercentDP );
|
||||
else if( pChild->name == "SurviveSeconds" ) pChild->GetValue( fSurviveSeconds );
|
||||
else if( pChild->name == "Modifiers" ) pChild->GetValue( sModifiers );
|
||||
if( (*child)->name == "Name" ) (*child)->GetValue( sName );
|
||||
else if( (*child)->name == "Grade" ) (*child)->GetValue( (int&)grade );
|
||||
else if( (*child)->name == "Score" ) (*child)->GetValue( iScore );
|
||||
else if( (*child)->name == "PercentDP" ) (*child)->GetValue( fPercentDP );
|
||||
else if( (*child)->name == "SurviveSeconds" ) (*child)->GetValue( fSurviveSeconds );
|
||||
else if( (*child)->name == "Modifiers" ) (*child)->GetValue( sModifiers );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -124,12 +124,12 @@ XNode* HighScoreList::CreateNode() const
|
||||
return pNode;
|
||||
}
|
||||
|
||||
void HighScoreList::LoadFromNode( XNode* pNode )
|
||||
void HighScoreList::LoadFromNode( const XNode* pNode )
|
||||
{
|
||||
Init();
|
||||
|
||||
ASSERT( pNode->name == "HighScoreList" );
|
||||
for( XNodes::iterator child = pNode->childs.begin();
|
||||
for( XNodes::const_iterator child = pNode->childs.begin();
|
||||
child != pNode->childs.end();
|
||||
child++)
|
||||
{
|
||||
|
||||
@@ -35,7 +35,7 @@ struct HighScore
|
||||
bool operator>=( const HighScore& other ) const;
|
||||
|
||||
XNode* CreateNode() const;
|
||||
void LoadFromNode( XNode* pNode );
|
||||
void LoadFromNode( const XNode* pNode );
|
||||
};
|
||||
|
||||
struct HighScoreList
|
||||
@@ -56,7 +56,7 @@ struct HighScoreList
|
||||
const HighScore& GetTopScore() const;
|
||||
|
||||
XNode* CreateNode() const;
|
||||
void LoadFromNode( XNode* pNode );
|
||||
void LoadFromNode( const XNode* pNode );
|
||||
};
|
||||
|
||||
|
||||
|
||||
+28
-20
@@ -40,10 +40,15 @@ public:
|
||||
static CString GetProfileDisplayNameFromDir( CString sDir );
|
||||
int GetSongNumTimesPlayed( const Song* pSong ) const;
|
||||
|
||||
//
|
||||
// Editable data
|
||||
//
|
||||
CString m_sDisplayName;
|
||||
float m_fWeightPounds;
|
||||
|
||||
//
|
||||
// General data
|
||||
//
|
||||
CString m_sName;
|
||||
CString m_sLastUsedHighScoreName;
|
||||
bool m_bUsingProfileDefaultModifiers;
|
||||
CString m_sDefaultModifiers;
|
||||
@@ -51,7 +56,6 @@ public:
|
||||
int m_iTotalPlaySeconds;
|
||||
int m_iTotalGameplaySeconds;
|
||||
int m_iCurrentCombo;
|
||||
float m_fWeightPounds;
|
||||
int m_fCaloriesBurned;
|
||||
mutable CString m_sLastMachinePlayed; // mutable because we overwrite this on save, and I don't want to remove const from the whole save chain. -Chris
|
||||
int m_iNumSongsPlayedByPlayMode[NUM_PLAY_MODES];
|
||||
@@ -124,12 +128,14 @@ public:
|
||||
//
|
||||
void InitAll()
|
||||
{
|
||||
InitEditableData();
|
||||
InitGeneralData();
|
||||
InitSongScores();
|
||||
InitCourseScores();
|
||||
InitCategoryScores();
|
||||
InitScreenshotData();
|
||||
}
|
||||
void InitEditableData();
|
||||
void InitGeneralData();
|
||||
void InitSongScores();
|
||||
void InitCourseScores();
|
||||
@@ -139,32 +145,34 @@ public:
|
||||
//
|
||||
// Loading and saving
|
||||
//
|
||||
bool LoadAllFromDir( CString sDir );
|
||||
bool LoadAllFromDir( CString sDir ); // return false on
|
||||
bool SaveAllToDir( CString sDir ) const;
|
||||
|
||||
bool LoadGeneralDataFromDir( CString sDir );
|
||||
bool SaveGeneralDataToDir( CString sDir ) const;
|
||||
|
||||
void LoadProfileDataFromDirSM390a12( CString sDir );
|
||||
void LoadSongScoresFromDirSM390a12( CString sDir );
|
||||
void LoadSongScoresFromDir( CString sDir );
|
||||
void SaveSongScoresToDir( CString sDir ) const;
|
||||
void DeleteSongScoresFromDirSM390a12( CString sDir ) const;
|
||||
|
||||
void LoadCourseScoresFromDirSM390a12( CString sDir );
|
||||
void LoadCourseScoresFromDir( CString sDir );
|
||||
void SaveCourseScoresToDir( CString sDir ) const;
|
||||
void DeleteCourseScoresFromDirSM390a12( CString sDir ) const;
|
||||
|
||||
void LoadCategoryScoresFromDirSM390a12( CString sDir );
|
||||
void LoadCategoryScoresFromDir( CString sDir );
|
||||
void SaveCategoryScoresToDir( CString sDir ) const;
|
||||
|
||||
void LoadEditableDataFromNode( const XNode* pNode );
|
||||
void LoadGeneralDataFromNode( const XNode* pNode );
|
||||
void LoadSongScoresFromNode( const XNode* pNode );
|
||||
void LoadCourseScoresFromNode( const XNode* pNode );
|
||||
void LoadCategoryScoresFromNode( const XNode* pNode );
|
||||
void LoadScreenshotDataFromNode( const XNode* pNode );
|
||||
|
||||
XNode* SaveEditableDataCreateNode() const;
|
||||
XNode* SaveGeneralDataCreateNode() const;
|
||||
XNode* SaveSongScoresCreateNode() const;
|
||||
XNode* SaveCourseScoresCreateNode() const;
|
||||
XNode* SaveCategoryScoresCreateNode() const;
|
||||
XNode* SaveScreenshotDataCreateNode() const;
|
||||
|
||||
void DeleteProfileDataFromDirSM390a12( CString sDir ) const;
|
||||
void DeleteSongScoresFromDirSM390a12( CString sDir ) const;
|
||||
void DeleteCourseScoresFromDirSM390a12( CString sDir ) const;
|
||||
void DeleteCategoryScoresFromDirSM390a12( CString sDir ) const;
|
||||
|
||||
void LoadScreenshotDataFromDir( CString sDir );
|
||||
void SaveScreenshotDataToDir( CString sDir ) const;
|
||||
|
||||
void SaveStatsWebPageToDir( CString sDir ) const;
|
||||
|
||||
void SaveMachinePublicKeyToDir( CString sDir ) const;
|
||||
};
|
||||
|
||||
|
||||
@@ -150,7 +150,7 @@ void PrintStatistics( RageFile &f, const Profile *pProfile, CString sTitle, vect
|
||||
PRINT_OPEN(f,"General Info",true);
|
||||
{
|
||||
BEGIN_TABLE(2);
|
||||
TABLE_LINE2( "Name", pProfile->m_sName );
|
||||
TABLE_LINE2( "DisplayName", pProfile->m_sDisplayName );
|
||||
TABLE_LINE2( "LastUsedHighScoreName", pProfile->m_sLastUsedHighScoreName );
|
||||
TABLE_LINE2( "UsingProfileDefaultModifiers", pProfile->m_bUsingProfileDefaultModifiers );
|
||||
TABLE_LINE2( "DefaultModifiers", pProfile->m_sDefaultModifiers );
|
||||
@@ -653,23 +653,32 @@ void PrintBookkeeping( RageFile &f, const Profile *pProfile, CString sTitle, vec
|
||||
PRINT_CLOSE(f);
|
||||
}
|
||||
|
||||
void PrintScreenshot( RageFile &f, const Profile::Screenshot &ss )
|
||||
{
|
||||
CString sHtmlPath = "Screenshots/"+ss.sFileName;
|
||||
CString sImgTag = ssprintf("<a href='%s' target='_new'><img class='screenshot' src='%s' width='160' height='120'></a>", sHtmlPath.c_str(), sHtmlPath.c_str() );
|
||||
CString sDetails = "<p>This is a screenshot</p>\n<p>We have no idea where it came from</p>";
|
||||
|
||||
BEGIN_TABLE(1);
|
||||
|
||||
TABLE_LINE2( sImgTag, sDetails );
|
||||
|
||||
END_TABLE;
|
||||
}
|
||||
|
||||
void PrintScreenshots( RageFile &f, const Profile *pProfile, CString sTitle, CString sProfileDir )
|
||||
{
|
||||
PRINT_OPEN(f, sTitle );
|
||||
{
|
||||
CStringArray asFiles;
|
||||
GetDirListing( sProfileDir+"Screenshots/*.jpg", asFiles );
|
||||
|
||||
BEGIN_TABLE(2);
|
||||
for( unsigned i=0; i<asFiles.size(); i++ )
|
||||
PRINT_OPEN(f, "Less Than 1 Month Old" );
|
||||
{
|
||||
CString sFile = "Screenshots/"+asFiles[i];
|
||||
|
||||
CString sImgTag = ssprintf("<a href='%s' target='_new'><img class='screenshot' src='%s' width='160' height='120'></a>", sFile.c_str(), sFile.c_str() );
|
||||
|
||||
TABLE_LINE1( sImgTag );
|
||||
for( int i=0; i<pProfile->m_vScreenshots.size(); i++ )
|
||||
{
|
||||
const Profile::Screenshot &ss = pProfile->m_vScreenshots[i];
|
||||
PrintScreenshot( f, ss );
|
||||
}
|
||||
}
|
||||
END_TABLE;
|
||||
PRINT_CLOSE(f);
|
||||
}
|
||||
PRINT_CLOSE(f);
|
||||
}
|
||||
@@ -793,7 +802,7 @@ TITLE.c_str(), STYLE_CSS ) );
|
||||
|
||||
CString sName =
|
||||
pProfile->m_sLastUsedHighScoreName.empty() ?
|
||||
pProfile->m_sName :
|
||||
pProfile->m_sDisplayName :
|
||||
pProfile->m_sLastUsedHighScoreName;
|
||||
time_t ltime = time( NULL );
|
||||
CString sTime = ctime( <ime );
|
||||
|
||||
@@ -116,7 +116,7 @@ bool ProfileManager::CreateProfile( CString sProfileDir, CString sName )
|
||||
bool bResult;
|
||||
|
||||
Profile pro;
|
||||
pro.m_sName = sName;
|
||||
pro.m_sDisplayName = sName;
|
||||
bResult = pro.SaveAllToDir( sProfileDir );
|
||||
if( !bResult )
|
||||
return false;
|
||||
@@ -249,15 +249,7 @@ bool ProfileManager::CreateLocalProfile( CString sName )
|
||||
return false;
|
||||
sProfileDir += "/";
|
||||
|
||||
Profile pro;
|
||||
pro.m_sName = sName;
|
||||
|
||||
bool bResult = pro.SaveAllToDir( sProfileDir );
|
||||
if( !bResult )
|
||||
return false;
|
||||
|
||||
FlushDirCache();
|
||||
return true;
|
||||
return CreateProfile( sProfileDir, sName );
|
||||
}
|
||||
|
||||
bool ProfileManager::RenameLocalProfile( CString sProfileID, CString sNewName )
|
||||
@@ -271,7 +263,7 @@ bool ProfileManager::RenameLocalProfile( CString sProfileID, CString sNewName )
|
||||
bResult = pro.LoadAllFromDir( sProfileDir );
|
||||
if( !bResult )
|
||||
return false;
|
||||
pro.m_sName = sNewName;
|
||||
pro.m_sDisplayName = sNewName;
|
||||
bResult = pro.SaveAllToDir( sProfileDir );
|
||||
if( !bResult )
|
||||
return false;
|
||||
@@ -297,7 +289,7 @@ void ProfileManager::SaveMachineProfile()
|
||||
// If the machine name has changed, make sure we use the new name.
|
||||
// It's important that this name be applied before the Player profiles
|
||||
// are saved, so that the Player's profiles show the right machine name.
|
||||
m_MachineProfile.m_sName = PREFSMAN->m_sMachineName;
|
||||
m_MachineProfile.m_sDisplayName = PREFSMAN->m_sMachineName;
|
||||
|
||||
m_MachineProfile.SaveAllToDir( MACHINE_PROFILE_DIR );
|
||||
}
|
||||
@@ -317,7 +309,7 @@ void ProfileManager::LoadMachineProfile()
|
||||
}
|
||||
|
||||
// If the machine name has changed, make sure we use the new name
|
||||
m_MachineProfile.m_sName = PREFSMAN->m_sMachineName;
|
||||
m_MachineProfile.m_sDisplayName = PREFSMAN->m_sMachineName;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -785,6 +785,20 @@ LPXNode _tagXMLNode::GetChild( LPCTSTR name )
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const LPXNode _tagXMLNode::GetChild( LPCTSTR name ) const
|
||||
{
|
||||
for( unsigned i = 0 ; i < childs.size(); i++ )
|
||||
{
|
||||
LPXNode node = childs[i];
|
||||
if( node )
|
||||
{
|
||||
if( node->name == name )
|
||||
return node;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
//========================================================
|
||||
// Name : GetChildValue
|
||||
// Desc : Find child with name and return child's value
|
||||
|
||||
@@ -123,9 +123,10 @@ typedef struct _tagXMLNode
|
||||
// name and value
|
||||
CString name;
|
||||
CString value;
|
||||
void GetValue(CString &out) { out = value; }
|
||||
void GetValue(int &out) { out = atoi(value); }
|
||||
void GetValue(float &out) { out = (float) atof(value); }
|
||||
void GetValue(CString &out) const { out = value; }
|
||||
void GetValue(int &out) const { out = atoi(value); }
|
||||
void GetValue(float &out) const { out = (float) atof(value); }
|
||||
void GetValue(bool &out) const { out = atoi(value) != 0; }
|
||||
|
||||
// internal variables
|
||||
LPXNode parent; // parent node
|
||||
@@ -146,11 +147,13 @@ typedef struct _tagXMLNode
|
||||
XAttrs GetAttrs( LPCTSTR name );
|
||||
|
||||
// in one level child nodes
|
||||
const LPXNode GetChild( LPCTSTR name ) const;
|
||||
LPXNode GetChild( LPCTSTR name );
|
||||
LPCTSTR GetChildValue( LPCTSTR name );
|
||||
bool GetChildValue(LPCTSTR name,CString &out) { XNode* pChild=GetChild(name); if(pChild==NULL) return false; pChild->GetValue(out); return true; }
|
||||
bool GetChildValue(LPCTSTR name,int &out) { XNode* pChild=GetChild(name); if(pChild==NULL) return false; pChild->GetValue(out); return true; }
|
||||
bool GetChildValue(LPCTSTR name,float &out) { XNode* pChild=GetChild(name); if(pChild==NULL) return false; pChild->GetValue(out); return true; }
|
||||
bool GetChildValue(LPCTSTR name,CString &out) const { const XNode* pChild=GetChild(name); if(pChild==NULL) return false; pChild->GetValue(out); return true; }
|
||||
bool GetChildValue(LPCTSTR name,int &out) const { const XNode* pChild=GetChild(name); if(pChild==NULL) return false; pChild->GetValue(out); return true; }
|
||||
bool GetChildValue(LPCTSTR name,float &out) const { const XNode* pChild=GetChild(name); if(pChild==NULL) return false; pChild->GetValue(out); return true; }
|
||||
bool GetChildValue(LPCTSTR name,bool &out) const { const XNode* pChild=GetChild(name); if(pChild==NULL) return false; pChild->GetValue(out); return true; }
|
||||
XNodes GetChilds( LPCTSTR name );
|
||||
XNodes GetChilds();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user