fivem icon indicating copy to clipboard operation
fivem copied to clipboard

``RequestScaleformMovie`` fails to execute/invoke if called again after resource restart.

Open significant-quart opened this issue 3 years ago • 7 comments

Description: While developing scaleforms I've come to discover that if a streamed scaleform is loaded (and although not required disposed of accordingly with SetScaleformMovieAsNoLongerNeeded) then the resource responsible restarts and attempts to load the scaleform again (for example, if you've made changes and wish to test) the call to RequestScaleformMovie will fail.

I'm Unsure how long this problem has existed however the repro I've provided was tested on the latest server artefacts although that shouldn't affect anything AFAIK.

How to use repro:

  1. Download and install repro resource here (repro.zip).
  2. Once in server start the resource
  3. Ensure the resource to which an error will be displayed in the console.

Misc details: The scaleform being streamed is a random scaleform I chose from the vanilla game however this issue can observed with both vanilla or custom scaleforms.

significant-quart avatar Aug 15 '22 15:08 significant-quart

I believe this was raised in the past by manups4e when working on ScaleformUI, but was in the Discord at the time.

Local9 avatar Oct 20 '22 18:10 Local9

Calling SetScaleformMovieAsNoLongerNeeded on onResourceStop, then creating the same scaleform again, causes native errors and then eventually crashes your client. Even if I add a 10 second delay before creating the scale forms, the problem still happens, I assume the scaleforms stops getting cleaned up after the resource stops?

One workaround so far is to unload it before you restart the resource, eg distance checking and unloading. then once it's unloaded restart the resource and the issue won't happen.

EDIT:

If if create a unload command, run that, then wait 2-5 seconds, do a restart of the resource the problem doesn't happen. Done this about 20+ times now with no errors happening.

FingerlessGlov3s avatar Sep 02 '23 20:09 FingerlessGlov3s

Have any of you Scaleform GFx users played with the SCALEFORM_DLC_FILE manifest entry?

Running the reproduction it does seem like the GFx is not being instantly unloaded from CScaleformStore and the subsequent scaleform request is still using the remnants of the previous Scaleform definition (the data file entry solves all of this). Any additional progress/updates made on this since initial reporting?

In this specific case it may be possible to work around this by emulating something similar RELOAD_MAP_STORE for CScaleformStore, e.g., mirror the CScaleformPreallocationDataFileMounter unload logic. It may be possible to force a SCALEFORM_DLC_FILE entry gfx files in stream/.

IT would be nice if SCALEFORM_DLC_FILE could be tested here.

gottfriedleibniz avatar Feb 08 '24 02:02 gottfriedleibniz

Just stumbled across this issue when testing stuff with DUIs today.

IT would be nice if SCALEFORM_DLC_FILE could be tested here.

Registering the .gfx file as SCALEFORM_DLC_FILE doesn't help resolving the mentioned issue.

tens0rfl0w avatar Feb 29 '24 12:02 tens0rfl0w

Would it be possible to provide a reproduction? My uses of SCALEFORM_DLC_FILE with generic_texture_renderer_gfx (presumably what you are using) seem to work fine.

gottfriedleibniz avatar Feb 29 '24 16:02 gottfriedleibniz

Would it be possible to provide a reproduction?

Didn't really have time to test this on different game builds, but on a vanilla server with only base-resources started, this is constantly reproducible for me (with using generic_texture_renderer_gfx).

Restarting the resource that contains the scaleform and DUI (with or without manual scaleform unload and DUI destruction per onResourceStop handler) produces the following error when invoking RequestScaleformMovie again:

Error executing native 0x11fe353cf9733e6f at address FiveM_b2944_GTAProcess.exe+168B8E.

Gamebuild was: 2944 Resource used for testing: scaleform-repro.zip

tens0rfl0w avatar Feb 29 '24 17:02 tens0rfl0w

SCALEFORM_DLC_FILE expects ScaleformPreallocation entries, e.g., from contents:

284       <filename>dlc_mpBusiness2:/common/data/ui/CacheAndCarry.xml</filename>
285       <fileType>SCALEFORM_DLC_FILE</fileType>  

However, playing with this a bit further there still does seem something else racey involved with scaleform unloading.

gottfriedleibniz avatar Feb 29 '24 19:02 gottfriedleibniz