-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathProgram.cs
31 lines (27 loc) · 1.11 KB
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
using System.Reflection;
using System.Reflection.Metadata;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using Terramon.Core.Loaders.UILoading;
[assembly: MetadataUpdateHandler(typeof(UILoader))]
namespace Terramon;
[AutoloadBossHead]
internal class Program
{
public static void Main(string[] args)
{
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
Environment.CurrentDirectory = @"C:\Program Files (x86)\Steam\steamapps\common\tModLoader";
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
Environment.CurrentDirectory = Environment.GetEnvironmentVariable("HOME") + "/.steam/steam/steamapps/common/tModLoader";
DoLaunch(args);
}
[MethodImpl(MethodImplOptions.NoInlining)]
private static void DoLaunch(string[] args)
{
args = args.Append("-console").ToArray();
typeof(ModLoader).Assembly.GetType("Terraria.MonoLaunch")!.GetMethod("Main",
BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static)!.CreateDelegate<Action<string[]>>()
.Invoke(args);
}
}