From 65e75438c73f0beead48edbdd182eee3d660c04e Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Sun, 15 Feb 2004 06:10:21 +0000 Subject: [PATCH] don't sign profile data by default (so that players at home can take data between machines) --- stepmania/src/PrefsManager.cpp | 6 +++--- stepmania/src/PrefsManager.h | 8 +++++--- stepmania/src/Profile.cpp | 19 +++++++++++-------- 3 files changed, 19 insertions(+), 14 deletions(-) diff --git a/stepmania/src/PrefsManager.cpp b/stepmania/src/PrefsManager.cpp index e3aa35c3f0..40d791b314 100644 --- a/stepmania/src/PrefsManager.cpp +++ b/stepmania/src/PrefsManager.cpp @@ -212,7 +212,7 @@ PrefsManager::PrefsManager() m_iAttractSoundFrequency = 1; m_bAllowExtraStage = true; g_bAutoRestart = false; - m_bAllowReadOldScoreFormats = true; + m_bSignProfileData = false; m_bEditorShowBGChangesPlay = false; @@ -487,7 +487,7 @@ void PrefsManager::ReadGlobalPrefsFromDisk() ini.GetValue( "Options", "AttractSoundFrequency", m_iAttractSoundFrequency ); ini.GetValue( "Options", "AllowExtraStage", m_bAllowExtraStage ); ini.GetValue( "Options", "AutoRestart", g_bAutoRestart ); - ini.GetValue( "Options", "AllowReadOldScoreFormats", m_bAllowReadOldScoreFormats ); + ini.GetValue( "Options", "SignProfileData", m_bSignProfileData ); ini.GetValue( "Editor", "ShowBGChangesPlay", m_bEditorShowBGChangesPlay ); @@ -699,7 +699,7 @@ void PrefsManager::SaveGlobalPrefsToDisk() const ini.SetValue( "Options", "AttractSoundFrequency", m_iAttractSoundFrequency ); ini.SetValue( "Options", "AllowExtraStage", m_bAllowExtraStage ); ini.SetValue( "Options", "AutoRestart", g_bAutoRestart ); - ini.SetValue( "Options", "AllowReadOldScoreFormats", m_bAllowReadOldScoreFormats ); + ini.SetValue( "Options", "SignProfileData", m_bSignProfileData ); ini.SetValue( "Options", "SoundWriteAhead", m_iSoundWriteAhead ); diff --git a/stepmania/src/PrefsManager.h b/stepmania/src/PrefsManager.h index 5de7823e5b..c3ad214f64 100644 --- a/stepmania/src/PrefsManager.h +++ b/stepmania/src/PrefsManager.h @@ -187,9 +187,11 @@ public: int m_iAttractSoundFrequency; // 0 = never, 1 = every time bool m_bAllowExtraStage; - // This should be false for arcade machines since the old score format wasn't signed. - // People can cheat easily using the old score formats - bool m_bAllowReadOldScoreFormats; + // If true, then signatures created when writing profile data + // and verified when reading profile data. Leave this false if + // you want to use a profile on different machines that don't + // have the same key, or else the profile's data will be discarded. + bool m_bSignProfileData; /* Editor prefs: */ bool m_bEditorShowBGChangesPlay; diff --git a/stepmania/src/Profile.cpp b/stepmania/src/Profile.cpp index 5b1e67cf4b..e4891d170e 100644 --- a/stepmania/src/Profile.cpp +++ b/stepmania/src/Profile.cpp @@ -280,14 +280,17 @@ bool Profile::LoadAllFromDir( CString sDir ) { InitAll(); bool bResult = LoadGeneralDataFromDir( sDir ); - if( PREFSMAN->m_bAllowReadOldScoreFormats ) + + // Only try to load old score formats if we're allowing unsigned data. + if( !PREFSMAN->m_bSignProfileData ) + { LoadSongScoresFromDirSM390a12( sDir ); - LoadSongScoresFromDir( sDir ); - if( PREFSMAN->m_bAllowReadOldScoreFormats ) LoadCourseScoresFromDirSM390a12( sDir ); - LoadCourseScoresFromDir( sDir ); - if( PREFSMAN->m_bAllowReadOldScoreFormats ) LoadCategoryScoresFromDirSM390a12( sDir ); + } + + LoadSongScoresFromDir( sDir ); + LoadCourseScoresFromDir( sDir ); LoadCategoryScoresFromDir( sDir ); return bResult; } @@ -313,12 +316,12 @@ bool Profile::SaveAllToDir( CString sDir ) const #define WARN_AND_RETURN { WARN; return; } #define WARN_AND_CONTINUE { WARN; continue; } #define CRYPT_VERIFY_FILE \ - if( !CryptManager::VerifyFile(fn) ) { \ + if( PREFSMAN->m_bSignProfileData && !CryptManager::VerifyFile(fn) ) { \ LOG->Warn("Signature check failed for '%s' at %s:%d",fn.c_str(),__FILE__,__LINE__); return; } #define CRYPT_VERIFY_FILE_BOOL \ - if( !CryptManager::VerifyFile(fn) ) { \ + if( PREFSMAN->m_bSignProfileData && !CryptManager::VerifyFile(fn) ) { \ LOG->Warn("Signature check failed for '%s' at %s:%d",fn.c_str(),__FILE__,__LINE__); return false; } -#define CRYPT_WRITE_SIG CryptManager::SignFile(fn); +#define CRYPT_WRITE_SIG if( PREFSMAN->m_bSignProfileData ) { CryptManager::SignFile(fn); } bool Profile::LoadGeneralDataFromDir( CString sDir ) {