Publictest (#335)

* Fix compiler errors

* Fix Jenkins

* Build public test as Release

* Fix more things

* Oops

* Remove obsolete code

* Fix GameStatePatchShim
This commit is contained in:
Brant Martin
2019-08-22 13:25:53 -04:00
committed by GitHub
parent 1a1f8b2235
commit 43adecaf99
22 changed files with 68 additions and 769 deletions

View File

@@ -31,7 +31,7 @@ namespace Torch.Server
private const string RUNSCRIPT = @"force_install_dir ../
login anonymous
app_update 298740
app_update 298740 -beta publictest -betapassword nt8WuDw9kdvE validate
quit";
private TorchConfig _config;

View File

@@ -198,16 +198,6 @@ namespace Torch.Server.Managers
public void SaveConfig()
{
var cf = Torch.Config as TorchConfig;
if (cf?.ReservedPlayers?.Count > 0)
{
foreach (var res in cf.ReservedPlayers)
{
if (!DedicatedConfig.Reserved.Contains(res))
DedicatedConfig.Reserved.Add(res);
}
}
DedicatedConfig.Save(Path.Combine(Torch.Config.InstancePath, CONFIG_NAME));
Log.Info("Saved dedicated config.");

View File

@@ -0,0 +1,48 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using NLog;
using Sandbox;
using Torch.Managers.PatchManager;
using Torch.Managers.PatchManager.MSIL;
namespace Torch.Patches
{
/// <summary>
/// Patches MySandboxGame.InitQuickLaunch to rethrow exceptions caught during session load.
/// </summary>
[PatchShim]
public static class WorldLoadExceptionPatch
{
private static readonly ILogger _log = LogManager.GetCurrentClassLogger();
public static void Patch(PatchContext ctx)
{
ctx.GetPattern(typeof(MySandboxGame).GetMethod("InitQuickLaunch", BindingFlags.Instance | BindingFlags.NonPublic))
.Transpilers.Add(typeof(WorldLoadExceptionPatch).GetMethod(nameof(Transpile), BindingFlags.Static | BindingFlags.NonPublic));
}
private static IEnumerable<MsilInstruction> Transpile(IEnumerable<MsilInstruction> method)
{
var msil = method.ToList();
for (var i = 0; i < msil.Count; i++)
{
if (msil[i].TryCatchOperations.All(x => x.Type != MsilTryCatchOperationType.BeginClauseBlock))
continue;
for (; i < msil.Count; i++)
{
if (msil[i].OpCode != OpCodes.Leave)
continue;
msil[i] = new MsilInstruction(OpCodes.Rethrow);
break;
}
}
return msil;
}
}
}

View File

@@ -208,15 +208,8 @@
<HintPath>..\GameBinaries\VRage.Math.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="VRage.Native, Version=0.0.0.0, Culture=neutral, processorArchitecture=AMD64">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\GameBinaries\VRage.Native.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="VRage.OpenVRWrapper, Version=1.0.0.0, Culture=neutral, processorArchitecture=AMD64">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\GameBinaries\VRage.OpenVRWrapper.dll</HintPath>
<Private>False</Private>
<Reference Include="VRage.Platform.Windows, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null">
<HintPath>..\GameBinaries\VRage.Platform.Windows.dll</HintPath>
</Reference>
<Reference Include="VRage.Render, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
@@ -257,6 +250,7 @@
<Compile Include="NativeMethods.cs" />
<Compile Include="Initializer.cs" />
<Compile Include="Patches\PromotePatch.cs" />
<Compile Include="Patches\WorldLoadExceptionPatch.cs" />
<Compile Include="Properties\Annotations.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="TorchConfig.cs" />

View File

@@ -109,10 +109,6 @@ namespace Torch.Server
public string LastUsedTheme { get; set; } = "Torch Theme";
//TODO: REMOVE ME BY JULY 2019
[Obsolete("Use vanilla reserved slot config")]
public HashSet<ulong> ReservedPlayers { get; set; } = new HashSet<ulong>();
//Prevent reserved players being written to disk, but allow it to be read
//remove this when ReservedPlayers is removed
private bool ShouldSerializeReservedPlayers() => false;

View File

@@ -27,6 +27,7 @@ using VRage;
using VRage.Dedicated;
using VRage.Dedicated.RemoteAPI;
using VRage.GameServices;
using VRage.Scripting;
using VRage.Steam;
using Timer = System.Threading.Timer;