Fix parameters of EnableDraw

This commit is contained in:
Ottermandias 2023-06-20 17:11:40 +02:00
parent 5805d5c798
commit 895e70555d
2 changed files with 6 additions and 3 deletions

View file

@ -403,6 +403,9 @@ public static class FullEquipTypeExtensions
_ => string.Empty, _ => string.Empty,
}; };
public static bool IsOffhandType(this FullEquipType type)
=> type.OffhandTypeSuffix().Length > 0;
public static readonly IReadOnlyList<FullEquipType> WeaponTypes public static readonly IReadOnlyList<FullEquipType> WeaponTypes
= Enum.GetValues<FullEquipType>().Where(v => v.IsWeapon()).ToArray(); = Enum.GetValues<FullEquipType>().Where(v => v.IsWeapon()).ToArray();

View file

@ -132,15 +132,15 @@ public class DrawObjectState : IDisposable, IReadOnlyDictionary<nint, (nint, boo
/// EnableDraw is what creates DrawObjects for gameObjects, /// EnableDraw is what creates DrawObjects for gameObjects,
/// so we always keep track of the current GameObject to be able to link it to the DrawObject. /// so we always keep track of the current GameObject to be able to link it to the DrawObject.
/// </summary> /// </summary>
private delegate void EnableDrawDelegate(nint gameObject, nint b, nint c, nint d); private delegate void EnableDrawDelegate(nint gameObject);
[Signature(Sigs.EnableDraw, DetourName = nameof(EnableDrawDetour))] [Signature(Sigs.EnableDraw, DetourName = nameof(EnableDrawDetour))]
private readonly Hook<EnableDrawDelegate> _enableDrawHook = null!; private readonly Hook<EnableDrawDelegate> _enableDrawHook = null!;
private void EnableDrawDetour(nint gameObject, nint b, nint c, nint d) private void EnableDrawDetour(nint gameObject)
{ {
_lastGameObject.Value!.Enqueue(gameObject); _lastGameObject.Value!.Enqueue(gameObject);
_enableDrawHook.Original.Invoke(gameObject, b, c, d); _enableDrawHook.Original.Invoke(gameObject);
_lastGameObject.Value!.TryDequeue(out _); _lastGameObject.Value!.TryDequeue(out _);
} }
} }