forked from liza/Deliveroo
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 int PauseAtRank { get; set; }
|
||||||
public EBehaviorOnOtherWorld BehaviorOnOtherWorld { get; set; } = EBehaviorOnOtherWorld.Warning;
|
public EBehaviorOnOtherWorld BehaviorOnOtherWorld { get; set; } = EBehaviorOnOtherWorld.Warning;
|
||||||
public bool DisableFrameLimiter { get; set; } = true;
|
public bool DisableFrameLimiter { get; set; } = true;
|
||||||
|
public bool UncapFrameRate { get; set; }
|
||||||
|
|
||||||
internal sealed class PurchasePriority
|
internal sealed class PurchasePriority
|
||||||
{
|
{
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net8.0-windows</TargetFramework>
|
<TargetFramework>net8.0-windows</TargetFramework>
|
||||||
<Version>4.5</Version>
|
<Version>4.6</Version>
|
||||||
<LangVersion>12</LangVersion>
|
<LangVersion>12</LangVersion>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
|
<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 readonly AllaganToolsIpc _allaganToolsIpc;
|
||||||
|
|
||||||
private bool? _pandoraState;
|
private bool? _pandoraState;
|
||||||
private ConfigState? _configState;
|
private SystemConfigState? _limitFrameRateWhenClientInactive;
|
||||||
|
private SystemConfigState? _uncapFrameRate;
|
||||||
|
|
||||||
public ExternalPluginHandler(DalamudPluginInterface pluginInterface, IGameConfig gameConfig,
|
public ExternalPluginHandler(DalamudPluginInterface pluginInterface, IGameConfig gameConfig,
|
||||||
Configuration configuration, IPluginLog pluginLog)
|
Configuration configuration, IPluginLog pluginLog)
|
||||||
@ -66,8 +67,14 @@ internal sealed class ExternalPluginHandler : IDisposable
|
|||||||
|
|
||||||
private void SaveGameConfig()
|
private void SaveGameConfig()
|
||||||
{
|
{
|
||||||
if (_configuration.DisableFrameLimiter)
|
if (!_configuration.DisableFrameLimiter)
|
||||||
_configState = new ConfigState(_gameConfig);
|
return;
|
||||||
|
|
||||||
|
_limitFrameRateWhenClientInactive ??=
|
||||||
|
new SystemConfigState(_gameConfig, SystemConfigState.ConfigFpsInactive, 0);
|
||||||
|
|
||||||
|
if (_configuration.UncapFrameRate)
|
||||||
|
_uncapFrameRate ??= new SystemConfigState(_gameConfig, SystemConfigState.ConfigFps, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Restore()
|
public void Restore()
|
||||||
@ -103,8 +110,11 @@ internal sealed class ExternalPluginHandler : IDisposable
|
|||||||
|
|
||||||
private void RestoreGameConfig()
|
private void RestoreGameConfig()
|
||||||
{
|
{
|
||||||
_configState?.Restore(_gameConfig);
|
_uncapFrameRate?.Restore(_gameConfig);
|
||||||
_configState = null;
|
_uncapFrameRate = null;
|
||||||
|
|
||||||
|
_limitFrameRateWhenClientInactive?.Restore(_gameConfig);
|
||||||
|
_limitFrameRateWhenClientInactive = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
@ -114,22 +124,20 @@ internal sealed class ExternalPluginHandler : IDisposable
|
|||||||
|
|
||||||
public uint GetRetainerItemCount(uint itemId) => _allaganToolsIpc.GetRetainerItemCount(itemId);
|
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";
|
public const string ConfigFps = "Fps";
|
||||||
private const string ConfigFpsInactive = "FPSInActive";
|
public const string ConfigFpsInactive = "FPSInActive";
|
||||||
|
|
||||||
public ConfigState(IGameConfig gameConfig)
|
public SystemConfigState(IGameConfig gameConfig, string key, uint newValue)
|
||||||
: this(gameConfig.System.GetUInt(ConfigFps), gameConfig.System.GetUInt(ConfigFpsInactive))
|
: this(key, gameConfig.System.GetUInt(key))
|
||||||
{
|
{
|
||||||
gameConfig.System.Set(ConfigFps, 0);
|
gameConfig.System.Set(key, newValue);
|
||||||
gameConfig.System.Set(ConfigFpsInactive, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Restore(IGameConfig gameConfig)
|
public void Restore(IGameConfig gameConfig)
|
||||||
{
|
{
|
||||||
gameConfig.System.Set(ConfigFps, Fps);
|
gameConfig.System.Set(Key, OldValue);
|
||||||
gameConfig.System.Set(ConfigFpsInactive, FpsInactive);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -385,12 +385,24 @@ internal sealed class ConfigWindow : LWindow
|
|||||||
ImGui.Separator();
|
ImGui.Separator();
|
||||||
|
|
||||||
bool disableFrameLimiter = _configuration.DisableFrameLimiter;
|
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;
|
_configuration.DisableFrameLimiter = disableFrameLimiter;
|
||||||
Save();
|
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();
|
ImGui.EndTabItem();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user