From 1e2d94fc95339b60b3eff0a7bb9aacc2b2e38e17 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=CE=B6eh=20Matt?= <5415177+ZehMatt@users.noreply.github.com>
Date: Wed, 23 Apr 2025 00:32:16 +0300
Subject: [PATCH] Add project for dependencies, restructure targets and cleanup
unused
---
openrct2.deps.targets | 298 +++++++++++++++++++++
openrct2.proj | 76 +-----
openrct2.sln | 44 ++--
openrct2.targets | 334 +-----------------------
src/openrct2-cli/openrct2-cli.vcxproj | 8 +
src/openrct2-data/openrct2-data.vcxproj | 10 +-
src/openrct2-deps/openrct2-deps.vcxproj | 61 +++++
src/openrct2-ui/libopenrct2ui.vcxproj | 7 +-
src/openrct2-win/openrct2-win.vcxproj | 11 +
src/openrct2/libopenrct2.vcxproj | 8 +
test/tests/tests.vcxproj | 8 +
11 files changed, 432 insertions(+), 433 deletions(-)
create mode 100644 openrct2.deps.targets
create mode 100644 src/openrct2-deps/openrct2-deps.vcxproj
diff --git a/openrct2.deps.targets b/openrct2.deps.targets
new file mode 100644
index 0000000000..7cf0394019
--- /dev/null
+++ b/openrct2.deps.targets
@@ -0,0 +1,298 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 0)
+ {
+ Array.Resize(ref lines, lines.Length + 1);
+ }
+ lineIndex = lines.Length - 1;
+
+ // End with new line
+ Array.Resize(ref lines, lines.Length + 1);
+ }
+ lines[lineIndex] = newLine;
+ File.WriteAllLines(checkFile, lines);
+ }
+ catch (Exception ex)
+ {
+ Log.LogWarningFromException(ex, showStackTrace: false);
+ }
+ }
+
+ private int GetCheckFileLineIndexSha1(string[] lines, string name, out string sha1)
+ {
+ for (int i = 0; i < lines.Length; i++)
+ {
+ string line = lines[i];
+ string[] lineParts = line.Split('=');
+ if (lineParts.Length == 2)
+ {
+ string lineTag = lineParts[0].Trim();
+ string lineSha1 = lineParts[1].Trim();
+ if (lineTag == name)
+ {
+ sha1 = lineSha1;
+ return i;
+ }
+ }
+ }
+ sha1 = null;
+ return -1;
+ }
+
+ private bool CheckFileSha1(string file, string expectedSha1, out string actualSha1)
+ {
+ using (var fs = new FileStream(file, FileMode.Open))
+ {
+ var hasher = System.Security.Cryptography.SHA1.Create();
+ byte[] hash = hasher.ComputeHash(fs);
+ actualSha1 = BytesToHexString(hash);
+ if (String.Equals(actualSha1, expectedSha1, StringComparison.OrdinalIgnoreCase))
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private string BytesToHexString(byte[] data)
+ {
+ var sb = new StringBuilder();
+ foreach (byte b in data)
+ {
+ sb.Append(b.ToString("x2"));
+ }
+ return sb.ToString();
+ }
+
+ private static void ExtractZip(string zipPath, string destinationDirectory, bool overwrite)
+ {
+ var archive = ZipFile.OpenRead(zipPath);
+ if (!overwrite)
+ {
+ archive.ExtractToDirectory(destinationDirectory);
+ return;
+ }
+ foreach (ZipArchiveEntry file in archive.Entries)
+ {
+ string fileName = Path.Combine(destinationDirectory, file.FullName);
+ string directory = Path.GetDirectoryName(fileName);
+ if (!Directory.Exists(directory))
+ {
+ Directory.CreateDirectory(directory);
+ }
+ if (file.Name != String.Empty)
+ {
+ file.ExtractToFile(fileName, true);
+ }
+ }
+ }
+ ]]>
+
+
+
+
+
+
+ $(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/title-sequences/releases/download/v0.4.14/title-sequences.zip
+ 6c04781b959b468e1f65ec2d2f21f5aaa5e5724d
+ https://github.com/OpenRCT2/objects/releases/download/v1.6.1/objects.zip
+ 749a9df9ed728676ef7c3b87c8a6b813069476d3
+ https://github.com/OpenRCT2/OpenSoundEffects/releases/download/v1.0.5/opensound.zip
+ b1b1f1b241d2cbff63a1889c4dc5a09bdf769bfb
+ https://github.com/OpenRCT2/OpenMusic/releases/download/v1.6/openmusic.zip
+ ba170fa6d777b309c15420f4b6eb3fa25082a9d1
+ https://github.com/OpenRCT2/replays/releases/download/v0.0.87/replays.zip
+ 6061B53DE346BD853BB997E635AC7374B1A7D2F0
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/openrct2.proj b/openrct2.proj
index b2801449b0..aa46978908 100644
--- a/openrct2.proj
+++ b/openrct2.proj
@@ -30,36 +30,6 @@
$(SlnProperties);OPENRCT2_CL_ADDITIONALOPTIONS=$(OPENRCT2_CL_ADDITIONALOPTIONS)
-
-
- $(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/title-sequences/releases/download/v0.4.14/title-sequences.zip
- 6c04781b959b468e1f65ec2d2f21f5aaa5e5724d
- https://github.com/OpenRCT2/objects/releases/download/v1.6.1/objects.zip
- 749a9df9ed728676ef7c3b87c8a6b813069476d3
- https://github.com/OpenRCT2/OpenSoundEffects/releases/download/v1.0.5/opensound.zip
- b1b1f1b241d2cbff63a1889c4dc5a09bdf769bfb
- https://github.com/OpenRCT2/OpenMusic/releases/download/v1.6/openmusic.zip
- ba170fa6d777b309c15420f4b6eb3fa25082a9d1
- https://github.com/OpenRCT2/replays/releases/download/v0.0.87/replays.zip
- 6061B53DE346BD853BB997E635AC7374B1A7D2F0
-
-
-
-
-
-
-
$(SlnProperties);Configuration=$(Configuration)
@@ -93,53 +63,9 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
diff --git a/openrct2.sln b/openrct2.sln
index 147f82a2ba..519545faa3 100644
--- a/openrct2.sln
+++ b/openrct2.sln
@@ -4,21 +4,13 @@ Microsoft Visual Studio Solution File, Format Version 12.00
VisualStudioVersion = 17.4.33213.308
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libopenrct2", "src\openrct2\libopenrct2.vcxproj", "{D24D94F6-2A74-480C-B512-629C306CE92F}"
+ ProjectSection(ProjectDependencies) = postProject
+ {C453DA76-44B3-4AC8-AAA2-2B64A76993A5} = {C453DA76-44B3-4AC8-AAA2-2B64A76993A5}
+ EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "openrct2-win", "src\openrct2-win\openrct2-win.vcxproj", "{7A9A57D5-7006-4208-A290-5491BA3C8808}"
- ProjectSection(ProjectDependencies) = postProject
- {8DD8AB7D-2EA6-44E3-8265-BAF08E832951} = {8DD8AB7D-2EA6-44E3-8265-BAF08E832951}
- {B6808F71-30B4-4499-8FF6-0B1C86391842} = {B6808F71-30B4-4499-8FF6-0B1C86391842}
- {D24D94F6-2A74-480C-B512-629C306CE92F} = {D24D94F6-2A74-480C-B512-629C306CE92F}
- EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tests", "test\tests\tests.vcxproj", "{62B020FA-E4FB-4C6E-B32A-DC999470F155}"
- ProjectSection(ProjectDependencies) = postProject
- {7A9A57D5-7006-4208-A290-5491BA3C8808} = {7A9A57D5-7006-4208-A290-5491BA3C8808}
- {8DD8AB7D-2EA6-44E3-8265-BAF08E832951} = {8DD8AB7D-2EA6-44E3-8265-BAF08E832951}
- {B6808F71-30B4-4499-8FF6-0B1C86391842} = {B6808F71-30B4-4499-8FF6-0B1C86391842}
- {D24D94F6-2A74-480C-B512-629C306CE92F} = {D24D94F6-2A74-480C-B512-629C306CE92F}
- EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{2202A816-377D-4FA0-A7AF-7D4105F8A4FB}"
EndProject
@@ -27,17 +19,10 @@ EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libopenrct2ui", "src\openrct2-ui\libopenrct2ui.vcxproj", "{8DD8AB7D-2EA6-44E3-8265-BAF08E832951}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "openrct2-cli", "src\openrct2-cli\openrct2-cli.vcxproj", "{B6808F71-30B4-4499-8FF6-0B1C86391842}"
- ProjectSection(ProjectDependencies) = postProject
- {D24D94F6-2A74-480C-B512-629C306CE92F} = {D24D94F6-2A74-480C-B512-629C306CE92F}
- EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "openrct2-data", "src\openrct2-data\openrct2-data.vcxproj", "{70EEED2D-2344-4F28-87B7-3EFC4E78B923}"
- ProjectSection(ProjectDependencies) = postProject
- {7A9A57D5-7006-4208-A290-5491BA3C8808} = {7A9A57D5-7006-4208-A290-5491BA3C8808}
- {8DD8AB7D-2EA6-44E3-8265-BAF08E832951} = {8DD8AB7D-2EA6-44E3-8265-BAF08E832951}
- {B6808F71-30B4-4499-8FF6-0B1C86391842} = {B6808F71-30B4-4499-8FF6-0B1C86391842}
- {D24D94F6-2A74-480C-B512-629C306CE92F} = {D24D94F6-2A74-480C-B512-629C306CE92F}
- EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "openrct2-deps", "src\openrct2-deps\openrct2-deps.vcxproj", "{C453DA76-44B3-4AC8-AAA2-2B64A76993A5}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -160,6 +145,24 @@ Global
{70EEED2D-2344-4F28-87B7-3EFC4E78B923}.ReleaseLTCG|Win32.Build.0 = Release|Win32
{70EEED2D-2344-4F28-87B7-3EFC4E78B923}.ReleaseLTCG|x64.ActiveCfg = Release|x64
{70EEED2D-2344-4F28-87B7-3EFC4E78B923}.ReleaseLTCG|x64.Build.0 = Release|x64
+ {C453DA76-44B3-4AC8-AAA2-2B64A76993A5}.Debug|arm64.ActiveCfg = Debug|arm64
+ {C453DA76-44B3-4AC8-AAA2-2B64A76993A5}.Debug|arm64.Build.0 = Debug|arm64
+ {C453DA76-44B3-4AC8-AAA2-2B64A76993A5}.Debug|Win32.ActiveCfg = Debug|Win32
+ {C453DA76-44B3-4AC8-AAA2-2B64A76993A5}.Debug|Win32.Build.0 = Debug|Win32
+ {C453DA76-44B3-4AC8-AAA2-2B64A76993A5}.Debug|x64.ActiveCfg = Debug|x64
+ {C453DA76-44B3-4AC8-AAA2-2B64A76993A5}.Debug|x64.Build.0 = Debug|x64
+ {C453DA76-44B3-4AC8-AAA2-2B64A76993A5}.Release|arm64.ActiveCfg = Release|arm64
+ {C453DA76-44B3-4AC8-AAA2-2B64A76993A5}.Release|arm64.Build.0 = Release|arm64
+ {C453DA76-44B3-4AC8-AAA2-2B64A76993A5}.Release|Win32.ActiveCfg = Release|Win32
+ {C453DA76-44B3-4AC8-AAA2-2B64A76993A5}.Release|Win32.Build.0 = Release|Win32
+ {C453DA76-44B3-4AC8-AAA2-2B64A76993A5}.Release|x64.ActiveCfg = Release|x64
+ {C453DA76-44B3-4AC8-AAA2-2B64A76993A5}.Release|x64.Build.0 = Release|x64
+ {C453DA76-44B3-4AC8-AAA2-2B64A76993A5}.ReleaseLTCG|arm64.ActiveCfg = ReleaseLTCG|arm64
+ {C453DA76-44B3-4AC8-AAA2-2B64A76993A5}.ReleaseLTCG|arm64.Build.0 = ReleaseLTCG|arm64
+ {C453DA76-44B3-4AC8-AAA2-2B64A76993A5}.ReleaseLTCG|Win32.ActiveCfg = ReleaseLTCG|Win32
+ {C453DA76-44B3-4AC8-AAA2-2B64A76993A5}.ReleaseLTCG|Win32.Build.0 = ReleaseLTCG|Win32
+ {C453DA76-44B3-4AC8-AAA2-2B64A76993A5}.ReleaseLTCG|x64.ActiveCfg = ReleaseLTCG|x64
+ {C453DA76-44B3-4AC8-AAA2-2B64A76993A5}.ReleaseLTCG|x64.Build.0 = ReleaseLTCG|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -171,6 +174,7 @@ Global
{8DD8AB7D-2EA6-44E3-8265-BAF08E832951} = {2202A816-377D-4FA0-A7AF-7D4105F8A4FB}
{B6808F71-30B4-4499-8FF6-0B1C86391842} = {2202A816-377D-4FA0-A7AF-7D4105F8A4FB}
{70EEED2D-2344-4F28-87B7-3EFC4E78B923} = {2202A816-377D-4FA0-A7AF-7D4105F8A4FB}
+ {C453DA76-44B3-4AC8-AAA2-2B64A76993A5} = {2202A816-377D-4FA0-A7AF-7D4105F8A4FB}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {AE225595-70B7-4580-92EF-6F2B461EBFC7}
diff --git a/openrct2.targets b/openrct2.targets
index 7ac1e46905..fb9ece9173 100644
--- a/openrct2.targets
+++ b/openrct2.targets
@@ -1,335 +1,5 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 0)
- {
- Array.Resize(ref lines, lines.Length + 1);
- }
- lineIndex = lines.Length - 1;
-
- // End with new line
- Array.Resize(ref lines, lines.Length + 1);
- }
- lines[lineIndex] = newLine;
- File.WriteAllLines(checkFile, lines);
- }
- catch (Exception ex)
- {
- Log.LogWarningFromException(ex, showStackTrace: false);
- }
- }
-
- private int GetCheckFileLineIndexSha1(string[] lines, string name, out string sha1)
- {
- for (int i = 0; i < lines.Length; i++)
- {
- string line = lines[i];
- string[] lineParts = line.Split('=');
- if (lineParts.Length == 2)
- {
- string lineTag = lineParts[0].Trim();
- string lineSha1 = lineParts[1].Trim();
- if (lineTag == name)
- {
- sha1 = lineSha1;
- return i;
- }
- }
- }
- sha1 = null;
- return -1;
- }
-
- private bool CheckFileSha1(string file, string expectedSha1, out string actualSha1)
- {
- using (var fs = new FileStream(file, FileMode.Open))
- {
- var hasher = System.Security.Cryptography.SHA1.Create();
- byte[] hash = hasher.ComputeHash(fs);
- actualSha1 = BytesToHexString(hash);
- if (String.Equals(actualSha1, expectedSha1, StringComparison.OrdinalIgnoreCase))
- {
- return true;
- }
- }
- return false;
- }
-
- private string BytesToHexString(byte[] data)
- {
- var sb = new StringBuilder();
- foreach (byte b in data)
- {
- sb.Append(b.ToString("x2"));
- }
- return sb.ToString();
- }
-
- private static void ExtractZip(string zipPath, string destinationDirectory, bool overwrite)
- {
- var archive = ZipFile.OpenRead(zipPath);
- if (!overwrite)
- {
- archive.ExtractToDirectory(destinationDirectory);
- return;
- }
- foreach (ZipArchiveEntry file in archive.Entries)
- {
- string fileName = Path.Combine(destinationDirectory, file.FullName);
- string directory = Path.GetDirectoryName(fileName);
- if (!Directory.Exists(directory))
- {
- Directory.CreateDirectory(directory);
- }
- if (file.Name != String.Empty)
- {
- file.ExtractToFile(fileName, true);
- }
- }
- }
- ]]>
-
-
-
-
+
$(MSBuildThisFileDirectory)
@@ -350,7 +20,7 @@
$(ResourcesG2Path)sprites.json
$(OutDir)data\
-
+
diff --git a/src/openrct2-cli/openrct2-cli.vcxproj b/src/openrct2-cli/openrct2-cli.vcxproj
index 3e9f97f517..bcae99f04f 100644
--- a/src/openrct2-cli/openrct2-cli.vcxproj
+++ b/src/openrct2-cli/openrct2-cli.vcxproj
@@ -75,5 +75,13 @@
+
+
+ {c453da76-44b3-4ac8-aaa2-2b64a76993a5}
+
+
+ {d24d94f6-2a74-480c-b512-629c306ce92f}
+
+
\ No newline at end of file
diff --git a/src/openrct2-data/openrct2-data.vcxproj b/src/openrct2-data/openrct2-data.vcxproj
index 55f4bf7315..04c54a5d29 100644
--- a/src/openrct2-data/openrct2-data.vcxproj
+++ b/src/openrct2-data/openrct2-data.vcxproj
@@ -38,24 +38,24 @@
arm64
-
+
+
+ {b6808f71-30b4-4499-8ff6-0b1c86391842}
+
+
{70eeed2d-2344-4f28-87b7-3efc4e78b923}
openrct2-data
true
-
Utility
-
-
openrct2-data
$(SolutionDir)bin;$(LibraryPath)
-
\ No newline at end of file
diff --git a/src/openrct2-deps/openrct2-deps.vcxproj b/src/openrct2-deps/openrct2-deps.vcxproj
new file mode 100644
index 0000000000..deac9e7891
--- /dev/null
+++ b/src/openrct2-deps/openrct2-deps.vcxproj
@@ -0,0 +1,61 @@
+
+
+
+
+ Debug
+ Win32
+
+
+ Debug
+ x64
+
+
+ Debug
+ arm64
+
+
+ ReleaseLTCG
+ arm64
+
+
+ ReleaseLTCG
+ Win32
+
+
+ ReleaseLTCG
+ x64
+
+
+ Release
+ Win32
+
+
+ Release
+ x64
+
+
+ Release
+ arm64
+
+
+
+
+ {c453da76-44b3-4ac8-aaa2-2b64a76993a5}
+ openrct2-deps
+ true
+
+
+
+ Utility
+
+
+
+
+
+ openrct2-deps
+ $(SolutionDir)bin;$(LibraryPath)
+
+
+
+
+
\ No newline at end of file
diff --git a/src/openrct2-ui/libopenrct2ui.vcxproj b/src/openrct2-ui/libopenrct2ui.vcxproj
index d96fa49e61..82e299cf25 100644
--- a/src/openrct2-ui/libopenrct2ui.vcxproj
+++ b/src/openrct2-ui/libopenrct2ui.vcxproj
@@ -238,6 +238,11 @@
+
+
+ {c453da76-44b3-4ac8-aaa2-2b64a76993a5}
+
+
{8DD8AB7D-2EA6-44E3-8265-BAF08E832951}
openrct2-ui
@@ -263,4 +268,4 @@
-
+
\ No newline at end of file
diff --git a/src/openrct2-win/openrct2-win.vcxproj b/src/openrct2-win/openrct2-win.vcxproj
index 059e4e8296..e04dccfdf0 100644
--- a/src/openrct2-win/openrct2-win.vcxproj
+++ b/src/openrct2-win/openrct2-win.vcxproj
@@ -78,5 +78,16 @@
+
+
+ {c453da76-44b3-4ac8-aaa2-2b64a76993a5}
+
+
+ {8dd8ab7d-2ea6-44e3-8265-baf08e832951}
+
+
+ {d24d94f6-2a74-480c-b512-629c306ce92f}
+
+
\ No newline at end of file
diff --git a/src/openrct2/libopenrct2.vcxproj b/src/openrct2/libopenrct2.vcxproj
index 60bb96262f..23119502e5 100644
--- a/src/openrct2/libopenrct2.vcxproj
+++ b/src/openrct2/libopenrct2.vcxproj
@@ -1,3 +1,4 @@
+
..\..\
@@ -44,11 +45,13 @@
{D24D94F6-2A74-480C-B512-629C306CE92F}
openrct2-lib
libopenrct2
+ true
StaticLibrary
+
__ENABLE_DISCORD__;%(PreprocessorDefinitions)
@@ -1158,5 +1161,10 @@
TurnOffAllWarnings
+
+
+ {c453da76-44b3-4ac8-aaa2-2b64a76993a5}
+
+
\ No newline at end of file
diff --git a/test/tests/tests.vcxproj b/test/tests/tests.vcxproj
index 53c7877c2a..c79eab00b2 100644
--- a/test/tests/tests.vcxproj
+++ b/test/tests/tests.vcxproj
@@ -109,5 +109,13 @@
+
+
+ {c453da76-44b3-4ac8-aaa2-2b64a76993a5}
+
+
+ {d24d94f6-2a74-480c-b512-629c306ce92f}
+
+
\ No newline at end of file