-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
## Winch v0.6.0 - Added WinchLauncher.exe which will detect if the installed version of DREDGE is from Steam or Epic and then launch it via the vendor (previously Epic would just not launch properly from the manager). ## IntroSkipper v1.0.1 - Fixed a newly introduced NRE that would leave you stuck on a black screen in DREDGE 1.5.4 (Epic Games version)
- Loading branch information
Showing
9 changed files
with
180 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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/[email protected] | ||
- name: Download Winch Asset | ||
uses: actions/download-artifact@v3 | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: Winch | ||
path: Winch/bin | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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/[email protected] | ||
- name: Download Winch Asset | ||
uses: actions/download-artifact@v3 | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: Winch | ||
path: Winch/bin | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,5 +2,5 @@ | |
"Name": "Winch", | ||
"Author": "Hacktix", | ||
"ModGUID": "hacktix.winch", | ||
"Version": "0.5.3" | ||
"Version": "0.6.0" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Diagnostics; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Reflection; | ||
|
||
namespace WinchLauncher; | ||
|
||
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(); | ||
} | ||
|
||
/// <summary> | ||
/// Adapted from OWML https://github.com/ow-mods/owml/blob/master/src/OWML.Launcher/App.cs | ||
/// </summary> | ||
public static void StartGame() | ||
{ | ||
string gamePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); | ||
|
||
var dllPath = Path.Combine(gamePath, "DREDGE_Data/Managed/Assembly-CSharp.dll"); | ||
|
||
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 | ||
{ | ||
assembly = Assembly.LoadFrom(dllPath); | ||
} | ||
catch (Exception e) | ||
{ | ||
Console.WriteLine("Failed to load assembly: " + e.Message); | ||
StartGameViaExe(); | ||
return; | ||
} | ||
|
||
try | ||
{ | ||
List<string> types; | ||
try | ||
{ | ||
types = assembly.GetExportedTypes().Select(x => x.Name).ToList(); | ||
} | ||
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(); | ||
} | ||
|
||
types.Sort(); | ||
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"); | ||
|
||
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(); | ||
} | ||
} | ||
catch (Exception e) | ||
{ | ||
Console.WriteLine("Failed to start process: " + e.Message); | ||
StartGameViaExe(); | ||
return; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net6.0</TargetFramework> | ||
<LangVersion>latest</LangVersion> | ||
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath> | ||
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<None Include="WinchLauncher.csproj.user" /> | ||
</ItemGroup> | ||
|
||
</Project> |