Fix offsets.

This commit is contained in:
Ottermandias 2024-01-01 00:48:20 +01:00
parent 68c782f0b9
commit bc068f9913
2 changed files with 4 additions and 5 deletions

View file

@ -22,13 +22,12 @@ public sealed unsafe class GetEqpIndirect : FastHook<GetEqpIndirect.Delegate>
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
private void Detour(DrawObject* drawObject)
{
if ((*(byte*)(drawObject + Offsets.GetEqpIndirectSkip1) & 1) == 0 || *(ulong*)(drawObject + Offsets.GetEqpIndirectSkip2) == 0)
// Shortcut because this is also called all the time.
// Same thing is checked at the beginning of the original function.
if ((*(byte*)((nint)drawObject + Offsets.GetEqpIndirectSkip1) & 1) == 0 || *(ulong*)((nint)drawObject + Offsets.GetEqpIndirectSkip2) == 0)
return;
Penumbra.Log.Excessive($"[Get EQP Indirect] Invoked on {(nint)drawObject:X}.");
// Shortcut because this is also called all the time.
// Same thing is checked at the beginning of the original function.
var collection = _collectionResolver.IdentifyCollection(drawObject, true);
using var eqp = _metaState.ResolveEqpData(collection.ModCollection);
Task.Result.Original(drawObject);

View file

@ -24,7 +24,7 @@ public sealed unsafe class UpdateModel : FastHook<UpdateModel.Delegate>
{
// Shortcut because this is called all the time.
// Same thing is checked at the beginning of the original function.
if (*(int*)(drawObject + Offsets.UpdateModelSkip) == 0)
if (*(int*)((nint)drawObject + Offsets.UpdateModelSkip) == 0)
return;
Penumbra.Log.Excessive($"[Update Model] Invoked on {(nint)drawObject:X}.");