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++) #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; CHECKPOINT;
@@ -483,7 +483,7 @@ bool Profile::LoadAllFromDir( CString sDir )
break; break;
} }
if( PREFSMAN->m_bSignProfileData ) if( bRequireSignature )
{ {
CString sStatsXmlSigFile = fn+SIGNATURE_APPEND; CString sStatsXmlSigFile = fn+SIGNATURE_APPEND;
CString sDontShareFile = sDir + DONT_SHARE_SIG; 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. 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; m_sLastPlayedMachineGuid = PROFILEMAN->GetMachineProfile()->m_sGuid;
@@ -547,7 +547,7 @@ bool Profile::SaveAllToDir( CString sDir ) const
xml.AppendChild( SaveCalorieDataCreateNode() ); xml.AppendChild( SaveCalorieDataCreateNode() );
xml.AppendChild( SaveAwardsCreateNode() ); xml.AppendChild( SaveAwardsCreateNode() );
bool bSaved = xml.SaveToFile(fn); bool bSaved = xml.SaveToFile(fn);
if( bSaved && PREFSMAN->m_bSignProfileData ) if( bSaved && bSignData )
{ {
CString sStatsXmlSigFile = fn+SIGNATURE_APPEND; CString sStatsXmlSigFile = fn+SIGNATURE_APPEND;
CryptManager::SignFileToFile(fn, sStatsXmlSigFile); CryptManager::SignFileToFile(fn, sStatsXmlSigFile);
+2 -2
View File
@@ -263,8 +263,8 @@ public:
// //
// Loading and saving // Loading and saving
// //
bool LoadAllFromDir( CString sDir ); // return false on bool LoadAllFromDir( CString sDir, bool bRequireSignature ); // return false on error
bool SaveAllToDir( CString sDir ) const; bool SaveAllToDir( CString sDir, bool bSignData ) const;
void LoadProfileDataFromDirSM390a12( CString sDir ); void LoadProfileDataFromDirSM390a12( CString sDir );
void LoadSongScoresFromDirSM390a12( 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 ) if( bLoadNamesOnly )
m_Profile[pn].LoadEditableDataFromDir( m_sProfileDir[pn] ); m_Profile[pn].LoadEditableDataFromDir( m_sProfileDir[pn] );
else else
m_Profile[pn].LoadAllFromDir( m_sProfileDir[pn] ); m_Profile[pn].LoadAllFromDir( m_sProfileDir[pn], PREFSMAN->m_bSignProfileData );
return true; return true;
} }
@@ -104,7 +104,7 @@ bool ProfileManager::CreateProfile( CString sProfileDir, CString sName )
Profile pro; Profile pro;
pro.m_sDisplayName = sName; pro.m_sDisplayName = sName;
bResult = pro.SaveAllToDir( sProfileDir ); bResult = pro.SaveAllToDir( sProfileDir, PREFSMAN->m_bSignProfileData );
if( !bResult ) if( !bResult )
return false; return false;
@@ -186,7 +186,7 @@ bool ProfileManager::SaveProfile( PlayerNumber pn ) const
if( m_sProfileDir[pn].empty() ) if( m_sProfileDir[pn].empty() )
return false; 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 ) void ProfileManager::UnloadProfile( PlayerNumber pn )
@@ -249,11 +249,11 @@ bool ProfileManager::RenameLocalProfile( CString sProfileID, CString sNewName )
Profile pro; Profile pro;
bool bResult; bool bResult;
bResult = pro.LoadAllFromDir( sProfileDir ); bResult = pro.LoadAllFromDir( sProfileDir, PREFSMAN->m_bSignProfileData );
if( !bResult ) if( !bResult )
return false; return false;
pro.m_sDisplayName = sNewName; pro.m_sDisplayName = sNewName;
bResult = pro.SaveAllToDir( sProfileDir ); bResult = pro.SaveAllToDir( sProfileDir, PREFSMAN->m_bSignProfileData );
if( !bResult ) if( !bResult )
return false; return false;
@@ -280,7 +280,7 @@ void ProfileManager::SaveMachineProfile()
// are saved, so that the Player's profiles show the right machine name. // are saved, so that the Player's profiles show the right machine name.
m_MachineProfile.m_sDisplayName = PREFSMAN->m_sMachineName; 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 // read old style notes scores
// ReadSM300NoteScores(); // ReadSM300NoteScores();
if( !m_MachineProfile.LoadAllFromDir(MACHINE_PROFILE_DIR ) ) if( !m_MachineProfile.LoadAllFromDir(MACHINE_PROFILE_DIR, false) )
{ {
CreateProfile(MACHINE_PROFILE_DIR, "Machine"); 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 // 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 "ScreenManager.h"
#include "MemoryCardManager.h" #include "MemoryCardManager.h"
#include "ThemeManager.h" #include "ThemeManager.h"
#include "PrefsManager.h"
#define NEXT_SCREEN THEME->GetMetric(m_sName,"NextScreen") #define NEXT_SCREEN THEME->GetMetric(m_sName,"NextScreen")
@@ -17,7 +18,7 @@ static void SaveMachineStatsToFirstMemCard()
CString sDir = MEM_CARD_MOUNT_POINT[pn]; CString sDir = MEM_CARD_MOUNT_POINT[pn];
sDir += "MachineProfile/"; 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) ); SCREENMAN->SystemMessage( ssprintf("Machine stats saved to P%d card.",pn+1) );
return; return;
} }