mirror of
https://github.com/Relintai/sdl2_frt.git
synced 2024-12-29 20:27:12 +01:00
Emscripten: Fixed receiving joystick events after failed init or subsystem quit.
The callbacks used to receive the HTML events were not removed if the joystick subsystem initialization failed or if the joystick subsystem was quit. Also, the already connected joysticks were not deleted if the initialization failed later.
This commit is contained in:
parent
f9adb453dd
commit
6dda14c0d8
@ -220,6 +220,7 @@ SDL_SYS_JoystickInit(void)
|
|||||||
Emscripten_JoyStickConnected);
|
Emscripten_JoyStickConnected);
|
||||||
|
|
||||||
if(retval != EMSCRIPTEN_RESULT_SUCCESS) {
|
if(retval != EMSCRIPTEN_RESULT_SUCCESS) {
|
||||||
|
SDL_SYS_JoystickQuit();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -227,6 +228,7 @@ SDL_SYS_JoystickInit(void)
|
|||||||
0,
|
0,
|
||||||
Emscripten_JoyStickDisconnected);
|
Emscripten_JoyStickDisconnected);
|
||||||
if(retval != EMSCRIPTEN_RESULT_SUCCESS) {
|
if(retval != EMSCRIPTEN_RESULT_SUCCESS) {
|
||||||
|
SDL_SYS_JoystickQuit();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -399,6 +401,9 @@ SDL_SYS_JoystickQuit(void)
|
|||||||
|
|
||||||
numjoysticks = 0;
|
numjoysticks = 0;
|
||||||
instance_counter = 0;
|
instance_counter = 0;
|
||||||
|
|
||||||
|
emscripten_set_gamepadconnected_callback(NULL, 0, NULL);
|
||||||
|
emscripten_set_gamepaddisconnected_callback(NULL, 0, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_JoystickGUID SDL_SYS_JoystickGetDeviceGUID(int index)
|
SDL_JoystickGUID SDL_SYS_JoystickGetDeviceGUID(int index)
|
||||||
|
Loading…
Reference in New Issue
Block a user