diff --git a/OWML.Common/Constants.cs b/OWML.Common/Constants.cs new file mode 100644 index 00000000..ca887fde --- /dev/null +++ b/OWML.Common/Constants.cs @@ -0,0 +1,7 @@ +namespace OWML.Common +{ + public class Constants + { + public const string QuitKeyPhrase = "{RageAgainstTheDyingOfTheLight}"; + } +} diff --git a/OWML.Common/OWML.Common.csproj b/OWML.Common/OWML.Common.csproj index 76fd9eff..d562b820 100644 --- a/OWML.Common/OWML.Common.csproj +++ b/OWML.Common/OWML.Common.csproj @@ -62,6 +62,7 @@ + diff --git a/OWML.Launcher/App.cs b/OWML.Launcher/App.cs index 0461791f..fb715559 100644 --- a/OWML.Launcher/App.cs +++ b/OWML.Launcher/App.cs @@ -12,7 +12,7 @@ namespace OWML.Launcher { public class App { - private const string Version = "0.3.25"; + private const string Version = "0.3.26"; private readonly IOwmlConfig _owmlConfig; private readonly IModConsole _writer; @@ -36,7 +36,7 @@ public App(IOwmlConfig owmlConfig, IModConsole writer, IModFinder modFinder, _update = update; } - public void Run() + public void Run(string[] args) { _writer.WriteLine($"Started OWML version {Version}"); _writer.WriteLine("For detailed log, see Logs/OWML.Log.txt"); @@ -55,7 +55,7 @@ public void Run() PatchGame(mods); - StartGame(); + StartGame(args); Console.ReadLine(); } @@ -132,6 +132,10 @@ private void OnOutput(string s) foreach (var line in lines) { _writer.WriteLine(line); + if (line == Constants.QuitKeyPhrase) + { + Environment.Exit(0); + } } } @@ -145,12 +149,12 @@ private void PatchGame(IList mods) _vrPatcher.PatchVR(enableVR); } - private void StartGame() + private void StartGame(string[] args) { _writer.WriteLine("Starting game..."); try { - Process.Start($"{_owmlConfig.GamePath}/OuterWilds.exe"); + Process.Start($"{_owmlConfig.GamePath}/OuterWilds.exe", string.Join(" ", args)); } catch (Exception ex) { diff --git a/OWML.Launcher/Program.cs b/OWML.Launcher/Program.cs index c5b75fe3..7d1c581d 100644 --- a/OWML.Launcher/Program.cs +++ b/OWML.Launcher/Program.cs @@ -22,7 +22,7 @@ static void Main(string[] args) var vrPatcher = new VRPatcher(owmlConfig, writer); var update = new ModUpdate(writer); var app = new App(owmlConfig, writer, modFinder, outputListener, pathFinder, owPatcher, vrPatcher, update); - app.Run(); + app.Run(args); } private static IOwmlConfig GetOwmlConfig() diff --git a/OWML.ModHelper/OWML.ModHelper.csproj b/OWML.ModHelper/OWML.ModHelper.csproj index c2c6e54f..a12d7df7 100644 --- a/OWML.ModHelper/OWML.ModHelper.csproj +++ b/OWML.ModHelper/OWML.ModHelper.csproj @@ -67,6 +67,7 @@ + diff --git a/OWML.ModHelper/OwmlBehaviour.cs b/OWML.ModHelper/OwmlBehaviour.cs new file mode 100644 index 00000000..ae3a4092 --- /dev/null +++ b/OWML.ModHelper/OwmlBehaviour.cs @@ -0,0 +1,13 @@ +using OWML.Common; +using UnityEngine; + +namespace OWML.ModHelper +{ + public class OwmlBehaviour : MonoBehaviour + { + void OnApplicationQuit() + { + ModConsole.Instance.WriteLine(Constants.QuitKeyPhrase); + } + } +} diff --git a/OWML.ModLoader/ModLoader.cs b/OWML.ModLoader/ModLoader.cs index 1e51cada..e25c7e34 100644 --- a/OWML.ModLoader/ModLoader.cs +++ b/OWML.ModLoader/ModLoader.cs @@ -15,6 +15,8 @@ public class ModLoader public static void LoadMods() { + var owmlGo = new GameObject(); + owmlGo.AddComponent(); var owmlConfig = GetOwmlConfig(); if (owmlConfig == null) { diff --git a/OWML.SampleMods/OWML.EnableDebugMode/manifest.json b/OWML.SampleMods/OWML.EnableDebugMode/manifest.json index 857471a0..b88b32f8 100644 --- a/OWML.SampleMods/OWML.EnableDebugMode/manifest.json +++ b/OWML.SampleMods/OWML.EnableDebugMode/manifest.json @@ -4,5 +4,5 @@ "name": "EnableDebugMode", "uniqueName": "Alek.EnableDebugMode", "version": "0.2", - "owmlVersion": "0.3.25" + "owmlVersion": "0.3.26" } \ No newline at end of file diff --git a/OWML.SampleMods/OWML.LoadCustomAssets/manifest.json b/OWML.SampleMods/OWML.LoadCustomAssets/manifest.json index 92ed4c73..b31aff73 100644 --- a/OWML.SampleMods/OWML.LoadCustomAssets/manifest.json +++ b/OWML.SampleMods/OWML.LoadCustomAssets/manifest.json @@ -4,5 +4,5 @@ "name": "LoadCustomAssets", "uniqueName": "Alek.LoadCustomAssets", "version": "0.4", - "owmlVersion": "0.3.25" + "owmlVersion": "0.3.26" } \ No newline at end of file