mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-12 18:27:24 +01:00
Add CalculateHeight Hook
This commit is contained in:
parent
69012e5ecd
commit
808d7ab017
2 changed files with 19 additions and 2 deletions
|
|
@ -1 +1 @@
|
|||
Subproject commit f004e069824a1588244e06080b32bab170f78077
|
||||
Subproject commit 7c483764678c6edb5efd55f056aeaecae144d5fe
|
||||
|
|
@ -1,5 +1,7 @@
|
|||
using Dalamud.Hooking;
|
||||
using Dalamud.Utility.Signatures;
|
||||
using FFXIVClientStructs.FFXIV.Client.Game.Character;
|
||||
using FFXIVClientStructs.FFXIV.Client.Game.Object;
|
||||
using FFXIVClientStructs.FFXIV.Client.Graphics.Scene;
|
||||
using OtterGui.Classes;
|
||||
using Penumbra.Collections;
|
||||
|
|
@ -36,7 +38,7 @@ namespace Penumbra.Interop.PathResolving;
|
|||
// RSP tail entries seem to be obtained by "E8 ?? ?? ?? ?? 0F 28 F0 48 8B 05"
|
||||
// RSP bust size entries seem to be obtained by "E8 ?? ?? ?? ?? F2 0F 10 44 24 ?? 8B 44 24 ?? F2 0F 11 45 ?? 89 45 ?? 83 FF"
|
||||
// they all are called by many functions, but the most relevant seem to be Human.SetupFromCharacterData, which is only called by CharacterBase.Create,
|
||||
// ChangeCustomize and RspSetupCharacter, which is hooked here.
|
||||
// ChangeCustomize and RspSetupCharacter, which is hooked here, as well as Character.CalculateHeight.
|
||||
|
||||
// GMP Entries seem to be only used by "48 8B ?? 53 55 57 48 83 ?? ?? 48 8B", which has a DrawObject as its first parameter.
|
||||
public unsafe class MetaState : IDisposable
|
||||
|
|
@ -74,6 +76,7 @@ public unsafe class MetaState : IDisposable
|
|||
_setupVisorHook.Enable();
|
||||
_rspSetupCharacterHook.Enable();
|
||||
_changeCustomize.Enable();
|
||||
_calculateHeightHook.Enable();
|
||||
_gameEventManager.CreatingCharacterBase += OnCreatingCharacterBase;
|
||||
_gameEventManager.CharacterBaseCreated += OnCharacterBaseCreated;
|
||||
}
|
||||
|
|
@ -118,6 +121,7 @@ public unsafe class MetaState : IDisposable
|
|||
_setupVisorHook.Dispose();
|
||||
_rspSetupCharacterHook.Dispose();
|
||||
_changeCustomize.Dispose();
|
||||
_calculateHeightHook.Dispose();
|
||||
_gameEventManager.CreatingCharacterBase -= OnCreatingCharacterBase;
|
||||
_gameEventManager.CharacterBaseCreated -= OnCharacterBaseCreated;
|
||||
}
|
||||
|
|
@ -242,6 +246,19 @@ public unsafe class MetaState : IDisposable
|
|||
}
|
||||
}
|
||||
|
||||
private delegate ulong CalculateHeightDelegate(Character* character);
|
||||
|
||||
// TODO: use client structs
|
||||
[Signature(Sigs.CalculateHeight, DetourName = nameof(CalculateHeightDetour))]
|
||||
private readonly Hook<CalculateHeightDelegate> _calculateHeightHook = null!;
|
||||
|
||||
private ulong CalculateHeightDetour(Character* character)
|
||||
{
|
||||
var resolveData = _collectionResolver.IdentifyCollection((GameObject*)character, true);
|
||||
using var cmp = resolveData.ModCollection.TemporarilySetCmpFile(_characterUtility);
|
||||
return _calculateHeightHook.Original(character);
|
||||
}
|
||||
|
||||
private delegate bool ChangeCustomizeDelegate(nint human, nint data, byte skipEquipment);
|
||||
|
||||
[Signature(Sigs.ChangeCustomize, DetourName = nameof(ChangeCustomizeDetour))]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue