don't sign profile data by default (so that players at home can take data between machines)

This commit is contained in:
Chris Danford
2004-02-15 06:10:21 +00:00
parent c9240bd7c3
commit 65e75438c7
3 changed files with 19 additions and 14 deletions
+3 -3
View File
@@ -212,7 +212,7 @@ PrefsManager::PrefsManager()
m_iAttractSoundFrequency = 1; m_iAttractSoundFrequency = 1;
m_bAllowExtraStage = true; m_bAllowExtraStage = true;
g_bAutoRestart = false; g_bAutoRestart = false;
m_bAllowReadOldScoreFormats = true; m_bSignProfileData = false;
m_bEditorShowBGChangesPlay = false; m_bEditorShowBGChangesPlay = false;
@@ -487,7 +487,7 @@ void PrefsManager::ReadGlobalPrefsFromDisk()
ini.GetValue( "Options", "AttractSoundFrequency", m_iAttractSoundFrequency ); ini.GetValue( "Options", "AttractSoundFrequency", m_iAttractSoundFrequency );
ini.GetValue( "Options", "AllowExtraStage", m_bAllowExtraStage ); ini.GetValue( "Options", "AllowExtraStage", m_bAllowExtraStage );
ini.GetValue( "Options", "AutoRestart", g_bAutoRestart ); ini.GetValue( "Options", "AutoRestart", g_bAutoRestart );
ini.GetValue( "Options", "AllowReadOldScoreFormats", m_bAllowReadOldScoreFormats ); ini.GetValue( "Options", "SignProfileData", m_bSignProfileData );
ini.GetValue( "Editor", "ShowBGChangesPlay", m_bEditorShowBGChangesPlay ); ini.GetValue( "Editor", "ShowBGChangesPlay", m_bEditorShowBGChangesPlay );
@@ -699,7 +699,7 @@ void PrefsManager::SaveGlobalPrefsToDisk() const
ini.SetValue( "Options", "AttractSoundFrequency", m_iAttractSoundFrequency ); ini.SetValue( "Options", "AttractSoundFrequency", m_iAttractSoundFrequency );
ini.SetValue( "Options", "AllowExtraStage", m_bAllowExtraStage ); ini.SetValue( "Options", "AllowExtraStage", m_bAllowExtraStage );
ini.SetValue( "Options", "AutoRestart", g_bAutoRestart ); ini.SetValue( "Options", "AutoRestart", g_bAutoRestart );
ini.SetValue( "Options", "AllowReadOldScoreFormats", m_bAllowReadOldScoreFormats ); ini.SetValue( "Options", "SignProfileData", m_bSignProfileData );
ini.SetValue( "Options", "SoundWriteAhead", m_iSoundWriteAhead ); ini.SetValue( "Options", "SoundWriteAhead", m_iSoundWriteAhead );
+5 -3
View File
@@ -187,9 +187,11 @@ public:
int m_iAttractSoundFrequency; // 0 = never, 1 = every time int m_iAttractSoundFrequency; // 0 = never, 1 = every time
bool m_bAllowExtraStage; bool m_bAllowExtraStage;
// This should be false for arcade machines since the old score format wasn't signed. // If true, then signatures created when writing profile data
// People can cheat easily using the old score formats // and verified when reading profile data. Leave this false if
bool m_bAllowReadOldScoreFormats; // 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: */ /* Editor prefs: */
bool m_bEditorShowBGChangesPlay; bool m_bEditorShowBGChangesPlay;
+11 -8
View File
@@ -280,14 +280,17 @@ bool Profile::LoadAllFromDir( CString sDir )
{ {
InitAll(); InitAll();
bool bResult = LoadGeneralDataFromDir( sDir ); 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 ); LoadSongScoresFromDirSM390a12( sDir );
LoadSongScoresFromDir( sDir );
if( PREFSMAN->m_bAllowReadOldScoreFormats )
LoadCourseScoresFromDirSM390a12( sDir ); LoadCourseScoresFromDirSM390a12( sDir );
LoadCourseScoresFromDir( sDir );
if( PREFSMAN->m_bAllowReadOldScoreFormats )
LoadCategoryScoresFromDirSM390a12( sDir ); LoadCategoryScoresFromDirSM390a12( sDir );
}
LoadSongScoresFromDir( sDir );
LoadCourseScoresFromDir( sDir );
LoadCategoryScoresFromDir( sDir ); LoadCategoryScoresFromDir( sDir );
return bResult; return bResult;
} }
@@ -313,12 +316,12 @@ bool Profile::SaveAllToDir( CString sDir ) const
#define WARN_AND_RETURN { WARN; return; } #define WARN_AND_RETURN { WARN; return; }
#define WARN_AND_CONTINUE { WARN; continue; } #define WARN_AND_CONTINUE { WARN; continue; }
#define CRYPT_VERIFY_FILE \ #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; } LOG->Warn("Signature check failed for '%s' at %s:%d",fn.c_str(),__FILE__,__LINE__); return; }
#define CRYPT_VERIFY_FILE_BOOL \ #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; } 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 ) bool Profile::LoadGeneralDataFromDir( CString sDir )
{ {