diff --git a/PatchEntryPoint.cs b/PatchEntryPoint.cs index 68d53bd..7c6a105 100644 --- a/PatchEntryPoint.cs +++ b/PatchEntryPoint.cs @@ -1,5 +1,7 @@ using HarmonyLib; using System; +using System.Reflection; +using UnityEngine; using UnityEngine.SceneManagement; namespace Sandbox @@ -20,7 +22,24 @@ namespace Sandbox new Harmony("com.thearst3rd.sandbox").PatchAll(); IsPatched = true; SceneManager.sceneLoaded -= beginPatch; + + KickstartSpeedrunData(); } } + + private static void KickstartSpeedrunData() + { + // Kickstart SpeedrunData using reflection shenanigans + // We want to run the following code: + //SpeedrunData.SetValue(0, -1, -1); + + Assembly miuuAsm = typeof(MarbleController).Assembly; + Type speedrunDataType = miuuAsm.GetType("SpeedrunData"); + MethodInfo speedrunDataSetValueMethod = speedrunDataType.GetMethod("SetValue", BindingFlags.Public | BindingFlags.Static); + + speedrunDataSetValueMethod.Invoke(null, new object[] { 0, -1, -1 }); + + Debug.Log("SpeedrunData kickstarted"); + } } }