fix(streaming): reinitialize scaleform .gfx on resource restart#3859
fix(streaming): reinitialize scaleform .gfx on resource restart#3859frostfire575 wants to merge 1 commit intocitizenfx:masterfrom
Conversation
When a resource with a .gfx scaleform is restarted, the existing streaming slot is found by FindSlot but initGfxTexture is skipped (only runs for new slots). CScaleformStore retains stale state, causing RequestScaleformMovie to fail with native error 0x11fe353cf9733e6f and eventually crash. Detect .gfx entries pending removal and force ReleaseObject + initGfxTexture reinit so the scaleform loads cleanly after restart. Fixes citizenfx#1576
| Hey @prikolium-cfx @radium-cfx, can you take a look at this? It is an important one. |
| Please accept this pr lol |
| i mean.. i simply make 2 resources... the "assets" resource with the .gfx in it (never to be restarted).. and the script one that can be restarted.. it's pretty much that :) edit: also this is basically FiveM assets handling 101... never stream in the same resource with the code if you can avoid it.. because you should never restart an assets unless specifically needed |
yeah that works as a workaround but as someone who sells scripts on Tebex, shipping an extra resource just to work around a bug isnt great for end users. |
| having one instead of 2 resources is much better, and being able to restart it real time for debugging would be 🔥 |
| Anyway i'm all UP for this PR and i really hope it gets merged soon! |
| I made a whole tool to automate the restarting of the scaleform by renaming the scaleform and reloading, it works but man it seems so stupid when we can just use this pr, @frostfire575 it does live edits too right? |
what do you mean by live edits? can you explain a bit ? |
Sure so let's say you edit a scaleform live and restart the resource, will the scaleform reload with the changes? |
yes since the fix forces ReleaseObject on the stale entry and reinitializes . it will pick up the updated .gfx file on restart so yes, edit your scaleform, restart the resource, changes load in cleanly. This is my discord : frostfire575 you can message me . |
Okay this needs to be merged! I'll shoot you a msg |
| I’d like to address the unnecessary hostility outside GH following my previous comments. My intent was never to discourage this PR or present a workaround as a replacement for a core fix. With 8 years of experience in FiveM resource management, and 5 years of experience in scaleforms development, a depth of field experience that is not exactly common in this environment, I simply shared the "Assets vs. Scripts" separation as a fundamental best practice (FiveM 101) to ensure stability in production. Providing architectural advice to help users avoid crashes in the meantime does not negate the value of fixing the underlying engine bug. It is disappointing to be attacked for sharing technical expertise aimed at improving workflow. I fully support this PR as a step toward a more resilient platform, but I expect a professional and respectful dialogue, especially when sharing established industry-standard methods. |
You provided a workaround sure, i understand the usecase but this PR is more than just "crashing when restarting a scaleform" you failed to even read the PR, This pull request from my understand of reading it is the following Fixes slots and data when reloading a scaleform providing so a scaleform can be updated and reloaded while ingame fixing the issue of having to restart your game or renaming a scaleform to see that gfx be updated. Your method to streaming scaleforms and restart a resource using them separately is fine sure but it's not what this PR is about. Splitting up streaming resources is optional and it should be working but it's not and that's why your "FiveM industry-standard" is just not industry-standard. I simply pointed this out and you took my opinions to heart and got all egotistical on me 🤷 |
I agree, we don't want workarounds, we want true fixes! yay |






Goal of this PR
Fix
.gfxscaleform files failing to load after a resource restart, eventually causing a crash.When a resource containing a
.gfxfile is restarted,FindSlotfinds the existing streaming slot soinitGfxTextureis skipped (it only runs for newly created slots).CScaleformStoreretains stale internal state, causingRequestScaleformMovieto fail with native error0x11fe353cf9733e6fand eventually crash.How is this PR achieving the goal
Two changes in
LoadStreamingFile.cpp:.gfxentry's slot already exists and is pending removal, push it ontonewGfxsoinitGfxTextureruns again after reload.ReleaseObjecton the old streaming entry soCScaleformStoredrops its stale state, allowing a clean reinit.Both paths are gated on
g_pendingRemovals.count(...), so they only fire during resource restart — normal first-load and non-.gfxpaths are untouched.This PR applies to the following area(s)
FiveM
Successfully tested on
Game builds: FiveM
Platforms: Windows
Checklist
Fixes issues
Fixes #1576