Private function issues in standart UI
1 Attachment(s)
Hi, everyone!
I was trying to implement new main menu for gamepad, based on ZO_RadialMenu. Because it would be much comfortable to use such menu, that the current one. Here you can see what i mean:
Warning: Spoiler
And everything was perfectly fine, until i tried to use item from the inventory. I got the following error message:
Warning: Spoiler
To show the inventory menu, i use simple code: Lua Code:
And the main problem is, that if i hit an "I" button to open inventory first, and than try to open it from my menu (pressing "start" on gamepad), everything works perfectly fine. So my hypothesis is that inventory menu makes some initialization on first opening, and, when i trigger that from insecure code, that initialization makes full inventory insecure. The fact confirming that is that when i try to open inventory with "I" button later (after it was insecurly initialized) it still doesn't work. And if i initialize it securely (pressing "I") than it perfectly working in my menu. So, is there anything i missing, that could fix my problem? It looks like currently impossible to implement main menu replacement with such limitations. And it not because it was forbidden, but rather, due to the imperfection of security system. I saw ZOS developers posting on this forum, and maybe thay can give some advices (or just implement such menu themselves :rolleyes:). |
Try CallSecureProtected as wrapper around UseItem.
Lua Code:
If this does not work I'm not sure if there is a way to make your code NOT taint the inventory code. I'm pretty unsure why the code get's insecure though. Are you hooking/chaning any inventory code for your menu? If so try SecurePostHook instead of ZO_PostHook etc. |
Quote:
The build-in code is not written to take care of CallSecureProtected, because it normally doesn't need to. 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. |
Thank you for you replies!
Quote:
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. Quote:
Lua Code:
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. |
Overriding the functions will most likely end in an addon that will break about all other addons around, using these functions :(
Maybe ask ZOs_DanBrown here in the forum if he got any other idea or if your addon idea would not be possible this way. |
I've managed to abuse "playerSubmenu" scene, and default main menu implementation, to avoid code tainting. User expirience get worse a bit, due to proxy dialog showing to open inventory and settings, but it is working correctly now.
Here you can see how to achieve this, if you interested: https://github.com/GRascm/eso_agui/c...313adR162-R165 https://github.com/GRascm/eso_agui/c...ad6ff9313adR48 I'm going to report issue to "Bug Reports" section of this forum later, and maybe ZOS will fix it eventually. |
All times are GMT -6. The time now is 07:49 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2014 - 2022 MMOUI