aers / FFXIVClientStructs

Resources for reverse-engineering the FFXIV client's native classes.
MIT License
218 stars 154 forks source link

Help with a error I can't solve #292

Closed SolenoidMan closed 3 months ago

SolenoidMan commented 1 year ago

Trying to find out if I'm inside or not, get a confusing error. Can't find any documentation so any help would be appreciated.

Code: FFXIVClientStructs.Interop.Resolver rt = FFXIVClientStructs.Interop.Resolver.GetInstance; rt.SetupSearchSpace(); rt.Resolve();
bool isInside = FFXIVClientStructs.FFXIV.Client.Game.Housing.HousingManager.Instance()->IsInside();

Error: Function pointer for HousingManager.Instance is null. The resolver was either uninitialized or failed to resolve address with signature E8 ?? ?? ?? ?? 8B 56 7C ?? ?? ?? ?? ?? ?? ?? ??.'

aers commented 1 year ago

Its possible the code was already hooked so the signature failed to resolve.

Is this in a Dalamud plugin or elsewhere?

SolenoidMan commented 1 year ago

I'm sorry for the long delay. I'm trying to write a fully stand-alone program (not via dalamud ingame addon). I'm probably missing something super obvious here.

Here's what I did to make a quick test program. I am a real amateur so I wrote all steps just incase.

Visual Studio 2022 with .Net 7

  1. Downoad FFXIVClientStructs repo, build all - release, use FFXIVClientStructs-main\bin\Release\FFXIVClientStructs.dll

  2. Create new 'Windows Forms App', with framework '.NET 7.0 (Standard Term Support)', put new button1 and label1 on form

  3. Add reference to FFXIVClientStructs-main\bin\Release\FFXIVClientStructs.dll,

  4. add to button_click

        FFXIVClientStructs.Interop.Resolver rt = FFXIVClientStructs.Interop.Resolver.GetInstance;
        rt.SetupSearchSpace();
        rt.Resolve();
        FFXIVClientStructs.FFXIV.Client.Game.Housing.HousingManager ewee = new();
        label1.Text = ewee.IsInside().ToString();

After getting ffxiv running and player standing inside house ingame, then Running test program and clicking button Gives:

"System.InvalidOperationException: 'Function pointer for HousingManager.IsInside is null. The resolver was either uninitialized or failed to resolve address with signature E8 ?? ?? ?? ?? 48 8D 4B D0 33 D2 ?? ?? ?? ?? ??.'"

I should add that I am launching FFXIV with XIVLauncher incase that matters, though when I tried the above code with both XIVLauncher and the built in SQ launcher it gave the same error in both (restarted ffxiv every attempt to ensure no hooks left, etc.)