mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-09-21 20:06:40 +00:00
Use MD5 hash for splash screen version check
Instead of using the file modification date, this uses the MD5 hash of the file holding the content of the splash screen for the version check. This ensures the splash screen isn't unintentionally shown again when just the modification date of the file changes. Fixes #4399
This commit is contained in:
@@ -482,7 +482,7 @@ phase = completed ; Show a chat notification if you or an ally h
|
||||
|
||||
[gui.splashscreen]
|
||||
enable = true ; Enable/disable the splashscreen
|
||||
version = 0 ; Splashscreen version (date of last modification). By default, 0 to force splashscreen to appear at first launch
|
||||
version = 0 ; Splashscreen version (MD5 hash of file content). By default, 0 to force splashscreen to appear at first launch
|
||||
|
||||
[gui.session.diplomacycolors]
|
||||
self = "21 55 149" ; Color of your units when diplomacy colors are enabled
|
||||
|
||||
@@ -31,7 +31,7 @@ class SplashScreenHandler
|
||||
this.showSplashScreen = false;
|
||||
|
||||
if (Engine.ConfigDB_GetValue("user", "gui.splashscreen.enable") === "true" ||
|
||||
Engine.ConfigDB_GetValue("user", "gui.splashscreen.version") < Engine.GetFileMTime("gui/splashscreen/splashscreen.txt"))
|
||||
Engine.ConfigDB_GetValue("user", "gui.splashscreen.version") !== Engine.CalculateMD5(Engine.ReadFile("gui/splashscreen/splashscreen.txt")))
|
||||
Engine.PushGuiPage("page_splashscreen.xml", {});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ function init(data)
|
||||
function closePage()
|
||||
{
|
||||
Engine.ConfigDB_CreateValue("user", "gui.splashscreen.enable", String(Engine.GetGUIObjectByName("displaySplashScreen").checked));
|
||||
Engine.ConfigDB_CreateValue("user", "gui.splashscreen.version", Engine.GetFileMTime(g_SplashScreenFile));
|
||||
Engine.ConfigDB_CreateValue("user", "gui.splashscreen.version", Engine.CalculateMD5(Engine.ReadFile(g_SplashScreenFile)));
|
||||
Engine.ConfigDB_SaveChanges("user");
|
||||
Engine.PopGuiPage();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user