Extract all signatures to a single file.

This commit is contained in:
Ottermandias 2023-01-09 13:59:24 +01:00
parent 40b7266c22
commit a061ab9b8b
18 changed files with 202 additions and 96 deletions

View file

@ -6,6 +6,7 @@ using Dalamud.Game.ClientState.Conditions;
using Dalamud.Hooking;
using Dalamud.Utility.Signatures;
using FFXIVClientStructs.FFXIV.Client.Game.Object;
using Penumbra.GameData;
namespace Penumbra.Interop.Resolver;
@ -96,7 +97,7 @@ public class CutsceneCharacters : IDisposable
private unsafe delegate ulong CopyCharacterDelegate( GameObject* target, GameObject* source, uint unk );
[Signature( "E8 ?? ?? ?? ?? 0F B6 9F ?? ?? ?? ?? 48 8D 8F", DetourName = nameof( CopyCharacterDetour ) )]
[Signature( Sigs.CopyCharacter, DetourName = nameof( CopyCharacterDetour ) )]
private readonly Hook< CopyCharacterDelegate > _copyCharacterHook = null!;
private unsafe ulong CopyCharacterDetour( GameObject* target, GameObject* source, uint unk )

View file

@ -6,6 +6,7 @@ using Dalamud.Utility.Signatures;
using FFXIVClientStructs.FFXIV.Client.Game.Character;
using FFXIVClientStructs.FFXIV.Client.Game.Object;
using Penumbra.Collections;
using Penumbra.GameData;
using Penumbra.GameData.Actors;
namespace Penumbra.Interop.Resolver;
@ -117,8 +118,7 @@ public unsafe class IdentifiedCollectionCache : IDisposable, IEnumerable< (IntPt
private delegate void CharacterDestructorDelegate( Character* character );
[Signature( "48 89 5C 24 ?? 48 89 74 24 ?? 57 48 83 EC ?? 48 8D 05 ?? ?? ?? ?? 48 8B D9 48 89 01 48 8D 05 ?? ?? ?? ?? 48 89 81 ?? ?? ?? ?? 48 8D 05",
DetourName = nameof( CharacterDestructorDetour ) )]
[Signature( Sigs.CharacterDestructor, DetourName = nameof( CharacterDestructorDetour ) )]
private Hook< CharacterDestructorDelegate > _characterDtorHook = null!;
private void CharacterDestructorDetour( Character* character )

View file

@ -1,9 +1,10 @@
using System;
using System.Runtime.InteropServices;
using Dalamud.Hooking;
using Dalamud.Utility.Signatures;
using Penumbra.Collections;
using Penumbra.GameData;
using Penumbra.GameData.Enums;
using Penumbra.Interop.Structs;
using Penumbra.String;
using Penumbra.String.Classes;
using Penumbra.Util;
@ -109,7 +110,7 @@ public unsafe partial class PathResolver
// Characters load some of their voice lines or whatever with this function.
private delegate IntPtr LoadCharacterSound( IntPtr character, int unk1, int unk2, IntPtr unk3, ulong unk4, int unk5, int unk6, ulong unk7 );
[Signature( "4C 89 4C 24 ?? 55 57 41 56", DetourName = nameof( LoadCharacterSoundDetour ) )]
[Signature( Sigs.LoadCharacterSound, DetourName = nameof( LoadCharacterSoundDetour ) )]
private readonly Hook< LoadCharacterSound > _loadCharacterSoundHook = null!;
private IntPtr LoadCharacterSoundDetour( IntPtr character, int unk1, int unk2, IntPtr unk3, ulong unk4, int unk5, int unk6, ulong unk7 )
@ -149,7 +150,7 @@ public unsafe partial class PathResolver
// We can obtain the associated game object from the timelines 28'th vfunc and use that to apply the correct collection.
private delegate ulong LoadTimelineResourcesDelegate( IntPtr timeline );
[Signature( "E8 ?? ?? ?? ?? 83 7F ?? ?? 75 ?? 0F B6 87", DetourName = nameof( LoadTimelineResourcesDetour ) )]
[Signature( Sigs.LoadTimelineResources, DetourName = nameof( LoadTimelineResourcesDetour ) )]
private readonly Hook< LoadTimelineResourcesDelegate > _loadTimelineResourcesHook = null!;
private ulong LoadTimelineResourcesDetour( IntPtr timeline )
@ -166,8 +167,7 @@ public unsafe partial class PathResolver
// Make it aware of the correct collection to load the correct pap files.
private delegate void CharacterBaseNoArgumentDelegate( IntPtr drawBase );
[Signature( "E8 ?? ?? ?? ?? BA ?? ?? ?? ?? 48 8B CF 44 8B C2 E8 ?? ?? ?? ?? 48 8B 05",
DetourName = nameof( CharacterBaseLoadAnimationDetour ) )]
[Signature( Sigs.CharacterBaseLoadAnimation, DetourName = nameof( CharacterBaseLoadAnimationDetour ) )]
private readonly Hook< CharacterBaseNoArgumentDelegate > _characterBaseLoadAnimationHook = null!;
private void CharacterBaseLoadAnimationDetour( IntPtr drawObject )
@ -186,8 +186,7 @@ public unsafe partial class PathResolver
// Unknown what exactly this is but it seems to load a bunch of paps.
private delegate void LoadSomePap( IntPtr a1, int a2, IntPtr a3, int a4 );
[Signature( "48 89 5C 24 ?? 48 89 6C 24 ?? 48 89 74 24 ?? 57 41 56 41 57 48 83 EC ?? 41 8B D9 89 51",
DetourName = nameof( LoadSomePapDetour ) )]
[Signature( Sigs.LoadSomePap, DetourName = nameof( LoadSomePapDetour ) )]
private readonly Hook< LoadSomePap > _loadSomePapHook = null!;
private void LoadSomePapDetour( IntPtr a1, int a2, IntPtr a3, int a4 )
@ -209,7 +208,7 @@ public unsafe partial class PathResolver
}
// Seems to load character actions when zoning or changing class, maybe.
[Signature( "E8 ?? ?? ?? ?? C6 83 ?? ?? ?? ?? ?? 8B 8E", DetourName = nameof( SomeActionLoadDetour ) )]
[Signature( Sigs.LoadSomeAction, DetourName = nameof( SomeActionLoadDetour ) )]
private readonly Hook< CharacterBaseNoArgumentDelegate > _someActionLoadHook = null!;
private void SomeActionLoadDetour( IntPtr gameObject )
@ -221,25 +220,9 @@ public unsafe partial class PathResolver
_animationLoadData = last;
}
[StructLayout( LayoutKind.Explicit )]
private struct VfxParams
{
[FieldOffset( 0x118 )]
public uint GameObjectId;
[FieldOffset( 0x11C )]
public byte GameObjectType;
[FieldOffset( 0xD0 )]
public ushort TargetCount;
[FieldOffset( 0x120 )]
public fixed ulong Target[16];
}
private delegate IntPtr LoadCharacterVfxDelegate( byte* vfxPath, VfxParams* vfxParams, byte unk1, byte unk2, float unk3, int unk4 );
[Signature( "E8 ?? ?? ?? ?? 48 8B F8 48 8D 93", DetourName = nameof( LoadCharacterVfxDetour ) )]
[Signature( Sigs.LoadCharacterVfx, DetourName = nameof( LoadCharacterVfxDetour ) )]
private readonly Hook< LoadCharacterVfxDelegate > _loadCharacterVfxHook = null!;
private global::Dalamud.Game.ClientState.Objects.Types.GameObject? GetOwnedObject( uint id )
@ -288,7 +271,7 @@ public unsafe partial class PathResolver
private delegate IntPtr LoadAreaVfxDelegate( uint vfxId, float* pos, GameObject* caster, float unk1, float unk2, byte unk3 );
[Signature( "48 8B C4 53 55 56 57 41 56 48 81 EC", DetourName = nameof( LoadAreaVfxDetour ) )]
[Signature( Sigs.LoadAreaVfx, DetourName = nameof( LoadAreaVfxDetour ) )]
private readonly Hook< LoadAreaVfxDelegate > _loadAreaVfxHook = null!;
private IntPtr LoadAreaVfxDetour( uint vfxId, float* pos, GameObject* caster, float unk1, float unk2, byte unk3 )
@ -314,20 +297,9 @@ public unsafe partial class PathResolver
}
[StructLayout( LayoutKind.Explicit )]
private struct ClipScheduler
{
[FieldOffset( 0 )]
public IntPtr* VTable;
[FieldOffset( 0x38 )]
public IntPtr SchedulerTimeline;
}
private delegate void ScheduleClipUpdate( ClipScheduler* x );
[Signature( "40 53 55 56 57 41 56 48 81 EC ?? ?? ?? ?? 48 8B F9", DetourName = nameof( ScheduleClipUpdateDetour ) )]
[Signature( Sigs.ScheduleClipUpdate, DetourName = nameof( ScheduleClipUpdateDetour ) )]
private readonly Hook< ScheduleClipUpdate > _scheduleClipUpdateHook = null!;
private void ScheduleClipUpdateDetour( ClipScheduler* x )

View file

@ -8,6 +8,7 @@ using FFXIVClientStructs.FFXIV.Client.Game.Object;
using Penumbra.Api;
using FFXIVClientStructs.FFXIV.Client.Graphics.Scene;
using OtterGui.Classes;
using Penumbra.GameData;
using Penumbra.GameData.Enums;
using Penumbra.String.Classes;
using Penumbra.Util;
@ -134,7 +135,7 @@ public unsafe partial class PathResolver
// and use the last game object that called EnableDraw to link them.
private delegate IntPtr CharacterBaseCreateDelegate( uint a, IntPtr b, IntPtr c, byte d );
[Signature( "E8 ?? ?? ?? ?? 48 85 C0 74 21 C7 40", DetourName = nameof( CharacterBaseCreateDetour ) )]
[Signature( Sigs.CharacterBaseCreate, DetourName = nameof( CharacterBaseCreateDetour ) )]
private readonly Hook< CharacterBaseCreateDelegate > _characterBaseCreateHook = null!;
private IntPtr CharacterBaseCreateDetour( uint a, IntPtr b, IntPtr c, byte d )
@ -186,8 +187,7 @@ public unsafe partial class PathResolver
// Remove DrawObjects from the list when they are destroyed.
private delegate void CharacterBaseDestructorDelegate( IntPtr drawBase );
[Signature( "E8 ?? ?? ?? ?? 40 F6 C7 01 74 3A 40 F6 C7 04 75 27 48 85 DB 74 2F 48 8B 05 ?? ?? ?? ?? 48 8B D3 48 8B 48 30",
DetourName = nameof( CharacterBaseDestructorDetour ) )]
[Signature( Sigs.CharacterBaseDestructor, DetourName = nameof( CharacterBaseDestructorDetour ) )]
private readonly Hook< CharacterBaseDestructorDelegate > _characterBaseDestructorHook = null!;
private void CharacterBaseDestructorDetour( IntPtr drawBase )
@ -201,7 +201,7 @@ public unsafe partial class PathResolver
// so we always keep track of the current GameObject to be able to link it to the DrawObject.
private delegate void EnableDrawDelegate( IntPtr gameObject, IntPtr b, IntPtr c, IntPtr d );
[Signature( "E8 ?? ?? ?? ?? 48 8B 8B ?? ?? ?? ?? 48 85 C9 74 33 45 33 C0", DetourName = nameof( EnableDrawDetour ) )]
[Signature( Sigs.EnableDraw, DetourName = nameof( EnableDrawDetour ) )]
private readonly Hook< EnableDrawDelegate > _enableDrawHook = null!;
private void EnableDrawDetour( IntPtr gameObject, IntPtr b, IntPtr c, IntPtr d )
@ -216,7 +216,7 @@ public unsafe partial class PathResolver
// so we use that.
private delegate void WeaponReloadFunc( IntPtr a1, uint a2, IntPtr a3, byte a4, byte a5, byte a6, byte a7 );
[Signature( "E8 ?? ?? ?? ?? 44 8B 9F", DetourName = nameof( WeaponReloadDetour ) )]
[Signature( Sigs.WeaponReload, DetourName = nameof( WeaponReloadDetour ) )]
private readonly Hook< WeaponReloadFunc > _weaponReloadHook = null!;
public void WeaponReloadDetour( IntPtr a1, uint a2, IntPtr a3, byte a4, byte a5, byte a6, byte a7 )

