From 87ff10604e9a00293e3ab0bdc88728dc83089722 Mon Sep 17 00:00:00 2001 From: xen-42 Date: Tue, 24 Dec 2024 17:34:24 -0500 Subject: [PATCH 01/14] make launcher that checks for steam vs epic --- Winch.sln | 10 ++++-- WinchLauncher/Launcher.cs | 51 ++++++++++++++++++++++++++++++ WinchLauncher/WinchLauncher.csproj | 14 ++++++++ 3 files changed, 73 insertions(+), 2 deletions(-) create mode 100644 WinchLauncher/Launcher.cs create mode 100644 WinchLauncher/WinchLauncher.csproj diff --git a/Winch.sln b/Winch.sln index 4ceb150f..461d6264 100644 --- a/Winch.sln +++ b/Winch.sln @@ -11,9 +11,11 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DisasterButton", "Winch.Exa EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ExampleItems", "Winch.Examples\ExampleItems\ExampleItems.csproj", "{C112288E-E993-44F3-B7B0-FB4BD37F18EA}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WinchConsole", "WinchConsole\WinchConsole.csproj", "{D5CFABA9-FA58-474F-A394-E197BDF38FDD}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WinchConsole", "WinchConsole\WinchConsole.csproj", "{D5CFABA9-FA58-474F-A394-E197BDF38FDD}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WinchCommon", "WinchCommon\WinchCommon.csproj", "{EF5F69E6-FD4D-4314-B187-A89D00BF9355}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WinchCommon", "WinchCommon\WinchCommon.csproj", "{EF5F69E6-FD4D-4314-B187-A89D00BF9355}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WinchLauncher", "WinchLauncher\WinchLauncher.csproj", "{45CB6021-0D96-4231-9F53-4C73597998D8}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -45,6 +47,10 @@ Global {EF5F69E6-FD4D-4314-B187-A89D00BF9355}.Debug|Any CPU.Build.0 = Debug|Any CPU {EF5F69E6-FD4D-4314-B187-A89D00BF9355}.Release|Any CPU.ActiveCfg = Release|Any CPU {EF5F69E6-FD4D-4314-B187-A89D00BF9355}.Release|Any CPU.Build.0 = Release|Any CPU + {45CB6021-0D96-4231-9F53-4C73597998D8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {45CB6021-0D96-4231-9F53-4C73597998D8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {45CB6021-0D96-4231-9F53-4C73597998D8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {45CB6021-0D96-4231-9F53-4C73597998D8}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/WinchLauncher/Launcher.cs b/WinchLauncher/Launcher.cs new file mode 100644 index 00000000..4271b5fa --- /dev/null +++ b/WinchLauncher/Launcher.cs @@ -0,0 +1,51 @@ +using System.Diagnostics; +using System.Reflection; + +namespace WinchLauncher; + +internal static class Launcher +{ + public static void Main(string[] args) + { + StartGame(args[0]); + } + + /// + /// Adapted from OWML https://github.com/ow-mods/owml/blob/master/src/OWML.Launcher/App.cs + /// + /// + public static void StartGame(string gamePath) + { + var dllPath = Path.Combine(gamePath, "DREDGE_Data/Managed/Assembly-CSharp.dll"); + + void StartGameViaExe() => Process.Start(Path.Combine(gamePath, "DREDGE.exe")); + + Assembly assembly = null; + try + { + assembly = Assembly.LoadFrom(dllPath); + } + catch + { + StartGameViaExe(); + return; + } + + var types = assembly.GetTypes(); + var isEpic = types.Any(x => x.Name == "EpicEntitlementRetriever"); + var isSteam = types.Any(x => x.Name == "SteamEntitlementRetriever"); + + if (isEpic && !isSteam) + { + Process.Start("com.epicgames.launcher://apps/8b454b47f5544fc6829cf0fed42ebae0%3Aeac6533129434f98a6b04a81cbcaf357%3A65c25644a2e0444d8766967a008b1d69?action=launch&silent=true"); + } + else if (!isEpic && isSteam) + { + Process.Start("steam://rungameid/1562430"); + } + else + { + StartGameViaExe(); + } + } +} diff --git a/WinchLauncher/WinchLauncher.csproj b/WinchLauncher/WinchLauncher.csproj new file mode 100644 index 00000000..dc970cf0 --- /dev/null +++ b/WinchLauncher/WinchLauncher.csproj @@ -0,0 +1,14 @@ + + + + Exe + net6.0 + enable + enable + + + + + + + From a19885f7d7c7088d18b7fd5d6da8d8376d6fe42c Mon Sep 17 00:00:00 2001 From: xen-42 Date: Tue, 24 Dec 2024 18:04:34 -0500 Subject: [PATCH 02/14] Launcher works for steam and epic now --- WinchLauncher/Launcher.cs | 55 +++++++++++++++++++++++++++++---------- 1 file changed, 41 insertions(+), 14 deletions(-) diff --git a/WinchLauncher/Launcher.cs b/WinchLauncher/Launcher.cs index 4271b5fa..95feb845 100644 --- a/WinchLauncher/Launcher.cs +++ b/WinchLauncher/Launcher.cs @@ -7,15 +7,17 @@ internal static class Launcher { public static void Main(string[] args) { - StartGame(args[0]); + StartGame(); } /// /// Adapted from OWML https://github.com/ow-mods/owml/blob/master/src/OWML.Launcher/App.cs /// /// - public static void StartGame(string gamePath) + public static void StartGame() { + string gamePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + var dllPath = Path.Combine(gamePath, "DREDGE_Data/Managed/Assembly-CSharp.dll"); void StartGameViaExe() => Process.Start(Path.Combine(gamePath, "DREDGE.exe")); @@ -25,27 +27,52 @@ public static void StartGame(string gamePath) { assembly = Assembly.LoadFrom(dllPath); } - catch + catch (Exception e) { + Console.WriteLine(e.Message); StartGameViaExe(); return; } - var types = assembly.GetTypes(); - var isEpic = types.Any(x => x.Name == "EpicEntitlementRetriever"); - var isSteam = types.Any(x => x.Name == "SteamEntitlementRetriever"); - - if (isEpic && !isSteam) - { - Process.Start("com.epicgames.launcher://apps/8b454b47f5544fc6829cf0fed42ebae0%3Aeac6533129434f98a6b04a81cbcaf357%3A65c25644a2e0444d8766967a008b1d69?action=launch&silent=true"); - } - else if (!isEpic && isSteam) + try { - Process.Start("steam://rungameid/1562430"); + var types = assembly.GetTypes().Select(x => x.Name).ToList(); + types.Sort(); + var isEpic = types.Any(x => x == "EOSScreenshotStrategy"); + var isSteam = types.Any(x => x == "SteamEntitlementStrategy"); + + foreach (var type in types) + { + Console.WriteLine(type); + } + + if (isEpic && !isSteam) + { + Console.WriteLine("Identified as Epic install"); + + Process.Start(new ProcessStartInfo("com.epicgames.launcher://apps/8b454b47f5544fc6829cf0fed42ebae0%3Aeac6533129434f98a6b04a81cbcaf357%3A65c25644a2e0444d8766967a008b1d69?action=launch&silent=true") { UseShellExecute = true }); + } + else if (!isEpic && isSteam) + { + Console.WriteLine("Identified as Steam install"); + + Process.Start(new ProcessStartInfo("steam://rungameid/1562430") { UseShellExecute = true }); + } + else + { + Console.WriteLine("Couldn't identify vendor"); + + StartGameViaExe(); + } } - else + catch (Exception e) { + Console.WriteLine(e.Message); StartGameViaExe(); } + + // Keep the window open until the user presses a key + Console.WriteLine("Press any key to exit..."); + Console.ReadKey(); } } From 9008ab68026c465dddd421faea7cdf6398ceaf3c Mon Sep 17 00:00:00 2001 From: xen-42 Date: Tue, 24 Dec 2024 18:05:57 -0500 Subject: [PATCH 03/14] Fix action and bump version number --- .github/workflows/build.yml | 4 ++++ Winch/mod_meta.json | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 65ee8303..8242a636 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -27,6 +27,10 @@ jobs: run: | cp -r WinchConsole/bin/* Winch/bin/ + - name: Copy WinchLauncher into Winch folder + run: | + cp -r WinchLauncher/bin/* Winch/bin/ + - name: Upload Winch Artifact uses: actions/upload-artifact@v3 with: diff --git a/Winch/mod_meta.json b/Winch/mod_meta.json index cd58fd24..d4fdd5cc 100644 --- a/Winch/mod_meta.json +++ b/Winch/mod_meta.json @@ -2,5 +2,5 @@ "Name": "Winch", "Author": "Hacktix", "ModGUID": "hacktix.winch", - "Version": "0.5.3" + "Version": "0.6.0" } From b91f6c8140dfaa3d13d5bac28632181903e5a317 Mon Sep 17 00:00:00 2001 From: xen-42 Date: Tue, 24 Dec 2024 18:14:49 -0500 Subject: [PATCH 04/14] Fix bin --- WinchLauncher/Launcher.cs | 5 ++++- WinchLauncher/WinchLauncher.csproj | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/WinchLauncher/Launcher.cs b/WinchLauncher/Launcher.cs index 95feb845..229fce63 100644 --- a/WinchLauncher/Launcher.cs +++ b/WinchLauncher/Launcher.cs @@ -1,4 +1,7 @@ -using System.Diagnostics; +using System; +using System.Diagnostics; +using System.IO; +using System.Linq; using System.Reflection; namespace WinchLauncher; diff --git a/WinchLauncher/WinchLauncher.csproj b/WinchLauncher/WinchLauncher.csproj index dc970cf0..e85cd574 100644 --- a/WinchLauncher/WinchLauncher.csproj +++ b/WinchLauncher/WinchLauncher.csproj @@ -5,6 +5,9 @@ net6.0 enable enable + 11 + false + false From a165766a6cbfdf03a98b1d925ebdd26e2415d3b1 Mon Sep 17 00:00:00 2001 From: xen-42 Date: Wed, 25 Dec 2024 00:25:18 -0500 Subject: [PATCH 05/14] I have no idea why this doesn't work --- .github/workflows/build.yml | 8 ++--- WinchLauncher/Launcher.cs | 48 +++++++++++++++++++++++------- WinchLauncher/WinchLauncher.csproj | 4 +-- 3 files changed, 42 insertions(+), 18 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8242a636..0bccc0f5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -15,10 +15,10 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup .NET - uses: actions/setup-dotnet@v3 + uses: actions/setup-dotnet@v4 - name: Build Winch run: dotnet build -c ${{ inputs.build_type }} @@ -32,7 +32,7 @@ jobs: cp -r WinchLauncher/bin/* Winch/bin/ - name: Upload Winch Artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: Winch path: Winch/bin @@ -46,7 +46,7 @@ jobs: done - name: Upload Example Mod Artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: Winch Examples path: | diff --git a/WinchLauncher/Launcher.cs b/WinchLauncher/Launcher.cs index 229fce63..9c29da73 100644 --- a/WinchLauncher/Launcher.cs +++ b/WinchLauncher/Launcher.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; @@ -11,19 +12,28 @@ internal static class Launcher public static void Main(string[] args) { StartGame(); + + // Keep the window open until the user presses a key + Console.WriteLine("Press any key to exit..."); + Console.ReadKey(); } /// /// Adapted from OWML https://github.com/ow-mods/owml/blob/master/src/OWML.Launcher/App.cs /// - /// public static void StartGame() { string gamePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); var dllPath = Path.Combine(gamePath, "DREDGE_Data/Managed/Assembly-CSharp.dll"); - void StartGameViaExe() => Process.Start(Path.Combine(gamePath, "DREDGE.exe")); + void StartGameViaExe() + { + Console.WriteLine("Defaulting to running exe. If you bought DREDGE on Epic Games this will not work. Run the game from there directly"); + Process.Start(Path.Combine(gamePath, "DREDGE.exe")); + } + + bool isEpic = false, isSteam = false; Assembly assembly = null; try @@ -32,23 +42,42 @@ public static void StartGame() } catch (Exception e) { - Console.WriteLine(e.Message); + Console.WriteLine("Failed to load assembly: " + e.Message); StartGameViaExe(); return; } try { - var types = assembly.GetTypes().Select(x => x.Name).ToList(); + List types; + try + { + types = assembly.GetExportedTypes().Select(x => x.Name).ToList(); + } + catch (ReflectionTypeLoadException ex) + { + // Apparently this can happen + types = ex.Types.Where(x => x != null).Select(x => x.Name).ToList(); + } + types.Sort(); - var isEpic = types.Any(x => x == "EOSScreenshotStrategy"); - var isSteam = types.Any(x => x == "SteamEntitlementStrategy"); + isEpic = types.Any(x => x == "EOSScreenshotStrategy"); + isSteam = types.Any(x => x == "SteamEntitlementStrategy"); foreach (var type in types) { Console.WriteLine(type); } + } + catch (Exception e) + { + Console.WriteLine("Failed to load types from assembly: " + e.Message); + StartGameViaExe(); + return; + } + try + { if (isEpic && !isSteam) { Console.WriteLine("Identified as Epic install"); @@ -70,12 +99,9 @@ public static void StartGame() } catch (Exception e) { - Console.WriteLine(e.Message); + Console.WriteLine("Failed to start process: " + e.Message); StartGameViaExe(); + return; } - - // Keep the window open until the user presses a key - Console.WriteLine("Press any key to exit..."); - Console.ReadKey(); } } diff --git a/WinchLauncher/WinchLauncher.csproj b/WinchLauncher/WinchLauncher.csproj index e85cd574..db166cd6 100644 --- a/WinchLauncher/WinchLauncher.csproj +++ b/WinchLauncher/WinchLauncher.csproj @@ -3,9 +3,7 @@ Exe net6.0 - enable - enable - 11 + latest false false From 55daa592ede74e7ea40ec772f6bb1f31f6f7ae89 Mon Sep 17 00:00:00 2001 From: xen-42 Date: Wed, 25 Dec 2024 00:28:18 -0500 Subject: [PATCH 06/14] Update all action versions --- .github/workflows/manual_nuget.yml | 4 ++-- .github/workflows/release_build.yml | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/manual_nuget.yml b/.github/workflows/manual_nuget.yml index 42c7e7c4..6bce15ca 100644 --- a/.github/workflows/manual_nuget.yml +++ b/.github/workflows/manual_nuget.yml @@ -20,7 +20,7 @@ jobs: if: github.ref == 'refs/heads/master' steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Get version id: version uses: notiz-dev/github-action-json-property@release @@ -30,7 +30,7 @@ jobs: - name: Set up nuget uses: NuGet/setup-nuget@v1.0.5 - name: Download Winch Asset - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: Winch path: Winch/bin diff --git a/.github/workflows/release_build.yml b/.github/workflows/release_build.yml index 4088a1e2..8d0f6bcd 100644 --- a/.github/workflows/release_build.yml +++ b/.github/workflows/release_build.yml @@ -33,7 +33,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Download Winch Asset - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: Winch path: Winch @@ -46,7 +46,7 @@ jobs: cd .. - name: Download Example Mods - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: Winch Examples path: Examples @@ -78,7 +78,7 @@ jobs: if: github.ref == 'refs/heads/master' steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Get version id: version uses: notiz-dev/github-action-json-property@release @@ -88,7 +88,7 @@ jobs: - name: Set up nuget uses: NuGet/setup-nuget@v1.0.5 - name: Download Winch Asset - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: Winch path: Winch/bin From 130a662fc968235bc951ed2971268d7b8dd07ca2 Mon Sep 17 00:00:00 2001 From: xen-42 Date: Wed, 25 Dec 2024 00:33:26 -0500 Subject: [PATCH 07/14] Trying .net 7 --- WinchLauncher/Launcher.cs | 2 ++ WinchLauncher/WinchLauncher.csproj | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/WinchLauncher/Launcher.cs b/WinchLauncher/Launcher.cs index 9c29da73..11b2b2c7 100644 --- a/WinchLauncher/Launcher.cs +++ b/WinchLauncher/Launcher.cs @@ -56,6 +56,8 @@ void StartGameViaExe() } catch (ReflectionTypeLoadException ex) { + Console.WriteLine("Only partially loaded assembly: " + ex.Message); + // Apparently this can happen types = ex.Types.Where(x => x != null).Select(x => x.Name).ToList(); } diff --git a/WinchLauncher/WinchLauncher.csproj b/WinchLauncher/WinchLauncher.csproj index db166cd6..b033c737 100644 --- a/WinchLauncher/WinchLauncher.csproj +++ b/WinchLauncher/WinchLauncher.csproj @@ -2,7 +2,7 @@ Exe - net6.0 + .net7 latest false false From 513734f8fa9af25ff339b6001c0347157dffb50b Mon Sep 17 00:00:00 2001 From: xen-42 Date: Wed, 25 Dec 2024 00:35:30 -0500 Subject: [PATCH 08/14] Use net 6.0 and also in the action --- .github/workflows/build.yml | 2 ++ WinchLauncher/WinchLauncher.csproj | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0bccc0f5..986c275d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -19,6 +19,8 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@v4 + with: + dotnet-version: '6.x.x' - name: Build Winch run: dotnet build -c ${{ inputs.build_type }} diff --git a/WinchLauncher/WinchLauncher.csproj b/WinchLauncher/WinchLauncher.csproj index b033c737..db166cd6 100644 --- a/WinchLauncher/WinchLauncher.csproj +++ b/WinchLauncher/WinchLauncher.csproj @@ -2,7 +2,7 @@ Exe - .net7 + net6.0 latest false false From 550457c5bc7e8af7712c702da6a13e912eedf316 Mon Sep 17 00:00:00 2001 From: xen-42 Date: Wed, 25 Dec 2024 00:40:58 -0500 Subject: [PATCH 09/14] Okay dotnet 8 --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 986c275d..76c0f2ad 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -20,7 +20,7 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@v4 with: - dotnet-version: '6.x.x' + dotnet-version: '8.x.x' - name: Build Winch run: dotnet build -c ${{ inputs.build_type }} From eb76e27460db313c2ae924ee384145cfaaf35ab1 Mon Sep 17 00:00:00 2001 From: xen-42 Date: Wed, 25 Dec 2024 01:01:02 -0500 Subject: [PATCH 10/14] This wont work --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 76c0f2ad..7ebdcb4e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -12,7 +12,7 @@ on: jobs: build: name: Create artifacts - runs-on: ubuntu-latest + runs-on: windows-latest steps: - name: Checkout uses: actions/checkout@v4 From 7d8d2493c6563d2b6261d57a7ac49a078e5d4d13 Mon Sep 17 00:00:00 2001 From: xen-42 Date: Wed, 25 Dec 2024 01:02:41 -0500 Subject: [PATCH 11/14] Use bash shell --- .github/workflows/build.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7ebdcb4e..ced85b9e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -23,13 +23,16 @@ jobs: dotnet-version: '8.x.x' - name: Build Winch + shell: bash run: dotnet build -c ${{ inputs.build_type }} - name: Copy WinchConsole into Winch folder + shell: bash run: | cp -r WinchConsole/bin/* Winch/bin/ - name: Copy WinchLauncher into Winch folder + shell: bash run: | cp -r WinchLauncher/bin/* Winch/bin/ @@ -40,6 +43,7 @@ jobs: path: Winch/bin - name: Move Example Mods + shell: bash run: | for mod in DisasterButton ExampleItems IntroSkipper do From 6a52903966c886fa55fee81e2d36240b07c23ab0 Mon Sep 17 00:00:00 2001 From: xen-42 Date: Wed, 25 Dec 2024 01:54:54 -0500 Subject: [PATCH 12/14] Make the thing close because if it stays open Epic thinks Dredge is still running --- WinchLauncher/Launcher.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/WinchLauncher/Launcher.cs b/WinchLauncher/Launcher.cs index 11b2b2c7..13f41009 100644 --- a/WinchLauncher/Launcher.cs +++ b/WinchLauncher/Launcher.cs @@ -14,8 +14,8 @@ public static void Main(string[] args) StartGame(); // Keep the window open until the user presses a key - Console.WriteLine("Press any key to exit..."); - Console.ReadKey(); + // Console.WriteLine("Press any key to exit..."); + // Console.ReadKey(); } /// From 9867d6f201646a95b266a0e20169f00309716751 Mon Sep 17 00:00:00 2001 From: xen-42 Date: Thu, 26 Dec 2024 13:57:12 -0500 Subject: [PATCH 13/14] Fix introskipper breaking on 1.5.4 (Epic store version) --- .../IntroSkipper/SplashControllerPatcher.cs | 30 +++++++++++++++---- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/Winch.Examples/IntroSkipper/SplashControllerPatcher.cs b/Winch.Examples/IntroSkipper/SplashControllerPatcher.cs index 26a74cee..c027dcdb 100644 --- a/Winch.Examples/IntroSkipper/SplashControllerPatcher.cs +++ b/Winch.Examples/IntroSkipper/SplashControllerPatcher.cs @@ -1,16 +1,36 @@ -using HarmonyLib; +using System; +using HarmonyLib; using Winch.Core; namespace IntroSkipper; -[HarmonyPatch(typeof(SplashController))] -[HarmonyPatch(nameof(SplashController.OnEnable))] +[HarmonyPatch] internal static class SplashControllerPatcher { - public static bool Prefix() + [HarmonyPrefix] + [HarmonyPatch(typeof(SceneLoader), nameof(SceneLoader.ShouldShowSplashScreen))] + public static bool SceneLoader_ShouldShowSplashScreen(SceneLoader __instance, ref bool __result) + { + // Base game checks for save files here without null checking + __result = false; + return false; + } + + [HarmonyPrefix] + [HarmonyPatch(typeof(SplashController), nameof(SplashController.OnEnable))] + public static bool SplashController_OnEnable() { WinchCore.Log.Info("Skipping Splash Screen..."); - GameManager.Instance.Loader.LoadStartupFromSplash(); + try + { + GameManager.Instance.Loader.LoadStartupFromSplash(); + } + catch (Exception e) + { + // version 1.5.4 made it throw an exception before, let's keep this try-catch just in case (would result in a black screen that bricks the game) + WinchCore.Log.Error(e); + } + return false; } } \ No newline at end of file From f43fdb126dfb88eeec9f3cef15e22e5e4995c803 Mon Sep 17 00:00:00 2001 From: xen-42 Date: Thu, 26 Dec 2024 13:58:30 -0500 Subject: [PATCH 14/14] Update mod_meta.json --- Winch.Examples/IntroSkipper/mod_meta.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Winch.Examples/IntroSkipper/mod_meta.json b/Winch.Examples/IntroSkipper/mod_meta.json index ed3b2521..f61adc8d 100644 --- a/Winch.Examples/IntroSkipper/mod_meta.json +++ b/Winch.Examples/IntroSkipper/mod_meta.json @@ -1,7 +1,7 @@ { "Name": "Intro Skipper", "ModGUID": "hacktix.introskipper", - "Version": "1.0.0", + "Version": "1.0.1", "ModAssembly": "IntroSkipper.dll", "MinWinchVersion": "alpha-1.4", "ApplyPatches": true