diff --git a/CelesteTAS-EverestInterop/Source/EverestInterop/Core.cs b/CelesteTAS-EverestInterop/Source/EverestInterop/Core.cs index 3fe387f01..50994a918 100644 --- a/CelesteTAS-EverestInterop/Source/EverestInterop/Core.cs +++ b/CelesteTAS-EverestInterop/Source/EverestInterop/Core.cs @@ -21,7 +21,7 @@ private static void Load() { IL.Monocle.Engine.Update += IL_Engine_Update; typeof(GameInput) - .GetMethod(nameof(GameInput.UpdateGrab)) + .GetMethod(nameof(GameInput.UpdateGrab))! .SkipMethod(IsPaused); // The original mod makes the MInput.Update call conditional and invokes UpdateInputs afterwards. diff --git a/CelesteTAS-EverestInterop/Source/TAS/Manager.cs b/CelesteTAS-EverestInterop/Source/TAS/Manager.cs index 2873a4809..e609554a5 100644 --- a/CelesteTAS-EverestInterop/Source/TAS/Manager.cs +++ b/CelesteTAS-EverestInterop/Source/TAS/Manager.cs @@ -64,28 +64,26 @@ private static void Initialize() { // Hot-reloading support [Load] private static void RestoreStudioTasFilePath() { - Controller.FilePath = Engine.Instance.GetDynamicDataInstance() - .Get("CelesteTAS_FilePath"); + if (Engine.Instance.GetDynamicDataInstance().Get("CelesteTAS_FilePath") is { } filePath) { + Controller.FilePath = filePath; + } - Everest.Events.AssetReload.OnBeforeReload += OnAssetReload; + // Stop TAS to avoid blocking reload + typeof(AssetReloadHelper) + .GetMethodInfo(nameof(AssetReloadHelper.Do)) + .HookBefore(DisableRun); } [Unload] private static void SaveStudioTasFilePath() { - Engine.Instance.GetDynamicDataInstance() - .Set("CelesteTAS_FilePath", Controller.FilePath); - - Everest.Events.AssetReload.OnBeforeReload -= OnAssetReload; + Engine.Instance.GetDynamicDataInstance().Set("CelesteTAS_FilePath", Controller.FilePath); Controller.Stop(); Controller.Clear(); } - - private static void OnAssetReload(bool silent) => DisableRun(); #endif - public static void EnableRun() - { + public static void EnableRun() { if (Running) { return; } @@ -104,8 +102,7 @@ public static void EnableRun() Savestates.EnableRun(); } - public static void DisableRun() - { + public static void DisableRun() { if (!Running) { return; }