View file

@ -5,6 +5,7 @@ using Dalamud.Utility.Signatures;
using FFXIVClientStructs.FFXIV.Client.Graphics.Scene;
using OtterGui.Classes;
using Penumbra.Collections;
using Penumbra.GameData;
using Penumbra.GameData.Enums;
using Penumbra.Util;
using ObjectType = FFXIVClientStructs.FFXIV.Client.Graphics.Scene.ObjectType;
@ -87,7 +88,7 @@ public unsafe partial class PathResolver
private delegate void UpdateModelDelegate( IntPtr drawObject );
[Signature( "48 8B ?? 56 48 83 ?? ?? ?? B9", DetourName = nameof( UpdateModelsDetour ) )]
[Signature( Sigs.UpdateModel, DetourName = nameof( UpdateModelsDetour ) )]
private readonly Hook< UpdateModelDelegate > _updateModelsHook = null!;
private void UpdateModelsDetour( IntPtr drawObject )
@ -98,6 +99,7 @@ public unsafe partial class PathResolver
{
return;
}
using var performance = Penumbra.Performance.Measure( PerformanceType.UpdateModels );
var collection = GetResolveData( drawObject );
@ -124,8 +126,7 @@ public unsafe partial class PathResolver
public static GenderRace GetHumanGenderRace( IntPtr human )
=> ( GenderRace )( ( Human* )human )->RaceSexId;
[Signature( "40 ?? 48 83 ?? ?? ?? 81 ?? ?? ?? ?? ?? 48 8B ?? 74 ?? ?? 83 ?? ?? ?? ?? ?? ?? 74 ?? 4C",
DetourName = nameof( GetEqpIndirectDetour ) )]
[Signature( Sigs.GetEqpIndirect, DetourName = nameof( GetEqpIndirectDetour ) )]
private readonly Hook< OnModelLoadCompleteDelegate > _getEqpIndirectHook = null!;
private void GetEqpIndirectDetour( IntPtr drawObject )
@ -136,6 +137,7 @@ public unsafe partial class PathResolver
{
return;
}
using var performance = Penumbra.Performance.Measure( PerformanceType.GetEqp );
var resolveData = GetResolveData( drawObject );
using var eqp = resolveData.ModCollection.TemporarilySetEqpFile();
@ -147,7 +149,7 @@ public unsafe partial class PathResolver
// but it only applies a changed gmp file after a redraw for some reason.
private delegate byte SetupVisorDelegate( IntPtr drawObject, ushort modelId, byte visorState );
[Signature( "48 8B ?? 53 55 57 48 83 ?? ?? 48 8B", DetourName = nameof( SetupVisorDetour ) )]
[Signature( Sigs.SetupVisor, DetourName = nameof( SetupVisorDetour ) )]
private readonly Hook< SetupVisorDelegate > _setupVisorHook = null!;
private byte SetupVisorDetour( IntPtr drawObject, ushort modelId, byte visorState )
@ -161,7 +163,7 @@ public unsafe partial class PathResolver
// RSP
private delegate void RspSetupCharacterDelegate( IntPtr drawObject, IntPtr unk2, float unk3, IntPtr unk4, byte unk5 );
[Signature( "48 89 5C 24 ?? 48 89 6C 24 ?? 48 89 74 24 ?? 88 54 24 ?? 57 41 56", DetourName = nameof( RspSetupCharacterDetour ) )]
[Signature( Sigs.RspSetupCharacter, DetourName = nameof( RspSetupCharacterDetour ) )]
private readonly Hook< RspSetupCharacterDelegate > _rspSetupCharacterHook = null!;
private void RspSetupCharacterDetour( IntPtr drawObject, IntPtr unk2, float unk3, IntPtr unk4, byte unk5 )
@ -183,7 +185,7 @@ public unsafe partial class PathResolver
private bool _inChangeCustomize;
private delegate bool ChangeCustomizeDelegate( IntPtr human, IntPtr data, byte skipEquipment );
[Signature( "E8 ?? ?? ?? ?? 41 0F B6 C5 66 41 89 86", DetourName = nameof( ChangeCustomizeDetour ) )]
[Signature( Sigs.ChangeCustomize, DetourName = nameof( ChangeCustomizeDetour ) )]
private readonly Hook< ChangeCustomizeDelegate > _changeCustomize = null!;
private bool ChangeCustomizeDetour( IntPtr human, IntPtr data, byte skipEquipment )

