mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-08-29 10:01:35 +00:00
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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user