cleolibrary / CLEO-Redux

Experimental JavaScript runtime for GTA 3D era games/GTA IV/Bully
https://re.cleo.li
Other
210 stars 20 forks source link

[SA:DE] 0A69 crashes in JS script #12

Open x87 opened 2 years ago

x87 commented 2 years ago

Calling


/// <reference path=".config/sa.d.ts" />
Widget.CreateShopMenu('IE09')

crashes the game with error

ErrorMessage>LowLevelFatalError [File:Unknown] [Line: 970] 
Node /Game/SanAndreas/Textures/mobile/T_shop_barber_BC 0 Package_LoadSummary    has zero prerequisites, but has not been queued.

Same command works when in a CS script

{$CLEO}
{$USE ios}
{$O 0C05=0,terminate_this_custom_script }

0A69: create_shop_widget_menu "IE09"
0C05: terminate_this_custom_script 
x87 commented 2 years ago

note:

if I have both CS script and JS script with 0A69 and let CS run first (by adding wait command before Widget.CreateShopMenu in a js script), both would work with no crash.

x87 commented 2 years ago

This can be a technical limitation for now. Creating widgets requires running in the main thread (it appears that they use thread local storage for queuing resources?) and JavaScript VM currently runs in a separate thread. If I run a JS script with Widget.CreateShopMenu('IE09') on the main thread it works fine.

CS scripts run on the main thread and there is no issues with widgets.

I will look into possible workarounds, but can't promise anything