Profile HTML fixes
This commit is contained in:
@@ -4262,4 +4262,6 @@ LevelP1OnCommand=addy,-140
|
||||
LevelP2OnCommand=addy,-140
|
||||
|
||||
[ProfileManager]
|
||||
StatsTitle=StepMania Statistics
|
||||
StatsTitle=StepMania Data
|
||||
StatsFooter=generated by <a href='http://www.stepmania.com'>StepMania</a>
|
||||
StatsURL=
|
||||
|
||||
@@ -1056,20 +1056,20 @@ void SortCoursePointerArrayByAvgDifficulty( vector<Course*> &apCourses )
|
||||
}
|
||||
|
||||
|
||||
void SortCoursePointerArrayByMostPlayed( vector<Course*> &arrayCoursePointers, ProfileSlot slot )
|
||||
void SortCoursePointerArrayByNumPlays( vector<Course*> &arrayCoursePointers, ProfileSlot slot, bool bDescending )
|
||||
{
|
||||
Profile* pProfile = PROFILEMAN->GetProfile(slot);
|
||||
if( pProfile == NULL )
|
||||
return; // nothing to do since we don't have data
|
||||
SortCoursePointerArrayByMostPlayed( arrayCoursePointers, pProfile );
|
||||
SortCoursePointerArrayByNumPlays( arrayCoursePointers, pProfile, bDescending );
|
||||
}
|
||||
|
||||
void SortCoursePointerArrayByMostPlayed( vector<Course*> &arrayCoursePointers, const Profile* pProfile )
|
||||
void SortCoursePointerArrayByNumPlays( vector<Course*> &arrayCoursePointers, const Profile* pProfile, bool bDescending )
|
||||
{
|
||||
ASSERT( pProfile );
|
||||
for(unsigned i = 0; i < arrayCoursePointers.size(); ++i)
|
||||
course_sort_val[arrayCoursePointers[i]] = (float) pProfile->GetCourseNumTimesPlayed(arrayCoursePointers[i]);
|
||||
stable_sort( arrayCoursePointers.begin(), arrayCoursePointers.end(), CompareCoursePointersBySortValueDescending );
|
||||
stable_sort( arrayCoursePointers.begin(), arrayCoursePointers.end(), bDescending ? CompareCoursePointersBySortValueDescending : CompareCoursePointersBySortValueAscending );
|
||||
course_sort_val.clear();
|
||||
}
|
||||
|
||||
|
||||
@@ -166,8 +166,8 @@ void SortCoursePointerArrayByType( vector<Course*> &apCourses );
|
||||
void SortCoursePointerArrayByAvgDifficulty( vector<Course*> &apCourses );
|
||||
void SortCoursePointerArrayByTotalDifficulty( vector<Course*> &apCourses );
|
||||
void SortCoursePointerArrayByRanking( vector<Course*> &apCourses );
|
||||
void SortCoursePointerArrayByMostPlayed( vector<Course*> &arrayCoursePointers, ProfileSlot slot );
|
||||
void SortCoursePointerArrayByMostPlayed( vector<Course*> &arrayCoursePointers, const Profile* pProfile );
|
||||
void SortCoursePointerArrayByNumPlays( vector<Course*> &arrayCoursePointers, ProfileSlot slot, bool bDescending );
|
||||
void SortCoursePointerArrayByNumPlays( vector<Course*> &arrayCoursePointers, const Profile* pProfile, bool bDescending );
|
||||
|
||||
void MoveRandomToEnd( vector<Course*> &apCourses );
|
||||
|
||||
|
||||
@@ -121,3 +121,8 @@ void CryptManager::DigestFile(const char *filename)
|
||||
// cout << "\nMD5: ";
|
||||
// md5Filter.TransferTo(encoder);
|
||||
}
|
||||
|
||||
CString CryptManager::GetPublicKeyFileName()
|
||||
{
|
||||
return PUBLIC_KEY_PATH;
|
||||
}
|
||||
|
||||
@@ -13,6 +13,8 @@ public:
|
||||
static bool VerifyFile( CString sPath );
|
||||
|
||||
static void DigestFile(const char *filename);
|
||||
|
||||
static CString GetPublicKeyFileName();
|
||||
};
|
||||
|
||||
extern CryptManager* CRYPTMAN; // global and accessable from anywhere in our program
|
||||
|
||||
@@ -266,7 +266,7 @@ void GameState::EndGame()
|
||||
CHECKPOINT;
|
||||
|
||||
BOOKKEEPER->WriteToDisk();
|
||||
PROFILEMAN->SaveMachineScoresToDisk();
|
||||
PROFILEMAN->SaveMachineProfile();
|
||||
|
||||
for( p=0; p<NUM_PLAYERS; p++ )
|
||||
{
|
||||
|
||||
@@ -251,6 +251,7 @@ PrefsManager::PrefsManager()
|
||||
m_bAllowUnacceleratedRenderer = false;
|
||||
m_bThreadedInput = true;
|
||||
m_bScreenTestMode = false;
|
||||
m_sMachineName = "NoName";
|
||||
m_sIgnoredMessageWindows = "";
|
||||
|
||||
m_sCoursesToShowRanking = "";
|
||||
@@ -430,6 +431,7 @@ void PrefsManager::ReadGlobalPrefsFromDisk()
|
||||
ini.GetValue( "Options", "AllowUnacceleratedRenderer", m_bAllowUnacceleratedRenderer );
|
||||
ini.GetValue( "Options", "ThreadedInput", m_bThreadedInput );
|
||||
ini.GetValue( "Options", "ScreenTestMode", m_bScreenTestMode );
|
||||
ini.GetValue( "Options", "MachineName", m_sMachineName );
|
||||
ini.GetValue( "Options", "IgnoredMessageWindows", m_sIgnoredMessageWindows );
|
||||
ini.GetValue( "Options", "SoloSingle", m_bSoloSingle );
|
||||
ini.GetValue( "Options", "DancePointsForOni", m_bDancePointsForOni );
|
||||
@@ -646,6 +648,7 @@ void PrefsManager::SaveGlobalPrefsToDisk() const
|
||||
ini.SetValue( "Options", "AllowUnacceleratedRenderer", m_bAllowUnacceleratedRenderer );
|
||||
ini.SetValue( "Options", "ThreadedInput", m_bThreadedInput );
|
||||
ini.SetValue( "Options", "ScreenTestMode", m_bScreenTestMode );
|
||||
ini.SetValue( "Options", "MachineName", m_sMachineName );
|
||||
ini.SetValue( "Options", "IgnoredMessageWindows", m_sIgnoredMessageWindows );
|
||||
ini.SetValue( "Options", "SoloSingle", m_bSoloSingle );
|
||||
ini.SetValue( "Options", "DancePointsForOni", m_bDancePointsForOni );
|
||||
|
||||
@@ -227,6 +227,7 @@ public:
|
||||
bool m_bAllowUnacceleratedRenderer;
|
||||
bool m_bThreadedInput;
|
||||
bool m_bScreenTestMode;
|
||||
CString m_sMachineName;
|
||||
|
||||
CString m_sIgnoredMessageWindows;
|
||||
|
||||
|
||||
+23
-12
@@ -66,6 +66,7 @@ void Profile::InitGeneralData()
|
||||
m_iCurrentCombo = 0;
|
||||
m_fWeightPounds = 0;
|
||||
m_fCaloriesBurned = 0;
|
||||
m_sLastMachinePlayed = "";
|
||||
|
||||
int i;
|
||||
for( i=0; i<NUM_PLAY_MODES; i++ )
|
||||
@@ -95,14 +96,14 @@ void Profile::InitCategoryScores()
|
||||
m_CategoryHighScores[st][rc].Init();
|
||||
}
|
||||
|
||||
CString Profile::GetDisplayName()
|
||||
CString Profile::GetDisplayName() const
|
||||
{
|
||||
if( !m_sName.empty() )
|
||||
return m_sName;
|
||||
else if( !m_sLastUsedHighScoreName.empty() )
|
||||
return m_sLastUsedHighScoreName;
|
||||
else
|
||||
return "NO NAME";
|
||||
return "NoName";
|
||||
}
|
||||
|
||||
CString Profile::GetDisplayCaloriesBurned()
|
||||
@@ -172,16 +173,9 @@ int Profile::GetStepsNumTimesPlayed( const Steps* pSteps ) const
|
||||
{
|
||||
std::map<const Steps*,HighScoresForASteps>::const_iterator iter = m_StepsHighScores.find( pSteps );
|
||||
if( iter == m_StepsHighScores.end() )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
int iTotalNumTimesPlayed = 0;
|
||||
for( unsigned st = 0; st < NUM_STEPS_TYPES; ++st )
|
||||
iTotalNumTimesPlayed += iter->second.hs.iNumTimesPlayed;
|
||||
return iTotalNumTimesPlayed;
|
||||
}
|
||||
return iter->second.hs.iNumTimesPlayed;
|
||||
}
|
||||
|
||||
void Profile::IncrementStepsPlayCount( const Steps* pSteps )
|
||||
@@ -294,6 +288,8 @@ bool Profile::LoadAllFromDir( CString sDir )
|
||||
|
||||
bool Profile::SaveAllToDir( CString sDir ) const
|
||||
{
|
||||
m_sLastMachinePlayed = PREFSMAN->m_sMachineName;
|
||||
|
||||
// Delete old files after saving new ones so we don't try to load old
|
||||
// and make duplicate records.
|
||||
// If the save fails, the delete will fail too... probably :-)
|
||||
@@ -305,6 +301,7 @@ bool Profile::SaveAllToDir( CString sDir ) const
|
||||
SaveCategoryScoresToDir( sDir );
|
||||
DeleteCategoryScoresFromDirSM390a12( sDir );
|
||||
SaveStatsWebPageToDir( sDir );
|
||||
SaveMachinePublicKeyToDir( sDir );
|
||||
return bResult;
|
||||
}
|
||||
|
||||
@@ -342,6 +339,9 @@ bool Profile::LoadGeneralDataFromDir( CString sDir )
|
||||
ini.GetValue( "Profile", "TotalPlaySeconds", m_iTotalPlaySeconds );
|
||||
ini.GetValue( "Profile", "TotalGameplaySeconds", m_iTotalGameplaySeconds );
|
||||
ini.GetValue( "Profile", "CurrentCombo", m_iCurrentCombo );
|
||||
ini.GetValue( "Profile", "WeightPounds", m_fWeightPounds );
|
||||
ini.GetValue( "Profile", "CaloriesBurned", m_fCaloriesBurned );
|
||||
ini.GetValue( "Profile", "LastMachinePlayed", m_sLastMachinePlayed );
|
||||
|
||||
unsigned i;
|
||||
for( i=0; i<NUM_PLAY_MODES; i++ )
|
||||
@@ -369,6 +369,9 @@ bool Profile::SaveGeneralDataToDir( CString sDir ) const
|
||||
ini.SetValue( "Profile", "TotalPlaySeconds", m_iTotalPlaySeconds );
|
||||
ini.SetValue( "Profile", "TotalGameplaySeconds", m_iTotalGameplaySeconds );
|
||||
ini.SetValue( "Profile", "CurrentCombo", m_iCurrentCombo );
|
||||
ini.SetValue( "Profile", "WeightPounds", m_fWeightPounds );
|
||||
ini.SetValue( "Profile", "CaloriesBurned", m_fCaloriesBurned );
|
||||
ini.SetValue( "Profile", "LastMachinePlayed", m_sLastMachinePlayed );
|
||||
|
||||
unsigned i;
|
||||
for( i=0; i<NUM_PLAY_MODES; i++ )
|
||||
@@ -986,13 +989,21 @@ void Profile::DeleteCategoryScoresFromDirSM390a12( CString sDir ) const
|
||||
|
||||
void Profile::SaveStatsWebPageToDir( CString sDir ) const
|
||||
{
|
||||
if( m_bIsMachineProfile )
|
||||
// UGLY...
|
||||
bool bThisIsMachineProfile = this == PROFILEMAN->GetMachineProfile();
|
||||
|
||||
if( bThisIsMachineProfile )
|
||||
{
|
||||
SaveMachineHtmlToDir( sDir, this );
|
||||
// SavePlayerHtmlToDir( sDir, this, PROFILEMAN->GetMachineProfile() ); // remove this when done debugging
|
||||
SavePlayerHtmlToDir( sDir+"temp/", this, PROFILEMAN->GetMachineProfile() ); // remove this when done debugging
|
||||
}
|
||||
else
|
||||
{
|
||||
SavePlayerHtmlToDir( sDir, this, PROFILEMAN->GetMachineProfile() );
|
||||
}
|
||||
}
|
||||
|
||||
void Profile::SaveMachinePublicKeyToDir( CString sDir ) const
|
||||
{
|
||||
FileCopy( CRYPTMAN->GetPublicKeyFileName(), "public.key.rsa" );
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ public:
|
||||
//
|
||||
// smart accessors
|
||||
//
|
||||
CString GetDisplayName();
|
||||
CString GetDisplayName() const;
|
||||
CString GetDisplayCaloriesBurned();
|
||||
int GetTotalNumSongsPlayed();
|
||||
static CString GetProfileDisplayNameFromDir( CString sDir );
|
||||
@@ -43,7 +43,6 @@ public:
|
||||
//
|
||||
// General data
|
||||
//
|
||||
bool m_bIsMachineProfile;
|
||||
CString m_sName;
|
||||
CString m_sLastUsedHighScoreName;
|
||||
bool m_bUsingProfileDefaultModifiers;
|
||||
@@ -54,6 +53,7 @@ public:
|
||||
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];
|
||||
int m_iNumSongsPlayedByStyle[NUM_STYLES];
|
||||
int m_iNumSongsPlayedByDifficulty[NUM_DIFFICULTIES];
|
||||
@@ -146,6 +146,8 @@ public:
|
||||
void DeleteCategoryScoresFromDirSM390a12( CString sDir ) const;
|
||||
|
||||
void SaveStatsWebPageToDir( CString sDir ) const;
|
||||
|
||||
void SaveMachinePublicKeyToDir( CString sDir ) const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#define STYLE_CSS "style.css"
|
||||
|
||||
#define STATS_TITLE THEME->GetMetric("ProfileManager","StatsTitle")
|
||||
#define STATS_FOOTER THEME->GetMetric("ProfileManager","StatsFooter")
|
||||
|
||||
|
||||
static int g_Level = 1;
|
||||
@@ -141,6 +142,8 @@ void PrintStatistics( RageFile &f, const Profile *pProfile, CString sTitle, vect
|
||||
TABLE_LINE2( "TotalPlaySeconds", pProfile->m_iTotalPlaySeconds );
|
||||
TABLE_LINE2( "TotalGameplaySeconds", pProfile->m_iTotalGameplaySeconds );
|
||||
TABLE_LINE2( "CurrentCombo", pProfile->m_iCurrentCombo );
|
||||
TABLE_LINE2( "CaloriesBurned", pProfile->m_fCaloriesBurned );
|
||||
TABLE_LINE2( "LastMachinePlayed", pProfile->m_sLastMachinePlayed );
|
||||
END_TABLE;
|
||||
}
|
||||
PRINT_CLOSE(f);
|
||||
@@ -201,35 +204,63 @@ void PrintPopularity( RageFile &f, const Profile *pProfile, CString sTitle, vect
|
||||
{
|
||||
PRINT_OPEN(f, sTitle );
|
||||
{
|
||||
// Songs by popularity
|
||||
{
|
||||
unsigned uNumToShow = min( vpSongs.size(), (unsigned)100 );
|
||||
SortSongPointerArrayByNumPlays( vpSongs, pProfile, true );
|
||||
Song* pSongPopularThreshold = vpSongs[ vpSongs.size()*2/3 ];
|
||||
int iPopularNumPlaysThreshold = pProfile->GetSongNumTimesPlayed(pSongPopularThreshold);
|
||||
|
||||
// unplayed songs are always considered unpopular
|
||||
if( iPopularNumPlaysThreshold == 0 )
|
||||
iPopularNumPlaysThreshold = 1;
|
||||
|
||||
SortSongPointerArrayByMostPlayed( vpSongs, pProfile );
|
||||
PRINT_OPEN(f, "Songs by Popularity" );
|
||||
unsigned uMaxToShow = min( vpSongs.size(), (unsigned)100 );
|
||||
|
||||
{
|
||||
PRINT_OPEN(f, "Most Popular Songs" );
|
||||
{
|
||||
BEGIN_TABLE(1);
|
||||
for( unsigned i=0; i<uNumToShow; i++ )
|
||||
for( unsigned i=0; i<uMaxToShow; i++ )
|
||||
{
|
||||
Song* pSong = vpSongs[i];
|
||||
TABLE_LINE3(i+1, pSong->GetFullDisplayTitle(), pProfile->GetSongNumTimesPlayed(pSong) );
|
||||
int iNumTimesPlayed = pProfile->GetSongNumTimesPlayed(pSong);
|
||||
if( iNumTimesPlayed == 0 || iNumTimesPlayed < iPopularNumPlaysThreshold ) // not popular
|
||||
break; // done searching
|
||||
TABLE_LINE3(i+1, pSong->GetFullDisplayTitle(), iNumTimesPlayed );
|
||||
}
|
||||
END_TABLE;
|
||||
}
|
||||
PRINT_CLOSE(f);
|
||||
}
|
||||
|
||||
{
|
||||
SortSongPointerArrayByNumPlays( vpSongs, pProfile, false );
|
||||
PRINT_OPEN(f, "Least Popular Songs" );
|
||||
{
|
||||
BEGIN_TABLE(1);
|
||||
for( unsigned i=0; i<uMaxToShow; i++ )
|
||||
{
|
||||
Song* pSong = vpSongs[i];
|
||||
int iNumTimesPlayed = pProfile->GetSongNumTimesPlayed(pSong);
|
||||
if( iNumTimesPlayed >= iPopularNumPlaysThreshold ) // not unpopular
|
||||
break; // done searching
|
||||
TABLE_LINE3(i+1, pSong->GetFullDisplayTitle(), iNumTimesPlayed );
|
||||
}
|
||||
END_TABLE;
|
||||
}
|
||||
PRINT_CLOSE(f);
|
||||
}
|
||||
|
||||
// Steps by popularity
|
||||
{
|
||||
unsigned uNumToShow = min( vpAllSteps.size(), (unsigned)100 );
|
||||
|
||||
SortStepsPointerArrayByMostPlayed( vpAllSteps, pProfile );
|
||||
PRINT_OPEN(f, "Steps by Popularity" );
|
||||
SortStepsPointerArrayByNumPlays( vpAllSteps, pProfile, true );
|
||||
PRINT_OPEN(f, "Most Popular Steps" );
|
||||
{
|
||||
BEGIN_TABLE(1);
|
||||
for( unsigned i=0; i<uNumToShow; i++ )
|
||||
{
|
||||
Steps* pSteps = vpAllSteps[i];
|
||||
if( pProfile->GetStepsNumTimesPlayed(pSteps)==0 )
|
||||
continue; // skip
|
||||
Song* pSong = mapStepsToSong[pSteps];
|
||||
CString s;
|
||||
s += pSong->GetFullDisplayTitle();
|
||||
@@ -244,12 +275,11 @@ void PrintPopularity( RageFile &f, const Profile *pProfile, CString sTitle, vect
|
||||
PRINT_CLOSE(f);
|
||||
}
|
||||
|
||||
// Course by popularity
|
||||
{
|
||||
unsigned uNumToShow = min( vpCourses.size(), (unsigned)100 );
|
||||
|
||||
SortCoursePointerArrayByMostPlayed( vpCourses, pProfile );
|
||||
PRINT_OPEN(f, "Courses by Popularity" );
|
||||
SortCoursePointerArrayByNumPlays( vpCourses, pProfile, true );
|
||||
PRINT_OPEN(f, "Most Popular Courses" );
|
||||
{
|
||||
BEGIN_TABLE(2);
|
||||
for( unsigned i=0; i<uNumToShow; i++ )
|
||||
@@ -321,19 +351,16 @@ void PrintStepsTypes( RageFile &f, const Profile *pProfile, CString sTitle, vect
|
||||
|
||||
void PrintHighScoresForSong( RageFile &f, const Profile *pProfile, Song* pSong )
|
||||
{
|
||||
int iNumTimesPlayed = pProfile->GetSongNumTimesPlayed(pSong);
|
||||
if( iNumTimesPlayed == 0 )
|
||||
return; // skip
|
||||
|
||||
vector<Steps*> vpSteps = pSong->GetAllSteps();
|
||||
|
||||
/* XXX: We can't call pSong->HasBanner on every song; it'll effectively re-traverse the estire
|
||||
* song directory tree checking if each banner file really exists.
|
||||
*
|
||||
* (Note for testing this: remember that we'll cache directories for a time; this is only slow if
|
||||
* the directory cache expires before we get here.) */
|
||||
/* Don't prist the song banner anyway since this is going on the memory card. -Chris */
|
||||
//CString sImagePath = pSong->HasBanner() ? pSong->GetBannerPath() : (pSong->HasBackground() ? pSong->GetBackgroundPath() : "" );
|
||||
PRINT_OPEN(f, pSong->GetFullDisplayTitle() );
|
||||
{
|
||||
BEGIN_TABLE(2);
|
||||
TABLE_LINE2( "NumTimesPlayed", pProfile->GetSongNumTimesPlayed(pSong) );
|
||||
TABLE_LINE2( "NumTimesPlayed", iNumTimesPlayed );
|
||||
END_TABLE;
|
||||
|
||||
//
|
||||
@@ -344,6 +371,9 @@ void PrintHighScoresForSong( RageFile &f, const Profile *pProfile, Song* pSong )
|
||||
Steps* pSteps = vpSteps[j];
|
||||
if( pSteps->IsAutogen() )
|
||||
continue; // skip autogen
|
||||
if( pProfile->GetStepsNumTimesPlayed(pSteps)==0 )
|
||||
continue; // skip
|
||||
|
||||
const HighScoreList &hsl = pProfile->GetStepsHighScoreList( pSteps );
|
||||
CString s =
|
||||
GAMEMAN->NotesTypeToString(pSteps->m_StepsType) +
|
||||
@@ -692,6 +722,13 @@ function expandIt(whichEl)\n\
|
||||
STATS_TITLE.c_str(), STYLE_CSS ) );
|
||||
}
|
||||
|
||||
CString sType;
|
||||
switch( saveType )
|
||||
{
|
||||
case SAVE_TYPE_PLAYER: sType = "Player: "; break;
|
||||
case SAVE_TYPE_MACHINE: sType = "Machine: "; break;
|
||||
}
|
||||
|
||||
CString sName =
|
||||
pProfile->m_sLastUsedHighScoreName.empty() ?
|
||||
pProfile->m_sName :
|
||||
@@ -700,18 +737,20 @@ STATS_TITLE.c_str(), STYLE_CSS ) );
|
||||
CString sTime = ctime( <ime );
|
||||
|
||||
f.Write( ssprintf(
|
||||
"<table border='0' cellpadding='0' cellspacing='0' width='100%%' cellspacing='5'><tr><td><h1>%s</h1></td><td>for %s<br>%s</td></tr></table>\n",
|
||||
STATS_TITLE.c_str(), sName.c_str(), sTime.c_str() ) );
|
||||
"<table border='0' cellpadding='0' cellspacing='0' width='100%%' cellspacing='5'><tr><td><h1>%s</h1></td><td>%s %s<br>%s</td></tr></table>\n",
|
||||
STATS_TITLE.c_str(), sType.c_str(), sName.c_str(), sTime.c_str() ) );
|
||||
|
||||
CString sPlayerName = pProfile->GetDisplayName();
|
||||
CString sMachineName = pProfileMachine->GetDisplayName();
|
||||
|
||||
switch( saveType )
|
||||
{
|
||||
case SAVE_TYPE_PLAYER:
|
||||
PrintStatistics( f, pProfile, "Personal Statistics", vpSongs, vpAllSteps, vStepsTypesToShow, mapStepsToSong, vpCourses );
|
||||
PrintPopularity( f, pProfile, "Personal Popularity", vpSongs, vpAllSteps, vStepsTypesToShow, mapStepsToSong, vpCourses );
|
||||
PrintHighScores( f, pProfile, "Personal High Scores", vpSongs, vpAllSteps, vStepsTypesToShow, mapStepsToSong, vpCourses );
|
||||
PrintPopularity( f, pProfileMachine, "Last Machine Popularity", vpSongs, vpAllSteps, vStepsTypesToShow, mapStepsToSong, vpCourses );
|
||||
PrintHighScores( f, pProfileMachine, "Last Machine High Scores", vpSongs, vpAllSteps, vStepsTypesToShow, mapStepsToSong, vpCourses );
|
||||
PrintStatistics( f, pProfile, sPlayerName+"'s Statistics", vpSongs, vpAllSteps, vStepsTypesToShow, mapStepsToSong, vpCourses );
|
||||
PrintPopularity( f, pProfile, sPlayerName+"'s Popularity", vpSongs, vpAllSteps, vStepsTypesToShow, mapStepsToSong, vpCourses );
|
||||
PrintHighScores( f, pProfile, sPlayerName+"'s High Scores", vpSongs, vpAllSteps, vStepsTypesToShow, mapStepsToSong, vpCourses );
|
||||
PrintPopularity( f, pProfileMachine, sMachineName+"'s Popularity", vpSongs, vpAllSteps, vStepsTypesToShow, mapStepsToSong, vpCourses );
|
||||
PrintHighScores( f, pProfileMachine, sMachineName+"'s High Scores", vpSongs, vpAllSteps, vStepsTypesToShow, mapStepsToSong, vpCourses );
|
||||
break;
|
||||
case SAVE_TYPE_MACHINE:
|
||||
PrintStatistics( f, pProfile, "Statistics", vpSongs, vpAllSteps, vStepsTypesToShow, mapStepsToSong, vpCourses );
|
||||
@@ -725,6 +764,8 @@ STATS_TITLE.c_str(), STYLE_CSS ) );
|
||||
ASSERT(0);
|
||||
}
|
||||
|
||||
f.PutLine( ssprintf("<p class='footer'>%s</p>\n", STATS_FOOTER.c_str()) );
|
||||
|
||||
f.PutLine( "</body>" );
|
||||
f.PutLine( "</html>" );
|
||||
|
||||
|
||||
@@ -56,12 +56,12 @@ ProfileManager::ProfileManager()
|
||||
for( int p=0; p<NUM_PLAYERS; p++ )
|
||||
m_bWasLoadedFromMemoryCard[p] = false;
|
||||
|
||||
InitMachineScoresFromDisk();
|
||||
LoadMachineProfile();
|
||||
}
|
||||
|
||||
ProfileManager::~ProfileManager()
|
||||
{
|
||||
SaveMachineScoresToDisk();
|
||||
SaveMachineProfile();
|
||||
}
|
||||
|
||||
void ProfileManager::GetLocalProfileIDs( vector<CString> &asProfileIDsOut )
|
||||
@@ -290,15 +290,20 @@ bool ProfileManager::DeleteLocalProfile( CString sProfileID )
|
||||
return FILEMAN->Remove( sProfileDir );
|
||||
}
|
||||
|
||||
void ProfileManager::SaveMachineScoresToDisk() const
|
||||
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.SaveAllToDir( MACHINE_PROFILE_DIR );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void ProfileManager::InitMachineScoresFromDisk()
|
||||
void ProfileManager::LoadMachineProfile()
|
||||
{
|
||||
// read old style notes scores
|
||||
// ReadSM300NoteScores();
|
||||
@@ -308,6 +313,9 @@ void ProfileManager::InitMachineScoresFromDisk()
|
||||
CreateProfile(MACHINE_PROFILE_DIR, "Machine");
|
||||
m_MachineProfile.LoadAllFromDir( MACHINE_PROFILE_DIR );
|
||||
}
|
||||
|
||||
// If the machine name has changed, make sure we use the new name
|
||||
m_MachineProfile.m_sName = PREFSMAN->m_sMachineName;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -38,6 +38,10 @@ public:
|
||||
bool SaveProfile( PlayerNumber pn );
|
||||
void UnloadProfile( PlayerNumber pn );
|
||||
|
||||
//
|
||||
// High scores
|
||||
//
|
||||
void LoadMachineProfile();
|
||||
void SaveMachineProfile();
|
||||
|
||||
bool IsUsingProfile( PlayerNumber pn ) { return !m_sProfileDir[pn].empty(); }
|
||||
@@ -67,11 +71,6 @@ public:
|
||||
bool ProfileWasLoadedFromMemoryCard( PlayerNumber pn );
|
||||
|
||||
|
||||
//
|
||||
// High scores
|
||||
//
|
||||
void InitMachineScoresFromDisk();
|
||||
void SaveMachineScoresToDisk() const;
|
||||
|
||||
//
|
||||
// Song stats
|
||||
|
||||
@@ -1300,7 +1300,7 @@ void ScreenEvaluation::Input( const DeviceInput& DeviceI, const InputEventType t
|
||||
/* XXX: What's the difference between this and StyleI.player? */
|
||||
/* StyleI won't be valid if it's a menu button that's pressed.
|
||||
* There's got to be a better way of doing this. -Chris */
|
||||
CString sDir = PROFILEMAN->GetProfileDir((ProfileSlot)pn);
|
||||
CString sDir = PROFILEMAN->GetProfileDir((ProfileSlot)pn) + "Screenshots/";
|
||||
SaveScreenshot( sDir, true, true );
|
||||
m_bSavedScreenshot[pn] = true;
|
||||
return; // handled
|
||||
|
||||
@@ -1367,20 +1367,20 @@ bool CompareSongPointersBySortValueDescending(const Song *pSong1, const Song *pS
|
||||
return song_sort_val[pSong1] > song_sort_val[pSong2];
|
||||
}
|
||||
|
||||
void SortSongPointerArrayByMostPlayed( vector<Song*> &arraySongPointers, ProfileSlot slot )
|
||||
void SortSongPointerArrayByNumPlays( vector<Song*> &arraySongPointers, ProfileSlot slot, bool bDescending )
|
||||
{
|
||||
Profile* pProfile = PROFILEMAN->GetProfile(slot);
|
||||
if( pProfile == NULL )
|
||||
return; // nothing to do since we don't have data
|
||||
SortSongPointerArrayByMostPlayed( arraySongPointers, pProfile );
|
||||
SortSongPointerArrayByNumPlays( arraySongPointers, pProfile, bDescending );
|
||||
}
|
||||
|
||||
void SortSongPointerArrayByMostPlayed( vector<Song*> &arraySongPointers, const Profile* pProfile )
|
||||
void SortSongPointerArrayByNumPlays( vector<Song*> &arraySongPointers, const Profile* pProfile, bool bDescending )
|
||||
{
|
||||
ASSERT( pProfile );
|
||||
for(unsigned i = 0; i < arraySongPointers.size(); ++i)
|
||||
song_sort_val[arraySongPointers[i]] = ssprintf("%9i", pProfile->GetSongNumTimesPlayed(arraySongPointers[i]));
|
||||
stable_sort( arraySongPointers.begin(), arraySongPointers.end(), CompareSongPointersBySortValueDescending );
|
||||
stable_sort( arraySongPointers.begin(), arraySongPointers.end(), bDescending ? CompareSongPointersBySortValueDescending : CompareSongPointersBySortValueAscending );
|
||||
song_sort_val.clear();
|
||||
}
|
||||
|
||||
|
||||
@@ -104,7 +104,9 @@ void SongManager::Reload()
|
||||
{
|
||||
FlushDirCache();
|
||||
|
||||
PROFILEMAN->SaveMachineScoresToDisk();
|
||||
// save scores before unloading songs, of the scores will be lost
|
||||
PROFILEMAN->SaveMachineProfile();
|
||||
|
||||
FreeSongs();
|
||||
FreeCourses();
|
||||
|
||||
@@ -118,7 +120,9 @@ void SongManager::Reload()
|
||||
InitSongsFromDisk(NULL);
|
||||
InitCoursesFromDisk(NULL);
|
||||
InitAutogenCourses();
|
||||
PROFILEMAN->InitMachineScoresFromDisk();
|
||||
|
||||
// reload scores afterward
|
||||
PROFILEMAN->LoadMachineProfile();
|
||||
|
||||
PREFSMAN->m_bFastLoad = OldVal;
|
||||
}
|
||||
@@ -870,10 +874,10 @@ void SongManager::UpdateBestAndShuffled()
|
||||
for( int i = 0; i < NUM_PROFILE_SLOTS; ++i )
|
||||
{
|
||||
m_pBestSongs[i] = m_pSongs;
|
||||
SortSongPointerArrayByMostPlayed( m_pBestSongs[i], (ProfileSlot) i );
|
||||
SortSongPointerArrayByNumPlays( m_pBestSongs[i], (ProfileSlot) i, true );
|
||||
|
||||
m_pBestCourses[i] = m_pCourses;
|
||||
SortCoursePointerArrayByMostPlayed( m_pBestCourses[i], (ProfileSlot) i );
|
||||
SortCoursePointerArrayByNumPlays( m_pBestCourses[i], (ProfileSlot) i, true );
|
||||
}
|
||||
|
||||
// update shuffled
|
||||
|
||||
@@ -1191,7 +1191,7 @@ bool HandleGlobalInputs( DeviceInput DeviceI, InputEventType type, GameInput Gam
|
||||
// HACK: Also save bookkeeping and profile info for debugging
|
||||
// so we don't have to play through a whole song to get new output.
|
||||
BOOKKEEPER->WriteToDisk();
|
||||
PROFILEMAN->SaveMachineScoresToDisk();
|
||||
PROFILEMAN->SaveMachineProfile();
|
||||
|
||||
/* If we're in screen test mode, reload the screen. */
|
||||
if( PREFSMAN->m_bScreenTestMode )
|
||||
|
||||
@@ -328,20 +328,20 @@ bool CompareStepsPointersBySortValueDescending(const Steps *pSteps1, const Steps
|
||||
return steps_sort_val[pSteps1] > steps_sort_val[pSteps2];
|
||||
}
|
||||
|
||||
void SortStepsPointerArrayByMostPlayed( vector<Steps*> &vStepsPointers, ProfileSlot slot )
|
||||
void SortStepsPointerArrayByNumPlays( vector<Steps*> &vStepsPointers, ProfileSlot slot, bool bDescending )
|
||||
{
|
||||
Profile* pProfile = PROFILEMAN->GetProfile(slot);
|
||||
if( pProfile == NULL )
|
||||
return; // nothing to do since we don't have data
|
||||
SortStepsPointerArrayByMostPlayed( vStepsPointers, pProfile );
|
||||
SortStepsPointerArrayByNumPlays( vStepsPointers, pProfile, bDescending );
|
||||
}
|
||||
|
||||
void SortStepsPointerArrayByMostPlayed( vector<Steps*> &vStepsPointers, const Profile* pProfile )
|
||||
void SortStepsPointerArrayByNumPlays( vector<Steps*> &vStepsPointers, const Profile* pProfile, bool bDecending )
|
||||
{
|
||||
ASSERT( pProfile );
|
||||
for(unsigned i = 0; i < vStepsPointers.size(); ++i)
|
||||
steps_sort_val[vStepsPointers[i]] = ssprintf("%9i", pProfile->GetStepsNumTimesPlayed(vStepsPointers[i]));
|
||||
stable_sort( vStepsPointers.begin(), vStepsPointers.end(), CompareStepsPointersBySortValueDescending );
|
||||
stable_sort( vStepsPointers.begin(), vStepsPointers.end(), bDecending ? CompareStepsPointersBySortValueDescending : CompareStepsPointersBySortValueAscending );
|
||||
steps_sort_val.clear();
|
||||
}
|
||||
|
||||
|
||||
@@ -90,7 +90,7 @@ bool CompareNotesPointersByDifficulty(const Steps *pNotes1, const Steps *pNotes2
|
||||
void SortNotesArrayByDifficulty( vector<Steps*> &arrayNotess );
|
||||
bool CompareStepsPointersByTypeAndDifficulty(const Steps *pStep1, const Steps *pStep2);
|
||||
void SortStepsByTypeAndDifficulty( vector<Steps*> &arraySongPointers );
|
||||
void SortStepsPointerArrayByMostPlayed( vector<Steps*> &vStepsPointers, ProfileSlot slot );
|
||||
void SortStepsPointerArrayByMostPlayed( vector<Steps*> &vStepsPointers, const Profile* pProfile );
|
||||
void SortStepsPointerArrayByNumPlays( vector<Steps*> &vStepsPointers, ProfileSlot slot, bool bDescending );
|
||||
void SortStepsPointerArrayByNumPlays( vector<Steps*> &vStepsPointers, const Profile* pProfile, bool bDescending );
|
||||
|
||||
#endif
|
||||
|
||||
@@ -210,8 +210,8 @@ void SortSongPointerArrayByGrade( vector<Song*> &arraySongPointers );
|
||||
void SortSongPointerArrayByArtist( vector<Song*> &arraySongPointers );
|
||||
void SortSongPointerArrayByGroupAndDifficulty( vector<Song*> &arraySongPointers );
|
||||
void SortSongPointerArrayByGroupAndTitle( vector<Song*> &arraySongPointers );
|
||||
void SortSongPointerArrayByMostPlayed( vector<Song*> &arraySongPointers, ProfileSlot slot );
|
||||
void SortSongPointerArrayByMostPlayed( vector<Song*> &arraySongPointers, const Profile* pProfile );
|
||||
void SortSongPointerArrayByNumPlays( vector<Song*> &arraySongPointers, ProfileSlot slot, bool bDescending );
|
||||
void SortSongPointerArrayByNumPlays( vector<Song*> &arraySongPointers, const Profile* pProfile, bool bDescending );
|
||||
void SortSongPointerArrayByMeter( vector<Song*> &arraySongPointers, Difficulty dc );
|
||||
CString GetSectionNameFromSongAndSort( const Song* pSong, SongSortOrder so );
|
||||
void SortSongPointerArrayBySectionName( vector<Song*> &arraySongPointers, SongSortOrder so );
|
||||
|
||||
Reference in New Issue
Block a user