Thread Tools Display Modes
05/15/15, 01:26 AM   #1
votan
 
votan's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2014
Posts: 578
Secure Render Mode Bug

Neither SCENE_MANAGER nor WINDOW_MANAGER do handle entering/leaving SecureRenderMode properly. (Opening/Closing Crone Market)

SCENE_MANAGER does not wait until all custom fade-scenes reaching SCENE_HIDDEN state.
Any custom fade-scene with a fade-out duration greather than zero will cause security exceptions (Access private function "StopAllMovements" from ...)
One would expect one could dynamically change the fade-out-duration by handling the EVENT_SECURE_RENDER_MODE_CHANGED and call SetHiddenForReason with a zero fade-duration. But this event is not triggered before the market is causing a security exception already. You have no chance to react to this situation.
The only way to overcome this is to create fade-scenes with zero fade-out duration (which is not default value for ZO_FadeSceneFragment!) just for the rare case the market will be opened...

The same thing the other way round: The SCENE_MANAGER does not wait until market scene reaching SCENE_HIDDEN before showing custom scenes again.
Any key-bind function simply doing SCENE_MANAGER:Show("myscene") or SCENE_MANAGER:ShowBaseScene() without checking WINDOW_MNAGER:IsSecureRenderModeEnabled() and skipping any scene change, will cause a security exception.

Please prove I just doing something wrong, but I think the whole SecureRenderMode transition should be reviewed by ZOS.
  Reply With Quote
05/15/15, 04:41 AM   #2
XanDDemoX
AddOn Author - Click to view addons
Join Date: May 2015
Posts: 28
My store does something like this. I can reproduce it by clicking tabs on the world map info control and then clicking on the store.

Code:
EsoUI/Ingame/Scenes/IngameFragments.lua:430: attempt to access a private function 'StopAllMovement' from insecure code
stack traceback:
	EsoUI/Ingame/Scenes/IngameFragments.lua:430: in function 'ZO_StopMovementFragment:Show'
	EsoUI/Libraries/ZO_Scene/ZO_SceneFragment.lua:126: in function 'ZO_SceneFragment:ShouldBeShown'
	EsoUI/Libraries/ZO_Scene/ZO_SceneFragment.lua:170: in function 'ZO_SceneFragment:Refresh'
	EsoUI/Libraries/ZO_Scene/ZO_Scene.lua:291: in function 'ZO_Scene:RefreshFragmentsHelper'
	EsoUI/Libraries/ZO_Scene/ZO_Scene.lua:299: in function 'ZO_Scene:RefreshFragments'
	EsoUI/Libraries/ZO_Scene/ZO_Scene.lua:256: in function 'ZO_Scene:SetState'
	EsoUI/Libraries/ZO_Scene/ZO_Scene.lua:406: in function 'ZO_RemoteScene:SetState'
	EsoUI/Libraries/ZO_Scene/ZO_SceneManager.lua:155: in function 'ZO_SceneManager:ShowScene'
	EsoUI/Libraries/ZO_Scene/ZO_SceneManager.lua:430: in function 'ZO_SceneManager:OnSceneStateChange'
	EsoUI/Ingame/Scenes/IngameSceneManager.lua:278: in function 'ZO_IngameSceneManager:OnS

Last edited by XanDDemoX : 05/15/15 at 06:14 AM.
  Reply With Quote
