InitialDet/AutoHook

Crashing During Fête: Shear-a-Yak

Closed this issue · 14 comments

This bug is oddly specific, but after a lot of testing, I found that this plugin was the source of a crash after every attempt at Shear-a-Yak.

I have no idea why.

Now that is weird, the plugin literally does nothing outside of fishing, no processing at all. Did you check dalamud.log to see what was the crash error?

Yes, but it wasn't any help. So I just turned off plugins until I stopped crashing and then AutoHook ended up being the problem.

Well ill try and see for myself, but im certain it was another plugin conflicting with something. Because like i said before, autohook does nothing outside of fishing to even have a "chance" to crash the game.

If you happen to crash again, please send me the log files

I'm not OP but have been crashing the moment I press the button for Aetheromatic Clipper in Shear-a-Yak. Got pointed to this issue from a forum thread. I usually got nothing in the logs but I decided to hook up the VS debugger to see what the crash looks like and sure enough
image

2023-11-28 18:11:28.720 -08:00 [FTL] Unhandled exception on AppDomain
System.NullReferenceException: Object reference not set to an instance of an object.
   at AutoHook.HookingManager.OnUseAction(IntPtr manager, ActionType actionType, UInt32 actionId, GameObjectID targetId, UInt32 a4, UInt32 a5, UInt32 a6, IntPtr a7)
   at SimpleTweaksPlugin.Tweaks.SanctuarySprintReplacer.UseActionDetour(ActionManager* mgr, ActionType type, UInt32 id, Int64 targetid, Int32 a4, Int32 a5, Int32 a6, Void* a7) in /work/repo/Tweaks/SanctuarySprintReplacer.cs:line 53
   at Dalamud.Game.Framework.HandleFrameworkUpdate(IntPtr framework) in C:\goatsoft\companysecrets\dalamud\Game\Framework.cs:line 433

Looks like it might be an interaction with SimpleTweaks, I'm not sure; I'll try it again when I can. It's annoying to figure out because the fete is up for like 5 minutes every 2 hours and crashing takes most of that time to get back in, I can only try one thing because loading back puts you in the Pillars.
Anyway here's the log.
dalamud.log

Turned off AutoHook, left that SimpleTweak enabled - no crash.
Turned off the tweak, enabled AutoHook, and it crashed again with a different second hook listed.

2023-11-28 22:12:22.482 -08:00 [FTL] Unhandled exception on AppDomain
System.NullReferenceException: Object reference not set to an instance of an object.
   at AutoHook.HookingManager.OnUseAction(IntPtr manager, ActionType actionType, UInt32 actionId, GameObjectID targetId, UInt32 a4, UInt32 a5, UInt32 a6, IntPtr a7)
   at CrossUp.Game.Hooks.ActionBarHooks.ActionBarReceiveEventDetour(AddonActionBarBase* barBase, UInt32 eventType, Void* a3, Void* a4, NumberArrayData** numberArrayData) in /work/repo/Game/Hooks/ActionBar.cs:line 96
   at Dalamud.Game.Framework.HandleFrameworkUpdate(IntPtr framework) in C:\goatsoft\companysecrets\dalamud\Game\Framework.cs:line 433

I can confirm this crash. Sadly, I don't get an error message on the crash.
If Autohook is the only mod turned on, it crashes. Even if autohook is toggled off through /ahoff, it crashes.

Maybe it has something to do with that special tool that gets used that somehow gets recognized as a fishing pole?

Ok, here we go. Removed every other plugin, enabled managed exception handling, and
image
actionType is ActionType.Action and actionId is 24280 as expected so that should mean that the issue is with PlayerResources.ActionTypeAvailable()? VS isn't decompiling that symbol so I'll have to actually build the plugin and wait for 1-2 days for fetes to come around again to look deeper.

I took a memory dump before I quit VS, if that would help.

Oh wow, thank you so much for the detailed reports, it really helps a lot. I'll be fixing this issue in the next update.

Maybe before anyone tries it, the aether thingy in Diadem DOES work. It seems to be coded differently even though it seems to be using the exact same animation.

Some context for anyone curious about this issue.

When making the plugin i needed to find a way to know when the user started fishing or mooching without needing to check for the text displayed in the chat. My solution was to check if the player used the actions Cast (id 289) or Mooch 1/2 (ids: 297/268) and call OnBeganFishing or OnBeganMooch to set everything up.

The problem was, if the user pressed Cast or Mooch even when the action was not available (when the icon is dark, like trying to use Cast while already fishing), the game would still recognized the press as the action being used and OnBeganFishing/OnBeganMooch were being called in the wrong time and everything bugged out.

The solution for that was checking if the pressed action is actually AVAILABLE and OFF COOLDOWN (for mooch2), its a simple check and worked pretty well.

Well, now for reasons i dont even think its worth the effort to find out why, checking if Aetheromatic Clipper (id: 24280) is available and off cooldown makes the game crash?? Most actions return a simple true or false but this one is being a lil different.

I'll make sure the plugin only checks fishing related actions and the problem should fixed

Should be fixed

Confirmed, it works!