From f0006424d52af7e26eb16e61dde989936d84e166 Mon Sep 17 00:00:00 2001 From: TheStachelfisch Date: Wed, 31 Mar 2021 16:04:43 +0200 Subject: [PATCH] Made ModCompile standalone and fixed targets file --- .../ModCompile.cs.patch | 60 +++++++++++-------- .../UIDeveloperModeHelp.cs.patch | 10 ++++ 2 files changed, 45 insertions(+), 25 deletions(-) create mode 100644 patches/64bit/Terraria.ModLoader.UI/UIDeveloperModeHelp.cs.patch diff --git a/patches/64bit/Terraria.ModLoader.Core/ModCompile.cs.patch b/patches/64bit/Terraria.ModLoader.Core/ModCompile.cs.patch index 4f0c112ceb8..c48baee54db 100644 --- a/patches/64bit/Terraria.ModLoader.Core/ModCompile.cs.patch +++ b/patches/64bit/Terraria.ModLoader.Core/ModCompile.cs.patch @@ -1,29 +1,39 @@ --- src/tModLoader/Terraria.ModLoader.Core/ModCompile.cs +++ src/64bit/Terraria.ModLoader.Core/ModCompile.cs -@@ -183,12 +_,20 @@ - if (referenceAssembliesPath != null) - return true; +@@ -55,6 +_,7 @@ -- if (Platform.IsWindows) -- referenceAssembliesPath = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86) + @"\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5"; -- else if (Platform.IsOSX) -- referenceAssembliesPath = "/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/4.5-api"; -- else if (Platform.IsLinux) -- referenceAssembliesPath = "/usr/lib/mono/4.5-api"; -+ -+ switch (PlatformUtilities.RunningPlatform()) { -+ case PlatformID.Win32NT: -+ referenceAssembliesPath = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86) + @"\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5"; -+ break; -+ case PlatformID.MacOSX: -+ referenceAssembliesPath = "/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/4.5-api"; -+ break; -+ default: -+ referenceAssembliesPath = "/usr/lib/mono/4.5-api"; -+ break; -+ } -+ -+ Logging.tML.Info(referenceAssembliesPath); + public static readonly string ModSourcePath = Path.Combine(Program.SavePath, "Mod Sources"); - if (Directory.Exists(referenceAssembliesPath)) - return true; ++ // Use ModCompile64 instead of ModCompile + internal static readonly string modCompileDir = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "ModCompile64"); + internal static readonly string modCompileVersionPath = Path.Combine(modCompileDir, "version"); + +@@ -224,6 +_,7 @@ + if (!Directory.Exists(modReferencesPath)) + Directory.CreateDirectory(modReferencesPath); + ++ // tModLoader64bit.exe + var tMLPath = Assembly.GetExecutingAssembly().Location; + var touchStamp = $"{tMLPath} @ {File.GetLastWriteTime(tMLPath)}"; + var touchFile = Path.Combine(modReferencesPath, "touch"); +@@ -246,16 +_,16 @@ + + var tMLDir = Path.GetDirectoryName(tMLPath); + #if CLIENT +- var tMLServerName = Path.GetFileName(tMLPath).Replace("tModLoader", "tModLoaderServer"); ++ var tMLServerName = Path.GetFileName(tMLPath).Replace("tModLoader64bit", "tModLoader64bitServer"); + if (tMLServerName == "Terraria.exe") +- tMLServerName = "tModLoaderServer.exe"; ++ tMLServerName = "tModLoader64bitServer.exe"; + var tMLServerPath = Path.Combine(tMLDir, tMLServerName); + #else + var tMLServerPath = tMLPath; +- var tMLClientName = Path.GetFileName(tMLPath).Replace("tModLoaderServer", "tModLoader"); ++ var tMLClientName = Path.GetFileName(tMLPath).Replace("tModLoader64bit", "tModLoader64bitServer"); + tMLPath = Path.Combine(tMLDir, tMLClientName); + if (!File.Exists(tMLPath)) +- tMLPath = Path.Combine(tMLDir, "Terraria.exe"); ++ tMLPath = Path.Combine(tMLDir, "tModLoader64bit.exe"); + #endif + var tMLBuildServerPath = tMLServerPath; + if (FrameworkVersion.Framework == Framework.Mono) diff --git a/patches/64bit/Terraria.ModLoader.UI/UIDeveloperModeHelp.cs.patch b/patches/64bit/Terraria.ModLoader.UI/UIDeveloperModeHelp.cs.patch new file mode 100644 index 00000000000..52e2767f19c --- /dev/null +++ b/patches/64bit/Terraria.ModLoader.UI/UIDeveloperModeHelp.cs.patch @@ -0,0 +1,10 @@ +--- src/tModLoader/Terraria.ModLoader.UI/UIDeveloperModeHelp.cs ++++ src/64bit/Terraria.ModLoader.UI/UIDeveloperModeHelp.cs +@@ -191,6 +_,7 @@ + Interface.downloadProgress.OnDownloadsComplete += () => { + Main.menuMode = Interface.developerModeHelpID; + }; ++ // Change download name from ModCompile to ModCompile64 + DownloadFileFromUrl("ModCompile64", url, file, () => { + try { + Extract(file);