diff --git a/docs/content/pages/guides/mod_settings.md b/docs/content/pages/guides/mod_settings.md index 576553084..3a7f4b102 100644 --- a/docs/content/pages/guides/mod_settings.md +++ b/docs/content/pages/guides/mod_settings.md @@ -126,3 +126,7 @@ public class MyMod : ModBehaviour { } } ``` + +## Config Updates + +Something important to note is that when the manager pulls and update for your mod, the `config.json` file is preserved. The issue with this is menus are generated from the `config.json` file. When changing options like slider minimums and maximums or choices, you may want to create a new property rather than edit an existing one to make sure the UI is correct. diff --git a/src/OWML.Common/Interfaces/IModEvents.cs b/src/OWML.Common/Interfaces/IModEvents.cs index e207034cb..cab6cff3a 100644 --- a/src/OWML.Common/Interfaces/IModEvents.cs +++ b/src/OWML.Common/Interfaces/IModEvents.cs @@ -3,14 +3,19 @@ namespace OWML.Common { + [Obsolete("Use HarmonyHelper instead.")] public interface IModEvents { + [Obsolete("Use HarmonyHelper instead.")] IModPlayerEvents Player { get; } + [Obsolete("Use HarmonyHelper instead.")] IModSceneEvents Scenes { get; } + [Obsolete("Use HarmonyHelper instead.")] IModUnityEvents Unity { get; } + [Obsolete("Use HarmonyHelper instead.")] event Action Event; [Obsolete("Use Event instead.")] diff --git a/src/OWML.Common/Interfaces/IModPlayerEvents.cs b/src/OWML.Common/Interfaces/IModPlayerEvents.cs index 7fa2e698c..319d31b03 100644 --- a/src/OWML.Common/Interfaces/IModPlayerEvents.cs +++ b/src/OWML.Common/Interfaces/IModPlayerEvents.cs @@ -4,6 +4,7 @@ namespace OWML.Common { public interface IModPlayerEvents { + [Obsolete("Use HarmonyHelper instead.")] event Action OnPlayerAwake; void Init(IModEvents events); diff --git a/src/OWML.Common/Interfaces/IModSceneEvents.cs b/src/OWML.Common/Interfaces/IModSceneEvents.cs index a86bf6048..75a048c4c 100644 --- a/src/OWML.Common/Interfaces/IModSceneEvents.cs +++ b/src/OWML.Common/Interfaces/IModSceneEvents.cs @@ -4,8 +4,10 @@ namespace OWML.Common { public interface IModSceneEvents { + [Obsolete("Use HarmonyHelper instead.")] event Action OnStartSceneChange; + [Obsolete("Use HarmonyHelper instead.")] event Action OnCompleteSceneChange; } } diff --git a/src/OWML.Common/Interfaces/IModUnityEvents.cs b/src/OWML.Common/Interfaces/IModUnityEvents.cs index 6e9f629d4..0a0ae67e8 100644 --- a/src/OWML.Common/Interfaces/IModUnityEvents.cs +++ b/src/OWML.Common/Interfaces/IModUnityEvents.cs @@ -4,10 +4,13 @@ namespace OWML.Common { public interface IModUnityEvents { + [Obsolete("Use HarmonyHelper instead.")] event Action OnUpdate; + [Obsolete("Use HarmonyHelper instead.")] event Action OnFixedUpdate; + [Obsolete("Use HarmonyHelper instead.")] event Action OnLateUpdate; void FireOnNextUpdate(Action action); diff --git a/src/OWML.Launcher/OWML.Manifest.json b/src/OWML.Launcher/OWML.Manifest.json index 7c040f168..bf03c46db 100644 --- a/src/OWML.Launcher/OWML.Manifest.json +++ b/src/OWML.Launcher/OWML.Manifest.json @@ -3,7 +3,7 @@ "author": "Alek", "name": "OWML", "uniqueName": "Alek.OWML", - "version": "2.7.5", + "version": "2.8.0", "minGameVersion": "1.1.13.393", "maxGameVersion": "1.1.13.456" } diff --git a/src/OWML.ModHelper.Events/ModEvents.cs b/src/OWML.ModHelper.Events/ModEvents.cs index 161350376..a49f95ffd 100644 --- a/src/OWML.ModHelper.Events/ModEvents.cs +++ b/src/OWML.ModHelper.Events/ModEvents.cs @@ -6,14 +6,19 @@ namespace OWML.ModHelper.Events { + [Obsolete("Use HarmonyHelper instead.")] public class ModEvents : IModEvents { + [Obsolete("Use HarmonyHelper instead.")] public IModPlayerEvents Player { get; } + [Obsolete("Use HarmonyHelper instead.")] public IModSceneEvents Scenes { get; } + [Obsolete("Use HarmonyHelper instead.")] public IModUnityEvents Unity { get; } + [Obsolete("Use HarmonyHelper instead.")] public event Action Event; [Obsolete("Use Event instead.")] @@ -57,6 +62,7 @@ private void OnPatchEvent(MonoBehaviour behaviour, Common.Events ev) } } + [Obsolete("Use HarmonyHelper instead.")] public void Subscribe(Common.Events ev) where T : MonoBehaviour { SubscribeToEvent(ev); diff --git a/src/OWML.ModHelper.Events/ModPlayerEvents.cs b/src/OWML.ModHelper.Events/ModPlayerEvents.cs index fb1eed05b..d6b3e8ea8 100644 --- a/src/OWML.ModHelper.Events/ModPlayerEvents.cs +++ b/src/OWML.ModHelper.Events/ModPlayerEvents.cs @@ -6,6 +6,7 @@ namespace OWML.ModHelper.Events { public class ModPlayerEvents : IModPlayerEvents { + [Obsolete("Use HarmonyHelper instead.")] public event Action OnPlayerAwake; public void Init(IModEvents events) diff --git a/src/OWML.ModHelper.Events/ModSceneEvents.cs b/src/OWML.ModHelper.Events/ModSceneEvents.cs index 95e7d7a75..996e84385 100644 --- a/src/OWML.ModHelper.Events/ModSceneEvents.cs +++ b/src/OWML.ModHelper.Events/ModSceneEvents.cs @@ -5,7 +5,9 @@ namespace OWML.ModHelper.Events { public class ModSceneEvents : IModSceneEvents { + [Obsolete("Use HarmonyHelper instead.")] public event Action OnStartSceneChange; + [Obsolete("Use HarmonyHelper instead.")] public event Action OnCompleteSceneChange; public ModSceneEvents() diff --git a/src/OWML.ModHelper.Events/ModUnityEvents.cs b/src/OWML.ModHelper.Events/ModUnityEvents.cs index 4ffe81dc1..bf5883439 100644 --- a/src/OWML.ModHelper.Events/ModUnityEvents.cs +++ b/src/OWML.ModHelper.Events/ModUnityEvents.cs @@ -7,10 +7,13 @@ namespace OWML.ModHelper.Events { public class ModUnityEvents : MonoBehaviour, IModUnityEvents { + [Obsolete("Use HarmonyHelper instead.")] public event Action OnUpdate; + [Obsolete("Use HarmonyHelper instead.")] public event Action OnFixedUpdate; + [Obsolete("Use HarmonyHelper instead.")] public event Action OnLateUpdate; public void FireOnNextUpdate(Action action) => diff --git a/src/OWML.ModHelper.Menus/ModConfigMenuBase.cs b/src/OWML.ModHelper.Menus/ModConfigMenuBase.cs index 83f797280..ce39fbcf4 100644 --- a/src/OWML.ModHelper.Menus/ModConfigMenuBase.cs +++ b/src/OWML.ModHelper.Menus/ModConfigMenuBase.cs @@ -164,7 +164,7 @@ private void AddSeparator(string key, int index, JObject obj) separator.Show(); } - private void SetupInputTooltip(IModInput input, string tooltip) + internal void SetupInputTooltip(IModInput input, string tooltip) { var menuOption = input.Element.GetComponent(); menuOption.SetValue("_tooltipTextType", UITextType.None); diff --git a/src/OWML.ModHelper.Menus/OwmlConfigMenu.cs b/src/OWML.ModHelper.Menus/OwmlConfigMenu.cs index 3d6a6a83d..f93301b20 100644 --- a/src/OWML.ModHelper.Menus/OwmlConfigMenu.cs +++ b/src/OWML.ModHelper.Menus/OwmlConfigMenu.cs @@ -6,7 +6,11 @@ namespace OWML.ModHelper.Menus public class OwmlConfigMenu : ModConfigMenuBase { private const string DebugModeTitle = "Debug mode"; + private const string DebugModeTooltip = "Enable verbose logging. Some effects only enable/disable when game is reloaded."; private const string ForceExeTitle = "Force run through .exe"; + private const string ForceExeTooltip = "Force OWML to run the game's exe, rather than going through Steam/Epic."; + private const string IncrementalGCTitle = "Enable incremental GC"; + private const string IncrementalGCTooltip = "Incremental GC (garbage collection) can help reduce lag spikes with some mods. Only has effect after game is reloaded."; private readonly IOwmlConfig _config; private readonly IOwmlConfig _defaultConfig; @@ -27,20 +31,31 @@ protected override void AddInputs() { AddConfigInput(DebugModeTitle, _config.DebugMode, 2); AddConfigInput(ForceExeTitle, _config.ForceExe, 3); + AddConfigInput(IncrementalGCTitle, _config.IncrementalGC, 4); UpdateNavigation(); SelectFirst(); } public override void UpdateUIValues() { - GetToggleInput(DebugModeTitle).Value = _config.DebugMode; - GetToggleInput(ForceExeTitle).Value = _config.ForceExe; + var debug = GetToggleInput(DebugModeTitle); + debug.Value = _config.DebugMode; + SetupInputTooltip(debug, DebugModeTooltip); + + var exe = GetToggleInput(ForceExeTitle); + exe.Value = _config.ForceExe; + SetupInputTooltip(exe, ForceExeTooltip); + + var gc = GetToggleInput(IncrementalGCTitle); + gc.Value = _config.IncrementalGC; + SetupInputTooltip(gc, IncrementalGCTooltip); } protected override void OnSave() { _config.DebugMode = GetInputValue(DebugModeTitle); _config.ForceExe = GetInputValue(ForceExeTitle); + _config.IncrementalGC = GetInputValue(IncrementalGCTitle); JsonHelper.SaveJsonObject($"{_config.OWMLPath}{Constants.OwmlConfigFileName}", _config); Close(); } @@ -50,6 +65,7 @@ protected override void OnReset() _config.GamePath = _defaultConfig.GamePath; _config.DebugMode = _defaultConfig.DebugMode; _config.ForceExe = _defaultConfig.ForceExe; + _config.IncrementalGC = _defaultConfig.IncrementalGC; UpdateUIValues(); } }