Compare commits

...

3 Commits
2.1.5 ... 2.1.6

Author SHA1 Message Date
zznty
65e2f342a3 fix exception when destruction occurs before game has been initialized
All checks were successful
Release / Get Version (push) Successful in 15s
Release / Build and Publish Nuget (push) Successful in 2m21s
Release / Build and Publish Package (push) Successful in 2m51s
2024-10-13 22:29:05 +07:00
zznty
6a695f2abf fix backwards compat with some plugins 2024-10-13 22:26:09 +07:00
zznty
9289ab8003 fix compiler paths on publish 2024-10-13 22:17:07 +07:00
3 changed files with 42 additions and 18 deletions

View File

@@ -1,4 +1,5 @@
using System;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using System.Threading.Tasks;
using Microsoft.Extensions.Configuration;
@@ -140,6 +141,22 @@ namespace Torch.API
event Action<ITorchServer> Initialized;
TimeSpan ElapsedPlayTime { get; set; }
#region Backwards compat
/// <summary>
/// Path of the dedicated instance folder.
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
new string InstancePath => ((ITorchBase)this).InstancePath;
/// <summary>
/// Name of the dedicated instance.
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
new string InstanceName => ((ITorchBase)this).InstanceName;
#endregion
}
/// <summary>

View File

@@ -45,6 +45,12 @@ namespace Torch.Patches
private static void WhitelistCtorPrefix(MyScriptCompiler scriptCompiler)
{
var baseDir = new FileInfo(typeof(Type).Assembly.Location).DirectoryName!;
var binDir =
#if DEBUG
baseDir;
#else
Path.Join(AppContext.BaseDirectory, "torch64");
#endif
scriptCompiler.AddReferencedAssemblies(
typeof(Type).Assembly.Location,
@@ -57,22 +63,22 @@ namespace Torch.Patches
typeof(TypeConverter).Assembly.Location,
typeof(System.Diagnostics.TraceSource).Assembly.Location,
typeof(System.Security.Policy.Evidence).Assembly.Location,
Path.Combine(baseDir, "System.Xml.ReaderWriter.dll"),
Path.Combine(MyFileSystem.ExePath, "ProtoBuf.Net.dll"),
Path.Combine(MyFileSystem.ExePath, "ProtoBuf.Net.Core.dll"),
Path.Combine(baseDir, "netstandard.dll"),
Path.Combine(baseDir, "System.Runtime.dll"),
Path.Combine(MyFileSystem.ExePath, "Sandbox.Game.dll"),
Path.Combine(MyFileSystem.ExePath, "Sandbox.Common.dll"),
Path.Combine(MyFileSystem.ExePath, "Sandbox.Graphics.dll"),
Path.Combine(MyFileSystem.ExePath, "VRage.dll"),
Path.Combine(MyFileSystem.ExePath, "VRage.Library.dll"),
Path.Combine(MyFileSystem.ExePath, "VRage.Math.dll"),
Path.Combine(MyFileSystem.ExePath, "VRage.Game.dll"),
Path.Combine(MyFileSystem.ExePath, "VRage.Render.dll"),
Path.Combine(MyFileSystem.ExePath, "VRage.Input.dll"),
Path.Combine(MyFileSystem.ExePath, "SpaceEngineers.ObjectBuilders.dll"),
Path.Combine(MyFileSystem.ExePath, "SpaceEngineers.Game.dll"));
Path.Join(binDir, "System.Xml.ReaderWriter.dll"),
Path.Join(MyFileSystem.ExePath, "ProtoBuf.Net.dll"),
Path.Join(MyFileSystem.ExePath, "ProtoBuf.Net.Core.dll"),
Path.Join(binDir, "netstandard.dll"),
Path.Join(baseDir, "System.Runtime.dll"),
Path.Join(MyFileSystem.ExePath, "Sandbox.Game.dll"),
Path.Join(MyFileSystem.ExePath, "Sandbox.Common.dll"),
Path.Join(MyFileSystem.ExePath, "Sandbox.Graphics.dll"),
Path.Join(MyFileSystem.ExePath, "VRage.dll"),
Path.Join(MyFileSystem.ExePath, "VRage.Library.dll"),
Path.Join(MyFileSystem.ExePath, "VRage.Math.dll"),
Path.Join(MyFileSystem.ExePath, "VRage.Game.dll"),
Path.Join(MyFileSystem.ExePath, "VRage.Render.dll"),
Path.Join(MyFileSystem.ExePath, "VRage.Input.dll"),
Path.Join(MyFileSystem.ExePath, "SpaceEngineers.ObjectBuilders.dll"),
Path.Join(MyFileSystem.ExePath, "SpaceEngineers.Game.dll"));
}
private static bool InitializePrefix(Thread updateThread, Type[] referencedTypes, string[] symbols)

View File

@@ -312,7 +312,7 @@ namespace Torch
private void Destroy()
{
_game.Dispose();
_game?.Dispose();
_game = null;
MyGameService.ShutDown();
@@ -462,7 +462,8 @@ namespace Torch
public void SignalDestroy()
{
_destroyGame = true;
SignalStop();
if (_game is not null)
SignalStop();
_commandChanged.Set();
}