Skip to content

Commit

Permalink
Revert "Launch game with OpenVR flag if VR is required (#124)"
Browse files Browse the repository at this point in the history
This reverts commit 0df8464.
  • Loading branch information
Raicuparta committed Jul 2, 2020
1 parent bad06c5 commit 0be5743
Showing 1 changed file with 9 additions and 22 deletions.
31 changes: 9 additions & 22 deletions OWML.Launcher/App.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ 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)
{
Expand Down Expand Up @@ -57,10 +55,9 @@ public void Run(string[] args)

ShowModList(mods);

var hasVrMod = HasVrMod(mods);
PatchGame(hasVrMod);
PatchGame(mods);

StartGame(args, hasVrMod);
StartGame(args);

if (hasPortArgument)
{
Expand Down Expand Up @@ -145,18 +142,13 @@ private void OnOutput(string s)
}
}

private bool HasVrMod(IList<IModData> mods)
{
var vrMod = mods.FirstOrDefault(x => x.Config.RequireVR && x.Config.Enabled);
var hasVrMod = vrMod != null;
_writer.WriteLine(hasVrMod ? $"{vrMod.Manifest.UniqueName} requires VR." : "No mods require VR.");
return hasVrMod;
}

private void PatchGame(bool enableVR)
private void PatchGame(IList<IModData> mods)
{
_owPatcher.PatchGame();
_vrPatcher.PatchVR(enableVR);

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.");
try
{
_vrPatcher.PatchVR(enableVR);
Expand All @@ -167,17 +159,12 @@ private void PatchGame(bool enableVR)
}
}

private void StartGame(string[] args, bool enableVR)
private void StartGame(string[] args)
{
_writer.WriteLine("Starting game...");
try
{
var gameArgs = string.Join(" ", args);
if (enableVR)
{
gameArgs += VrArgument;
}
Process.Start($"{_owmlConfig.GamePath}/OuterWilds.exe", gameArgs);
Process.Start($"{_owmlConfig.GamePath}/OuterWilds.exe", string.Join(" ", args));
}
catch (Exception ex)
{
Expand Down

0 comments on commit 0be5743

Please sign in to comment.