From 3b92a86a7328c633abbac38b9a53dea6f1459013 Mon Sep 17 00:00:00 2001 From: XtraCube <72575280+XtraCube@users.noreply.github.com> Date: Mon, 5 Oct 2026 12:48:24 -0400 Subject: [PATCH 1/4] remove unnecessary patch --- Reactor/Patches/Miscellaneous/SplashSkipPatch.cs | 9 --------- 1 file changed, 9 deletions(-) diff --git a/Reactor/Patches/Miscellaneous/SplashSkipPatch.cs b/Reactor/Patches/Miscellaneous/SplashSkipPatch.cs index 20e3519c..2258b180 100644 --- a/Reactor/Patches/Miscellaneous/SplashSkipPatch.cs +++ b/Reactor/Patches/Miscellaneous/SplashSkipPatch.cs @@ -11,13 +11,4 @@ private static void RemoveMinimumWait(SplashManager __instance) { __instance.minimumSecondsBeforeSceneChange = 0; } - - [HarmonyPatch(typeof(SplashManager), nameof(SplashManager.Update))] - [HarmonyPrefix] - private static bool WaitForLogin(SplashManager __instance) - { - if (__instance.startedSceneLoad) return true; - - return true; - } } From 2e84155b382570d762fec8be8c49fb728f108a53 Mon Sep 17 00:00:00 2001 From: XtraCube <72575280+XtraCube@users.noreply.github.com> Date: Mon, 5 Oct 2026 12:48:56 -0400 Subject: [PATCH 2/4] fix naming of steam appid file --- Reactor/Patches/Miscellaneous/StandaloneSteamPatch.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Reactor/Patches/Miscellaneous/StandaloneSteamPatch.cs b/Reactor/Patches/Miscellaneous/StandaloneSteamPatch.cs index 0e6a33a2..50532029 100644 --- a/Reactor/Patches/Miscellaneous/StandaloneSteamPatch.cs +++ b/Reactor/Patches/Miscellaneous/StandaloneSteamPatch.cs @@ -27,11 +27,11 @@ public static MethodBase TargetMethod() public static bool Prefix(out bool __result) { - const string file = "steam_appid.txt"; + const string AppIdFile = "steam_appid.txt"; - if (!File.Exists(file)) + if (!File.Exists(AppIdFile)) { - File.WriteAllText(file, "945360"); + File.WriteAllText(AppIdFile, "945360"); } return __result = false; From 3e575e4621c67e12c0a9df43d9342ca06152c335 Mon Sep 17 00:00:00 2001 From: XtraCube <72575280+XtraCube@users.noreply.github.com> Date: Mon, 5 Oct 2026 13:12:15 -0400 Subject: [PATCH 3/4] Starlight compatible MethodRpc --- Reactor/Networking/Rpc/MethodRpc.cs | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/Reactor/Networking/Rpc/MethodRpc.cs b/Reactor/Networking/Rpc/MethodRpc.cs index 49016355..235fdf73 100644 --- a/Reactor/Networking/Rpc/MethodRpc.cs +++ b/Reactor/Networking/Rpc/MethodRpc.cs @@ -18,7 +18,9 @@ namespace Reactor.Networking.Rpc; /// /// Provides a custom rpc for method rpc. /// +#pragma warning disable CA1001 public class MethodRpc : UnsafeCustomRpc +#pragma warning restore CA1001 { private delegate object HandleDelegate(InnerNetObject innerNetObject, object[] args); @@ -154,12 +156,29 @@ public void Send(InnerNetObject innerNetObject, object[] args) private static readonly MethodInfo _sendMethod = AccessTools.Method(typeof(MethodRpc), nameof(Send)); + // ReSharper disable once NotAccessedField.Local + private Hook? _hook; + /// /// Hooks the rpc with a dynamic method that sends it. /// private HandleDelegate Hook(MethodInfo method, ParameterInfo[] parameters, bool isStatic) { - var detour = new Detour(method, GenerateSender()); + // MonoMod Hook is used instead of Detour because Starlight + // uses the "reorg" branch which no longer includes Detour. + // Hook is still present with the same signature. + // DMD is a workaround since reorganized Hook doesn't contain a + // function to make a trampoline. + + // Create a copy of the original method with DMD + var dmd = new DynamicMethodDefinition(method); + var originalTrampoline = dmd.Generate(); + + // Hook the method to send the RPC + _hook = new Hook(method, GenerateSender()); + + // Return the generated Handler method + return GenerateHandler(originalTrampoline); // Used as target when hooking, sends the method rpc DynamicMethod GenerateSender() @@ -244,7 +263,7 @@ DynamicMethod GenerateSender() } // Proxy translating object array to trampoline method args, used by MethodRpc to invoke original handling - HandleDelegate GenerateHandler(DynamicMethod trampoline) + HandleDelegate GenerateHandler(MethodInfo trampoline) { var dynamicMethod = new DynamicMethod($"Handler<{method.GetID(simple: true)}>", typeof(object), new[] { typeof(InnerNetObject), typeof(object[]) }); dynamicMethod.DefineParameter(0, ParameterAttributes.None, "innerNetObject"); @@ -280,7 +299,5 @@ HandleDelegate GenerateHandler(DynamicMethod trampoline) return dynamicMethod.CreateDelegate(); } - - return GenerateHandler((DynamicMethod) detour.GenerateTrampoline()); } } From 9cb05a7fa6637c2cdba82b04566aaecbdfc0a891 Mon Sep 17 00:00:00 2001 From: XtraCube <72575280+XtraCube@users.noreply.github.com> Date: Mon, 5 Oct 2026 13:42:33 -0400 Subject: [PATCH 4/4] make methodrpc disposable so we arent suprressing a warning --- Reactor/Networking/Rpc/MethodRpc.cs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Reactor/Networking/Rpc/MethodRpc.cs b/Reactor/Networking/Rpc/MethodRpc.cs index 235fdf73..09e5583a 100644 --- a/Reactor/Networking/Rpc/MethodRpc.cs +++ b/Reactor/Networking/Rpc/MethodRpc.cs @@ -18,9 +18,7 @@ namespace Reactor.Networking.Rpc; /// /// Provides a custom rpc for method rpc. /// -#pragma warning disable CA1001 -public class MethodRpc : UnsafeCustomRpc -#pragma warning restore CA1001 +public class MethodRpc : UnsafeCustomRpc, IDisposable { private delegate object HandleDelegate(InnerNetObject innerNetObject, object[] args); @@ -300,4 +298,11 @@ HandleDelegate GenerateHandler(MethodInfo trampoline) return dynamicMethod.CreateDelegate(); } } + + /// + public void Dispose() + { + GC.SuppressFinalize(this); + _hook?.Dispose(); + } }