diff --git a/OWML.Launcher/App.cs b/OWML.Launcher/App.cs index ae0b4861a..e04ed595a 100644 --- a/OWML.Launcher/App.cs +++ b/OWML.Launcher/App.cs @@ -21,6 +21,8 @@ public class App private readonly OWPatcher _owPatcher; private readonly VRPatcher _vrPatcher; + private const string VrArgument = " -vrmode openvr"; + public App(IOwmlConfig owmlConfig, IModManifest owmlManifest, IModConsole writer, IModFinder modFinder, OutputListener listener, PathFinder pathFinder, OWPatcher owPatcher, VRPatcher vrPatcher) { @@ -55,9 +57,10 @@ public void Run(string[] args) ShowModList(mods); - PatchGame(mods); + var hasVrMod = HasVrMod(mods); + PatchGame(hasVrMod); - StartGame(args); + StartGame(args, hasVrMod); if (hasPortArgument) { @@ -142,13 +145,18 @@ private void OnOutput(string s) } } - private void PatchGame(IList mods) + private bool HasVrMod(IList mods) { - _owPatcher.PatchGame(); - var vrMod = mods.FirstOrDefault(x => x.Config.RequireVR && x.Config.Enabled); - var enableVR = vrMod != null; - _writer.WriteLine(enableVR ? $"{vrMod.Manifest.UniqueName} requires VR." : "No mods require VR."); + var hasVrMod = vrMod != null; + _writer.WriteLine(hasVrMod ? $"{vrMod.Manifest.UniqueName} requires VR." : "No mods require VR."); + return hasVrMod; + } + + private void PatchGame(bool enableVR) + { + _owPatcher.PatchGame(); + _vrPatcher.PatchVR(enableVR); try { _vrPatcher.PatchVR(enableVR); @@ -159,12 +167,17 @@ private void PatchGame(IList mods) } } - private void StartGame(string[] args) + private void StartGame(string[] args, bool enableVR) { _writer.WriteLine("Starting game..."); try { - Process.Start($"{_owmlConfig.GamePath}/OuterWilds.exe", string.Join(" ", args)); + var gameArgs = string.Join(" ", args); + if (enableVR) + { + gameArgs += VrArgument; + } + Process.Start($"{_owmlConfig.GamePath}/OuterWilds.exe", gameArgs); } catch (Exception ex) {