Skip to content

Commit 43adeca

Browse files
authored
Publictest (#335)
* Fix compiler errors * Fix Jenkins * Build public test as Release * Fix more things * Oops * Remove obsolete code * Fix GameStatePatchShim
1 parent 1a1f8b2 commit 43adeca

22 files changed

Lines changed: 68 additions & 769 deletions

‎Jenkins/jenkins-grab-se.ps1‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
pushd
22

3-
$steamData = "C:/Steam/Data/"
3+
$steamData = "C:/Steam/Data-playtest/"
44
$steamCMDPath = "C:/Steam/steamcmd/"
55
$steamCMDZip = "C:/Steam/steamcmd.zip"
66

@@ -17,6 +17,6 @@ if (!(Test-Path $steamCMDPath)) {
1717
}
1818

1919
cd "$steamData"
20-
& "$steamCMDPath/steamcmd.exe" "+login anonymous" "+force_install_dir $steamData" "+app_update 298740" "+quit"
20+
& "$steamCMDPath/steamcmd.exe" "+login anonymous" "+force_install_dir $steamData" "+app_update 298740 -beta publictest -betapassword nt8WuDw9kdvE validate" "+quit"
2121

2222
popd

‎Jenkinsfile‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ node {
2222
stage('Acquire SE') {
2323
bat 'powershell -File Jenkins/jenkins-grab-se.ps1'
2424
bat 'IF EXIST GameBinaries RMDIR GameBinaries'
25-
bat 'mklink /J GameBinaries "C:/Steam/Data/DedicatedServer64/"'
25+
bat 'mklink /J GameBinaries "C:/Steam/Data-playtest/DedicatedServer64/"'
2626
}
2727

2828
stage('Acquire NuGet Packages') {
@@ -31,7 +31,7 @@ node {
3131

3232
stage('Build') {
3333
currentBuild.description = bat(returnStdout: true, script: '@powershell -File Versioning/version.ps1').trim()
34-
if (env.BRANCH_NAME == "master" || env.BRANCH_NAME == "Patron") {
34+
if (env.BRANCH_NAME == "master" || env.BRANCH_NAME == "Patron" || env.BRANCH_NAME == "publictest") {
3535
buildMode = "Release"
3636
} else {
3737
buildMode = "Debug"

‎Torch.API/WebAPI/JenkinsQuery.cs‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,6 @@ private JenkinsQuery()
3030

3131
public async Task<Job> GetLatestVersion(string branch)
3232
{
33-
#if DEBUG
34-
branch = "master";
35-
#endif
3633
var h = await _client.GetAsync(string.Format(BRANCH_QUERY, branch));
3734
if (!h.IsSuccessStatusCode)
3835
{

‎Torch.Server/Initializer.cs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public class Initializer
3131

3232
private const string RUNSCRIPT = @"force_install_dir ../
3333
login anonymous
34-
app_update 298740
34+
app_update 298740 -beta publictest -betapassword nt8WuDw9kdvE validate
3535
quit";
3636

3737
private TorchConfig _config;

‎Torch.Server/Managers/InstanceManager.cs‎

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -198,16 +198,6 @@ private void ImportWorldConfig(bool modsOnly = true)
198198

199199
public void SaveConfig()
200200
{
201-
var cf = Torch.Config as TorchConfig;
202-
if (cf?.ReservedPlayers?.Count > 0)
203-
{
204-
foreach (var res in cf.ReservedPlayers)
205-
{
206-
if (!DedicatedConfig.Reserved.Contains(res))
207-
DedicatedConfig.Reserved.Add(res);
208-
}
209-
}
210-
211201
DedicatedConfig.Save(Path.Combine(Torch.Config.InstancePath, CONFIG_NAME));
212202
Log.Info("Saved dedicated config.");
213203

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
using System;
2+
using System.Collections;
3+
using System.Collections.Generic;
4+
using System.Linq;
5+
using System.Reflection;
6+
using System.Reflection.Emit;
7+
using NLog;
8+
using Sandbox;
9+
using Torch.Managers.PatchManager;
10+
using Torch.Managers.PatchManager.MSIL;
11+
12+
namespace Torch.Patches
13+
{
14+
/// <summary>
15+
/// Patches MySandboxGame.InitQuickLaunch to rethrow exceptions caught during session load.
16+
/// </summary>
17+
[PatchShim]
18+
public static class WorldLoadExceptionPatch
19+
{
20+
private static readonly ILogger _log = LogManager.GetCurrentClassLogger();
21+
22+
public static void Patch(PatchContext ctx)
23+
{
24+
ctx.GetPattern(typeof(MySandboxGame).GetMethod("InitQuickLaunch", BindingFlags.Instance | BindingFlags.NonPublic))
25+
.Transpilers.Add(typeof(WorldLoadExceptionPatch).GetMethod(nameof(Transpile), BindingFlags.Static | BindingFlags.NonPublic));
26+
}
27+
28+
private static IEnumerable<MsilInstruction> Transpile(IEnumerable<MsilInstruction> method)
29+
{
30+
var msil = method.ToList();
31+
for (var i = 0; i < msil.Count; i++)
32+
{
33+
if (msil[i].TryCatchOperations.All(x => x.Type != MsilTryCatchOperationType.BeginClauseBlock))
34+
continue;
35+
36+
for (; i < msil.Count; i++)
37+
{
38+
if (msil[i].OpCode != OpCodes.Leave)
39+
continue;
40+
41+
msil[i] = new MsilInstruction(OpCodes.Rethrow);
42+
break;
43+
}
44+
}
45+
return msil;
46+
}
47+
}
48+
}

‎Torch.Server/Torch.Server.csproj‎

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -208,15 +208,8 @@
208208
<HintPath>..\GameBinaries\VRage.Math.dll</HintPath>
209209
<Private>False</Private>
210210
</Reference>
211-
<Reference Include="VRage.Native, Version=0.0.0.0, Culture=neutral, processorArchitecture=AMD64">
212-
<SpecificVersion>False</SpecificVersion>
213-
<HintPath>..\GameBinaries\VRage.Native.dll</HintPath>
214-
<Private>False</Private>
215-
</Reference>
216-
<Reference Include="VRage.OpenVRWrapper, Version=1.0.0.0, Culture=neutral, processorArchitecture=AMD64">
217-
<SpecificVersion>False</SpecificVersion>
218-
<HintPath>..\GameBinaries\VRage.OpenVRWrapper.dll</HintPath>
219-
<Private>False</Private>
211+
<Reference Include="VRage.Platform.Windows, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null">
212+
<HintPath>..\GameBinaries\VRage.Platform.Windows.dll</HintPath>
220213
</Reference>
221214
<Reference Include="VRage.Render, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
222215
<SpecificVersion>False</SpecificVersion>
@@ -257,6 +250,7 @@
257250
<Compile Include="NativeMethods.cs" />
258251
<Compile Include="Initializer.cs" />
259252
<Compile Include="Patches\PromotePatch.cs" />
253+
<Compile Include="Patches\WorldLoadExceptionPatch.cs" />
260254
<Compile Include="Properties\Annotations.cs" />
261255
<Compile Include="Properties\AssemblyInfo.cs" />
262256
<Compile Include="TorchConfig.cs" />

‎Torch.Server/TorchConfig.cs‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,6 @@ public string InstancePath
109109

110110
public string LastUsedTheme { get; set; } = "Torch Theme";
111111

112-
//TODO: REMOVE ME BY JULY 2019
113-
[Obsolete("Use vanilla reserved slot config")]
114-
public HashSet<ulong> ReservedPlayers { get; set; } = new HashSet<ulong>();
115-
116112
//Prevent reserved players being written to disk, but allow it to be read
117113
//remove this when ReservedPlayers is removed
118114
private bool ShouldSerializeReservedPlayers() => false;

‎Torch.Server/TorchServer.cs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
using VRage.Dedicated;
2828
using VRage.Dedicated.RemoteAPI;
2929
using VRage.GameServices;
30+
using VRage.Scripting;
3031
using VRage.Steam;
3132
using Timer = System.Threading.Timer;
3233

0 commit comments

Comments
 (0)