Compare commits
6 Commits
v1.0.23-ma
...
v1.0.29-ma
Author | SHA1 | Date | |
---|---|---|---|
![]() |
1f7e4e869d | ||
![]() |
ba5b611994 | ||
![]() |
2bcf79efdd | ||
![]() |
d5c101bf19 | ||
![]() |
e9841b4de1 | ||
![]() |
aea0011683 |
@@ -1,6 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Reflection.Emit;
|
using System.Reflection.Emit;
|
||||||
@@ -8,6 +9,7 @@ using NLog;
|
|||||||
using Sandbox;
|
using Sandbox;
|
||||||
using Torch.Managers.PatchManager;
|
using Torch.Managers.PatchManager;
|
||||||
using Torch.Managers.PatchManager.MSIL;
|
using Torch.Managers.PatchManager.MSIL;
|
||||||
|
using Torch.Utils;
|
||||||
|
|
||||||
namespace Torch.Patches
|
namespace Torch.Patches
|
||||||
{
|
{
|
||||||
@@ -17,12 +19,14 @@ namespace Torch.Patches
|
|||||||
[PatchShim]
|
[PatchShim]
|
||||||
public static class WorldLoadExceptionPatch
|
public static class WorldLoadExceptionPatch
|
||||||
{
|
{
|
||||||
private static readonly ILogger _log = LogManager.GetCurrentClassLogger();
|
private static readonly ILogger Log = LogManager.GetCurrentClassLogger();
|
||||||
|
|
||||||
|
[ReflectedMethodInfo(typeof(MySandboxGame), "InitQuickLaunch")]
|
||||||
|
private static MethodInfo _quickLaunchMethod = null!;
|
||||||
|
|
||||||
public static void Patch(PatchContext ctx)
|
public static void Patch(PatchContext ctx)
|
||||||
{
|
{
|
||||||
ctx.GetPattern(typeof(MySandboxGame).GetMethod("InitQuickLaunch", BindingFlags.Instance | BindingFlags.NonPublic))
|
ctx.GetPattern(_quickLaunchMethod).AddTranspiler(nameof(Transpile));
|
||||||
.Transpilers.Add(typeof(WorldLoadExceptionPatch).GetMethod(nameof(Transpile), BindingFlags.Static | BindingFlags.NonPublic));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static IEnumerable<MsilInstruction> Transpile(IEnumerable<MsilInstruction> method)
|
private static IEnumerable<MsilInstruction> Transpile(IEnumerable<MsilInstruction> method)
|
||||||
@@ -30,19 +34,19 @@ namespace Torch.Patches
|
|||||||
var msil = method.ToList();
|
var msil = method.ToList();
|
||||||
for (var i = 0; i < msil.Count; i++)
|
for (var i = 0; i < msil.Count; i++)
|
||||||
{
|
{
|
||||||
if (msil[i].TryCatchOperations.All(x => x.Type != MsilTryCatchOperationType.BeginClauseBlock))
|
var instruction = msil[i];
|
||||||
continue;
|
if (instruction.IsLocalStore() && instruction.Operand is MsilOperandInline.MsilOperandLocal {Value.Index: 19} operand)
|
||||||
|
|
||||||
for (; i < msil.Count; i++)
|
|
||||||
{
|
{
|
||||||
if (msil[i].OpCode != OpCodes.Leave)
|
msil.InsertRange(i + 1, new []
|
||||||
continue;
|
{
|
||||||
|
operand.Instruction.CopyWith(OpCodes.Ldloc_S),
|
||||||
msil[i] = new MsilInstruction(OpCodes.Rethrow);
|
new MsilInstruction(OpCodes.Call).InlineValue(new Action<Exception>(LogFatal).Method)
|
||||||
break;
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return msil;
|
return msil;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void LogFatal(Exception e) => Log.Fatal(e.ToStringDemystified());
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -7,6 +7,7 @@ namespace Torch.Server
|
|||||||
{
|
{
|
||||||
internal static class Program
|
internal static class Program
|
||||||
{
|
{
|
||||||
|
[STAThread]
|
||||||
public static void Main(string[] args)
|
public static void Main(string[] args)
|
||||||
{
|
{
|
||||||
var isService = Environment.GetEnvironmentVariable("TORCH_SERVICE")
|
var isService = Environment.GetEnvironmentVariable("TORCH_SERVICE")
|
||||||
@@ -23,8 +24,6 @@ namespace Torch.Server
|
|||||||
File.Delete(file);
|
File.Delete(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
TorchLauncher.Launch(workingDir, binDir);
|
|
||||||
|
|
||||||
// Breaks on Windows Server 2019
|
// Breaks on Windows Server 2019
|
||||||
#if TORCH_SERVICE
|
#if TORCH_SERVICE
|
||||||
if (!new ComputerInfo().OSFullName.Contains("Server 2019") && !Environment.UserInteractive)
|
if (!new ComputerInfo().OSFullName.Contains("Server 2019") && !Environment.UserInteractive)
|
||||||
@@ -45,7 +44,7 @@ namespace Torch.Server
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
instancePath = Path.GetFullPath(instanceName);
|
instancePath = Directory.CreateDirectory(instanceName).FullName;
|
||||||
}
|
}
|
||||||
|
|
||||||
var oldTorchCfg = Path.Combine(workingDir, "Torch.cfg");
|
var oldTorchCfg = Path.Combine(workingDir, "Torch.cfg");
|
||||||
@@ -70,6 +69,8 @@ namespace Torch.Server
|
|||||||
if (!initializer.Initialize(args))
|
if (!initializer.Initialize(args))
|
||||||
Environment.Exit(1);
|
Environment.Exit(1);
|
||||||
|
|
||||||
|
TorchLauncher.Launch(workingDir, binDir);
|
||||||
|
|
||||||
CopyNative(binDir);
|
CopyNative(binDir);
|
||||||
initializer.Run(isService, instanceName, instancePath);
|
initializer.Run(isService, instanceName, instancePath);
|
||||||
}
|
}
|
||||||
|
@@ -161,6 +161,5 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Page Remove="Views\WorldSelectControl.xaml" />
|
<Page Remove="Views\WorldSelectControl.xaml" />
|
||||||
<None Include="..\NLog.config" Visible="false" CopyToOutputDirectory="PreserveNewest" CopyToPublishDirectory="Always" />
|
<None Include="..\NLog.config" Visible="false" CopyToOutputDirectory="PreserveNewest" CopyToPublishDirectory="Always" />
|
||||||
<None Include="..\Dockerfile" Visible="false" CopyToPublishDirectory="Always" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
@@ -17,6 +17,7 @@ internal static class GcCollectPatch
|
|||||||
{
|
{
|
||||||
// FUCK YO KEEN
|
// FUCK YO KEEN
|
||||||
// every call results in freeze for seconds
|
// every call results in freeze for seconds
|
||||||
|
|
||||||
private static readonly MethodBase[] _targets =
|
private static readonly MethodBase[] _targets =
|
||||||
{
|
{
|
||||||
Info.OfMethod<MyPlanetTextureMapProvider>(nameof(MyPlanetTextureMapProvider.GetHeightmap)),
|
Info.OfMethod<MyPlanetTextureMapProvider>(nameof(MyPlanetTextureMapProvider.GetHeightmap)),
|
||||||
|
@@ -1,7 +1,9 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Collections;
|
||||||
using System.Collections.Concurrent;
|
using System.Collections.Concurrent;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.Immutable;
|
using System.Collections.Immutable;
|
||||||
|
using System.ComponentModel;
|
||||||
using System.Diagnostics.CodeAnalysis;
|
using System.Diagnostics.CodeAnalysis;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@@ -43,11 +45,14 @@ namespace Torch.Patches
|
|||||||
private static void WhitelistCtorPrefix(MyScriptCompiler scriptCompiler)
|
private static void WhitelistCtorPrefix(MyScriptCompiler scriptCompiler)
|
||||||
{
|
{
|
||||||
scriptCompiler.AddReferencedAssemblies(
|
scriptCompiler.AddReferencedAssemblies(
|
||||||
|
typeof(ValueType).Assembly.Location,
|
||||||
|
typeof(LinkedList<>).Assembly.Location,
|
||||||
typeof(Regex).Assembly.Location,
|
typeof(Regex).Assembly.Location,
|
||||||
typeof(Enumerable).Assembly.Location,
|
typeof(Enumerable).Assembly.Location,
|
||||||
typeof(ConcurrentBag<>).Assembly.Location,
|
typeof(ConcurrentBag<>).Assembly.Location,
|
||||||
typeof(ImmutableArray).Assembly.Location,
|
typeof(ImmutableArray).Assembly.Location,
|
||||||
typeof(System.ComponentModel.TypeConverter).Assembly.Location,
|
typeof(PropertyChangedEventArgs).Assembly.Location,
|
||||||
|
typeof(TypeConverter).Assembly.Location,
|
||||||
typeof(System.Diagnostics.TraceSource).Assembly.Location,
|
typeof(System.Diagnostics.TraceSource).Assembly.Location,
|
||||||
typeof(ProtoBuf.Meta.RuntimeTypeModel).Assembly.Location,
|
typeof(ProtoBuf.Meta.RuntimeTypeModel).Assembly.Location,
|
||||||
Path.Combine(MyFileSystem.ExePath, "Sandbox.Game.dll"),
|
Path.Combine(MyFileSystem.ExePath, "Sandbox.Game.dll"),
|
||||||
|
@@ -47,14 +47,11 @@ install:
|
|||||||
cache:
|
cache:
|
||||||
- c:\steam\dedi\
|
- c:\steam\dedi\
|
||||||
- c:\steam\cmd\
|
- c:\steam\cmd\
|
||||||
before_build:
|
|
||||||
- pwsh: dotnet restore .\Torch.Server\Torch.Server.csproj
|
|
||||||
build_script:
|
build_script:
|
||||||
- pwsh: >-
|
- pwsh: >-
|
||||||
dotnet publish .\Torch.Server\Torch.Server.csproj --self-contained -f net6-windows -r win7-64 -c Release -o .\publish\
|
dotnet publish .\Torch.Server\Torch.Server.csproj --self-contained -f net6-windows -r win-x64 -c Release -o .\publish\
|
||||||
|
|
||||||
cmd /c "rmdir GameBinaries"
|
Compress-Archive -Path .\publish\* -DestinationPath .\torch-server.zip
|
||||||
Compress-Archive -Path .\publish\* -DestinationPath torch-server.zip
|
|
||||||
artifacts:
|
artifacts:
|
||||||
- path: torch-server.zip
|
- path: torch-server.zip
|
||||||
deploy:
|
deploy:
|
||||||
|
Reference in New Issue
Block a user