View file

@ -4,6 +4,7 @@ using System.Collections.Generic;
using System.Runtime.CompilerServices;
using Dalamud.Utility.Signatures;
using Penumbra.Collections;
using Penumbra.GameData;
using Penumbra.String;
namespace Penumbra.Interop.Resolver;
@ -12,17 +13,16 @@ public unsafe partial class PathResolver
{
public class PathState : IDisposable
{
[Signature( "48 8D 05 ?? ?? ?? ?? 48 89 03 48 8D 8B ?? ?? ?? ?? 44 89 83 ?? ?? ?? ?? 48 8B C1", ScanType = ScanType.StaticAddress )]
[Signature( Sigs.HumanVTable, ScanType = ScanType.StaticAddress )]
public readonly IntPtr* HumanVTable = null!;
[Signature( "48 8D 05 ?? ?? ?? ?? 48 89 03 B8 ?? ?? ?? ?? 66 89 83 ?? ?? ?? ?? 48 8B C3 48 89 8B ?? ?? ?? ?? 48 89 8B",
ScanType = ScanType.StaticAddress )]
[Signature( Sigs.WeaponVTable, ScanType = ScanType.StaticAddress )]
private readonly IntPtr* _weaponVTable = null!;
[Signature( "48 8D 05 ?? ?? ?? ?? 45 33 C0 48 89 03 BA", ScanType = ScanType.StaticAddress )]
[Signature( Sigs.DemiHumanVTable, ScanType = ScanType.StaticAddress )]
private readonly IntPtr* _demiHumanVTable = null!;
[Signature( "48 8D 05 ?? ?? ?? ?? 48 89 03 33 C0 48 89 83 ?? ?? ?? ?? 48 89 83 ?? ?? ?? ?? C7 83", ScanType = ScanType.StaticAddress )]
[Signature( Sigs.MonsterVTable, ScanType = ScanType.StaticAddress )]
private readonly IntPtr* _monsterVTable = null!;
private readonly ResolverHooks _human;

View file

@ -6,6 +6,7 @@ using Dalamud.Hooking;
using Dalamud.Utility.Signatures;
using FFXIVClientStructs.FFXIV.Client.System.Resource;
using Penumbra.Collections;
using Penumbra.GameData;
using Penumbra.GameData.Enums;
using Penumbra.Interop.Loader;
using Penumbra.Interop.Structs;
@ -159,7 +160,7 @@ public unsafe partial class PathResolver
private delegate byte LoadMtrlFilesDelegate( IntPtr mtrlResourceHandle );
[Signature( "4C 8B DC 49 89 5B ?? 49 89 73 ?? 55 57 41 55", DetourName = nameof( LoadMtrlTexDetour ) )]
[Signature( Sigs.LoadMtrlTex, DetourName = nameof( LoadMtrlTexDetour ) )]
private readonly Hook< LoadMtrlFilesDelegate > _loadMtrlTexHook = null!;
private byte LoadMtrlTexDetour( IntPtr mtrlResourceHandle )
@ -171,8 +172,7 @@ public unsafe partial class PathResolver
return ret;
}
[Signature( "48 89 5C 24 ?? 57 48 81 EC ?? ?? ?? ?? 48 8B 05 ?? ?? ?? ?? 48 33 C4 48 89 84 24 ?? ?? ?? ?? 44 0F B7 89",
DetourName = nameof( LoadMtrlShpkDetour ) )]
[Signature( Sigs.LoadMtrlShpk, DetourName = nameof( LoadMtrlShpkDetour ) )]
private readonly Hook< LoadMtrlFilesDelegate > _loadMtrlShpkHook = null!;
private byte LoadMtrlShpkDetour( IntPtr mtrlResourceHandle )
@ -197,7 +197,7 @@ public unsafe partial class PathResolver
private delegate byte ApricotResourceLoadDelegate( IntPtr handle, IntPtr unk1, byte unk2 );
[Signature( "48 89 74 24 ?? 57 48 83 EC ?? 41 0F B6 F0 48 8B F9", DetourName = nameof( ApricotResourceLoadDetour ) )]
[Signature( Sigs.ApricotResourceLoad, DetourName = nameof( ApricotResourceLoadDetour ) )]
private readonly Hook< ApricotResourceLoadDelegate > _apricotResourceLoadHook = null!;