diff --git a/NFMFix/NoteMovementFix.csproj b/NFMFix/NoteMovementFix.csproj index 16f66e4..b1d2ec5 100644 --- a/NFMFix/NoteMovementFix.csproj +++ b/NFMFix/NoteMovementFix.csproj @@ -45,6 +45,16 @@ $(BeatSaberDir)\Beat Saber_Data\Managed\BGLib.DotnetExtension.dll False + + False + $(BeatSaberDir)\Beat Saber_Data\Managed\BGLib.AppFlow.dll + False + + + False + $(BeatSaberDir)\Beat Saber_Data\Managed\BGLib.UnityExtension.dll + False + False $(BeatSaberDir)\Beat Saber_Data\Managed\DataModels.dll diff --git a/NFMFix/Patches/Yeet.cs b/NFMFix/Patches/Yeet.cs index 08cc099..a4dd779 100644 --- a/NFMFix/Patches/Yeet.cs +++ b/NFMFix/Patches/Yeet.cs @@ -11,6 +11,11 @@ internal class DisableFloorMovement { static bool Prefix(ref NoteFloorMovement __instance, ref Vector3 __result) { + if (!Plugin.AllowedToPatch) + { + return true; + } + // Skip floor movement if disabled if (Config.Instance.Enabled && !Plugin.InReplay && Config.Instance.HiddenFloorMovement) { @@ -40,6 +45,11 @@ static bool Prefix(ref NoteJump __instance, ref Vector3 __result, ref Action ___ ref Action ___noteJumpDidPassMissedMarkerEvent, ref Action ___noteJumpDidPassThreeQuartersEvent, ref Action ___noteJumpDidPassHalfEvent, ref Action ___noteJumpDidUpdateProgressEvent) { + if (!Plugin.AllowedToPatch) + { + return true; + } + if (Config.Instance.Enabled && !Plugin.InReplay) { if (!__instance._missedMarkReported) @@ -233,6 +243,11 @@ internal class FakeGhostMode { static void Prefix(ref NoteFloorMovement __instance) { + if (!Plugin.AllowedToPatch) + { + return; + } + if (Config.Instance.Enabled && Config.Instance.FakeGhostMode && Config.Instance.FakeGhostNote) { var p = __instance._rotatedObject.parent; @@ -244,18 +259,24 @@ static void Prefix(ref NoteFloorMovement __instance) } } - [HarmonyPatch(typeof(GameplayCoreInstaller), nameof(GameplayCoreInstaller.InstallBindings))] - static class DisableNE + [HarmonyPatch] + internal static class DisableNE { - static void Postfix(ref GameplayCoreInstaller __instance) + [HarmonyPatch(typeof(LevelScenesTransitionSetupDataSO), + nameof(LevelScenesTransitionSetupDataSO.BeforeScenesWillBeActivated))] + [HarmonyPatch(typeof(LevelScenesTransitionSetupDataSO), + nameof(LevelScenesTransitionSetupDataSO.BeforeScenesWillBeActivatedAsync))] + [HarmonyPostfix] + private static void LevelScenesTransitionSetupDataSO_BeforeScenesWillBeActivated(LevelScenesTransitionSetupDataSO __instance) { - var key = (BeatmapKey)__instance._sceneSetupData?.beatmapKey; + BeatmapKey? key = __instance.gameplayCoreSceneSetupData?.beatmapKey; if (key != null) { - var hasRequirement = SongCore.Collections.GetCustomLevelSongDifficultyData(key)? - .additionalDifficultyData? - ._requirements?.Any(x => x == "Noodle Extensions" || x == "Mapping Extensions") == true; - if (hasRequirement) Config.Instance.Enabled = false; + bool hasRequirement = SongCore.Collections.GetCustomLevelSongDifficultyData(key.Value)? + .additionalDifficultyData + ._requirements.Any(x => x == "Noodle Extensions" || x == "Mapping Extensions") == true; + + Plugin.AllowedToPatch = !hasRequirement; } } } diff --git a/NFMFix/Plugin.cs b/NFMFix/Plugin.cs index ba5b9b8..26d31df 100644 --- a/NFMFix/Plugin.cs +++ b/NFMFix/Plugin.cs @@ -19,6 +19,7 @@ public class Plugin internal static Harmony harmony; internal static bool InReplay = false; internal static bool Submission = true; + internal static bool AllowedToPatch = true; static class BsmlWrapper {