From 9014958a4850ca9c433ab6a79096fbdd2c4ea712 Mon Sep 17 00:00:00 2001 From: Noah Pilarski Date: Fri, 30 Jun 2023 11:07:48 -0400 Subject: [PATCH] support other versions --- OWAML/FileVerificationAndInitialization.cs | 56 +++++++++++++++------- OWAML/OWAML.Manifest.json | 2 +- 2 files changed, 41 insertions(+), 17 deletions(-) diff --git a/OWAML/FileVerificationAndInitialization.cs b/OWAML/FileVerificationAndInitialization.cs index 94ba047..0dda363 100644 --- a/OWAML/FileVerificationAndInitialization.cs +++ b/OWAML/FileVerificationAndInitialization.cs @@ -11,7 +11,9 @@ public class FileVerificationAndInitialization const string winhttpFileName = "winhttp.dll"; const string bepInExConfigFileName = "BepInEx.cfg"; const string bepInExConfigFileRelativePath = @"BepInEx\config"; - const string OuterWilds_Alpha_1_2FileName = "OuterWilds_Alpha_1_2.exe"; + const string OuterWilds_Alpha_1_2_FileName = "OuterWilds_Alpha_1_2.exe"; + const string OuterWilds_IGF_FileName = "OuterWilds_IGF_Build.exe"; + const string OuterWilds_AlphaDemo_FileName = "OuterWilds_AlphaDemo_PC.exe"; const string doorstop_configtargetAssemblyCommand = "targetAssembly"; const string doorstop_configtargetAssemblyDefaultCommand = @"BepInEx\core\BepInEx.Preloader.dll"; @@ -87,7 +89,7 @@ public bool CheckBepInExConfig() return true; } - public bool CheckBepInExDoorstopAndWinhttp() + public bool CheckBepInExDoorstopAndWinhttp() { if (gameFolder.Equals(bepInExFolder)) return true; @@ -141,27 +143,49 @@ public bool CheckBepInExDoorstopAndWinhttp() #endregion } - public bool StartGame() + public bool StartGame() { ConsoleUtils.WriteByType("Starting Game"); - string gameEXEPath = Path.Combine(gameFolder, OuterWilds_Alpha_1_2FileName); - if (!File.Exists(gameEXEPath)) + if (CheckAllPaths(out string gameEXEPath)) { - ConsoleUtils.WriteByType($"Game executable ({gameEXEPath}) wasn't found", MessageType.Error); - return false; - } - if (string.IsNullOrWhiteSpace(consolePort)) - { - Process.Start(gameEXEPath); + if (string.IsNullOrWhiteSpace(consolePort)) + { + Process.Start(gameEXEPath); + } + else + { + Process.Start(gameEXEPath, $"-consolePort {consolePort}"); + } + ConsoleUtils.WriteByType("Game was started", MessageType.Success); + + return true; } else - { - Process.Start(gameEXEPath, $"-consolePort {consolePort}"); - } - ConsoleUtils.WriteByType("Game was started", MessageType.Success); + return false; + } - return true; + private bool CheckAllPaths(out string gameEXEPath) + { + gameEXEPath = Path.Combine(gameFolder, OuterWilds_Alpha_1_2_FileName); + if (File.Exists(gameEXEPath)) + return true; + else + ConsoleUtils.WriteByType($"Game executable ({gameEXEPath}) wasn't found! Searching for other alpha versions.", MessageType.Warning); + + gameEXEPath = Path.Combine(gameFolder, OuterWilds_IGF_FileName); + if (File.Exists(gameEXEPath)) + return true; + else + ConsoleUtils.WriteByType($"Game executable ({gameEXEPath}) wasn't found! Searching for other alpha versions.", MessageType.Warning); + + gameEXEPath = Path.Combine(gameFolder, OuterWilds_AlphaDemo_FileName); + if (File.Exists(gameEXEPath)) + return true; + else + ConsoleUtils.WriteByType($"Game executable ({gameEXEPath}) wasn't found!", MessageType.Error); + + return false; } private bool CheckDoorstopConfigFile(ref string[] doorstopFile, string bepInExFolder) diff --git a/OWAML/OWAML.Manifest.json b/OWAML/OWAML.Manifest.json index d4903fd..49e4196 100644 --- a/OWAML/OWAML.Manifest.json +++ b/OWAML/OWAML.Manifest.json @@ -2,7 +2,7 @@ "author": "Locochoco", "name": "OWAML", "uniqueName": "Locochoco.OWAML", - "version": "1.0.2", + "version": "1.0.3", "minBepInExVersion": "5.4.17", "maxBepInExVersion": "5.4.19.1" }