7d5496e959
81 namespace declarations and 100 using directives converted via sed, plus two FQN-aliases (ChatTwoPartyFinderPayload in PayloadHandler.cs and ModifierFlag in KeybindManager.cs) updated. Critical: Language.Designer.cs and HellionStrings.Designer.cs ResourceManager string arguments updated synchronously — these are runtime reflection lookups not caught by the C# compiler. Two intentional ChatTwo references remain: the legacy migration path 'ChatTwo.json' in Plugin.cs (still points to upstream Chat 2's config file by design) and the InternalsVisibleTo declaration in AssemblyInfo.cs (handled in the upcoming repo-folder rename task). The local alias names 'ChatTwoPartyFinderPayload' and 'ChatTwoConflictDetector' are preserved as local symbols; only their target namespaces and references changed.
47 lines
1.3 KiB
C#
47 lines
1.3 KiB
C#
using Dalamud.Utility;
|
|
using FFXIVClientStructs.FFXIV.Client.UI.Misc;
|
|
using FFXIVClientStructs.FFXIV.Component.Text;
|
|
|
|
namespace HellionChat.Util;
|
|
|
|
public static class GlobalParametersCache
|
|
{
|
|
private static int[] Cache = [];
|
|
|
|
public static int GetValue(int index)
|
|
{
|
|
if (index < 0 || index >= Cache.Length)
|
|
return 0;
|
|
|
|
return Cache[index];
|
|
}
|
|
|
|
/// <summary>
|
|
/// Refresh the cache of global parameters from RaptureTextModule.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// This should be called in the main thread when updates are necessary.
|
|
/// </remarks>
|
|
public static unsafe void Refresh()
|
|
{
|
|
if (!ThreadSafety.IsMainThread)
|
|
throw new InvalidOperationException("GlobalParametersCache.Refresh must be called on the main thread.");
|
|
|
|
var rtm = RaptureTextModule.Instance();
|
|
if (rtm is null)
|
|
return;
|
|
|
|
ref var gp = ref rtm->TextModule.MacroDecoder.GlobalParameters;
|
|
if (Cache.Length != (int)gp.MySize)
|
|
Cache = new int[gp.MySize];
|
|
|
|
for (ulong i = 0; i < gp.MySize; i++)
|
|
{
|
|
var p = gp[(long)i];
|
|
if (p.Type == TextParameterType.Integer)
|
|
Cache[(int)i] = p.IntValue;
|
|
else
|
|
Cache[(int)i] = 0;
|
|
}
|
|
}
|
|
} |