fix: vfunc change

This commit is contained in:
Anna 2022-08-24 15:53:05 -04:00
parent abd87b60f1
commit fb6d998725
2 changed files with 16 additions and 6 deletions

View File

@ -26,6 +26,16 @@ internal sealed unsafe class Context {
[Signature("E8 ?? ?? ?? ?? EB 45 45 33 C9", Fallibility = Fallibility.Fallible)]
private readonly delegate* unmanaged<void*, uint, byte, void> _searchForItem = null!;
#region Offsets
[Signature(
"FF 90 ?? ?? ?? ?? 8B 93 ?? ?? ?? ?? 48 8B C8 E8 ?? ?? ?? ?? E9 ?? ?? ?? ?? 41 B4 01",
Offset = 2
)]
private readonly int? _searchForRecipesUsingItemVfunc;
#endregion
private Plugin Plugin { get; }
internal Context(Plugin plugin) {
@ -82,13 +92,13 @@ internal sealed unsafe class Context {
}
internal void SearchForRecipesUsingItem(uint itemId) {
if (this._searchForRecipesUsingItem == null) {
if (this._searchForRecipesUsingItem == null || this._searchForRecipesUsingItemVfunc is not { } offset) {
return;
}
var uiModule = Framework.Instance()->GetUiModule();
var vf36 = (delegate* unmanaged<UIModule*, IntPtr>) uiModule->vfunc[36];
var a1 = vf36(uiModule);
var vf = (delegate* unmanaged<UIModule*, IntPtr>) uiModule->vfunc[offset / 8];
var a1 = vf(uiModule);
this._searchForRecipesUsingItem(a1, itemId);
}

View File

@ -189,7 +189,7 @@ internal unsafe class GameFunctions : IDisposable {
// this just probably needs to be set
agent->AddonId = addon->ID;
// vcall from E8 ?? ?? ?? ?? 0F B7 C0 48 83 C4 60
// vcall from E8 ?? ?? ?? ?? 0F B7 C0 48 83 C4 60 (FF 50 28 48 8B D3 48 8B CF)
var vf5 = (delegate* unmanaged<AtkUnitBase*, byte, uint, void>*) ((IntPtr) addon->VTable + 40);
// EA8BED: lets vf5 actually run
*(byte*) ((IntPtr) atkStage + 0x2B4) |= 2;
@ -210,7 +210,7 @@ internal unsafe class GameFunctions : IDisposable {
}
internal static void OpenPartyFinder() {
// this whole method: 6.05: 84433A
// this whole method: 6.05: 84433A (FF 97 ?? ?? ?? ?? 41 B4 01)
var lfg = Framework.Instance()->GetUiModule()->GetAgentModule()->GetAgentByInternalId(AgentId.LookingForGroup);
if (lfg->IsAgentActive()) {
var addonId = lfg->GetAddonID();
@ -273,7 +273,7 @@ internal unsafe class GameFunctions : IDisposable {
Type = ValueType.Int,
Int = 3,
};
int result = 0;
var result = 0;
var vf0 = *(delegate* unmanaged<AgentInterface*, int*, AtkValue*, ulong, ulong, int*>*) agent->VTable;
vf0(agent, &result, &value, 0, 0);
}