Fix enabling / disabling
This commit is contained in:
parent
e2fafa4f60
commit
3d192964d3
@ -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;
|
||||
}
|
||||
}
|
@ -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,8 +179,6 @@ public sealed unsafe class Plugin : IDalamudPlugin
|
||||
height = Service.Config.Height;
|
||||
}
|
||||
|
||||
if (Service.Config.IsEnabled)
|
||||
{
|
||||
if (width != dev->Width || height != dev->Height)
|
||||
{
|
||||
Service.PluginLog.Info($"Changing resolution to {width} x {height}");
|
||||
@ -197,12 +197,7 @@ public sealed unsafe class Plugin : IDalamudPlugin
|
||||
dev->NewHeight = height;
|
||||
dev->RequestResolutionChange = 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
width = dev->Width;
|
||||
height = dev->Height;
|
||||
}
|
||||
|
||||
|
||||
CurrentWidth = width;
|
||||
CurrentHeight = height;
|
||||
|
Loading…
Reference in New Issue
Block a user