View Single Post
11/05/20, 12:36 PM   #4
GRascm
AddOn Author - Click to view addons
Join Date: Oct 2020
Posts: 3
Thank you for you replies!

Originally Posted by votan View Post
Add the inventory fragment to the base scene at startup (built-in code will initialize it immediately)
And remove the fragment on EVENT_PLAYER_ACTIVATED. And beware, it could cause side-effects with other addons not expecting this to happen that early.
I've tried to do it, but nothing works

Digging basic esoui code deeper, gave me this:
https://github.com/esoui/esoui/blob/...entory.lua#L64

OnDeferredInitialize called when scene changes state to SCENE_SHOWING first time.
And, it's a hardcoded scene here:
https://github.com/esoui/esoui/blob/...entory.lua#L27
And callback registration happens here:
https://github.com/esoui/esoui/blob/...creen.lua#L227

As i can see, i can't override anything on this path, to force deferred initialization complete in secure way.


Originally Posted by Baertram View Post
Try CallSecureProtected as wrapper around UseItem.
Simple wrapper works fine for this case:

Lua Code:
  1. function UseItem(bag, index)
  2.     CallSecureProtected("UseItem", bag, index)
  3. end

But the solution seems dirty, and, still all interface accessed from main menu becomes tainted because of deferred initialization (ZO_Gamepad_ParametricList_Screen is basic class for almost all gamepad interface accessible from main menu).
And there potentially can be private functions, that couldn't be overrided that easily.
Also, it's too hard to find all functions i should override.

But looks like it's my only option.
  Reply With Quote