mirror of
https://github.com/goatcorp/Dalamud.git
synced 2026-02-25 14:11:48 +01:00
Rename Agent.ReceiveEvent2
This commit is contained in:
parent
a68248fdf8
commit
3422751c19
2 changed files with 9 additions and 9 deletions
|
|
@ -18,12 +18,12 @@ public enum AgentEvent
|
|||
/// <summary>
|
||||
/// An event that is fired before the agent processes its Filtered Receive Event Function.
|
||||
/// </summary>
|
||||
PreReceiveFilteredEvent,
|
||||
PreReceiveEventWithResult,
|
||||
|
||||
/// <summary>
|
||||
/// An event that is fired after the agent has processed its Filtered Receive Event Function.
|
||||
/// </summary>
|
||||
PostReceiveFilteredEvent,
|
||||
PostReceiveEventWithResult,
|
||||
|
||||
/// <summary>
|
||||
/// An event that is fired before the agent processes its Show Function.
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ internal unsafe class AgentVirtualTable : IDisposable
|
|||
// Pinned Function Delegates, as these functions get assigned to an unmanaged virtual table,
|
||||
// the CLR needs to know they are in use, or it will invalidate them causing random crashing.
|
||||
private readonly AgentInterface.Delegates.ReceiveEvent receiveEventFunction;
|
||||
private readonly AgentInterface.Delegates.ReceiveEvent2 filteredReceiveEventFunction;
|
||||
private readonly AgentInterface.Delegates.ReceiveEvent2 receiveEventWithResultFunction;
|
||||
private readonly AgentInterface.Delegates.Show showFunction;
|
||||
private readonly AgentInterface.Delegates.Hide hideFunction;
|
||||
private readonly AgentInterface.Delegates.Update updateFunction;
|
||||
|
|
@ -78,7 +78,7 @@ internal unsafe class AgentVirtualTable : IDisposable
|
|||
|
||||
// Pin each of our listener functions
|
||||
this.receiveEventFunction = this.OnAgentReceiveEvent;
|
||||
this.filteredReceiveEventFunction = this.OnAgentFilteredReceiveEvent;
|
||||
this.receiveEventWithResultFunction = this.OnAgentReceiveEventWithResult;
|
||||
this.showFunction = this.OnAgentShow;
|
||||
this.hideFunction = this.OnAgentHide;
|
||||
this.updateFunction = this.OnAgentUpdate;
|
||||
|
|
@ -88,7 +88,7 @@ internal unsafe class AgentVirtualTable : IDisposable
|
|||
|
||||
// Overwrite specific virtual table entries
|
||||
this.ModifiedVirtualTable->ReceiveEvent = (delegate* unmanaged<AgentInterface*, AtkValue*, AtkValue*, uint, ulong, AtkValue*>)Marshal.GetFunctionPointerForDelegate(this.receiveEventFunction);
|
||||
this.ModifiedVirtualTable->ReceiveEvent2 = (delegate* unmanaged<AgentInterface*, AtkValue*, AtkValue*, uint, ulong, AtkValue*>)Marshal.GetFunctionPointerForDelegate(this.filteredReceiveEventFunction);
|
||||
this.ModifiedVirtualTable->ReceiveEvent2 = (delegate* unmanaged<AgentInterface*, AtkValue*, AtkValue*, uint, ulong, AtkValue*>)Marshal.GetFunctionPointerForDelegate(this.receiveEventWithResultFunction);
|
||||
this.ModifiedVirtualTable->Show = (delegate* unmanaged<AgentInterface*, void>)Marshal.GetFunctionPointerForDelegate(this.showFunction);
|
||||
this.ModifiedVirtualTable->Hide = (delegate* unmanaged<AgentInterface*, void>)Marshal.GetFunctionPointerForDelegate(this.hideFunction);
|
||||
this.ModifiedVirtualTable->Update = (delegate* unmanaged<AgentInterface*, uint, void>)Marshal.GetFunctionPointerForDelegate(this.updateFunction);
|
||||
|
|
@ -156,7 +156,7 @@ internal unsafe class AgentVirtualTable : IDisposable
|
|||
return result;
|
||||
}
|
||||
|
||||
private AtkValue* OnAgentFilteredReceiveEvent(AgentInterface* thisPtr, AtkValue* returnValue, AtkValue* values, uint valueCount, ulong eventKind)
|
||||
private AtkValue* OnAgentReceiveEventWithResult(AgentInterface* thisPtr, AtkValue* returnValue, AtkValue* values, uint valueCount, ulong eventKind)
|
||||
{
|
||||
AtkValue* result = null;
|
||||
|
||||
|
|
@ -171,7 +171,7 @@ internal unsafe class AgentVirtualTable : IDisposable
|
|||
this.filteredReceiveEventArgs.ValueCount = valueCount;
|
||||
this.filteredReceiveEventArgs.EventKind = eventKind;
|
||||
|
||||
this.lifecycleService.InvokeListenersSafely(AgentEvent.PreReceiveFilteredEvent, this.filteredReceiveEventArgs);
|
||||
this.lifecycleService.InvokeListenersSafely(AgentEvent.PreReceiveEventWithResult, this.filteredReceiveEventArgs);
|
||||
|
||||
returnValue = (AtkValue*)this.filteredReceiveEventArgs.ReturnValue;
|
||||
values = (AtkValue*)this.filteredReceiveEventArgs.AtkValues;
|
||||
|
|
@ -187,11 +187,11 @@ internal unsafe class AgentVirtualTable : IDisposable
|
|||
Log.Error(e, "Caught exception when calling original Agent FilteredReceiveEvent. This may be a bug in the game or another plugin hooking this method.");
|
||||
}
|
||||
|
||||
this.lifecycleService.InvokeListenersSafely(AgentEvent.PostReceiveFilteredEvent, this.filteredReceiveEventArgs);
|
||||
this.lifecycleService.InvokeListenersSafely(AgentEvent.PostReceiveEventWithResult, this.filteredReceiveEventArgs);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Log.Error(e, "Caught exception from Dalamud when attempting to process OnAgentFilteredReceiveEvent.");
|
||||
Log.Error(e, "Caught exception from Dalamud when attempting to process OnAgentReceiveEventWithResult.");
|
||||
}
|
||||
|
||||
return result;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue