Fix incorrect AtkUnitBase.Update function delegate definition

This commit is contained in:
MidoriKami 2023-09-06 20:40:46 -07:00
parent 9176342ad5
commit 8cb76a7438
2 changed files with 6 additions and 10 deletions

View file

@ -55,7 +55,7 @@ internal unsafe class AddonLifecycle : IDisposable, IServiceType
private delegate void AddonDrawDelegate(AtkUnitBase* addon); private delegate void AddonDrawDelegate(AtkUnitBase* addon);
private delegate void AddonUpdateDelegate(AtkUnitBase* addon); private delegate void AddonUpdateDelegate(AtkUnitBase* addon, float delta);
/// <inheritdoc/> /// <inheritdoc/>
public void Dispose() public void Dispose()
@ -174,8 +174,6 @@ internal unsafe class AddonLifecycle : IDisposable, IServiceType
private void OnAddonDraw(AtkUnitBase* addon) private void OnAddonDraw(AtkUnitBase* addon)
{ {
if (addon is null) return;
try try
{ {
this.InvokeListeners(AddonEvent.PreDraw, new IAddonLifecycle.AddonArgs { Addon = (nint)addon }); this.InvokeListeners(AddonEvent.PreDraw, new IAddonLifecycle.AddonArgs { Addon = (nint)addon });
@ -185,7 +183,7 @@ internal unsafe class AddonLifecycle : IDisposable, IServiceType
Log.Error(e, "Exception in OnAddonDraw pre-draw invoke."); Log.Error(e, "Exception in OnAddonDraw pre-draw invoke.");
} }
((delegate* unmanaged<AtkUnitBase*, void>)addon->AtkEventListener.vfunc[42])(addon); addon->Draw();
try try
{ {
@ -197,10 +195,8 @@ internal unsafe class AddonLifecycle : IDisposable, IServiceType
} }
} }
private void OnAddonUpdate(AtkUnitBase* addon) private void OnAddonUpdate(AtkUnitBase* addon, float delta)
{ {
if (addon is null) return;
try try
{ {
this.InvokeListeners(AddonEvent.PreUpdate, new IAddonLifecycle.AddonArgs { Addon = (nint)addon }); this.InvokeListeners(AddonEvent.PreUpdate, new IAddonLifecycle.AddonArgs { Addon = (nint)addon });
@ -209,8 +205,8 @@ internal unsafe class AddonLifecycle : IDisposable, IServiceType
{ {
Log.Error(e, "Exception in OnAddonUpdate pre-update invoke."); Log.Error(e, "Exception in OnAddonUpdate pre-update invoke.");
} }
((delegate* unmanaged<AtkUnitBase*, void>)addon->AtkEventListener.vfunc[41])(addon); addon->Update(delta);
try try
{ {

View file

@ -33,7 +33,7 @@ internal class AddonLifecycleAddressResolver : BaseAddressResolver
{ {
this.AddonSetup = sig.ScanText("E8 ?? ?? ?? ?? 8B 83 ?? ?? ?? ?? C1 E8 14"); this.AddonSetup = sig.ScanText("E8 ?? ?? ?? ?? 8B 83 ?? ?? ?? ?? C1 E8 14");
this.AddonFinalize = sig.ScanText("E8 ?? ?? ?? ?? 48 8B 7C 24 ?? 41 8B C6"); this.AddonFinalize = sig.ScanText("E8 ?? ?? ?? ?? 48 8B 7C 24 ?? 41 8B C6");
this.AddonDraw = sig.ScanText("48 8B 01 FF 90 ?? ?? ?? ?? 83 EB 01 79 C1"); this.AddonDraw = sig.ScanText("FF 90 ?? ?? ?? ?? 83 EB 01 79 C1");
this.AddonUpdate = sig.ScanText("FF 90 ?? ?? ?? ?? 40 88 AF"); this.AddonUpdate = sig.ScanText("FF 90 ?? ?? ?? ?? 40 88 AF");
} }
} }