05/15/15, 09:01 AM   #3
ZOS_ChipHilseberg
ZOS Staff!
Premium Member
Yes this person is from ZeniMax!
Join Date: Oct 2014
Posts: 551
Looking at secure render mode it only impacts which controls draw and which don't, so it doesn't interact with the security violation code. It might be that something else is happening at the same time secure render mode is changing. I know that any scene that uses the stop movement fragment (I'm only seeing crown store and gamepad scenes using it right now) will trigger a violation if the scene is shown from insecure code. Is there some way your code is showing one of those?
  Reply With Quote
05/15/15, 09:30 AM   #4
votan
 
votan's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2014
Posts: 578
Originally Posted by ZOS_ChipHilseberg View Post
Looking at secure render mode it only impacts which controls draw and which don't, so it doesn't interact with the security violation code. It might be that something else is happening at the same time secure render mode is changing. I know that any scene that uses the stop movement fragment (I'm only seeing crown store and gamepad scenes using it right now) will trigger a violation if the scene is shown from insecure code. Is there some way your code is showing one of those?
If you want to have an example try the current version of Rare Fish Tracker.
It "just" surrounds a TopLevelWindow with a ZO_HUDFadeSceneFragment to handle where and when it is visible. rft is the TopLevelWindow:
Lua Code:
  1. RARE_FISH_TRACKER_FRAGMENT = ZO_HUDFadeSceneFragment:New(rft, 500, 0)
  2.     RARE_FISH_TRACKER_FRAGMENT:SetConditional( function()
  3.         if WORLD_MAP_FRAGMENT:IsShowing() then
  4.             return RFT.settings.shown_world
  5.         else
  6.             if IsUnitInCombat("player") then return false end
  7.             return RFT.settings.shown or RFT.isFishing
  8.         end
  9.     end )
  10.     WORLD_MAP_FRAGMENT:RegisterCallback("StateChange", function(oldState, newState)
  11.         if newState == SCENE_FRAGMENT_SHOWING or newState == SCENE_FRAGMENT_HIDING then
  12.             if RFT.settings.shown_world == RFT.settings.shown then RFT:RestorePosition() end
  13.             RARE_FISH_TRACKER_FRAGMENT:Refresh()
  14.         elseif newState == SCENE_FRAGMENT_HIDDEN then
  15.             RFT.RefreshWindowForZone(GetUnitZone('player'))
  16.         end
  17.     end )
  18.     CALLBACK_MANAGER:RegisterCallback("OnWorldMapChanged", function(navigateIn)
  19.         if WORLD_MAP_FRAGMENT:IsShowing() then
  20.             if navigateIn and GetMapType() ~= MAPTYPE_ZONE then return end
  21.             RFT.RefreshWindowForZone(ZO_WorldMap.zoneName)
  22.         else
  23.             RFT.RefreshWindowForZone(GetUnitZone('player'))
  24.         end
  25.     end )
  26.     RARE_FISH_TRACKER_FRAGMENT:RegisterCallback("StateChange", function(oldState, newState)
  27.         if newState == SCENE_FRAGMENT_SHOWING then RFT:RestorePosition() end
  28.     end )
  29.     EVENT_MANAGER:RegisterForEvent("RareFishTracker", EVENT_PLAYER_COMBAT_STATE, function() RARE_FISH_TRACKER_FRAGMENT:Refresh() end)
  30.  
  31.     HUD_SCENE:AddFragment(RARE_FISH_TRACKER_FRAGMENT)
  32.     HUD_UI_SCENE:AddFragment(RARE_FISH_TRACKER_FRAGMENT)
  33.     LOOT_SCENE:AddFragment(RARE_FISH_TRACKER_FRAGMENT)
  34.     WORLD_MAP_SCENE:AddFragment(RARE_FISH_TRACKER_FRAGMENT)
If you change the fade-out duration in line 266 of RareFishWindow.lua (here first line) from 0 to let's say 100 and you make the Rare Fish Tracker window visible, you can't open the store without crash. If you toggle it off first, all is ok.

Last edited by votan : 05/15/15 at 09:33 AM.
  Reply With Quote
05/15/15, 09:33 AM   #5
XanDDemoX
AddOn Author - Click to view addons
Join Date: May 2015
Posts: 28
Originally Posted by ZOS_ChipHilseberg View Post
Looking at secure render mode it only impacts which controls draw and which don't, so it doesn't interact with the security violation code. It might be that something else is happening at the same time secure render mode is changing. I know that any scene that uses the stop movement fragment (I'm only seeing crown store and gamepad scenes using it right now) will trigger a violation if the scene is shown from insecure code. Is there some way your code is showing one of those?
The only usage I have of Fragments is using ZO_FadeSceneFragment in Faster Travel to add its top level controls to the worldmapinfo control :

Code:
<TopLevelControl name="FasterTravel_WorldMapWayshrines" inherits="ZO_WorldMapInfoContent">
<OnInitialized>
...
self.fragment = ZO_FadeSceneFragment:New(self)
...
</OnInitialized>
Code:
local function AddWorldMapFragment(strId,fragment,normal,highlight,pressed)
    WORLD_MAP_INFO.modeBar:Add(strId, { fragment }, {pressed = pressed,highlight =highlight,normal = normal})
end

local path = "/esoui/art/treeicons/achievements_indexicon_alliancewar_"

AddWorldMapFragment(SI_MAP_INFO_MODE_WAYSHRINES,wayshrineControl.fragment,path.."up.dds",path.."over.dds",path.."down.dds")

path = "/esoui/art/mainmenu/menubar_group_"

AddWorldMapFragment(SI_MAP_INFO_MODE_PLAYERS,playersControl.fragment,path.."up.dds",path.."over.dds",path.."down.dds")

Last edited by XanDDemoX : 05/15/15 at 09:49 AM.
  Reply With Quote
05/18/15, 07:57 AM   #6
ZOS_ChipHilseberg
ZOS Staff!
Premium Member
Yes this person is from ZeniMax!
Join Date: Oct 2014
Posts: 551
Thanks for the test code. I was able to repro it here. It seems like the problem is: if you are the last fragment to complete in a scene then you will trigger the code to show the next scene which will be a security violation if that scene includes a fragment that calls a private function immediately on show. Fixing this will be a bit of work to separate out scenes a bit more. In the mean time you should be able to have an animation as long as it's finishes just before the slowest scene fragment.
  Reply With Quote
05/18/15, 12:15 PM   #7
votan
 
votan's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2014
Posts: 578
Originally Posted by ZOS_ChipHilseberg View Post
Thanks for the test code. I was able to repro it here. It seems like the problem is: if you are the last fragment to complete in a scene then you will trigger the code to show the next scene which will be a security violation if that scene includes a fragment that calls a private function immediately on show. Fixing this will be a bit of work to separate out scenes a bit more. In the mean time you should be able to have an animation as long as it's finishes just before the slowest scene fragment.
Thank you, Chip.
But I don't know, if I got you right. Any fade-out duration greather than zero (even 2ms) raises an exception.

By the way: You can also cause the exception the other way round:
Do this in chat window, while market is open:
Lua Code:
  1. /script SCENE_MANAGER:ShowBaseScene()
  Reply With Quote

ESOUI » Developer Discussions » General Authoring Discussion » Secure Render Mode Bug


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off