never sign machine profiles

This commit is contained in:
Glenn Maynard
2004-04-20 00:07:17 +00:00
parent f116061b9f
commit 70958ad3cb
4 changed files with 16 additions and 15 deletions
+4 -4
View File
@@ -446,7 +446,7 @@ int g_iOnceCtr;
#define FOR_ONCE for(g_iOnceCtr=0;g_iOnceCtr<1;g_iOnceCtr++)
bool Profile::LoadAllFromDir( CString sDir )
bool Profile::LoadAllFromDir( CString sDir, bool bRequireSignature )
{
CHECKPOINT;
@@ -483,7 +483,7 @@ bool Profile::LoadAllFromDir( CString sDir )
break;
}
if( PREFSMAN->m_bSignProfileData )
if( bRequireSignature )
{
CString sStatsXmlSigFile = fn+SIGNATURE_APPEND;
CString sDontShareFile = sDir + DONT_SHARE_SIG;
@@ -526,7 +526,7 @@ bool Profile::LoadAllFromDir( CString sDir )
return true; // FIXME? Investigate what happens if we always return true.
}
bool Profile::SaveAllToDir( CString sDir ) const
bool Profile::SaveAllToDir( CString sDir, bool bSignData ) const
{
m_sLastPlayedMachineGuid = PROFILEMAN->GetMachineProfile()->m_sGuid;
@@ -547,7 +547,7 @@ bool Profile::SaveAllToDir( CString sDir ) const
xml.AppendChild( SaveCalorieDataCreateNode() );
xml.AppendChild( SaveAwardsCreateNode() );
bool bSaved = xml.SaveToFile(fn);
if( bSaved && PREFSMAN->m_bSignProfileData )
if( bSaved && bSignData )
{
CString sStatsXmlSigFile = fn+SIGNATURE_APPEND;
CryptManager::SignFileToFile(fn, sStatsXmlSigFile);
+2 -2
View File
@@ -263,8 +263,8 @@ public:
//
// Loading and saving
//
bool LoadAllFromDir( CString sDir ); // return false on
bool SaveAllToDir( CString sDir ) const;
bool LoadAllFromDir( CString sDir, bool bRequireSignature ); // return false on error
bool SaveAllToDir( CString sDir, bool bSignData ) const;
void LoadProfileDataFromDirSM390a12( CString sDir );
void LoadSongScoresFromDirSM390a12( CString sDir );
+8 -8
View File
@@ -93,7 +93,7 @@ bool ProfileManager::LoadProfile( PlayerNumber pn, CString sProfileDir, bool bIs
if( bLoadNamesOnly )
m_Profile[pn].LoadEditableDataFromDir( m_sProfileDir[pn] );
else
m_Profile[pn].LoadAllFromDir( m_sProfileDir[pn] );
m_Profile[pn].LoadAllFromDir( m_sProfileDir[pn], PREFSMAN->m_bSignProfileData );
return true;
}
@@ -104,7 +104,7 @@ bool ProfileManager::CreateProfile( CString sProfileDir, CString sName )
Profile pro;
pro.m_sDisplayName = sName;
bResult = pro.SaveAllToDir( sProfileDir );
bResult = pro.SaveAllToDir( sProfileDir, PREFSMAN->m_bSignProfileData );
if( !bResult )
return false;
@@ -186,7 +186,7 @@ bool ProfileManager::SaveProfile( PlayerNumber pn ) const
if( m_sProfileDir[pn].empty() )
return false;
return m_Profile[pn].SaveAllToDir( m_sProfileDir[pn] );
return m_Profile[pn].SaveAllToDir( m_sProfileDir[pn], PREFSMAN->m_bSignProfileData );
}
void ProfileManager::UnloadProfile( PlayerNumber pn )
@@ -249,11 +249,11 @@ bool ProfileManager::RenameLocalProfile( CString sProfileID, CString sNewName )
Profile pro;
bool bResult;
bResult = pro.LoadAllFromDir( sProfileDir );
bResult = pro.LoadAllFromDir( sProfileDir, PREFSMAN->m_bSignProfileData );
if( !bResult )
return false;
pro.m_sDisplayName = sNewName;
bResult = pro.SaveAllToDir( sProfileDir );
bResult = pro.SaveAllToDir( sProfileDir, PREFSMAN->m_bSignProfileData );
if( !bResult )
return false;
@@ -280,7 +280,7 @@ void ProfileManager::SaveMachineProfile()
// are saved, so that the Player's profiles show the right machine name.
m_MachineProfile.m_sDisplayName = PREFSMAN->m_sMachineName;
m_MachineProfile.SaveAllToDir( MACHINE_PROFILE_DIR );
m_MachineProfile.SaveAllToDir( MACHINE_PROFILE_DIR, false ); /* don't sign machine profiles */
}
@@ -291,10 +291,10 @@ void ProfileManager::LoadMachineProfile()
// read old style notes scores
// ReadSM300NoteScores();
if( !m_MachineProfile.LoadAllFromDir(MACHINE_PROFILE_DIR ) )
if( !m_MachineProfile.LoadAllFromDir(MACHINE_PROFILE_DIR, false) )
{
CreateProfile(MACHINE_PROFILE_DIR, "Machine");
m_MachineProfile.LoadAllFromDir( MACHINE_PROFILE_DIR );
m_MachineProfile.LoadAllFromDir( MACHINE_PROFILE_DIR, false );
}
// If the machine name has changed, make sure we use the new name
+2 -1
View File
@@ -5,6 +5,7 @@
#include "ScreenManager.h"
#include "MemoryCardManager.h"
#include "ThemeManager.h"
#include "PrefsManager.h"
#define NEXT_SCREEN THEME->GetMetric(m_sName,"NextScreen")
@@ -17,7 +18,7 @@ static void SaveMachineStatsToFirstMemCard()
CString sDir = MEM_CARD_MOUNT_POINT[pn];
sDir += "MachineProfile/";
PROFILEMAN->GetMachineProfile()->SaveAllToDir( sDir );
PROFILEMAN->GetMachineProfile()->SaveAllToDir( sDir, PREFSMAN->m_bSignProfileData );
SCREENMAN->SystemMessage( ssprintf("Machine stats saved to P%d card.",pn+1) );
return;
}