some patches

This commit is contained in:
JohnCorby 2022-02-06 22:05:24 -08:00
parent b327b0c727
commit e9d97008a7
4 changed files with 50 additions and 10 deletions

View File

@ -4,13 +4,17 @@ using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using static EntitlementsManager;
using Debug = UnityEngine.Debug;
namespace EpicRerouter
{
/// <summary>
/// runs on qsb side
/// </summary>
public static class Interop
{
public static void Log(object msg) => Debug.LogError($"[interop] {msg}");
public static AsyncOwnershipStatus OwnershipStatus { get; private set; } = AsyncOwnershipStatus.NotReady;
public static void Go()
{
@ -43,8 +47,10 @@ namespace EpicRerouter
UseShellExecute = false
});
process!.WaitForExit();
var ownershipStatus = (EntitlementsManager.AsyncOwnershipStatus)process.ExitCode;
Log($"ownership status = {ownershipStatus}");
OwnershipStatus = (AsyncOwnershipStatus)process.ExitCode;
Log($"ownership status = {OwnershipStatus}");
}
public static void Log(object msg) => Debug.LogError($"[interop] {msg}");
}
}

View File

@ -2,6 +2,34 @@
namespace EpicRerouter
{
/// <summary>
/// runs on qsb side
/// </summary>
[HarmonyPatch(typeof(EpicPlatformManager))]
public static class Patches { }
internal static class Patches
{
[HarmonyPrefix]
[HarmonyPatch("instance", MethodType.Getter)]
private static bool GetInstance()
{
Interop.Log("instance get called");
return false;
}
[HarmonyPrefix]
[HarmonyPatch("instance", MethodType.Setter)]
private static bool SetInstance()
{
Interop.Log("instance set called");
return false;
}
[HarmonyPrefix]
[HarmonyPatch("platformInterface", MethodType.Getter)]
private static bool GetPlatformInterface()
{
Interop.Log("platformInterface get called");
return false;
}
}
}

View File

@ -1,13 +1,16 @@
using Epic.OnlineServices.Ecom;
using System;
using System;
using System.Reflection;
using System.Threading;
using static EntitlementsManager;
namespace EpicRerouter
{
public static class Program
/// <summary>
/// runs on process side
/// </summary>
internal static class Program
{
public static void Main(string[] assemblyLocations)
private static void Main(string[] assemblyLocations)
{
try
{
@ -21,7 +24,7 @@ namespace EpicRerouter
{
Console.WriteLine("all done");
Thread.Sleep(3000);
Environment.Exit((int)OwnershipStatus.Owned);
Environment.Exit((int)AsyncOwnershipStatus.Owned);
}
}
}

View File

@ -52,7 +52,10 @@ namespace QSB
public void Awake()
{
EpicRerouter.Interop.Go();
if (true || typeof(EpicPlatformManager).Assembly.GetTypes().Any(x => x.Name == "EpicEntitlementRetriever"))
{
EpicRerouter.Interop.Go();
}
UIHelper.ReplaceUI(UITextType.PleaseUseController,
"<color=orange>Quantum Space Buddies</color> is best experienced with friends...");