From 8e63452e84cd5b6decb57368fe49e434ca5fc1fa Mon Sep 17 00:00:00 2001 From: Ottermandias Date: Tue, 31 Oct 2023 11:32:40 +0100 Subject: [PATCH] Use some CS sigs. --- Penumbra.GameData | 2 +- Penumbra/Interop/Services/GameEventManager.cs | 18 +++++++++++------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/Penumbra.GameData b/Penumbra.GameData index e1a62d8e..04ddadb4 160000 --- a/Penumbra.GameData +++ b/Penumbra.GameData @@ -1 +1 @@ -Subproject commit e1a62d8e6b4e1d8c482253ad14850fd3dc372d86 +Subproject commit 04ddadb44600a382e26661e1db08fd16c3b671d8 diff --git a/Penumbra/Interop/Services/GameEventManager.cs b/Penumbra/Interop/Services/GameEventManager.cs index d11b7159..30319060 100644 --- a/Penumbra/Interop/Services/GameEventManager.cs +++ b/Penumbra/Interop/Services/GameEventManager.cs @@ -4,6 +4,7 @@ using Dalamud.Utility.Signatures; using Penumbra.GameData; using FFXIVClientStructs.FFXIV.Client.Game.Character; using FFXIVClientStructs.FFXIV.Client.Game.Object; +using FFXIVClientStructs.FFXIV.Client.Graphics.Scene; using Penumbra.Interop.Structs; namespace Penumbra.Interop.Services; @@ -27,7 +28,13 @@ public unsafe class GameEventManager : IDisposable _copyCharacterHook = interop.HookFromAddress((nint)CharacterSetup.MemberFunctionPointers.CopyFromCharacter, CopyCharacterDetour); - + _characterBaseCreateHook = + interop.HookFromAddress((nint)CharacterBase.MemberFunctionPointers.Create, CharacterBaseCreateDetour); + _characterBaseDestructorHook = + interop.HookFromAddress((nint)CharacterBase.MemberFunctionPointers.Destroy, + CharacterBaseDestructorDetour); + _weaponReloadHook = + interop.HookFromAddress((nint)DrawDataContainer.MemberFunctionPointers.LoadWeapon, WeaponReloadDetour); _characterDtorHook.Enable(); _copyCharacterHook.Enable(); _resourceHandleDestructorHook.Enable(); @@ -148,8 +155,7 @@ public unsafe class GameEventManager : IDisposable private delegate nint CharacterBaseCreateDelegate(uint a, nint b, nint c, byte d); - [Signature(Sigs.CharacterBaseCreate, DetourName = nameof(CharacterBaseCreateDetour))] - private readonly Hook _characterBaseCreateHook = null!; + private readonly Hook _characterBaseCreateHook; private nint CharacterBaseCreateDetour(uint a, nint b, nint c, byte d) { @@ -194,8 +200,7 @@ public unsafe class GameEventManager : IDisposable public delegate void CharacterBaseDestructorEvent(nint drawBase); - [Signature(Sigs.CharacterBaseDestructor, DetourName = nameof(CharacterBaseDestructorDetour))] - private readonly Hook _characterBaseDestructorHook = null!; + private readonly Hook _characterBaseDestructorHook; private void CharacterBaseDestructorDetour(IntPtr drawBase) { @@ -222,8 +227,7 @@ public unsafe class GameEventManager : IDisposable private delegate void WeaponReloadFunc(nint a1, uint a2, nint a3, byte a4, byte a5, byte a6, byte a7); - [Signature(Sigs.WeaponReload, DetourName = nameof(WeaponReloadDetour))] - private readonly Hook _weaponReloadHook = null!; + private readonly Hook _weaponReloadHook; private void WeaponReloadDetour(nint a1, uint a2, nint a3, byte a4, byte a5, byte a6, byte a7) {