mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-21 16:09:27 +01:00
Change Eqp hook to not need eqp files anymore.
This commit is contained in:
parent
e33512cf7f
commit
ad0c64d4ac
6 changed files with 19 additions and 23 deletions
|
|
@ -1,3 +1,4 @@
|
|||
using Penumbra.GameData.Enums;
|
||||
using Penumbra.GameData.Structs;
|
||||
using Penumbra.Interop.Services;
|
||||
using Penumbra.Interop.Structs;
|
||||
|
|
@ -28,6 +29,17 @@ public sealed class EqpCache(MetaFileManager manager, ModCollection collection)
|
|||
Penumbra.Log.Verbose($"{Collection.AnonymizedName}: Loaded {Count} delayed EQP manipulations.");
|
||||
}
|
||||
|
||||
public unsafe EqpEntry GetValues(CharacterArmor* armor)
|
||||
=> GetSingleValue(armor[0].Set, EquipSlot.Head)
|
||||
| GetSingleValue(armor[1].Set, EquipSlot.Body)
|
||||
| GetSingleValue(armor[2].Set, EquipSlot.Hands)
|
||||
| GetSingleValue(armor[3].Set, EquipSlot.Legs)
|
||||
| GetSingleValue(armor[4].Set, EquipSlot.Feet);
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
|
||||
private EqpEntry GetSingleValue(PrimaryId id, EquipSlot slot)
|
||||
=> TryGetValue(new EqpIdentifier(id, slot), out var pair) ? pair.Entry : ExpandedEqpFile.GetDefault(manager, id) & Eqp.Mask(slot);
|
||||
|
||||
public MetaList.MetaReverter TemporarilySetFile()
|
||||
=> Manager.TemporarilySetFile(_eqpFile, MetaIndex.Eqp);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
using System.IO.Pipes;
|
||||
using Penumbra.GameData.Enums;
|
||||
using Penumbra.GameData.Structs;
|
||||
using Penumbra.Interop.Services;
|
||||
|
|
@ -146,9 +145,6 @@ public class MetaCache(MetaFileManager manager, ModCollection collection)
|
|||
public void SetImcFiles(bool fromFullCompute)
|
||||
=> Imc.SetFiles(fromFullCompute);
|
||||
|
||||
public MetaList.MetaReverter TemporarilySetEqpFile()
|
||||
=> Eqp.TemporarilySetFile();
|
||||
|
||||
public MetaList.MetaReverter? TemporarilySetEqdpFile(GenderRace genderRace, bool accessory)
|
||||
=> Eqdp.TemporarilySetFile(genderRace, accessory);
|
||||
|
||||
|
|
@ -161,10 +157,6 @@ public class MetaCache(MetaFileManager manager, ModCollection collection)
|
|||
public MetaList.MetaReverter TemporarilySetEstFile(EstType type)
|
||||
=> Est.TemporarilySetFiles(type);
|
||||
|
||||
public unsafe EqpEntry ApplyGlobalEqp(EqpEntry baseEntry, CharacterArmor* armor)
|
||||
=> GlobalEqp.Apply(baseEntry, armor);
|
||||
|
||||
|
||||
/// <summary> Try to obtain a manipulated IMC file. </summary>
|
||||
public bool GetImcFile(Utf8GamePath path, [NotNullWhen(true)] out Meta.Files.ImcFile? file)
|
||||
=> Imc.GetFile(path, out file);
|
||||
|
|
|
|||
|
|
@ -100,10 +100,6 @@ public partial class ModCollection
|
|||
return idx >= 0 ? utility.TemporarilyResetResource(idx) : null;
|
||||
}
|
||||
|
||||
public MetaList.MetaReverter TemporarilySetEqpFile(CharacterUtility utility)
|
||||
=> _cache?.Meta.TemporarilySetEqpFile()
|
||||
?? utility.TemporarilyResetResource(MetaIndex.Eqp);
|
||||
|
||||
public MetaList.MetaReverter TemporarilySetGmpFile(CharacterUtility utility)
|
||||
=> _cache?.Meta.TemporarilySetGmpFile()
|
||||
?? utility.TemporarilyResetResource(MetaIndex.Gmp);
|
||||
|
|
@ -115,7 +111,4 @@ public partial class ModCollection
|
|||
public MetaList.MetaReverter TemporarilySetEstFile(CharacterUtility utility, EstType type)
|
||||
=> _cache?.Meta.TemporarilySetEstFile(type)
|
||||
?? utility.TemporarilyResetResource((MetaIndex)type);
|
||||
|
||||
public unsafe EqpEntry ApplyGlobalEqp(EqpEntry baseEntry, CharacterArmor* armor)
|
||||
=> _cache?.Meta.ApplyGlobalEqp(baseEntry, armor) ?? baseEntry;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,11 +19,10 @@ public unsafe class EqpHook : FastHook<EqpHook.Delegate>
|
|||
|
||||
private void Detour(CharacterUtility* utility, EqpEntry* flags, CharacterArmor* armor)
|
||||
{
|
||||
if (_metaState.EqpCollection.Valid)
|
||||
if (_metaState.EqpCollection is { Valid: true, ModCollection.MetaCache: { } cache })
|
||||
{
|
||||
using var eqp = _metaState.ResolveEqpData(_metaState.EqpCollection.ModCollection);
|
||||
Task.Result.Original(utility, flags, armor);
|
||||
*flags = _metaState.EqpCollection.ModCollection.ApplyGlobalEqp(*flags, armor);
|
||||
*flags = cache.Eqp.GetValues(armor);
|
||||
*flags = cache.GlobalEqp.Apply(*flags, armor);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -47,6 +47,8 @@ public sealed unsafe class MetaState : IDisposable
|
|||
|
||||
public ResolveData CustomizeChangeCollection = ResolveData.Invalid;
|
||||
public ResolveData EqpCollection = ResolveData.Invalid;
|
||||
public ResolveData GmpCollection = ResolveData.Invalid;
|
||||
public PrimaryId UndividedGmpId = 0;
|
||||
|
||||
private ResolveData _lastCreatedCollection = ResolveData.Invalid;
|
||||
private DisposableContainer _characterBaseCreateMetaChanges = DisposableContainer.Empty;
|
||||
|
|
@ -93,9 +95,6 @@ public sealed unsafe class MetaState : IDisposable
|
|||
_ => DisposableContainer.Empty,
|
||||
};
|
||||
|
||||
public MetaList.MetaReverter ResolveEqpData(ModCollection collection)
|
||||
=> collection.TemporarilySetEqpFile(_characterUtility);
|
||||
|
||||
public MetaList.MetaReverter ResolveGmpData(ModCollection collection)
|
||||
=> collection.TemporarilySetGmpFile(_characterUtility);
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ using ImGuiNET;
|
|||
using OtterGui;
|
||||
using OtterGui.Custom;
|
||||
using OtterGui.Raii;
|
||||
using OtterGui.Text;
|
||||
using Penumbra.Api.Enums;
|
||||
using Penumbra.Services;
|
||||
using Penumbra.UI.Classes;
|
||||
|
|
@ -144,7 +145,7 @@ public sealed class ConfigWindow : Window
|
|||
using var color = ImRaii.PushColor(ImGuiCol.Text, Colors.RegexWarningBorder);
|
||||
ImGui.NewLine();
|
||||
ImGui.NewLine();
|
||||
ImGuiUtil.TextWrapped(text);
|
||||
ImUtf8.TextWrapped(text);
|
||||
color.Pop();
|
||||
|
||||
ImGui.NewLine();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue