mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-02-28 22:28:19 +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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user