feat: add function to get AtkModule
This commit is contained in:
parent
b56855e4af
commit
918826f913
|
@ -21,6 +21,8 @@ namespace XivCommon {
|
|||
|
||||
private delegate IntPtr GetAgentModuleDelegate(IntPtr basePtr);
|
||||
|
||||
private delegate IntPtr GetAtkModuleDelegate(IntPtr uiModule);
|
||||
|
||||
private delegate IntPtr GetAgentByInternalIdDelegate(IntPtr agentModule, uint id);
|
||||
|
||||
private DalamudPluginInterface Interface { get; }
|
||||
|
@ -114,6 +116,30 @@ namespace XivCommon {
|
|||
return this.Interface.Framework.Gui.GetUIModule();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the pointer to the RaptureAtkModule
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public IntPtr GetAtkModule() {
|
||||
var uiModule = this.GetUiModule();
|
||||
if (uiModule == IntPtr.Zero) {
|
||||
return IntPtr.Zero;
|
||||
}
|
||||
|
||||
var vtbl = Marshal.ReadIntPtr(uiModule);
|
||||
if (vtbl == IntPtr.Zero) {
|
||||
return IntPtr.Zero;
|
||||
}
|
||||
|
||||
var getAtkModulePtr = Marshal.ReadIntPtr(vtbl + 0x38);
|
||||
if (getAtkModulePtr == IntPtr.Zero) {
|
||||
return IntPtr.Zero;
|
||||
}
|
||||
|
||||
var getAtkModule = Marshal.GetDelegateForFunctionPointer<GetAtkModuleDelegate>(getAtkModulePtr);
|
||||
return getAtkModule(uiModule);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the pointer to the agent module
|
||||
/// </summary>
|
||||
|
|
Loading…
Reference in New Issue
Block a user