From a1cc4ebca4961bd59a94598f53604f1bff7547f3 Mon Sep 17 00:00:00 2001 From: Cruz Godar Date: Wed, 11 Feb 2026 00:05:18 -0500 Subject: [PATCH] Added compatibility with motion smoothing --- Source/FunctionalZoomOutModule.cs | 32 ++++++++++++++++++------ Source/Interop/MotionSmoothingImports.cs | 11 ++++++++ everest.yaml | 5 +++- 3 files changed, 39 insertions(+), 9 deletions(-) create mode 100644 Source/Interop/MotionSmoothingImports.cs diff --git a/Source/FunctionalZoomOutModule.cs b/Source/FunctionalZoomOutModule.cs index 277d484..09a388b 100644 --- a/Source/FunctionalZoomOutModule.cs +++ b/Source/FunctionalZoomOutModule.cs @@ -1,4 +1,7 @@ -namespace Celeste.Mod.FunctionalZoomOut; +using Celeste.Mod.FunctionalZoomOut.Interop; +using MonoMod.ModInterop; + +namespace Celeste.Mod.FunctionalZoomOut; public class FunctionalZoomOutModule : EverestModule { @@ -31,6 +34,8 @@ public override void Load() { HookHelper.Initialize(typeof(FunctionalZoomOutModule).Assembly); HookHelper.LoadTag("loader"); + typeof(MotionSmoothingImports).ModInterop(); + Everest.Events.Level.OnLoadEntity += Event_OnLoadEntity; } @@ -141,13 +146,19 @@ public static float GetFixedHDUpscale(float orig) { public static float GetFixedCameraSizePadded(float orig, int padding) => GetFixedCameraSize(orig - padding) + padding; public static int GetFixedCameraSizeIntPadded(int orig, int padding) => (int)GetFixedCameraSize(orig - padding) + padding; - public static void EnsureBufferDimensions(VirtualRenderTarget target, int padding = 0) { - if (target is null || target.IsDisposed || (target.Width + padding == GameplayBufferWidth + padding && target.Height + padding == GameplayBufferHeight + padding)) - return; + public static bool EnsureBufferDimensions(VirtualRenderTarget target, int padding = 0) { + if (target == null) + return false; + + target = MotionSmoothingImports.GetResizableBuffer?.Invoke(target) ?? target; + + if (target.IsDisposed || (target.Width + padding == GameplayBufferWidth + padding && target.Height + padding == GameplayBufferHeight + padding)) + return false; target.Width = GameplayBufferWidth + padding; target.Height = GameplayBufferHeight + padding; target.Reload(); + return true; } #endregion @@ -304,18 +315,23 @@ private static void Level_LoadLevel(On.Celeste.Level.orig_LoadLevel orig, Level } private static void EnsureVanillaBuffers() { - EnsureBufferDimensions(GameplayBuffers.Gameplay); - EnsureBufferDimensions(GameplayBuffers.Level); + bool needToReloadLargeTextures = false; + + needToReloadLargeTextures |= EnsureBufferDimensions(GameplayBuffers.Gameplay); + needToReloadLargeTextures |= EnsureBufferDimensions(GameplayBuffers.Level); EnsureBufferDimensions(GameplayBuffers.Light); EnsureBufferDimensions(GameplayBuffers.Displacement); EnsureBufferDimensions(GameplayBuffers.ResortDust); - EnsureBufferDimensions(GameplayBuffers.TempA); - EnsureBufferDimensions(GameplayBuffers.TempB); + needToReloadLargeTextures |= EnsureBufferDimensions(GameplayBuffers.TempA); + needToReloadLargeTextures |= EnsureBufferDimensions(GameplayBuffers.TempB); // ?? EnsureBufferDimensions(GameplayBuffers.MirrorSources, 64); EnsureBufferDimensions(GameplayBuffers.MirrorMasks, 64); UpdateEffectSwap(); + + if (needToReloadLargeTextures) + MotionSmoothingImports.ReloadLargeTextures?.Invoke(); } #endregion diff --git a/Source/Interop/MotionSmoothingImports.cs b/Source/Interop/MotionSmoothingImports.cs new file mode 100644 index 0000000..011f620 --- /dev/null +++ b/Source/Interop/MotionSmoothingImports.cs @@ -0,0 +1,11 @@ +using MonoMod.ModInterop; + +namespace Celeste.Mod.FunctionalZoomOut.Interop; + +[ModImportName("MotionSmoothing")] +public static class MotionSmoothingImports +{ + public static Func GetResizableBuffer; + + public static Action ReloadLargeTextures; +} diff --git a/everest.yaml b/everest.yaml index 18a5073..1b5148d 100644 --- a/everest.yaml +++ b/everest.yaml @@ -1,6 +1,9 @@ - Name: ZoomOutHelperPrototype - Version: 0.2.0 + Version: 0.2.1 DLL: bin/FunctionalZoomOut.dll Dependencies: - Name: EverestCore Version: 1.5577.0 + OptionalDependencies: + - Name: MotionSmoothing + Version: 1.3.2 \ No newline at end of file