static bool OnUnload(UnityModManager.ModEntry modEntry) { #if DEBUG HarmonyInstance.UnpatchAll(null); #endif return(true); }
internal static void Quit() { MelonHandler.OnApplicationQuit(); MelonPreferences.Save(); HarmonyInstance.UnpatchAll(); bHaptics.Quit(); MelonLogger.Flush(); Fixes.QuitFix.Run(); }
/// <summary> /// Attempts to remove all the Harmony patches that used our HarmonyId. /// </summary> internal static void RemoveHarmonyPatches() { try { // Removes all patches with this HarmonyId harmony.UnpatchAll(HarmonyId); } catch (Exception ex) { Plugin.Log?.Error("Error removing Harmony patches: " + ex.Message); Plugin.Log?.Debug(ex); } }
internal static void Quit() { MelonHandler.OnApplicationQuit(); MelonPreferences.Save(); HarmonyInstance.UnpatchAll(); if (MelonLaunchOptions.Core.EnableBHapticsIntegration) { bHaptics.Quit(); } Fixes.QuitFix.Run(); }
internal static void Quit() { MelonHandler.OnApplicationQuit(); MelonPreferences.Save(); HarmonyInstance.UnpatchAll(); bHaptics.Quit(); MelonLogger.Flush(); if (MelonLaunchOptions.Core.QuitFix) { Process.GetCurrentProcess().Kill(); } }
public override void InstallBindings() { Container.Bind <VersionUtility>().AsSingle().NonLazy(); MainConfigModel mainConfig = Plugin.MainConfig; Container.Bind <MainConfigModel>().FromInstance(mainConfig); mainConfig.HUDConfig.MainCanvasSettings.IsMainCanvas = true; Container.Bind <HUDConfigModel>().FromInstance(mainConfig.HUDConfig); if (harmony != null) { harmony.UnpatchAll(HARMONY_ID); // Covers game restarts } harmony = new HarmonyObj(HARMONY_ID); Container.Bind <HarmonyObj>().WithId(HARMONY_ID).FromInstance(harmony); GameplayCoreSceneSetupPatch.Patch(harmony); CoreGameHUDControllerPatch.Patch(harmony); BindConfig <MissedConfigModel>(mainConfig.MissedConfig); BindConfig <NoteConfigModel>(mainConfig.NoteConfig); BindConfig <ProgressConfigModel>(mainConfig.ProgressConfig); BindConfig <ScoreConfigModel>(mainConfig.ScoreConfig); BindConfig <SpeedConfigModel>(mainConfig.SpeedConfig); BindConfig <SpinometerConfigModel>(mainConfig.SpinometerConfig); BindConfig <PBConfigModel>(mainConfig.PBConfig); BindConfig <CutConfigModel>(mainConfig.CutConfig); BindConfig <FailConfigModel>(mainConfig.FailsConfig); BindConfig <NotesLeftConfigModel>(mainConfig.NotesLeftConfig); foreach (CustomCounter customCounter in Plugin.LoadedCustomCounters.Values) { if (!mainConfig.CustomCounters.TryGetValue(customCounter.Name, out CustomConfigModel config)) { config = customCounter.ConfigDefaults; mainConfig.CustomCounters.Add(customCounter.Name, config); } config.AttachedCustomCounter = customCounter; customCounter.Config = config; BindCustomCounter(customCounter, config); } }
public override void OnDisabled() { instance?.UnpatchAll(); }
public void OnDisable() { harmony.UnpatchAll(HARMONY_ID); }