Show message when a Profile load fails so that the player doesn't accidentally save over their possibly-good data.

Save a copy of Stats.xml to the memory card after a successful load.  I have seen one instance where the digital signature on save is bogus, and there's no way for the player to recover their data.
Update Stats.xsl text help text.
This commit is contained in:
Chris Danford
2004-10-06 08:39:38 +00:00
parent 12c21c302c
commit ebb9e730a4
6 changed files with 128 additions and 77 deletions
+20 -1
View File
@@ -41,7 +41,10 @@ ProfileManager::~ProfileManager()
void ProfileManager::Init()
{
FOREACH_PlayerNumber( p )
{
m_bWasLoadedFromMemoryCard[p] = false;
m_bLastLoadWasTamperedOrCorrupt[p] = false;
}
LoadMachineProfile();
}
@@ -79,8 +82,18 @@ bool ProfileManager::LoadProfile( PlayerNumber pn, CString sProfileDir, bool bIs
m_sProfileDir[pn] = sProfileDir;
m_bWasLoadedFromMemoryCard[pn] = bIsMemCard;
bool bSuccess = m_Profile[pn].LoadAllFromDir( m_sProfileDir[pn], PREFSMAN->m_bSignProfileData );
m_Profile[pn].LoadAllFromDir( m_sProfileDir[pn], PREFSMAN->m_bSignProfileData );
m_bLastLoadWasTamperedOrCorrupt[pn] = !bSuccess;
// Save a backup of the profile now that we've loaded it and know it's good.
// This should be reasonably fast because we're only saving Stats.xml and
// signatures - not all of the files in the Profile.
if( bSuccess )
{
CString sBackupDir = m_sProfileDir[pn] + "LastGood/";
m_Profile[pn].SaveStatsXmlToDir( sBackupDir, PREFSMAN->m_bSignProfileData );
}
if( bIsMemCard )
MEMCARDMAN->UnPauseMountingThread();
@@ -206,6 +219,7 @@ void ProfileManager::UnloadProfile( PlayerNumber pn )
{
m_sProfileDir[pn] = "";
m_bWasLoadedFromMemoryCard[pn] = false;
m_bLastLoadWasTamperedOrCorrupt[pn] = false;
m_Profile[pn].InitAll();
}
@@ -320,6 +334,11 @@ bool ProfileManager::ProfileWasLoadedFromMemoryCard( PlayerNumber pn ) const
return GetProfile(pn) && m_bWasLoadedFromMemoryCard[pn];
}
bool ProfileManager::LastLoadWasTamperedOrCorrupt( PlayerNumber pn ) const
{
return GetProfile(pn) && m_bLastLoadWasTamperedOrCorrupt[pn];
}
CString ProfileManager::GetProfileDir( ProfileSlot slot ) const
{
switch( slot )