Skip to content

Commit

Permalink
Made ModCompile standalone and fixed targets file
Browse files Browse the repository at this point in the history
  • Loading branch information
TheStachelfisch committed Mar 31, 2021
1 parent 894cf35 commit f000642
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 25 deletions.
60 changes: 35 additions & 25 deletions patches/64bit/Terraria.ModLoader.Core/ModCompile.cs.patch
Original file line number Diff line number Diff line change
@@ -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)
10 changes: 10 additions & 0 deletions patches/64bit/Terraria.ModLoader.UI/UIDeveloperModeHelp.cs.patch
Original file line number Diff line number Diff line change
@@ -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);

0 comments on commit f000642

Please sign in to comment.