View Single Post
09/07/22, 03:08 AM   #3
Moohemoth
Join Date: Sep 2022
Posts: 2
Originally Posted by Baertram View Post
Most gamepad stuff gets initialized deferred means it is not loaded until shown first time. So if you add or hook there it will throw nil errors or get insecure code due to addons adding code before all was loaded properly (inventory at keyboard e.g. often was causing this if you tried to change it before it was initialized properly). ZOs added hook functions like SecurePostHook to circumvent this at keyboard stuff, hopefully at gamepad code too.

code gets tainted if you hook or add into it before it was loaded properly. try to use SecurePostHook at dialog functions to make your hooks secure, or add a ZO_PostHookHandler on the OnShow or OnEffectivelyShown (dialogs control) then hide the dialog directly and show your own dialog. Maybe it will make the original load, make all secure and then your dialogs can work afterwards. Could maybe make it flicker once but after that you maybe are able to replace the complete dialogs without getting insecure errors.
Yeah, that makes sense. I'm already using SecurePostHook on every hook I make, like so:

Code:
SecurePostHook(ZO_Armory_Gamepad, "RefreshBuildList", BetterArmory.RefreshBuildList)
That one so I can add new entries to the armory's build list, and:

Code:
SecurePostHook(ZO_ARMORY_MANAGER, "ShowBuildOperationConfirmationDialog", BetterArmory.ShowBuildOperationConfirmationDialog)
So I can know when the player tries to restore/save a build. I use buildIndexes way out of normal bounds for my own purposes, which the game, at least for now, just straight up ignores and does nothing with which brings up no dialog and also lets my own code run pretty much out of the way of the native UI. The hook function only does a few checks, and then shows its own dialog, which explains the gamepad dialog only just now loading and becoming insecure because of where it's at. Was the most straight forward way of doing it that I found, maybe I'm missing something but no matter which way I hooked it without the original dialog I would've ran into this same issue anyway.

Your idea to hook and hide the original dialog myself before continuing with my own code sounds like it would work tho! Gotta change and figure out a bunch of stuff to make it work, but I'll leave that for tomorrow methinks. When it's not 4am lol

Last edited by Moohemoth : 09/07/22 at 03:12 AM.
  Reply With Quote