emscripten: Move some EM_ASM blocks to MAIN_THREAD_EM_ASM.

These blocks reference the `navigator` global, which is not available in
background threads.
This commit is contained in:
Ryan C. Gordon
2026-02-20 10:23:45 -05:00
parent a79bd26d28
commit c728e2f044
2 changed files with 3 additions and 3 deletions

View File

@@ -449,7 +449,7 @@ static bool EMSCRIPTEN_JoystickOpen(SDL_Joystick *joystick, int device_index)
joystick->nbuttons = item->nbuttons;
joystick->naxes = item->naxes;
rumble_available = EM_ASM_INT({
rumble_available = MAIN_THREAD_EM_ASM_INT({
let gamepads = navigator['getGamepads']();
if (!gamepads) {
return 0;
@@ -570,7 +570,7 @@ static bool EMSCRIPTEN_JoystickRumble(SDL_Joystick *joystick, Uint16 low_frequen
SDL_joylist_item *item = (SDL_joylist_item *)joystick->hwdata;
// clang-format off
bool result = EM_ASM_INT({
bool result = MAIN_THREAD_EM_ASM_INT({
let gamepads = navigator['getGamepads']();
if (!gamepads) {
return 0;

View File

@@ -27,7 +27,7 @@
bool SDL_SYS_GetPreferredLocales(char *buf, size_t buflen)
{
/* *INDENT-OFF* */ // clang-format off
EM_ASM({
MAIN_THREAD_EM_ASM({
var buf = $0;
var buflen = $1;
var list = undefined;