save guid as string
This commit is contained in:
+13
-22
@@ -44,6 +44,7 @@ const int SM_390A12_CATEGORY_RANKING_VERSION = 6;
|
||||
const int SM_390A12_SONG_SCORES_VERSION = 9;
|
||||
const int SM_390A12_COURSE_SCORES_VERSION = 8;
|
||||
|
||||
#define GUID_SIZE_BYTES 8
|
||||
|
||||
#if defined(WIN32)
|
||||
#pragma warning (disable : 4706) // assignment within conditional expression
|
||||
@@ -56,7 +57,6 @@ const int SM_390A12_COURSE_SCORES_VERSION = 8;
|
||||
(Var##Iter != Node->childs.end() && (Var = *Var##Iter) ), Var##Iter != Node->childs.end(); \
|
||||
++Var##Iter )
|
||||
|
||||
|
||||
void Profile::InitEditableData()
|
||||
{
|
||||
m_sDisplayName = "";
|
||||
@@ -72,8 +72,9 @@ void Profile::InitGeneralData()
|
||||
random_add_noise( "ai8049ujr3odusj" );
|
||||
|
||||
{
|
||||
for( unsigned i=0; i<sizeof(m_iGuid); i++ )
|
||||
((Uint8*)&m_iGuid)[i] = random_byte();
|
||||
m_sGuid = "";
|
||||
for( unsigned i=0; i<GUID_SIZE_BYTES; i++ )
|
||||
m_sGuid += ssprintf( "%hx", random_byte() );
|
||||
}
|
||||
|
||||
|
||||
@@ -93,7 +94,7 @@ void Profile::InitGeneralData()
|
||||
m_iNumExtraStagesFailed = 0;
|
||||
m_iNumToasties = 0;
|
||||
m_UnlockedSongs.clear();
|
||||
m_iLastPlayedMachineGuid = 0;
|
||||
m_sLastPlayedMachineGuid = "";
|
||||
m_iTotalTapsAndHolds = 0;
|
||||
m_iTotalJumps = 0;
|
||||
m_iTotalHolds = 0;
|
||||
@@ -164,16 +165,6 @@ CString Profile::GetDisplayName() const
|
||||
return "NoName";
|
||||
}
|
||||
|
||||
CString Profile::GetDisplayGuid() const
|
||||
{
|
||||
return ssprintf("%x",m_iGuid);
|
||||
}
|
||||
|
||||
CString Profile::GetDisplayLastPlayedMachineGuid() const
|
||||
{
|
||||
return ssprintf("%x",m_iLastPlayedMachineGuid);
|
||||
}
|
||||
|
||||
CString Profile::GetDisplayTotalCaloriesBurned() const
|
||||
{
|
||||
if( m_iWeightPounds == 0 ) // weight not entered
|
||||
@@ -493,7 +484,7 @@ bool Profile::LoadAllFromDir( CString sDir )
|
||||
|
||||
bool Profile::SaveAllToDir( CString sDir ) const
|
||||
{
|
||||
m_iLastPlayedMachineGuid = PROFILEMAN->GetMachineProfile()->m_iGuid;
|
||||
m_sLastPlayedMachineGuid = PROFILEMAN->GetMachineProfile()->m_sGuid;
|
||||
|
||||
// Save editable.xml
|
||||
SaveEditableDataToDir( sDir );
|
||||
@@ -563,7 +554,7 @@ void Profile::LoadProfileDataFromDirSM390a12( CString sDir )
|
||||
ini.GetValue( "Profile", "CurrentCombo", m_iCurrentCombo );
|
||||
ini.GetValue( "Profile", "WeightPounds", m_iWeightPounds );
|
||||
ini.GetValue( "Profile", "CaloriesBurned", m_fTotalCaloriesBurned );
|
||||
ini.GetValue( "Profile", "LastPlayedMachineGuid", m_iLastPlayedMachineGuid );
|
||||
ini.GetValue( "Profile", "LastPlayedMachineGuid", m_sLastPlayedMachineGuid );
|
||||
|
||||
unsigned i;
|
||||
for( i=0; i<NUM_PLAY_MODES; i++ )
|
||||
@@ -594,7 +585,7 @@ XNode* Profile::SaveGeneralDataCreateNode() const
|
||||
XNode* pGeneralDataNode = new XNode;
|
||||
pGeneralDataNode->name = "GeneralData";
|
||||
|
||||
pGeneralDataNode->AppendChild( "Guid", m_iGuid );
|
||||
pGeneralDataNode->AppendChild( "Guid", m_sGuid );
|
||||
pGeneralDataNode->AppendChild( "UsingProfileDefaultModifiers", m_bUsingProfileDefaultModifiers );
|
||||
pGeneralDataNode->AppendChild( "DefaultModifiers", m_sDefaultModifiers );
|
||||
pGeneralDataNode->AppendChild( "SortOrder", SortOrderToString(m_SortOrder) );
|
||||
@@ -606,7 +597,7 @@ XNode* Profile::SaveGeneralDataCreateNode() const
|
||||
pGeneralDataNode->AppendChild( "TotalGameplaySeconds", m_iTotalGameplaySeconds );
|
||||
pGeneralDataNode->AppendChild( "CurrentCombo", m_iCurrentCombo );
|
||||
pGeneralDataNode->AppendChild( "TotalCaloriesBurned", m_fTotalCaloriesBurned );
|
||||
pGeneralDataNode->AppendChild( "LastPlayedMachineGuid", m_iLastPlayedMachineGuid );
|
||||
pGeneralDataNode->AppendChild( "LastPlayedMachineGuid", m_sLastPlayedMachineGuid );
|
||||
pGeneralDataNode->AppendChild( "TotalDancePoints", m_iTotalDancePoints );
|
||||
pGeneralDataNode->AppendChild( "NumExtraStagesPassed", m_iNumExtraStagesPassed );
|
||||
pGeneralDataNode->AppendChild( "NumExtraStagesFailed", m_iNumExtraStagesFailed );
|
||||
@@ -735,7 +726,7 @@ void Profile::LoadGeneralDataFromNode( const XNode* pNode )
|
||||
|
||||
CString s;
|
||||
|
||||
pNode->GetChildValue( "Guid", m_iGuid );
|
||||
pNode->GetChildValue( "Guid", m_sGuid );
|
||||
pNode->GetChildValue( "UsingProfileDefaultModifiers", m_bUsingProfileDefaultModifiers );
|
||||
pNode->GetChildValue( "DefaultModifiers", m_sDefaultModifiers );
|
||||
pNode->GetChildValue( "SortOrder", s ); m_SortOrder = StringToSortOrder( s );
|
||||
@@ -747,7 +738,7 @@ void Profile::LoadGeneralDataFromNode( const XNode* pNode )
|
||||
pNode->GetChildValue( "TotalGameplaySeconds", m_iTotalGameplaySeconds );
|
||||
pNode->GetChildValue( "CurrentCombo", m_iCurrentCombo );
|
||||
pNode->GetChildValue( "TotalCaloriesBurned", m_fTotalCaloriesBurned );
|
||||
pNode->GetChildValue( "LastPlayedMachineGuid", m_iLastPlayedMachineGuid );
|
||||
pNode->GetChildValue( "LastPlayedMachineGuid", m_sLastPlayedMachineGuid );
|
||||
pNode->GetChildValue( "TotalDancePoints", m_iTotalDancePoints );
|
||||
pNode->GetChildValue( "NumExtraStagesPassed", m_iNumExtraStagesPassed );
|
||||
pNode->GetChildValue( "NumExtraStagesFailed", m_iNumExtraStagesFailed );
|
||||
@@ -1560,7 +1551,7 @@ void Profile::LoadScreenshotDataFromNode( const XNode* pNode )
|
||||
if( !(*screenshot)->GetChildValue("Time",(int&)ss.time) ) // time_t is a signed long on Win32. Is this ok on other platforms?
|
||||
WARN;
|
||||
|
||||
if( !(*screenshot)->GetChildValue("MachineGuid",ss.iMachineGuid) )
|
||||
if( !(*screenshot)->GetChildValue("MachineGuid",ss.sMachineGuid) )
|
||||
WARN;
|
||||
|
||||
m_vScreenshots.push_back( ss );
|
||||
@@ -1586,7 +1577,7 @@ XNode* Profile::SaveScreenshotDataCreateNode() const
|
||||
pScreenshotNode->AppendChild( "FileName", ss.sFileName );
|
||||
pScreenshotNode->AppendChild( "MD5", ss.sMD5 );
|
||||
pScreenshotNode->AppendChild( "Time", (int) ss.time );
|
||||
pScreenshotNode->AppendChild( "MachineGuid", ss.iMachineGuid );
|
||||
pScreenshotNode->AppendChild( "MachineGuid", ss.sMachineGuid );
|
||||
}
|
||||
|
||||
return pNode;
|
||||
|
||||
@@ -67,8 +67,6 @@ public:
|
||||
// smart accessors
|
||||
//
|
||||
CString GetDisplayName() const;
|
||||
CString GetDisplayGuid() const;
|
||||
CString GetDisplayLastPlayedMachineGuid() const;
|
||||
CString GetDisplayTotalCaloriesBurned() const;
|
||||
int GetTotalNumSongsPlayed() const;
|
||||
int GetTotalNumSongsPassed() const;
|
||||
@@ -88,7 +86,7 @@ public:
|
||||
//
|
||||
// General data
|
||||
//
|
||||
Sint32 m_iGuid;
|
||||
CString m_sGuid;
|
||||
bool m_bUsingProfileDefaultModifiers;
|
||||
CString m_sDefaultModifiers;
|
||||
SortOrder m_SortOrder;
|
||||
@@ -110,7 +108,7 @@ public:
|
||||
int m_iTotalMines;
|
||||
int m_iTotalHands;
|
||||
set<int> m_UnlockedSongs;
|
||||
mutable Sint32 m_iLastPlayedMachineGuid; // mutable because we overwrite this on save, and I don't want to remove const from the whole save chain. -Chris
|
||||
mutable CString m_sLastPlayedMachineGuid; // 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];
|
||||
int m_iNumSongsPlayedByStyle[NUM_STYLES];
|
||||
int m_iNumSongsPlayedByDifficulty[NUM_DIFFICULTIES];
|
||||
@@ -172,7 +170,7 @@ public:
|
||||
CString sFileName; // no directory part - just the file name
|
||||
CString sMD5; // MD5 hash of the screenshot file
|
||||
time_t time; // return value of time() when screenshot was taken
|
||||
Sint32 iMachineGuid; // where this screenshot was taken
|
||||
CString sMachineGuid; // where this screenshot was taken
|
||||
};
|
||||
vector<Screenshot> m_vScreenshots;
|
||||
void AddScreenshot( Screenshot screenshot );
|
||||
|
||||
@@ -271,7 +271,7 @@ void PrintStatistics( RageFile &f, const Profile *pProfile, CString sTitle, vect
|
||||
{
|
||||
BEGIN_TABLE(2);
|
||||
TABLE_LINE2( "DisplayName", pProfile->m_sDisplayName );
|
||||
TABLE_LINE2( "ID", pProfile->GetDisplayGuid() );
|
||||
TABLE_LINE2( "ID", pProfile->m_sGuid );
|
||||
TABLE_LINE2( "LastUsedHighScoreName", pProfile->m_sLastUsedHighScoreName );
|
||||
TABLE_LINE2( "UsingProfileDefaultModifiers", pProfile->m_bUsingProfileDefaultModifiers );
|
||||
TABLE_LINE2( "DefaultModifiers", pProfile->m_sDefaultModifiers );
|
||||
@@ -280,7 +280,7 @@ void PrintStatistics( RageFile &f, const Profile *pProfile, CString sTitle, vect
|
||||
TABLE_LINE2( "TotalGameplay", SecondsToHHMMSS( (float) pProfile->m_iTotalGameplaySeconds) );
|
||||
TABLE_LINE2( "CurrentCombo", pProfile->m_iCurrentCombo );
|
||||
TABLE_LINE2( "TotalCaloriesBurned", pProfile->GetDisplayTotalCaloriesBurned() );
|
||||
TABLE_LINE2( "LastPlayedMachineID", pProfile->GetDisplayLastPlayedMachineGuid() );
|
||||
TABLE_LINE2( "LastPlayedMachineID", pProfile->m_sGuid );
|
||||
TABLE_LINE2( "TotalTapsAndHolds", pProfile->m_iTotalTapsAndHolds );
|
||||
TABLE_LINE2( "TotalJumps", pProfile->m_iTotalJumps );
|
||||
TABLE_LINE2( "TotalHolds", pProfile->m_iTotalHolds );
|
||||
@@ -922,7 +922,7 @@ void PrintScreenshot( RageFile &f, const Profile::Screenshot &ss )
|
||||
TABLE_LINE2( "File", ss.sFileName );
|
||||
TABLE_LINE2( "MD5", ss.sMD5 );
|
||||
TABLE_LINE2( "Time", (CString)ctime(&ss.time) );
|
||||
TABLE_LINE2( "Machine", ss.iMachineGuid );
|
||||
TABLE_LINE2( "Machine", ss.sMachineGuid );
|
||||
|
||||
END_TABLE;
|
||||
|
||||
@@ -1135,7 +1135,7 @@ TITLE.c_str(), STYLE_CSS.c_str() ) );
|
||||
}
|
||||
|
||||
CString sName = pProfile->GetDisplayName();
|
||||
CString sMachineName = pProfile->GetDisplayLastPlayedMachineGuid();
|
||||
CString sMachineName = pProfile->m_sGuid;
|
||||
time_t ltime = time( NULL );
|
||||
CString sTime = ctime( <ime );
|
||||
|
||||
|
||||
@@ -129,7 +129,7 @@ void ScreenAward::Input( const DeviceInput& DeviceI, const InputEventType type,
|
||||
screenshot.sFileName = sFileName;
|
||||
screenshot.sMD5 = CRYPTMAN->GetMD5( sPath );
|
||||
screenshot.time = time(NULL);
|
||||
screenshot.iMachineGuid = PROFILEMAN->GetMachineProfile()->m_iGuid;
|
||||
screenshot.sMachineGuid = PROFILEMAN->GetMachineProfile()->m_sGuid;
|
||||
pProfile->AddScreenshot( screenshot );
|
||||
}
|
||||
|
||||
|
||||
@@ -1451,7 +1451,7 @@ void ScreenEvaluation::Input( const DeviceInput& DeviceI, const InputEventType t
|
||||
screenshot.sFileName = sFileName;
|
||||
screenshot.sMD5 = CRYPTMAN->GetMD5( sPath );
|
||||
screenshot.time = time(NULL);
|
||||
screenshot.iMachineGuid = PROFILEMAN->GetMachineProfile()->m_iGuid;
|
||||
screenshot.sMachineGuid = PROFILEMAN->GetMachineProfile()->m_sGuid;
|
||||
pProfile->AddScreenshot( screenshot );
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user