From 3efb07896a56bdacd3eb15a2f5ade22f27f6edc5 Mon Sep 17 00:00:00 2001 From: JohnCorby Date: Sun, 6 Feb 2022 22:46:05 -0800 Subject: [PATCH] epic check in interop instead of qsbcore --- .../ProcessSide/EpicEntitlementRetriever.cs | 3 --- EpicRerouter/ProcessSide/EpicPlatformManager.cs | 3 --- EpicRerouter/ProcessSide/Program.cs | 15 +++++++++------ EpicRerouter/QsbSide/Interop.cs | 9 ++++++--- EpicRerouter/QsbSide/Patches.cs | 5 +---- QSB/QSBCore.cs | 5 +---- 6 files changed, 17 insertions(+), 23 deletions(-) diff --git a/EpicRerouter/ProcessSide/EpicEntitlementRetriever.cs b/EpicRerouter/ProcessSide/EpicEntitlementRetriever.cs index 83e60026..71783eab 100644 --- a/EpicRerouter/ProcessSide/EpicEntitlementRetriever.cs +++ b/EpicRerouter/ProcessSide/EpicEntitlementRetriever.cs @@ -5,9 +5,6 @@ using static EntitlementsManager; namespace EpicRerouter.ProcessSide { - /// - /// runs on process side - /// public static class EpicEntitlementRetriever { private const string _eosDlcItemID = "49a9ac61fe464cbf8c8c73f46b3f1133"; diff --git a/EpicRerouter/ProcessSide/EpicPlatformManager.cs b/EpicRerouter/ProcessSide/EpicPlatformManager.cs index 96e848f7..deb5a187 100644 --- a/EpicRerouter/ProcessSide/EpicPlatformManager.cs +++ b/EpicRerouter/ProcessSide/EpicPlatformManager.cs @@ -5,9 +5,6 @@ using System; namespace EpicRerouter.ProcessSide { - /// - /// runs on process side - /// public static class EpicPlatformManager { private const string _eosProductID = "prod-starfish"; diff --git a/EpicRerouter/ProcessSide/Program.cs b/EpicRerouter/ProcessSide/Program.cs index 790fe485..55662e18 100644 --- a/EpicRerouter/ProcessSide/Program.cs +++ b/EpicRerouter/ProcessSide/Program.cs @@ -1,14 +1,12 @@ using System; +using System.Linq; using System.Reflection; using System.Threading; using static EntitlementsManager; namespace EpicRerouter.ProcessSide { - /// - /// runs on process side - /// - internal static class Program + public static class Program { public static string ProductName; public static string Version; @@ -17,10 +15,15 @@ namespace EpicRerouter.ProcessSide { try { - foreach (var assemblyLocation in args) + ProductName = args[1]; + Console.WriteLine($"product name = {ProductName}"); + Version = args[2]; + Console.WriteLine($"version = {Version}"); + + foreach (var assemblyLocation in args.Skip(2)) { var assembly = Assembly.LoadFile(assemblyLocation); - Console.WriteLine($"loaded {assembly}"); + Console.WriteLine($"loaded {assembly} at {assemblyLocation}"); } Console.WriteLine(); diff --git a/EpicRerouter/QsbSide/Interop.cs b/EpicRerouter/QsbSide/Interop.cs index d23a0c04..c725cd41 100644 --- a/EpicRerouter/QsbSide/Interop.cs +++ b/EpicRerouter/QsbSide/Interop.cs @@ -9,15 +9,18 @@ using Debug = UnityEngine.Debug; namespace EpicRerouter.QsbSide { - /// - /// runs on qsb side - /// public static class Interop { public static AsyncOwnershipStatus OwnershipStatus { get; private set; } = AsyncOwnershipStatus.NotReady; public static void Go() { + if (typeof(EpicPlatformManager).GetField("_platformInterface", BindingFlags.NonPublic | BindingFlags.Instance) == null) + { + Log("not epic. don't reroute"); + // return; + } + Log("go"); Harmony.CreateAndPatchAll(typeof(Patches)); diff --git a/EpicRerouter/QsbSide/Patches.cs b/EpicRerouter/QsbSide/Patches.cs index 4ac3b0df..49c49694 100644 --- a/EpicRerouter/QsbSide/Patches.cs +++ b/EpicRerouter/QsbSide/Patches.cs @@ -2,11 +2,8 @@ namespace EpicRerouter.QsbSide { - /// - /// runs on qsb side - /// [HarmonyPatch(typeof(ProcessSide.EpicPlatformManager))] - internal static class Patches + public static class Patches { [HarmonyPrefix] [HarmonyPatch("instance", MethodType.Getter)] diff --git a/QSB/QSBCore.cs b/QSB/QSBCore.cs index e9baf763..6530f378 100644 --- a/QSB/QSBCore.cs +++ b/QSB/QSBCore.cs @@ -52,10 +52,7 @@ namespace QSB public void Awake() { - if (true || typeof(EpicPlatformManager).Assembly.GetTypes().Any(x => x.Name == "EpicEntitlementRetriever")) - { - EpicRerouter.QsbSide.Interop.Go(); - } + EpicRerouter.QsbSide.Interop.Go(); UIHelper.ReplaceUI(UITextType.PleaseUseController, "Quantum Space Buddies is best experienced with friends...");