From 19995eba1ac5e0b5c14b8f0ffa28adc1788e9b09 Mon Sep 17 00:00:00 2001 From: Brant Martin Date: Thu, 6 Jun 2019 15:54:05 -0400 Subject: [PATCH 1/6] Update protobuf to 2.4 --- Torch.Client.Tests/Torch.Client.Tests.csproj | 1 + Torch.Client.Tests/app.config | 11 +++++++++++ Torch.Client/Torch.Client.csproj | 1 + Torch.Client/TorchClientConfig.cs | 2 ++ Torch.Client/app.config | 11 +++++++++++ Torch.Server.Tests/Torch.Server.Tests.csproj | 1 + Torch.Server.Tests/app.config | 11 +++++++++++ Torch.Server/Initializer.cs | 6 ------ Torch.Server/Torch.Server.csproj | 8 ++++++-- Torch.Server/app.config | 11 +++++++++++ Torch.Server/packages.config | 2 +- Torch.Tests/Torch.Tests.csproj | 1 + Torch.Tests/app.config | 11 +++++++++++ Torch/Torch.csproj | 9 ++++++--- Torch/app.config | 11 +++++++++++ Torch/packages.config | 2 +- 16 files changed, 86 insertions(+), 13 deletions(-) create mode 100644 Torch.Client.Tests/app.config create mode 100644 Torch.Client/app.config create mode 100644 Torch.Server.Tests/app.config create mode 100644 Torch.Server/app.config create mode 100644 Torch.Tests/app.config create mode 100644 Torch/app.config diff --git a/Torch.Client.Tests/Torch.Client.Tests.csproj b/Torch.Client.Tests/Torch.Client.Tests.csproj index f57c10c..c1dc43a 100644 --- a/Torch.Client.Tests/Torch.Client.Tests.csproj +++ b/Torch.Client.Tests/Torch.Client.Tests.csproj @@ -86,6 +86,7 @@ + diff --git a/Torch.Client.Tests/app.config b/Torch.Client.Tests/app.config new file mode 100644 index 0000000..a73892d --- /dev/null +++ b/Torch.Client.Tests/app.config @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/Torch.Client/Torch.Client.csproj b/Torch.Client/Torch.Client.csproj index 82a74fa..1ecb37a 100644 --- a/Torch.Client/Torch.Client.csproj +++ b/Torch.Client/Torch.Client.csproj @@ -147,6 +147,7 @@ ResXFileCodeGenerator Resources.Designer.cs + SettingsSingleFileGenerator diff --git a/Torch.Client/TorchClientConfig.cs b/Torch.Client/TorchClientConfig.cs index fda35e0..ba6e5b3 100644 --- a/Torch.Client/TorchClientConfig.cs +++ b/Torch.Client/TorchClientConfig.cs @@ -23,6 +23,8 @@ namespace Torch.Client public bool NoGui { get; set; } = false; public bool RestartOnCrash { get; set; } = false; public string WaitForPID { get; set; } = null; + public string ChatName { get; set; } + public string ChatColor { get; set; } public bool Save(string path = null) { diff --git a/Torch.Client/app.config b/Torch.Client/app.config new file mode 100644 index 0000000..a73892d --- /dev/null +++ b/Torch.Client/app.config @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/Torch.Server.Tests/Torch.Server.Tests.csproj b/Torch.Server.Tests/Torch.Server.Tests.csproj index 157bedf..cf95a9a 100644 --- a/Torch.Server.Tests/Torch.Server.Tests.csproj +++ b/Torch.Server.Tests/Torch.Server.Tests.csproj @@ -92,6 +92,7 @@ + diff --git a/Torch.Server.Tests/app.config b/Torch.Server.Tests/app.config new file mode 100644 index 0000000..a73892d --- /dev/null +++ b/Torch.Server.Tests/app.config @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/Torch.Server/Initializer.cs b/Torch.Server/Initializer.cs index f9af400..78167b1 100644 --- a/Torch.Server/Initializer.cs +++ b/Torch.Server/Initializer.cs @@ -65,12 +65,6 @@ quit"; if (!File.Exists(apiTarget)) File.Copy(apiSource, apiTarget); - - var protoSource = Path.Combine(basePath, "DedicatedServer64", "protobuf-net.dll"); - var protoTarget = Path.Combine(basePath, "protobuf-net.dll"); - - if(!File.Exists(protoTarget)) - File.Copy(protoSource, protoTarget); _config = InitConfig(); if (!_config.Parse(args)) diff --git a/Torch.Server/Torch.Server.csproj b/Torch.Server/Torch.Server.csproj index 57b3dc8..02606b0 100644 --- a/Torch.Server/Torch.Server.csproj +++ b/Torch.Server/Torch.Server.csproj @@ -93,8 +93,8 @@ ..\packages\NLog.4.4.12\lib\net45\NLog.dll True - - ..\packages\protobuf-net.2.1.0\lib\net451\protobuf-net.dll + + ..\packages\protobuf-net.2.4.0\lib\net40\protobuf-net.dll False @@ -131,16 +131,19 @@ + + ..\packages\System.Security.AccessControl.4.4.0\lib\net461\System.Security.AccessControl.dll ..\packages\System.Security.Principal.Windows.4.4.0\lib\net461\System.Security.Principal.Windows.dll + @@ -362,6 +365,7 @@ ResXFileCodeGenerator Resources.Designer.cs + SettingsSingleFileGenerator diff --git a/Torch.Server/app.config b/Torch.Server/app.config new file mode 100644 index 0000000..a73892d --- /dev/null +++ b/Torch.Server/app.config @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/Torch.Server/packages.config b/Torch.Server/packages.config index 11d6e4d..8429d70 100644 --- a/Torch.Server/packages.config +++ b/Torch.Server/packages.config @@ -7,7 +7,7 @@ - + diff --git a/Torch.Tests/Torch.Tests.csproj b/Torch.Tests/Torch.Tests.csproj index 50977de..f4cf215 100644 --- a/Torch.Tests/Torch.Tests.csproj +++ b/Torch.Tests/Torch.Tests.csproj @@ -82,6 +82,7 @@ + diff --git a/Torch.Tests/app.config b/Torch.Tests/app.config new file mode 100644 index 0000000..a73892d --- /dev/null +++ b/Torch.Tests/app.config @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/Torch/Torch.csproj b/Torch/Torch.csproj index b1ab8fe..f499196 100644 --- a/Torch/Torch.csproj +++ b/Torch/Torch.csproj @@ -65,9 +65,8 @@ - - False - ..\GameBinaries\protobuf-net.dll + + ..\packages\protobuf-net.2.4.0\lib\net40\protobuf-net.dll ..\GameBinaries\Sandbox.Common.dll @@ -101,15 +100,18 @@ + + ..\packages\System.Security.AccessControl.4.4.0\lib\net461\System.Security.AccessControl.dll ..\packages\System.Security.Principal.Windows.4.4.0\lib\net461\System.Security.Principal.Windows.dll + ..\packages\ControlzEx.3.0.2.4\lib\net45\System.Windows.Interactivity.dll True @@ -320,6 +322,7 @@ + diff --git a/Torch/app.config b/Torch/app.config new file mode 100644 index 0000000..a73892d --- /dev/null +++ b/Torch/app.config @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/Torch/packages.config b/Torch/packages.config index e77c03c..702f58c 100644 --- a/Torch/packages.config +++ b/Torch/packages.config @@ -5,7 +5,7 @@ - + From 5d19cc7cf13a121eac1f993de6767d6dd3406bbb Mon Sep 17 00:00:00 2001 From: John Gross Date: Thu, 6 Jun 2019 15:48:29 -0700 Subject: [PATCH 2/6] I think I fixed it --- Torch.Server/Torch.Server.csproj | 8 ++++++-- Torch.Server/app.config | 11 ----------- Torch.Server/packages.config | 1 + Torch/Torch.csproj | 8 ++++++++ Torch/VRageGame.cs | 2 ++ Torch/packages.config | 1 + 6 files changed, 18 insertions(+), 13 deletions(-) delete mode 100644 Torch.Server/app.config diff --git a/Torch.Server/Torch.Server.csproj b/Torch.Server/Torch.Server.csproj index 02606b0..c38317f 100644 --- a/Torch.Server/Torch.Server.csproj +++ b/Torch.Server/Torch.Server.csproj @@ -86,6 +86,7 @@ ..\packages\Microsoft.Win32.Registry.4.4.0\lib\net461\Microsoft.Win32.Registry.dll + ..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll @@ -130,6 +131,10 @@ ..\GameBinaries\Steamworks.NET.dll + + ..\packages\System.ComponentModel.Annotations.4.5.0\lib\net461\System.ComponentModel.Annotations.dll + True + @@ -365,7 +370,6 @@ ResXFileCodeGenerator Resources.Designer.cs - SettingsSingleFileGenerator @@ -509,6 +513,6 @@ - copy "$(SolutionDir)NLog.config" "$(TargetDir)" & copy "$(SolutionDir)NLog-user.config" "$(TargetDir)" + copy "$(SolutionDir)NLog.config" "$(TargetDir)" & copy "$(SolutionDir)NLog-user.config" "$(TargetDir)" & del "$(TargetDir)System.*" \ No newline at end of file diff --git a/Torch.Server/app.config b/Torch.Server/app.config deleted file mode 100644 index a73892d..0000000 --- a/Torch.Server/app.config +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/Torch.Server/packages.config b/Torch.Server/packages.config index 8429d70..24c621a 100644 --- a/Torch.Server/packages.config +++ b/Torch.Server/packages.config @@ -9,6 +9,7 @@ + \ No newline at end of file diff --git a/Torch/Torch.csproj b/Torch/Torch.csproj index f499196..ca60249 100644 --- a/Torch/Torch.csproj +++ b/Torch/Torch.csproj @@ -37,6 +37,7 @@ + @@ -99,6 +100,10 @@ ..\GameBinaries\Steamworks.NET.dll + + ..\packages\System.ComponentModel.Annotations.4.5.0\lib\net461\System.ComponentModel.Annotations.dll + True + @@ -163,6 +168,9 @@ ..\GameBinaries\VRage.OpenVRWrapper.dll False + + ..\bin\x64\Release\DedicatedServer64\VRage.Platform.Windows.dll + ..\GameBinaries\VRage.Render.dll False diff --git a/Torch/VRageGame.cs b/Torch/VRageGame.cs index 1065f49..b3460a4 100644 --- a/Torch/VRageGame.cs +++ b/Torch/VRageGame.cs @@ -31,6 +31,7 @@ using VRage.Game.ObjectBuilder; using VRage.Game.SessionComponents; using VRage.GameServices; using VRage.Network; +using VRage.Platform.Windows; using VRage.Plugins; using VRage.Steam; using VRage.Utils; @@ -156,6 +157,7 @@ namespace Torch _tweakGameSettings(); MyFileSystem.Reset(); + MyVRageWindows.Init(MySandboxGame.Log, Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "SpaceEngineersDedicated")); MyInitializer.InvokeBeforeRun(_appSteamId, _appName, _userDataPath); // MyInitializer.InitCheckSum(); diff --git a/Torch/packages.config b/Torch/packages.config index 702f58c..7f9ae61 100644 --- a/Torch/packages.config +++ b/Torch/packages.config @@ -7,6 +7,7 @@ + \ No newline at end of file From 3e5b29c84db18f6ce514e68ef842c6b545b076f2 Mon Sep 17 00:00:00 2001 From: John Gross Date: Thu, 6 Jun 2019 17:07:25 -0700 Subject: [PATCH 3/6] I think I actually fixed it --- Torch.Server/Program.cs | 9 +++++++++ Torch.Server/Torch.Server.csproj | 3 +++ Torch.Server/TorchServer.cs | 14 ++++++++------ 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/Torch.Server/Program.cs b/Torch.Server/Program.cs index 0bc4d7e..aca5ab4 100644 --- a/Torch.Server/Program.cs +++ b/Torch.Server/Program.cs @@ -2,6 +2,7 @@ using System.Diagnostics; using System.IO; using System.IO.Compression; +using System.Linq; using System.Net; using System.Reflection; using System.ServiceProcess; @@ -21,12 +22,20 @@ namespace Torch.Server [STAThread] public static void Main(string[] args) { + + Target.Register("FlowDocument"); //Ensures that all the files are downloaded in the Torch directory. var workingDir = new FileInfo(typeof(Program).Assembly.Location).Directory.ToString(); var binDir = Path.Combine(workingDir, "DedicatedServer64"); Directory.SetCurrentDirectory(workingDir); + //HACK for block skins update + foreach (var f in Directory.EnumerateFiles(workingDir, "System.*", SearchOption.TopDirectoryOnly)) + { + File.Delete(f); + } + if (!TorchLauncher.IsTorchWrapped()) { TorchLauncher.Launch(Assembly.GetEntryAssembly().FullName, args, binDir); diff --git a/Torch.Server/Torch.Server.csproj b/Torch.Server/Torch.Server.csproj index c38317f..c6548df 100644 --- a/Torch.Server/Torch.Server.csproj +++ b/Torch.Server/Torch.Server.csproj @@ -87,6 +87,9 @@ ..\packages\Microsoft.Win32.Registry.4.4.0\lib\net461\Microsoft.Win32.Registry.dll + + ..\GameBinaries\netstandard.dll + ..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll diff --git a/Torch.Server/TorchServer.cs b/Torch.Server/TorchServer.cs index c4070cd..60c6268 100644 --- a/Torch.Server/TorchServer.cs +++ b/Torch.Server/TorchServer.cs @@ -123,12 +123,14 @@ namespace Torch.Server _hasRun = true; Log.Info("Starting server."); MySandboxGame.ConfigDedicated = DedicatedInstance.DedicatedConfig.Model; - if (MySandboxGame.ConfigDedicated.RemoteApiEnabled && !string.IsNullOrEmpty(MySandboxGame.ConfigDedicated.RemoteSecurityKey)) - { - var myRemoteServer = new MyRemoteServer(MySandboxGame.ConfigDedicated.RemoteApiPort, MySandboxGame.ConfigDedicated.RemoteSecurityKey); - Log.Info($"Remote API started on port {myRemoteServer.Port}"); - } - + //Are you serious, Keen? This is going away until it stops hanging. + //if (MySandboxGame.ConfigDedicated.RemoteApiEnabled && !string.IsNullOrEmpty(MySandboxGame.ConfigDedicated.RemoteSecurityKey)) + //{ + // var myRemoteServer = new MyRemoteServer(MySandboxGame.ConfigDedicated.RemoteApiPort, MySandboxGame.ConfigDedicated.RemoteSecurityKey); + // Log.Info($"Remote API started on port {myRemoteServer.Port}"); + //} + Log.Warn("Remote API is disabled because it hangs the server start process. Blame Keen."); + _uptime = Stopwatch.StartNew(); base.Start(); } From 97f380fb7bc3cb1fb8af889f71184e1cbad5ad27 Mon Sep 17 00:00:00 2001 From: John Gross Date: Thu, 6 Jun 2019 18:03:58 -0700 Subject: [PATCH 4/6] Fix moar --- Torch.Server/Initializer.cs | 3 ++- Torch.Server/Program.cs | 12 +++++++++--- Torch.Server/Torch.Server.csproj | 2 +- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/Torch.Server/Initializer.cs b/Torch.Server/Initializer.cs index 78167b1..42325a4 100644 --- a/Torch.Server/Initializer.cs +++ b/Torch.Server/Initializer.cs @@ -171,9 +171,10 @@ quit"; File.Delete(STEAMCMD_ZIP); log.Info("SteamCMD downloaded successfully!"); } - catch + catch (Exception e) { log.Error("Failed to download SteamCMD, unable to update the DS."); + log.Error(e); return; } } diff --git a/Torch.Server/Program.cs b/Torch.Server/Program.cs index aca5ab4..ea59df0 100644 --- a/Torch.Server/Program.cs +++ b/Torch.Server/Program.cs @@ -31,11 +31,17 @@ namespace Torch.Server Directory.SetCurrentDirectory(workingDir); //HACK for block skins update - foreach (var f in Directory.EnumerateFiles(workingDir, "System.*", SearchOption.TopDirectoryOnly)) + var badDlls = new[] { - File.Delete(f); - } + "System.Security.Principal.Windows.dll" + }; + foreach (var file in badDlls) + { + if (File.Exists(file)) + File.Delete(file); + } + if (!TorchLauncher.IsTorchWrapped()) { TorchLauncher.Launch(Assembly.GetEntryAssembly().FullName, args, binDir); diff --git a/Torch.Server/Torch.Server.csproj b/Torch.Server/Torch.Server.csproj index c6548df..fe9b5e6 100644 --- a/Torch.Server/Torch.Server.csproj +++ b/Torch.Server/Torch.Server.csproj @@ -516,6 +516,6 @@ - copy "$(SolutionDir)NLog.config" "$(TargetDir)" & copy "$(SolutionDir)NLog-user.config" "$(TargetDir)" & del "$(TargetDir)System.*" + copy "$(SolutionDir)NLog.config" "$(TargetDir)" & copy "$(SolutionDir)NLog-user.config" "$(TargetDir)" \ No newline at end of file From 0e6ac14b74ea74aef321eac06158a2c8390069ec Mon Sep 17 00:00:00 2001 From: John Gross Date: Thu, 6 Jun 2019 18:06:28 -0700 Subject: [PATCH 5/6] Error handling --- Torch.Server/Program.cs | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/Torch.Server/Program.cs b/Torch.Server/Program.cs index ea59df0..731dd02 100644 --- a/Torch.Server/Program.cs +++ b/Torch.Server/Program.cs @@ -9,6 +9,7 @@ using System.ServiceProcess; using System.Text; using System.Threading; using NLog; +using NLog.Fluent; using NLog.Targets; using Torch.Utils; @@ -35,11 +36,19 @@ namespace Torch.Server { "System.Security.Principal.Windows.dll" }; - - foreach (var file in badDlls) + + try { - if (File.Exists(file)) - File.Delete(file); + foreach (var file in badDlls) + { + if (File.Exists(file)) + File.Delete(file); + } + } + catch + { + LogManager.GetCurrentClassLogger().Error($"Error updating. Please delete the following files from the Torch root folder manually:\r\n{string.Join("\r\n", badDlls)}"); + return; } if (!TorchLauncher.IsTorchWrapped()) From a6e41b2a90649cadeb6a10094b1c14009c7e5a2d Mon Sep 17 00:00:00 2001 From: John Gross Date: Thu, 6 Jun 2019 18:23:39 -0700 Subject: [PATCH 6/6] Fix native Havok.dll loading --- Torch.Server/Initializer.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Torch.Server/Initializer.cs b/Torch.Server/Initializer.cs index 42325a4..b141d90 100644 --- a/Torch.Server/Initializer.cs +++ b/Torch.Server/Initializer.cs @@ -66,6 +66,12 @@ quit"; if (!File.Exists(apiTarget)) File.Copy(apiSource, apiTarget); + var havokSource = Path.Combine(basePath, "DedicatedServer64", "Havok.dll"); + var havokTarget = Path.Combine(basePath, "Havok.dll"); + + if (!File.Exists(havokTarget)) + File.Copy(havokSource, havokTarget); + _config = InitConfig(); if (!_config.Parse(args)) return false;