mirror of
https://github.com/xivdev/Penumbra.git
synced 2026-02-23 08:17:59 +01:00
Update for API 9
This commit is contained in:
parent
50f6de7809
commit
21d503a8cd
61 changed files with 210 additions and 192 deletions
|
|
@ -1,7 +1,5 @@
|
|||
using Dalamud.Game;
|
||||
using Dalamud.Plugin.Services;
|
||||
using FFXIVClientStructs.FFXIV.Client.Graphics.Kernel;
|
||||
using FFXIVClientStructs.FFXIV.Client.Graphics.Render;
|
||||
using Penumbra.GameData.Files;
|
||||
using Penumbra.Interop.SafeHandles;
|
||||
|
||||
|
|
@ -13,7 +11,7 @@ public sealed unsafe class LiveColorTablePreviewer : LiveMaterialPreviewerBase
|
|||
public const int TextureHeight = MtrlFile.ColorTable.NumRows;
|
||||
public const int TextureLength = TextureWidth * TextureHeight * 4;
|
||||
|
||||
private readonly Framework _framework;
|
||||
private readonly IFramework _framework;
|
||||
|
||||
private readonly Texture** _colorTableTexture;
|
||||
private readonly SafeTextureHandle _originalColorTableTexture;
|
||||
|
|
@ -24,7 +22,7 @@ public sealed unsafe class LiveColorTablePreviewer : LiveMaterialPreviewerBase
|
|||
public Half[] ColorTable
|
||||
=> _colorTable;
|
||||
|
||||
public LiveColorTablePreviewer(IObjectTable objects, Framework framework, MaterialInfo materialInfo)
|
||||
public LiveColorTablePreviewer(IObjectTable objects, IFramework framework, MaterialInfo materialInfo)
|
||||
: base(objects, materialInfo)
|
||||
{
|
||||
_framework = framework;
|
||||
|
|
@ -66,7 +64,7 @@ public sealed unsafe class LiveColorTablePreviewer : LiveMaterialPreviewerBase
|
|||
_updatePending = true;
|
||||
}
|
||||
|
||||
private void OnFrameworkUpdate(Framework _)
|
||||
private void OnFrameworkUpdate(IFramework _)
|
||||
{
|
||||
if (!_updatePending)
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -21,13 +21,13 @@ public unsafe class AnimationHookService : IDisposable
|
|||
private readonly CollectionResolver _collectionResolver;
|
||||
private readonly DrawObjectState _drawObjectState;
|
||||
private readonly CollectionResolver _resolver;
|
||||
private readonly Condition _conditions;
|
||||
private readonly ICondition _conditions;
|
||||
|
||||
private readonly ThreadLocal<ResolveData> _animationLoadData = new(() => ResolveData.Invalid, true);
|
||||
private readonly ThreadLocal<ResolveData> _characterSoundData = new(() => ResolveData.Invalid, true);
|
||||
|
||||
public AnimationHookService(PerformanceTracker performance, IObjectTable objects, CollectionResolver collectionResolver,
|
||||
DrawObjectState drawObjectState, CollectionResolver resolver, Condition conditions)
|
||||
DrawObjectState drawObjectState, CollectionResolver resolver, ICondition conditions, IGameInteropProvider interop)
|
||||
{
|
||||
_performance = performance;
|
||||
_objects = objects;
|
||||
|
|
@ -36,7 +36,7 @@ public unsafe class AnimationHookService : IDisposable
|
|||
_resolver = resolver;
|
||||
_conditions = conditions;
|
||||
|
||||
SignatureHelper.Initialise(this);
|
||||
interop.InitializeFromAttributes(this);
|
||||
|
||||
_loadCharacterSoundHook.Enable();
|
||||
_loadTimelineResourcesHook.Enable();
|
||||
|
|
|
|||
|
|
@ -20,9 +20,9 @@ public class DrawObjectState : IDisposable, IReadOnlyDictionary<nint, (nint, boo
|
|||
public nint LastGameObject
|
||||
=> _lastGameObject.IsValueCreated && _lastGameObject.Value!.Count > 0 ? _lastGameObject.Value.Peek() : nint.Zero;
|
||||
|
||||
public DrawObjectState(IObjectTable objects, GameEventManager gameEvents)
|
||||
public DrawObjectState(IObjectTable objects, GameEventManager gameEvents, IGameInteropProvider interop)
|
||||
{
|
||||
SignatureHelper.Initialise(this);
|
||||
interop.InitializeFromAttributes(this);
|
||||
_enableDrawHook.Enable();
|
||||
_objects = objects;
|
||||
_gameEvents = gameEvents;
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ public unsafe class IdentifiedCollectionCache : IDisposable, IEnumerable<(nint A
|
|||
_dirty = _cache.Count > 0;
|
||||
}
|
||||
|
||||
private void TerritoryClear(object? _1, ushort _2)
|
||||
private void TerritoryClear(ushort _2)
|
||||
=> _dirty = _cache.Count > 0;
|
||||
|
||||
private void OnCharacterDestruct(Character* character)
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using Dalamud.Hooking;
|
||||
using Dalamud.Plugin.Services;
|
||||
using Dalamud.Utility.Signatures;
|
||||
using FFXIVClientStructs.FFXIV.Client.Game.Character;
|
||||
using FFXIVClientStructs.FFXIV.Client.Game.Object;
|
||||
|
|
@ -59,7 +60,7 @@ public unsafe class MetaState : IDisposable
|
|||
private DisposableContainer _characterBaseCreateMetaChanges = DisposableContainer.Empty;
|
||||
|
||||
public MetaState(PerformanceTracker performance, CommunicatorService communicator, CollectionResolver collectionResolver,
|
||||
ResourceLoader resources, GameEventManager gameEventManager, CharacterUtility characterUtility, Configuration config)
|
||||
ResourceLoader resources, GameEventManager gameEventManager, CharacterUtility characterUtility, Configuration config, IGameInteropProvider interop)
|
||||
{
|
||||
_performance = performance;
|
||||
_communicator = communicator;
|
||||
|
|
@ -68,8 +69,8 @@ public unsafe class MetaState : IDisposable
|
|||
_gameEventManager = gameEventManager;
|
||||
_characterUtility = characterUtility;
|
||||
_config = config;
|
||||
SignatureHelper.Initialise(this);
|
||||
_onModelLoadCompleteHook = Hook<OnModelLoadCompleteDelegate>.FromAddress(_humanVTable[58], OnModelLoadCompleteDetour);
|
||||
interop.InitializeFromAttributes(this);
|
||||
_onModelLoadCompleteHook = interop.HookFromAddress<OnModelLoadCompleteDelegate>(_humanVTable[58], OnModelLoadCompleteDetour);
|
||||
_getEqpIndirectHook.Enable();
|
||||
_updateModelsHook.Enable();
|
||||
_onModelLoadCompleteHook.Enable();
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
using Dalamud.Plugin.Services;
|
||||
using Dalamud.Utility.Signatures;
|
||||
using Penumbra.Collections;
|
||||
using Penumbra.GameData;
|
||||
|
|
@ -34,16 +35,16 @@ public unsafe class PathState : IDisposable
|
|||
public IList<ResolveData> CurrentData
|
||||
=> _resolveData.Values;
|
||||
|
||||
public PathState(CollectionResolver collectionResolver, MetaState metaState, CharacterUtility characterUtility)
|
||||
public PathState(CollectionResolver collectionResolver, MetaState metaState, CharacterUtility characterUtility, IGameInteropProvider interop)
|
||||
{
|
||||
SignatureHelper.Initialise(this);
|
||||
interop.InitializeFromAttributes(this);
|
||||
CollectionResolver = collectionResolver;
|
||||
MetaState = metaState;
|
||||
CharacterUtility = characterUtility;
|
||||
_human = new ResolvePathHooks(this, _humanVTable, ResolvePathHooks.Type.Human);
|
||||
_weapon = new ResolvePathHooks(this, _weaponVTable, ResolvePathHooks.Type.Weapon);
|
||||
_demiHuman = new ResolvePathHooks(this, _demiHumanVTable, ResolvePathHooks.Type.Other);
|
||||
_monster = new ResolvePathHooks(this, _monsterVTable, ResolvePathHooks.Type.Other);
|
||||
_human = new ResolvePathHooks(interop, this, _humanVTable, ResolvePathHooks.Type.Human);
|
||||
_weapon = new ResolvePathHooks(interop, this, _weaponVTable, ResolvePathHooks.Type.Weapon);
|
||||
_demiHuman = new ResolvePathHooks(interop, this, _demiHumanVTable, ResolvePathHooks.Type.Other);
|
||||
_monster = new ResolvePathHooks(interop, this, _monsterVTable, ResolvePathHooks.Type.Other);
|
||||
_human.Enable();
|
||||
_weapon.Enable();
|
||||
_demiHuman.Enable();
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using Dalamud.Hooking;
|
||||
using Dalamud.Plugin.Services;
|
||||
using FFXIVClientStructs.FFXIV.Client.Graphics.Scene;
|
||||
using OtterGui.Classes;
|
||||
using Penumbra.Collections;
|
||||
|
|
@ -35,21 +36,21 @@ public unsafe class ResolvePathHooks : IDisposable
|
|||
|
||||
private readonly PathState _parent;
|
||||
|
||||
public ResolvePathHooks(PathState parent, nint* vTable, Type type)
|
||||
public ResolvePathHooks(IGameInteropProvider interop, PathState parent, nint* vTable, Type type)
|
||||
{
|
||||
_parent = parent;
|
||||
_resolveDecalPathHook = Create<GeneralResolveDelegate>(vTable[83], type, ResolveDecalWeapon, ResolveDecal);
|
||||
_resolveEidPathHook = Create<EidResolveDelegate>(vTable[85], type, ResolveEidWeapon, ResolveEid);
|
||||
_resolveImcPathHook = Create<GeneralResolveDelegate>(vTable[81], type, ResolveImcWeapon, ResolveImc);
|
||||
_resolveMPapPathHook = Create<MPapResolveDelegate>(vTable[79], type, ResolveMPapWeapon, ResolveMPap);
|
||||
_resolveMdlPathHook = Create<GeneralResolveDelegate>(vTable[73], type, ResolveMdlWeapon, ResolveMdl, ResolveMdlHuman);
|
||||
_resolveMtrlPathHook = Create<MaterialResolveDelegate>(vTable[82], type, ResolveMtrlWeapon, ResolveMtrl);
|
||||
_resolvePapPathHook = Create<MaterialResolveDelegate>(vTable[76], type, ResolvePapWeapon, ResolvePap, ResolvePapHuman);
|
||||
_resolvePhybPathHook = Create<GeneralResolveDelegate>(vTable[75], type, ResolvePhybWeapon, ResolvePhyb, ResolvePhybHuman);
|
||||
_resolveSklbPathHook = Create<GeneralResolveDelegate>(vTable[72], type, ResolveSklbWeapon, ResolveSklb, ResolveSklbHuman);
|
||||
_resolveSkpPathHook = Create<GeneralResolveDelegate>(vTable[74], type, ResolveSkpWeapon, ResolveSkp, ResolveSkpHuman);
|
||||
_resolveTmbPathHook = Create<EidResolveDelegate>(vTable[77], type, ResolveTmbWeapon, ResolveTmb);
|
||||
_resolveVfxPathHook = Create<MaterialResolveDelegate>(vTable[84], type, ResolveVfxWeapon, ResolveVfx);
|
||||
_resolveDecalPathHook = Create<GeneralResolveDelegate>(interop, vTable[83], type, ResolveDecalWeapon, ResolveDecal);
|
||||
_resolveEidPathHook = Create<EidResolveDelegate>(interop, vTable[85], type, ResolveEidWeapon, ResolveEid);
|
||||
_resolveImcPathHook = Create<GeneralResolveDelegate>(interop, vTable[81], type, ResolveImcWeapon, ResolveImc);
|
||||
_resolveMPapPathHook = Create<MPapResolveDelegate>(interop, vTable[79], type, ResolveMPapWeapon, ResolveMPap);
|
||||
_resolveMdlPathHook = Create<GeneralResolveDelegate>(interop, vTable[73], type, ResolveMdlWeapon, ResolveMdl, ResolveMdlHuman);
|
||||
_resolveMtrlPathHook = Create<MaterialResolveDelegate>(interop, vTable[82], type, ResolveMtrlWeapon, ResolveMtrl);
|
||||
_resolvePapPathHook = Create<MaterialResolveDelegate>(interop, vTable[76], type, ResolvePapWeapon, ResolvePap, ResolvePapHuman);
|
||||
_resolvePhybPathHook = Create<GeneralResolveDelegate>(interop, vTable[75], type, ResolvePhybWeapon, ResolvePhyb, ResolvePhybHuman);
|
||||
_resolveSklbPathHook = Create<GeneralResolveDelegate>(interop, vTable[72], type, ResolveSklbWeapon, ResolveSklb, ResolveSklbHuman);
|
||||
_resolveSkpPathHook = Create<GeneralResolveDelegate>(interop, vTable[74], type, ResolveSkpWeapon, ResolveSkp, ResolveSkpHuman);
|
||||
_resolveTmbPathHook = Create<EidResolveDelegate>(interop, vTable[77], type, ResolveTmbWeapon, ResolveTmb);
|
||||
_resolveVfxPathHook = Create<MaterialResolveDelegate>(interop, vTable[84], type, ResolveVfxWeapon, ResolveVfx);
|
||||
}
|
||||
|
||||
public void Enable()
|
||||
|
|
@ -217,7 +218,7 @@ public unsafe class ResolvePathHooks : IDisposable
|
|||
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
|
||||
private static Hook<T> Create<T>(nint address, Type type, T weapon, T other, T human) where T : Delegate
|
||||
private static Hook<T> Create<T>(IGameInteropProvider interop, nint address, Type type, T weapon, T other, T human) where T : Delegate
|
||||
{
|
||||
var del = type switch
|
||||
{
|
||||
|
|
@ -225,12 +226,12 @@ public unsafe class ResolvePathHooks : IDisposable
|
|||
Type.Weapon => weapon,
|
||||
_ => other,
|
||||
};
|
||||
return Hook<T>.FromAddress(address, del);
|
||||
return interop.HookFromAddress(address, del);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
|
||||
private static Hook<T> Create<T>(nint address, Type type, T weapon, T other) where T : Delegate
|
||||
=> Create(address, type, weapon, other, other);
|
||||
private static Hook<T> Create<T>(IGameInteropProvider interop, nint address, Type type, T weapon, T other) where T : Delegate
|
||||
=> Create(interop, address, type, weapon, other, other);
|
||||
|
||||
|
||||
// Implementation
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using Dalamud.Hooking;
|
||||
using Dalamud.Plugin.Services;
|
||||
using Dalamud.Utility.Signatures;
|
||||
using Penumbra.Api.Enums;
|
||||
using Penumbra.Collections;
|
||||
|
|
@ -30,9 +31,9 @@ public unsafe class SubfileHelper : IDisposable, IReadOnlyCollection<KeyValuePai
|
|||
|
||||
private readonly ConcurrentDictionary<nint, ResolveData> _subFileCollection = new();
|
||||
|
||||
public SubfileHelper(PerformanceTracker performance, ResourceLoader loader, GameEventManager events, CommunicatorService communicator)
|
||||
public SubfileHelper(PerformanceTracker performance, ResourceLoader loader, GameEventManager events, CommunicatorService communicator, IGameInteropProvider interop)
|
||||
{
|
||||
SignatureHelper.Initialise(this);
|
||||
interop.InitializeFromAttributes(this);
|
||||
|
||||
_performance = performance;
|
||||
_loader = loader;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using Dalamud.Hooking;
|
||||
using Dalamud.Plugin.Services;
|
||||
using Penumbra.String;
|
||||
using Penumbra.String.Classes;
|
||||
using Penumbra.String.Functions;
|
||||
|
|
@ -14,9 +15,9 @@ public unsafe class CreateFileWHook : IDisposable
|
|||
{
|
||||
public const int RequiredSize = 28;
|
||||
|
||||
public CreateFileWHook()
|
||||
public CreateFileWHook(IGameInteropProvider interop)
|
||||
{
|
||||
_createFileWHook = Hook<CreateFileWDelegate>.FromImport(null, "KERNEL32.dll", "CreateFileW", 0, CreateFileWDetour);
|
||||
_createFileWHook = interop.HookFromImport<CreateFileWDelegate>(null, "KERNEL32.dll", "CreateFileW", 0, CreateFileWDetour);
|
||||
_createFileWHook.Enable();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using Dalamud.Hooking;
|
||||
using Dalamud.Plugin.Services;
|
||||
using Dalamud.Utility.Signatures;
|
||||
using Penumbra.GameData;
|
||||
using Penumbra.Interop.Structs;
|
||||
|
|
@ -8,11 +9,11 @@ namespace Penumbra.Interop.ResourceLoading;
|
|||
|
||||
public unsafe class FileReadService : IDisposable
|
||||
{
|
||||
public FileReadService(PerformanceTracker performance, ResourceManagerService resourceManager)
|
||||
public FileReadService(PerformanceTracker performance, ResourceManagerService resourceManager, IGameInteropProvider interop)
|
||||
{
|
||||
_resourceManager = resourceManager;
|
||||
_performance = performance;
|
||||
SignatureHelper.Initialise(this);
|
||||
interop.InitializeFromAttributes(this);
|
||||
_readSqPackHook.Enable();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
using Dalamud.Plugin.Services;
|
||||
using Dalamud.Utility.Signatures;
|
||||
using FFXIVClientStructs.FFXIV.Client.System.Resource;
|
||||
using FFXIVClientStructs.FFXIV.Client.System.Resource.Handle;
|
||||
|
|
@ -10,8 +11,8 @@ namespace Penumbra.Interop.ResourceLoading;
|
|||
|
||||
public unsafe class ResourceManagerService
|
||||
{
|
||||
public ResourceManagerService()
|
||||
=> SignatureHelper.Initialise(this);
|
||||
public ResourceManagerService(IGameInteropProvider interop)
|
||||
=> interop.InitializeFromAttributes(this);
|
||||
|
||||
/// <summary> The SE Resource Manager as pointer. </summary>
|
||||
public ResourceManager* ResourceManager
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
using Dalamud.Hooking;
|
||||
using Dalamud.Plugin.Services;
|
||||
using Dalamud.Utility.Signatures;
|
||||
using FFXIVClientStructs.FFXIV.Client.System.Resource;
|
||||
using Penumbra.Api.Enums;
|
||||
using Penumbra.Collections;
|
||||
using Penumbra.GameData;
|
||||
using Penumbra.Interop.Structs;
|
||||
using Penumbra.String;
|
||||
|
|
@ -16,19 +16,19 @@ public unsafe class ResourceService : IDisposable
|
|||
private readonly PerformanceTracker _performance;
|
||||
private readonly ResourceManagerService _resourceManager;
|
||||
|
||||
public ResourceService(PerformanceTracker performance, ResourceManagerService resourceManager)
|
||||
public ResourceService(PerformanceTracker performance, ResourceManagerService resourceManager, IGameInteropProvider interop)
|
||||
{
|
||||
_performance = performance;
|
||||
_resourceManager = resourceManager;
|
||||
SignatureHelper.Initialise(this);
|
||||
interop.InitializeFromAttributes(this);
|
||||
_getResourceSyncHook.Enable();
|
||||
_getResourceAsyncHook.Enable();
|
||||
_resourceHandleDestructorHook.Enable();
|
||||
_incRefHook = Hook<ResourceHandlePrototype>.FromAddress(
|
||||
_incRefHook = interop.HookFromAddress<ResourceHandlePrototype>(
|
||||
(nint)FFXIVClientStructs.FFXIV.Client.System.Resource.Handle.ResourceHandle.MemberFunctionPointers.IncRef,
|
||||
ResourceHandleIncRefDetour);
|
||||
_incRefHook.Enable();
|
||||
_decRefHook = Hook<ResourceHandleDecRefPrototype>.FromAddress(
|
||||
_decRefHook = interop.HookFromAddress<ResourceHandleDecRefPrototype>(
|
||||
(nint)FFXIVClientStructs.FFXIV.Client.System.Resource.Handle.ResourceHandle.MemberFunctionPointers.DecRef,
|
||||
ResourceHandleDecRefDetour);
|
||||
_decRefHook.Enable();
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using Dalamud.Hooking;
|
||||
using Dalamud.Plugin.Services;
|
||||
using Dalamud.Utility.Signatures;
|
||||
using FFXIVClientStructs.FFXIV.Client.System.Resource.Handle;
|
||||
using Penumbra.Api.Enums;
|
||||
|
|
@ -19,9 +20,9 @@ public unsafe class TexMdlService
|
|||
public IReadOnlySet<ulong> CustomFileCrc
|
||||
=> _customFileCrc;
|
||||
|
||||
public TexMdlService()
|
||||
public TexMdlService(IGameInteropProvider interop)
|
||||
{
|
||||
SignatureHelper.Initialise(this);
|
||||
interop.InitializeFromAttributes(this);
|
||||
_checkFileStateHook.Enable();
|
||||
_loadTexFileExternHook.Enable();
|
||||
_loadMdlFileExternHook.Enable();
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using FFXIVClientStructs.FFXIV.Client.Graphics.Render;
|
||||
using FFXIVClientStructs.FFXIV.Client.Graphics.Kernel;
|
||||
using Penumbra.Interop.Structs;
|
||||
|
||||
namespace Penumbra.Interop.SafeHandles;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using Dalamud.Game;
|
||||
using Dalamud.Plugin.Services;
|
||||
using Dalamud.Utility.Signatures;
|
||||
using Penumbra.Collections.Manager;
|
||||
using Penumbra.GameData;
|
||||
|
|
@ -6,7 +6,7 @@ using Penumbra.Interop.Structs;
|
|||
|
||||
namespace Penumbra.Interop.Services;
|
||||
|
||||
public unsafe partial class CharacterUtility : IDisposable
|
||||
public unsafe class CharacterUtility : IDisposable
|
||||
{
|
||||
public record struct InternalIndex(int Value);
|
||||
|
||||
|
|
@ -52,12 +52,12 @@ public unsafe partial class CharacterUtility : IDisposable
|
|||
public (nint Address, int Size) DefaultResource(InternalIndex idx)
|
||||
=> _lists[idx.Value].DefaultResource;
|
||||
|
||||
private readonly Framework _framework;
|
||||
private readonly IFramework _framework;
|
||||
public readonly ActiveCollectionData Active;
|
||||
|
||||
public CharacterUtility(Framework framework, ActiveCollectionData active)
|
||||
public CharacterUtility(IFramework framework, IGameInteropProvider interop, ActiveCollectionData active)
|
||||
{
|
||||
SignatureHelper.Initialise(this);
|
||||
interop.InitializeFromAttributes(this);
|
||||
_lists = Enumerable.Range(0, RelevantIndices.Length)
|
||||
.Select(idx => new MetaList(this, new InternalIndex(idx)))
|
||||
.ToArray();
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
using Dalamud.Plugin.Services;
|
||||
using FFXIVClientStructs.FFXIV.Client.System.Framework;
|
||||
using FFXIVClientStructs.FFXIV.Component.GUI;
|
||||
using Penumbra.GameData;
|
||||
|
|
@ -24,7 +25,7 @@ public unsafe class FontReloader
|
|||
private AtkModule* _atkModule = null!;
|
||||
private delegate* unmanaged<AtkModule*, bool, bool, void> _reloadFontsFunc = null!;
|
||||
|
||||
public FontReloader(Dalamud.Game.Framework dFramework)
|
||||
public FontReloader(IFramework dFramework)
|
||||
{
|
||||
dFramework.RunOnFrameworkThread(() =>
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using Dalamud.Hooking;
|
||||
using Dalamud.Plugin.Services;
|
||||
using Dalamud.Utility.Signatures;
|
||||
using Penumbra.GameData;
|
||||
using FFXIVClientStructs.FFXIV.Client.Game.Character;
|
||||
|
|
@ -20,9 +21,9 @@ public unsafe class GameEventManager : IDisposable
|
|||
public event WeaponReloadingEvent? WeaponReloading;
|
||||
public event WeaponReloadedEvent? WeaponReloaded;
|
||||
|
||||
public GameEventManager()
|
||||
public GameEventManager(IGameInteropProvider interop)
|
||||
{
|
||||
SignatureHelper.Initialise(this);
|
||||
interop.InitializeFromAttributes(this);
|
||||
_characterDtorHook.Enable();
|
||||
_copyCharacterHook.Enable();
|
||||
_resourceHandleDestructorHook.Enable();
|
||||
|
|
|
|||
|
|
@ -100,10 +100,10 @@ public unsafe partial class RedrawService
|
|||
|
||||
public sealed unsafe partial class RedrawService : IDisposable
|
||||
{
|
||||
private readonly Framework _framework;
|
||||
private readonly IFramework _framework;
|
||||
private readonly IObjectTable _objects;
|
||||
private readonly ITargetManager _targets;
|
||||
private readonly Condition _conditions;
|
||||
private readonly ICondition _conditions;
|
||||
|
||||
private readonly List<int> _queue = new(100);
|
||||
private readonly List<int> _afterGPoseQueue = new(GPoseSlots);
|
||||
|
|
@ -111,7 +111,7 @@ public sealed unsafe partial class RedrawService : IDisposable
|
|||
|
||||
public event GameObjectRedrawnDelegate? GameObjectRedrawn;
|
||||
|
||||
public RedrawService(Framework framework, IObjectTable objects, ITargetManager targets, Condition conditions)
|
||||
public RedrawService(IFramework framework, IObjectTable objects, ITargetManager targets, ICondition conditions)
|
||||
{
|
||||
_framework = framework;
|
||||
_objects = objects;
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
using Dalamud.Plugin.Services;
|
||||
using Dalamud.Utility.Signatures;
|
||||
using Penumbra.GameData;
|
||||
|
||||
|
|
@ -21,10 +22,8 @@ public unsafe class ResidentResourceManager
|
|||
public Structs.ResidentResourceManager* Address
|
||||
=> *_residentResourceManagerAddress;
|
||||
|
||||
public ResidentResourceManager()
|
||||
{
|
||||
SignatureHelper.Initialise(this);
|
||||
}
|
||||
public ResidentResourceManager(IGameInteropProvider interop)
|
||||
=> interop.InitializeFromAttributes(this);
|
||||
|
||||
// Reload certain player resources by force.
|
||||
public void Reload()
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using Dalamud.Hooking;
|
||||
using Dalamud.Plugin.Services;
|
||||
using Dalamud.Utility.Signatures;
|
||||
using FFXIVClientStructs.FFXIV.Client.Graphics.Render;
|
||||
using OtterGui.Classes;
|
||||
|
|
@ -48,13 +49,13 @@ public sealed unsafe class SkinFixer : IDisposable
|
|||
public int ModdedSkinShpkCount
|
||||
=> _moddedSkinShpkCount;
|
||||
|
||||
public SkinFixer(GameEventManager gameEvents, CharacterUtility utility, CommunicatorService communicator)
|
||||
public SkinFixer(GameEventManager gameEvents, CharacterUtility utility, CommunicatorService communicator, IGameInteropProvider interop)
|
||||
{
|
||||
SignatureHelper.Initialise(this);
|
||||
interop.InitializeFromAttributes(this);
|
||||
_gameEvents = gameEvents;
|
||||
_utility = utility;
|
||||
_communicator = communicator;
|
||||
_onRenderMaterialHook = Hook<OnRenderMaterialDelegate>.FromAddress(_humanVTable[62], OnRenderHumanMaterial);
|
||||
_onRenderMaterialHook = interop.HookFromAddress<OnRenderMaterialDelegate>(_humanVTable[62], OnRenderHumanMaterial);
|
||||
_communicator.MtrlShpkLoaded.Subscribe(OnMtrlShpkLoaded, MtrlShpkLoaded.Priority.SkinFixer);
|
||||
_gameEvents.ResourceHandleDestructor += OnResourceHandleDestructor;
|
||||
_onRenderMaterialHook.Enable();
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using FFXIVClientStructs.FFXIV.Client.Graphics.Render;
|
||||
using FFXIVClientStructs.FFXIV.Client.Graphics.Kernel;
|
||||
using FFXIVClientStructs.FFXIV.Client.Graphics.Scene;
|
||||
|
||||
namespace Penumbra.Interop.Structs;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using FFXIVClientStructs.FFXIV.Client.Graphics.Render;
|
||||
using FFXIVClientStructs.FFXIV.Client.Graphics.Kernel;
|
||||
|
||||
namespace Penumbra.Interop.Structs;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,37 +1,31 @@
|
|||
using Dalamud.Plugin.Services;
|
||||
using Dalamud.Utility.Signatures;
|
||||
using FFXIVClientStructs.FFXIV.Client.Graphics.Kernel;
|
||||
using FFXIVClientStructs.FFXIV.Client.Graphics.Render;
|
||||
|
||||
namespace Penumbra.Interop.Structs;
|
||||
|
||||
public static unsafe class TextureUtility
|
||||
public unsafe class TextureUtility
|
||||
{
|
||||
private static readonly Functions Funcs = new();
|
||||
public TextureUtility(IGameInteropProvider interop)
|
||||
=> interop.InitializeFromAttributes(this);
|
||||
|
||||
|
||||
[Signature("E8 ?? ?? ?? ?? 8B 0F 48 8D 54 24")]
|
||||
private static nint _textureCreate2D = nint.Zero;
|
||||
|
||||
[Signature("E9 ?? ?? ?? ?? 8B 02 25")]
|
||||
private static nint _textureInitializeContents = nint.Zero;
|
||||
|
||||
public static Texture* Create2D(Device* device, int* size, byte mipLevel, uint textureFormat, uint flags, uint unk)
|
||||
=> ((delegate* unmanaged<Device*, int*, byte, uint, uint, uint, Texture*>)Funcs.TextureCreate2D)(device, size, mipLevel, textureFormat,
|
||||
=> ((delegate* unmanaged<Device*, int*, byte, uint, uint, uint, Texture*>)_textureCreate2D)(device, size, mipLevel, textureFormat,
|
||||
flags, unk);
|
||||
|
||||
public static bool InitializeContents(Texture* texture, void* contents)
|
||||
=> ((delegate* unmanaged<Texture*, void*, bool>)Funcs.TextureInitializeContents)(texture, contents);
|
||||
=> ((delegate* unmanaged<Texture*, void*, bool>)_textureInitializeContents)(texture, contents);
|
||||
|
||||
public static void IncRef(Texture* texture)
|
||||
=> ((delegate* unmanaged<Texture*, void>)(*(void***)texture)[2])(texture);
|
||||
|
||||
public static void DecRef(Texture* texture)
|
||||
=> ((delegate* unmanaged<Texture*, void>)(*(void***)texture)[3])(texture);
|
||||
|
||||
private sealed class Functions
|
||||
{
|
||||
[Signature("E8 ?? ?? ?? ?? 8B 0F 48 8D 54 24")]
|
||||
public nint TextureCreate2D = nint.Zero;
|
||||
|
||||
[Signature("E9 ?? ?? ?? ?? 8B 02 25")]
|
||||
public nint TextureInitializeContents = nint.Zero;
|
||||
|
||||
public Functions()
|
||||
{
|
||||
SignatureHelper.Initialise(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue