Move 'uncapped FPS' to a separate setting
This commit is contained in:
parent
e0e1de103e
commit
2ad03c86ef
@ -18,6 +18,7 @@ internal sealed class Configuration : IPluginConfiguration
|
||||
public int PauseAtRank { get; set; }
|
||||
public EBehaviorOnOtherWorld BehaviorOnOtherWorld { get; set; } = EBehaviorOnOtherWorld.Warning;
|
||||
public bool DisableFrameLimiter { get; set; } = true;
|
||||
public bool UncapFrameRate { get; set; }
|
||||
|
||||
internal sealed class PurchasePriority
|
||||
{
|
||||
|
@ -1,7 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0-windows</TargetFramework>
|
||||
<Version>4.5</Version>
|
||||
<Version>4.6</Version>
|
||||
<LangVersion>12</LangVersion>
|
||||
<Nullable>enable</Nullable>
|
||||
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
|
||||
|
36
Deliveroo/External/ExternalPluginHandler.cs
vendored
36
Deliveroo/External/ExternalPluginHandler.cs
vendored
@ -16,7 +16,8 @@ internal sealed class ExternalPluginHandler : IDisposable
|
||||
private readonly AllaganToolsIpc _allaganToolsIpc;
|
||||
|
||||
private bool? _pandoraState;
|
||||
private ConfigState? _configState;
|
||||
private SystemConfigState? _limitFrameRateWhenClientInactive;
|
||||
private SystemConfigState? _uncapFrameRate;
|
||||
|
||||
public ExternalPluginHandler(DalamudPluginInterface pluginInterface, IGameConfig gameConfig,
|
||||
Configuration configuration, IPluginLog pluginLog)
|
||||
@ -66,8 +67,14 @@ internal sealed class ExternalPluginHandler : IDisposable
|
||||
|
||||
private void SaveGameConfig()
|
||||
{
|
||||
if (_configuration.DisableFrameLimiter)
|
||||
_configState = new ConfigState(_gameConfig);
|
||||
if (!_configuration.DisableFrameLimiter)
|
||||
return;
|
||||
|
||||
_limitFrameRateWhenClientInactive ??=
|
||||
new SystemConfigState(_gameConfig, SystemConfigState.ConfigFpsInactive, 0);
|
||||
|
||||
if (_configuration.UncapFrameRate)
|
||||
_uncapFrameRate ??= new SystemConfigState(_gameConfig, SystemConfigState.ConfigFps, 0);
|
||||
}
|
||||
|
||||
public void Restore()
|
||||
@ -103,8 +110,11 @@ internal sealed class ExternalPluginHandler : IDisposable
|
||||
|
||||
private void RestoreGameConfig()
|
||||
{
|
||||
_configState?.Restore(_gameConfig);
|
||||
_configState = null;
|
||||
_uncapFrameRate?.Restore(_gameConfig);
|
||||
_uncapFrameRate = null;
|
||||
|
||||
_limitFrameRateWhenClientInactive?.Restore(_gameConfig);
|
||||
_limitFrameRateWhenClientInactive = null;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
@ -114,22 +124,20 @@ internal sealed class ExternalPluginHandler : IDisposable
|
||||
|
||||
public uint GetRetainerItemCount(uint itemId) => _allaganToolsIpc.GetRetainerItemCount(itemId);
|
||||
|
||||
private sealed record ConfigState(uint Fps, uint FpsInactive)
|
||||
private sealed record SystemConfigState(string Key, uint OldValue)
|
||||
{
|
||||
private const string ConfigFps = "Fps";
|
||||
private const string ConfigFpsInactive = "FPSInActive";
|
||||
public const string ConfigFps = "Fps";
|
||||
public const string ConfigFpsInactive = "FPSInActive";
|
||||
|
||||
public ConfigState(IGameConfig gameConfig)
|
||||
: this(gameConfig.System.GetUInt(ConfigFps), gameConfig.System.GetUInt(ConfigFpsInactive))
|
||||
public SystemConfigState(IGameConfig gameConfig, string key, uint newValue)
|
||||
: this(key, gameConfig.System.GetUInt(key))
|
||||
{
|
||||
gameConfig.System.Set(ConfigFps, 0);
|
||||
gameConfig.System.Set(ConfigFpsInactive, 0);
|
||||
gameConfig.System.Set(key, newValue);
|
||||
}
|
||||
|
||||
public void Restore(IGameConfig gameConfig)
|
||||
{
|
||||
gameConfig.System.Set(ConfigFps, Fps);
|
||||
gameConfig.System.Set(ConfigFpsInactive, FpsInactive);
|
||||
gameConfig.System.Set(Key, OldValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -385,12 +385,24 @@ internal sealed class ConfigWindow : LWindow
|
||||
ImGui.Separator();
|
||||
|
||||
bool disableFrameLimiter = _configuration.DisableFrameLimiter;
|
||||
if (ImGui.Checkbox("Disable the game's frame limiter when turning in items", ref disableFrameLimiter))
|
||||
if (ImGui.Checkbox("Disable the game setting 'Limit frame rate when client is inactive'",
|
||||
ref disableFrameLimiter))
|
||||
{
|
||||
_configuration.DisableFrameLimiter = disableFrameLimiter;
|
||||
Save();
|
||||
}
|
||||
|
||||
ImGui.Indent();
|
||||
ImGui.BeginDisabled(!disableFrameLimiter);
|
||||
bool uncapFrameRate = _configuration.UncapFrameRate;
|
||||
if (ImGui.Checkbox("Set frame rate to uncapped", ref uncapFrameRate))
|
||||
{
|
||||
_configuration.UncapFrameRate = uncapFrameRate;
|
||||
Save();
|
||||
}
|
||||
|
||||
ImGui.EndDisabled();
|
||||
ImGui.Unindent();
|
||||
ImGui.EndTabItem();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user