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->nbuttons = item->nbuttons;
|
||||||
joystick->naxes = item->naxes;
|
joystick->naxes = item->naxes;
|
||||||
|
|
||||||
rumble_available = EM_ASM_INT({
|
rumble_available = MAIN_THREAD_EM_ASM_INT({
|
||||||
let gamepads = navigator['getGamepads']();
|
let gamepads = navigator['getGamepads']();
|
||||||
if (!gamepads) {
|
if (!gamepads) {
|
||||||
return 0;
|
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;
|
SDL_joylist_item *item = (SDL_joylist_item *)joystick->hwdata;
|
||||||
|
|
||||||
// clang-format off
|
// clang-format off
|
||||||
bool result = EM_ASM_INT({
|
bool result = MAIN_THREAD_EM_ASM_INT({
|
||||||
let gamepads = navigator['getGamepads']();
|
let gamepads = navigator['getGamepads']();
|
||||||
if (!gamepads) {
|
if (!gamepads) {
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
bool SDL_SYS_GetPreferredLocales(char *buf, size_t buflen)
|
bool SDL_SYS_GetPreferredLocales(char *buf, size_t buflen)
|
||||||
{
|
{
|
||||||
/* *INDENT-OFF* */ // clang-format off
|
/* *INDENT-OFF* */ // clang-format off
|
||||||
EM_ASM({
|
MAIN_THREAD_EM_ASM({
|
||||||
var buf = $0;
|
var buf = $0;
|
||||||
var buflen = $1;
|
var buflen = $1;
|
||||||
var list = undefined;
|
var list = undefined;
|
||||||
|
|||||||
Reference in New Issue
Block a user