diff --git a/CustomResolution/Cmds/OpenSettingsCmd.cs b/CustomResolution/Cmds/MainCmd.cs similarity index 93% rename from CustomResolution/Cmds/OpenSettingsCmd.cs rename to CustomResolution/Cmds/MainCmd.cs index e005544..b8ba7be 100644 --- a/CustomResolution/Cmds/OpenSettingsCmd.cs +++ b/CustomResolution/Cmds/MainCmd.cs @@ -5,7 +5,7 @@ using System; namespace CustomResolution.Cmds; -public sealed class OpenSettingsCmd : Cmd +public sealed class MainCmd : Cmd { public override string Name => "cres"; @@ -20,7 +20,7 @@ public sealed class OpenSettingsCmd : Cmd { if (string.IsNullOrEmpty(arguments)) { - ToggleOpen(); + Service.PluginUI.SettingsVisible = !Service.PluginUI.SettingsVisible; return; } @@ -78,9 +78,4 @@ public sealed class OpenSettingsCmd : Cmd Service.PrintChat("Updated custom resolution scale."); } - - private void ToggleOpen() - { - Service.PluginUI.SettingsVisible = !Service.PluginUI.SettingsVisible; - } } diff --git a/CustomResolution/Plugin.cs b/CustomResolution/Plugin.cs index 9fc36a9..6c4b4ec 100644 --- a/CustomResolution/Plugin.cs +++ b/CustomResolution/Plugin.cs @@ -164,9 +164,11 @@ public sealed unsafe class Plugin : IDalamudPlugin uint width, height; - if (Service.Config.IsScale || _unloading) + bool disabled = _unloading || !Service.Config.IsEnabled; + + if (Service.Config.IsScale || disabled) { - var scale = _unloading ? 1f : Service.Config.Scale; + var scale = disabled ? 1f : Service.Config.Scale; width = (uint) Math.Round(rectWidth * scale); height = (uint) Math.Round(rectHeight * scale); @@ -177,32 +179,25 @@ public sealed unsafe class Plugin : IDalamudPlugin height = Service.Config.Height; } - if (Service.Config.IsEnabled) + if (width != dev->Width || height != dev->Height) { - if (width != dev->Width || height != dev->Height) + Service.PluginLog.Info($"Changing resolution to {width} x {height}"); + + if (width < 256) { - Service.PluginLog.Info($"Changing resolution to {width} x {height}"); - - if (width < 256) - { - width = 256; - } - - if (height < 256) - { - height = 256; - } - - dev->NewWidth = width; - dev->NewHeight = height; - dev->RequestResolutionChange = 1; + width = 256; } + + if (height < 256) + { + height = 256; + } + + dev->NewWidth = width; + dev->NewHeight = height; + dev->RequestResolutionChange = 1; } - else - { - width = dev->Width; - height = dev->Height; - } + CurrentWidth = width; CurrentHeight = height;