forked from liza/Deliveroo
Disable FPS limiter while turning in items
This commit is contained in:
parent
dd074b7133
commit
e0e1de103e
@ -17,6 +17,7 @@ internal sealed class Configuration : IPluginConfiguration
|
|||||||
public int ReservedSealCountAtMaxRank { get; set; }
|
public int ReservedSealCountAtMaxRank { get; set; }
|
||||||
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;
|
||||||
|
|
||||||
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.4</Version>
|
<Version>4.5</Version>
|
||||||
<LangVersion>12</LangVersion>
|
<LangVersion>12</LangVersion>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
|
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
|
||||||
|
@ -58,7 +58,7 @@ public sealed partial class DeliverooPlugin : IDalamudPlugin
|
|||||||
public DeliverooPlugin(DalamudPluginInterface pluginInterface, IChatGui chatGui, IGameGui gameGui,
|
public DeliverooPlugin(DalamudPluginInterface pluginInterface, IChatGui chatGui, IGameGui gameGui,
|
||||||
IFramework framework, IClientState clientState, IObjectTable objectTable, ITargetManager targetManager,
|
IFramework framework, IClientState clientState, IObjectTable objectTable, ITargetManager targetManager,
|
||||||
IDataManager dataManager, ICondition condition, ICommandManager commandManager, IPluginLog pluginLog,
|
IDataManager dataManager, ICondition condition, ICommandManager commandManager, IPluginLog pluginLog,
|
||||||
IAddonLifecycle addonLifecycle, ITextureProvider textureProvider)
|
IAddonLifecycle addonLifecycle, ITextureProvider textureProvider, IGameConfig gameConfig)
|
||||||
{
|
{
|
||||||
ArgumentNullException.ThrowIfNull(dataManager);
|
ArgumentNullException.ThrowIfNull(dataManager);
|
||||||
|
|
||||||
@ -67,23 +67,22 @@ public sealed partial class DeliverooPlugin : IDalamudPlugin
|
|||||||
_gameGui = gameGui;
|
_gameGui = gameGui;
|
||||||
_framework = framework;
|
_framework = framework;
|
||||||
_clientState = clientState;
|
_clientState = clientState;
|
||||||
ITargetManager targetManager1 = targetManager;
|
|
||||||
_condition = condition;
|
_condition = condition;
|
||||||
_commandManager = commandManager;
|
_commandManager = commandManager;
|
||||||
_pluginLog = pluginLog;
|
_pluginLog = pluginLog;
|
||||||
_addonLifecycle = addonLifecycle;
|
_addonLifecycle = addonLifecycle;
|
||||||
|
|
||||||
|
_configuration = (Configuration?)_pluginInterface.GetPluginConfig() ?? new Configuration();
|
||||||
_gameStrings = new GameStrings(dataManager, _pluginLog);
|
_gameStrings = new GameStrings(dataManager, _pluginLog);
|
||||||
_externalPluginHandler = new ExternalPluginHandler(_pluginInterface, _pluginLog);
|
_externalPluginHandler = new ExternalPluginHandler(_pluginInterface, gameConfig, _configuration, _pluginLog);
|
||||||
_gameFunctions = new GameFunctions(objectTable, _clientState, targetManager, dataManager,
|
_gameFunctions = new GameFunctions(objectTable, _clientState, targetManager, dataManager,
|
||||||
_externalPluginHandler, _pluginLog);
|
_externalPluginHandler, _pluginLog);
|
||||||
_configuration = (Configuration?)_pluginInterface.GetPluginConfig() ?? new Configuration();
|
|
||||||
_gcRewardsCache = new GcRewardsCache(dataManager);
|
_gcRewardsCache = new GcRewardsCache(dataManager);
|
||||||
_iconCache = new IconCache(textureProvider);
|
_iconCache = new IconCache(textureProvider);
|
||||||
var itemCache = new ItemCache(dataManager);
|
var itemCache = new ItemCache(dataManager);
|
||||||
|
|
||||||
_exchangeHandler = new ExchangeHandler(this, _gameFunctions, targetManager1, _gameGui, _chatGui, _pluginLog);
|
_exchangeHandler = new ExchangeHandler(this, _gameFunctions, targetManager, _gameGui, _chatGui, _pluginLog);
|
||||||
_supplyHandler = new SupplyHandler(this, _gameFunctions, targetManager1, _gameGui, _chatGui, itemCache,
|
_supplyHandler = new SupplyHandler(this, _gameFunctions, targetManager, _gameGui, _chatGui, itemCache,
|
||||||
_pluginLog);
|
_pluginLog);
|
||||||
|
|
||||||
_configWindow = new ConfigWindow(_pluginInterface, this, _configuration, _gcRewardsCache, _clientState,
|
_configWindow = new ConfigWindow(_pluginInterface, this, _configuration, _gcRewardsCache, _clientState,
|
||||||
|
41
Deliveroo/External/ExternalPluginHandler.cs
vendored
41
Deliveroo/External/ExternalPluginHandler.cs
vendored
@ -8,16 +8,22 @@ namespace Deliveroo.External;
|
|||||||
internal sealed class ExternalPluginHandler : IDisposable
|
internal sealed class ExternalPluginHandler : IDisposable
|
||||||
{
|
{
|
||||||
private readonly DalamudPluginInterface _pluginInterface;
|
private readonly DalamudPluginInterface _pluginInterface;
|
||||||
|
private readonly IGameConfig _gameConfig;
|
||||||
|
private readonly Configuration _configuration;
|
||||||
private readonly IPluginLog _pluginLog;
|
private readonly IPluginLog _pluginLog;
|
||||||
private readonly DeliverooIpc _deliverooIpc;
|
private readonly DeliverooIpc _deliverooIpc;
|
||||||
private readonly PandoraIpc _pandoraIpc;
|
private readonly PandoraIpc _pandoraIpc;
|
||||||
private readonly AllaganToolsIpc _allaganToolsIpc;
|
private readonly AllaganToolsIpc _allaganToolsIpc;
|
||||||
|
|
||||||
private bool? _pandoraState;
|
private bool? _pandoraState;
|
||||||
|
private ConfigState? _configState;
|
||||||
|
|
||||||
public ExternalPluginHandler(DalamudPluginInterface pluginInterface, IPluginLog pluginLog)
|
public ExternalPluginHandler(DalamudPluginInterface pluginInterface, IGameConfig gameConfig,
|
||||||
|
Configuration configuration, IPluginLog pluginLog)
|
||||||
{
|
{
|
||||||
_pluginInterface = pluginInterface;
|
_pluginInterface = pluginInterface;
|
||||||
|
_gameConfig = gameConfig;
|
||||||
|
_configuration = configuration;
|
||||||
_pluginLog = pluginLog;
|
_pluginLog = pluginLog;
|
||||||
_deliverooIpc = new DeliverooIpc(pluginInterface);
|
_deliverooIpc = new DeliverooIpc(pluginInterface);
|
||||||
_pandoraIpc = new PandoraIpc(pluginInterface, pluginLog);
|
_pandoraIpc = new PandoraIpc(pluginInterface, pluginLog);
|
||||||
@ -38,6 +44,7 @@ internal sealed class ExternalPluginHandler : IDisposable
|
|||||||
_deliverooIpc.StartTurnIn();
|
_deliverooIpc.StartTurnIn();
|
||||||
SaveYesAlreadyState();
|
SaveYesAlreadyState();
|
||||||
SavePandoraState();
|
SavePandoraState();
|
||||||
|
SaveGameConfig();
|
||||||
Saved = true;
|
Saved = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -57,12 +64,19 @@ internal sealed class ExternalPluginHandler : IDisposable
|
|||||||
_pluginLog.Info($"Previous pandora feature state: {_pandoraState}");
|
_pluginLog.Info($"Previous pandora feature state: {_pandoraState}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void SaveGameConfig()
|
||||||
|
{
|
||||||
|
if (_configuration.DisableFrameLimiter)
|
||||||
|
_configState = new ConfigState(_gameConfig);
|
||||||
|
}
|
||||||
|
|
||||||
public void Restore()
|
public void Restore()
|
||||||
{
|
{
|
||||||
if (Saved)
|
if (Saved)
|
||||||
{
|
{
|
||||||
RestoreYesAlready();
|
RestoreYesAlready();
|
||||||
RestorePandora();
|
RestorePandora();
|
||||||
|
RestoreGameConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
Saved = false;
|
Saved = false;
|
||||||
@ -87,10 +101,35 @@ internal sealed class ExternalPluginHandler : IDisposable
|
|||||||
_pandoraIpc.Enable();
|
_pandoraIpc.Enable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void RestoreGameConfig()
|
||||||
|
{
|
||||||
|
_configState?.Restore(_gameConfig);
|
||||||
|
_configState = null;
|
||||||
|
}
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
_deliverooIpc.Dispose();
|
_deliverooIpc.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
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 const string ConfigFps = "Fps";
|
||||||
|
private const string ConfigFpsInactive = "FPSInActive";
|
||||||
|
|
||||||
|
public ConfigState(IGameConfig gameConfig)
|
||||||
|
: this(gameConfig.System.GetUInt(ConfigFps), gameConfig.System.GetUInt(ConfigFpsInactive))
|
||||||
|
{
|
||||||
|
gameConfig.System.Set(ConfigFps, 0);
|
||||||
|
gameConfig.System.Set(ConfigFpsInactive, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Restore(IGameConfig gameConfig)
|
||||||
|
{
|
||||||
|
gameConfig.System.Set(ConfigFps, Fps);
|
||||||
|
gameConfig.System.Set(ConfigFpsInactive, FpsInactive);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -382,6 +382,15 @@ internal sealed class ConfigWindow : LWindow
|
|||||||
Save();
|
Save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ImGui.Separator();
|
||||||
|
|
||||||
|
bool disableFrameLimiter = _configuration.DisableFrameLimiter;
|
||||||
|
if (ImGui.Checkbox("Disable the game's frame limiter when turning in items", ref disableFrameLimiter))
|
||||||
|
{
|
||||||
|
_configuration.DisableFrameLimiter = disableFrameLimiter;
|
||||||
|
Save();
|
||||||
|
}
|
||||||
|
|
||||||
ImGui.EndTabItem();
|
ImGui.EndTabItem();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user