diff --git a/Mammoth/Include/TSEVersions.h b/Mammoth/Include/TSEVersions.h index 302812b06..b855d88e1 100644 --- a/Mammoth/Include/TSEVersions.h +++ b/Mammoth/Include/TSEVersions.h @@ -8,6 +8,7 @@ constexpr DWORD API_VERSION = 56; constexpr DWORD UNIVERSE_SAVE_VERSION = 41; constexpr DWORD SYSTEM_SAVE_VERSION = 213; +constexpr DWORD SETTINGS_VERSION = 1; // Uncomment out the following define when building a stable release @@ -1312,3 +1313,11 @@ constexpr DWORD SYSTEM_SAVE_VERSION = 213; // 213: 2.0 Alpha 2 // Change DiceRange to use -1 for not set // + +// SETTINGS VERSION HISTORY --------------------------------------------------- +// +// 0: Unknown version (2.0 Alpha 6 or older) +// +// 1: 2.0 Alpha 7 +// Added versioning for settings file +// diff --git a/Mammoth/TSUI/CExtensionListMap.cpp b/Mammoth/TSUI/CExtensionListMap.cpp index c8ee36429..afebce952 100644 --- a/Mammoth/TSUI/CExtensionListMap.cpp +++ b/Mammoth/TSUI/CExtensionListMap.cpp @@ -366,20 +366,21 @@ ALERROR CExtensionListMap::WriteList (IWriteStream &Output, DWORD dwAdventure, b CString sData; if (bDebugMode) - sData = strPatternSubst(CONSTLIT("\t\t"), dwAdventure); + sData = strPatternSubst(CONSTLIT("\t\t\r\n"), dwAdventure); else - sData = strPatternSubst(CONSTLIT("\t\t"), dwAdventure); + sData = strPatternSubst(CONSTLIT("\t\t\r\n"), dwAdventure); if (error = Output.Write(sData)) return error; // First we write out the list of enabled extensions - sData = CONSTLIT(""); + sData = CONSTLIT("\t\t\t\r\n"); if (error = Output.Write(sData)) return error; bool bFirstEntry = true; + bool bFoundEnabled = false; for (i = 0; i < List.GetCount(); i++) { if (List.GetValue(i)) @@ -387,30 +388,36 @@ ALERROR CExtensionListMap::WriteList (IWriteStream &Output, DWORD dwAdventure, b CString sEntry; if (bFirstEntry) { - sEntry = strPatternSubst(CONSTLIT("0x%x"), List.GetKey(i)); + sEntry = strPatternSubst(CONSTLIT("\t\t\t\t0x%x"), List.GetKey(i)); bFirstEntry = false; } else - sEntry = strPatternSubst(CONSTLIT(", 0x%x"), List.GetKey(i)); + sEntry = strPatternSubst(CONSTLIT(",\r\n\t\t\t\t0x%x"), List.GetKey(i)); + + bFoundEnabled = true; if (error = Output.Write(sEntry)) return error; } } - sData = CONSTLIT(""); + if (bFoundEnabled) + Output.Write(CONSTLIT("\r\n")); + + sData = CONSTLIT("\t\t\t\r\n"); if (error = Output.Write(sData)) return error; // Now we write the disabled extensions - sData = CONSTLIT(""); + sData = CONSTLIT("\t\t\t\r\n"); if (error = Output.Write(sData)) return error; + bool bFoundDisabled = false; if (bDisabledIfNotInList) { - sData = CONSTLIT("*"); + sData = CONSTLIT("\t\t\t\t*\r\n"); if (error = Output.Write(sData)) return error; } @@ -424,11 +431,13 @@ ALERROR CExtensionListMap::WriteList (IWriteStream &Output, DWORD dwAdventure, b CString sEntry; if (bFirstEntry) { - sEntry = strPatternSubst(CONSTLIT("0x%x"), List.GetKey(i)); + sEntry = strPatternSubst(CONSTLIT("\t\t\t\t0x%x"), List.GetKey(i)); bFirstEntry = false; } else - sEntry = strPatternSubst(CONSTLIT(", 0x%x"), List.GetKey(i)); + sEntry = strPatternSubst(CONSTLIT(",\r\n\t\t\t\t0x%x"), List.GetKey(i)); + + bFoundDisabled = true; if (error = Output.Write(sEntry)) return error; @@ -436,13 +445,16 @@ ALERROR CExtensionListMap::WriteList (IWriteStream &Output, DWORD dwAdventure, b } } - sData = CONSTLIT(""); + if (bFoundDisabled) + Output.Write(CONSTLIT("\r\n")); + + sData = CONSTLIT("\t\t\t\r\n"); if (error = Output.Write(sData)) return error; // Done - sData = CONSTLIT("\r\n"); + sData = CONSTLIT("\t\t\r\n"); if (error = Output.Write(sData)) return error; diff --git a/Transcendence/Transcendence/CGameSettings.cpp b/Transcendence/Transcendence/CGameSettings.cpp index a3208bd87..ffb86b8c5 100644 --- a/Transcendence/Transcendence/CGameSettings.cpp +++ b/Transcendence/Transcendence/CGameSettings.cpp @@ -13,6 +13,7 @@ #define NAME_ATTRIB CONSTLIT("name") #define PATH_ATTRIB CONSTLIT("path") #define VALUE_ATTRIB CONSTLIT("value") +#define VERSION_ATTRIB CONSTLIT("version") #define REGISTRY_COMPANY_NAME CONSTLIT("Neurohack") #define REGISTRY_PRODUCT_NAME CONSTLIT("Transcendence") @@ -72,6 +73,7 @@ SOptionDefaults g_OptionData[CGameSettings::OPTIONS_COUNT] = { "noAutoUpdate", optionBoolean, "false", 0 }, // Video options + { "forceDirectX", optionBoolean, "false", 0 }, { "forceNonDirectX", optionBoolean, "false", 0 }, { "forceExclusive", optionBoolean, "false", 0 }, @@ -90,6 +92,7 @@ SOptionDefaults g_OptionData[CGameSettings::OPTIONS_COUNT] = { "use60fps", optionBoolean, "true", 0 }, // Sounds options + { "noSound", optionBoolean, "false", 0 }, { "noMusic", optionBoolean, "false", 0 }, { "soundVolume", optionInteger, "7", 0 }, @@ -97,6 +100,7 @@ SOptionDefaults g_OptionData[CGameSettings::OPTIONS_COUNT] = { "musicPath", optionString, "", 0 }, // Accessibility options + { "colorIFFPlayer", optionString, "#FFFFFF", 0 }, { "colorIFFFriendly", optionString, "#50FF50", 0 }, // H:120 S:69 B:100 { "colorIFFNeutral", optionString, "#4FA7FF", 0 }, // H:210 S:69 B:100 @@ -106,6 +110,7 @@ SOptionDefaults g_OptionData[CGameSettings::OPTIONS_COUNT] = { "colorIFFProjectile", optionString, "#FFFF00", 0 }, // H:60 S:100 B:100 // Debug options + { "debugMode", optionBoolean, "false", 0 }, { "debugGame", optionBoolean, "false", 0 }, { "debugSaveFiles", optionBoolean, "false", 0 }, @@ -210,6 +215,26 @@ ALERROR CGameSettings::Load (const CString &sFilespec, CString *retsError) } } + // Get the version of the settings file + // Default is settings version 0, which means that this settings file was + // made prior to version 2.0 Alpha 7 + + int iSettingsVersion = pData->GetAttributeIntegerBounded(VERSION_ATTRIB, 0, -1, 0); + + // If the settings version is older than the current settings version, we will + // need to mark it as modified to ensure that it gets saved in the new format + + if (iSettingsVersion < SETTINGS_VERSION) + m_bModified = true; + + // If the settings version is newer than the current settings version, we need + // to do something (TBD). For now lets just attempt to load and resave it but + // this should be changed in the future. + + if (iSettingsVersion > SETTINGS_VERSION) + m_bModified = true; + + // Keep track of which settings we've seen bool bLoaded[OPTIONS_COUNT]; @@ -374,7 +399,7 @@ ALERROR CGameSettings::Save (const CString &sFilespec) // Write the XML header - CString sData = CONSTLIT("\r\n\r\n\r\n\r\n"); + CString sData = strPatternSubst(CONSTLIT("\r\n\r\n\r\n\r\n"), strFromInt(SETTINGS_VERSION)); if (error = DataFile.Write(sData.GetPointer(), sData.GetLength(), NULL)) return error;