Assert option and other fixes (#370)

* Add option to control assert logging

* Fix logging errors from calling InitMultithreading before InvokeBeforeRun
This commit is contained in:
Jimmacle
2020-03-20 09:44:54 -07:00
committed by GitHub
parent 33b2fa7094
commit 035325da22
5 changed files with 12 additions and 4 deletions

View File

@@ -120,6 +120,9 @@ namespace Torch.Server
[Arg("testplugin", "Path to a plugin to debug. For development use only.")] [Arg("testplugin", "Path to a plugin to debug. For development use only.")]
public string TestPlugin { get; set; } public string TestPlugin { get; set; }
[Arg("asserts", "Enable Keen's assert logging.")]
public bool EnableAsserts { get; set; } = false;
[XmlIgnore] [XmlIgnore]
private string _path; private string _path;

View File

@@ -53,7 +53,7 @@ namespace Torch.Server
internal bool FatalException { get; set; } internal bool FatalException { get; set; }
/// <inheritdoc /> /// <inheritdoc />
public TorchServer(TorchConfig config = null) public TorchServer(TorchConfig config = null)
{ {
DedicatedInstance = new InstanceManager(this); DedicatedInstance = new InstanceManager(this);
AddManager(DedicatedInstance); AddManager(DedicatedInstance);
@@ -63,6 +63,11 @@ namespace Torch.Server
var sessionManager = Managers.GetManager<ITorchSessionManager>(); var sessionManager = Managers.GetManager<ITorchSessionManager>();
sessionManager.AddFactory(x => new MultiplayerManagerDedicated(this)); sessionManager.AddFactory(x => new MultiplayerManagerDedicated(this));
// Needs to be done at some point after MyVRageWindows.Init
// where the debug listeners are registered
if (!((TorchConfig)Config).EnableAsserts)
MyDebug.Listeners.Clear();
} }
public bool HasRun { get => _hasRun; set => SetValue(ref _hasRun, value); } public bool HasRun { get => _hasRun; set => SetValue(ref _hasRun, value); }

View File

@@ -11,7 +11,7 @@ using Torch.Managers.PatchManager;
using Torch.Utils; using Torch.Utils;
using VRage.Utils; using VRage.Utils;
namespace Torch.Managers namespace Torch.Patches
{ {
[PatchShim] [PatchShim]
internal static class KeenLogPatch internal static class KeenLogPatch

View File

@@ -217,7 +217,6 @@
<Compile Include="Event\EventList.cs" /> <Compile Include="Event\EventList.cs" />
<Compile Include="Event\EventManager.cs" /> <Compile Include="Event\EventManager.cs" />
<Compile Include="Event\IEventList.cs" /> <Compile Include="Event\IEventList.cs" />
<Compile Include="Managers\KeenLogPatch.cs" />
<Compile Include="Managers\PatchManager\AssemblyMemory.cs" /> <Compile Include="Managers\PatchManager\AssemblyMemory.cs" />
<Compile Include="Managers\PatchManager\DecoratedMethod.cs" /> <Compile Include="Managers\PatchManager\DecoratedMethod.cs" />
<Compile Include="Managers\PatchManager\EmitExtensions.cs" /> <Compile Include="Managers\PatchManager\EmitExtensions.cs" />
@@ -244,6 +243,7 @@
<Compile Include="MySteamServiceWrapper.cs" /> <Compile Include="MySteamServiceWrapper.cs" />
<Compile Include="Patches\GameAnalyticsPatch.cs" /> <Compile Include="Patches\GameAnalyticsPatch.cs" />
<Compile Include="Patches\GameStatePatchShim.cs" /> <Compile Include="Patches\GameStatePatchShim.cs" />
<Compile Include="Patches\KeenLogPatch.cs" />
<Compile Include="Patches\ObjectFactoryInitPatch.cs" /> <Compile Include="Patches\ObjectFactoryInitPatch.cs" />
<Compile Include="Patches\PhysicsMemoryPatch.cs" /> <Compile Include="Patches\PhysicsMemoryPatch.cs" />
<Compile Include="Patches\SessionDownloadPatch.cs" /> <Compile Include="Patches\SessionDownloadPatch.cs" />

View File

@@ -153,7 +153,6 @@ namespace Torch
MySessionComponentExtDebug.ForceDisable = true; MySessionComponentExtDebug.ForceDisable = true;
MyPerGameSettings.SendLogToKeen = false; MyPerGameSettings.SendLogToKeen = false;
// SpaceEngineersGame.SetupAnalytics(); // SpaceEngineersGame.SetupAnalytics();
MySandboxGame.InitMultithreading();
MyFileSystem.ExePath = Path.GetDirectoryName(typeof(SpaceEngineersGame).Assembly.Location); MyFileSystem.ExePath = Path.GetDirectoryName(typeof(SpaceEngineersGame).Assembly.Location);
@@ -161,6 +160,7 @@ namespace Torch
MyFileSystem.Reset(); MyFileSystem.Reset();
MyInitializer.InvokeBeforeRun(_appSteamId, _appName, _userDataPath); MyInitializer.InvokeBeforeRun(_appSteamId, _appName, _userDataPath);
MySandboxGame.InitMultithreading();
// MyInitializer.InitCheckSum(); // MyInitializer.InitCheckSum();