From 6fd7cddf582c86f97486f97c6ecfd26c8e9dd395 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Janiszewski?= Date: Mon, 4 Aug 2025 17:25:08 +0200 Subject: [PATCH] Update Windows libraries to v38, use SHA256 checksums (#24887) --- openrct2.deps.targets | 96 +++++++++++++++++++++---------------------- 1 file changed, 47 insertions(+), 49 deletions(-) diff --git a/openrct2.deps.targets b/openrct2.deps.targets index 6e3737f91b..05771a40cd 100644 --- a/openrct2.deps.targets +++ b/openrct2.deps.targets @@ -1,6 +1,6 @@ - + - + @@ -28,8 +28,8 @@ { if (!String.IsNullOrEmpty(CheckFile)) { - string checkSha1 = GetSha1FromCheckFile(CheckFile, Name); - if (String.Equals(checkSha1, Sha1, StringComparison.OrdinalIgnoreCase) && Directory.Exists(OutputDirectory)) + string checkSha256 = GetSha256FromCheckFile(CheckFile, Name); + if (String.Equals(checkSha256, Sha256, StringComparison.OrdinalIgnoreCase) && Directory.Exists(OutputDirectory)) { Log.LogMessage(MessageImportance.Normal, String.Format("{0} up to date", Name)); return true; @@ -45,10 +45,10 @@ client.DownloadFile(Url, tempFile); // Check the file matches - string actualSha1; - if (!CheckFileSha1(tempFile, Sha1, out actualSha1)) + string actualSha256; + if (!CheckFileSha256(tempFile, Sha256, out actualSha256)) { - Log.LogError("Download file did not match expected SHA1\n expected: {0}\n actual: {1}", Sha1, actualSha1); + Log.LogError("Download file did not match expected SHA256\n expected: {0}\n actual: {1}", Sha256, actualSha256); return false; } @@ -60,7 +60,7 @@ } ExtractZip(tempFile, OutputDirectory, overwrite: true); - SetSha1InCheckFile(CheckFile, Name, Sha1); + SetSha256InCheckFile(CheckFile, Name, Sha256); } catch (Exception ex) { @@ -80,7 +80,7 @@ return true; } - private string GetSha1FromCheckFile(string checkFile, string name) + private string GetSha256FromCheckFile(string checkFile, string name) { string result = null; try @@ -88,9 +88,9 @@ if (File.Exists(checkFile)) { string[] lines = File.ReadAllLines(checkFile); - string sha1; - GetCheckFileLineIndexSha1(lines, name, out sha1); - return sha1; + string sha256; + GetCheckFileLineIndexSha256(lines, name, out sha256); + return sha256; } } catch (Exception ex) @@ -100,18 +100,18 @@ return result; } - private void SetSha1InCheckFile(string checkFile, string name, string sha1) + private void SetSha256InCheckFile(string checkFile, string name, string sha256) { try { - string newLine = String.Format("{0} = {1}", name, sha1.ToLower()); + string newLine = String.Format("{0} = {1}", name, sha256.ToLower()); string[] lines = new string[0]; int lineIndex = -1; if (File.Exists(checkFile)) { lines = File.ReadAllLines(checkFile); - string oldsha1; - lineIndex = GetCheckFileLineIndexSha1(lines, name, out oldsha1); + string oldsha256; + lineIndex = GetCheckFileLineIndexSha256(lines, name, out oldsha256); } if (lineIndex == -1) { @@ -133,7 +133,7 @@ } } - private int GetCheckFileLineIndexSha1(string[] lines, string name, out string sha1) + private int GetCheckFileLineIndexSha256(string[] lines, string name, out string sha256) { for (int i = 0; i < lines.Length; i++) { @@ -142,26 +142,26 @@ if (lineParts.Length == 2) { string lineTag = lineParts[0].Trim(); - string lineSha1 = lineParts[1].Trim(); + string lineSha256 = lineParts[1].Trim(); if (lineTag == name) { - sha1 = lineSha1; + sha256 = lineSha256; return i; } } } - sha1 = null; + sha256 = null; return -1; } - private bool CheckFileSha1(string file, string expectedSha1, out string actualSha1) + private bool CheckFileSha256(string file, string expectedSha256, out string actualSha256) { using (var fs = new FileStream(file, FileMode.Open)) { - var hasher = System.Security.Cryptography.SHA1.Create(); + var hasher = System.Security.Cryptography.SHA256.Create(); byte[] hash = hasher.ComputeHash(fs); - actualSha1 = BytesToHexString(hash); - if (String.Equals(actualSha1, expectedSha1, StringComparison.OrdinalIgnoreCase)) + actualSha256 = BytesToHexString(hash); + if (String.Equals(actualSha256, expectedSha256, StringComparison.OrdinalIgnoreCase)) { return true; } @@ -205,34 +205,34 @@ - + $(MsBuildThisFileDirectory) $(RootDir).dependencies - https://github.com/OpenRCT2/Dependencies/releases/download/v37/openrct2-libs-v37-arm64-windows-static.zip - 508bbd39b9be3d746ed8e17b6c0e7a79f6fa13c8 - https://github.com/OpenRCT2/Dependencies/releases/download/v37/openrct2-libs-v37-x64-windows-static.zip - 28fabdb3fe8ddb7c73cd1c5e57ec8df5bd6232e5 - https://github.com/OpenRCT2/Dependencies/releases/download/v37/openrct2-libs-v37-x86-windows-static.zip - 9984c1e317dcfb3aaf8e17f1db2ebb0f771e2373 + https://github.com/OpenRCT2/Dependencies/releases/download/v38/openrct2-libs-v38-arm64-windows-static.zip + 00ef08029e6eb251917a73a92063472dba92422ae91846cfa75d83bbdcdb3a4d + https://github.com/OpenRCT2/Dependencies/releases/download/v38/openrct2-libs-v38-x64-windows-static.zip + c9fdda3556305b4b9276d5901b37067b73eae80d95427189f026b78753e84f7b + https://github.com/OpenRCT2/Dependencies/releases/download/v38/openrct2-libs-v38-x86-windows-static.zip + dd58ad06d747caf2b6d34cfc90de217fb92379bde75183dbc91a25e191ec81fa https://github.com/OpenRCT2/title-sequences/releases/download/v0.4.14/title-sequences.zip - 6c04781b959b468e1f65ec2d2f21f5aaa5e5724d + 140df714e806fed411cc49763e7f16b0fcf2a487a57001d1e50fce8f9148a9f3 https://github.com/OpenRCT2/objects/releases/download/v1.7.2/objects.zip - ab0f05744105528067c6403a9e837fb6a2c52f74 + b4286f7af68a61b0f7fc6e379ba37bf6796286d73e97c967958bf374e3f98f35 https://github.com/OpenRCT2/OpenSoundEffects/releases/download/v1.0.6/opensound.zip - e8b6f24b3fb9d1ed5dc27022a50aaea98923d872 + 06b90f3e19c216752df441d551b26a9e3e1ba7755bdd2102504b73bf993608be https://github.com/OpenRCT2/OpenMusic/releases/download/v1.6.1/openmusic.zip - 5168c852b1a10b623c10f0ff2a590ba494df4edb + 994b350d3b180ee1cb9619fe27f7ebae3a1a5232840c4bd47a89f33fa89de1a1 https://github.com/OpenRCT2/replays/releases/download/v0.0.89/replays.zip - 089CB8EEA76A98028367FDDE72675E9309AB9036 + 04607bb1f67a0f31d841ed70b38d65b8f7a9e19749e414ff74b8a434bc90b42a - + - - + @@ -242,19 +242,17 @@ - - - + @@ -263,7 +261,7 @@ @@ -272,7 +270,7 @@ @@ -281,7 +279,7 @@ @@ -290,9 +288,9 @@ - +