Emscripten: Added missing error messages for audio and joystick init failures.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
diff --git a/src/audio/emscripten/SDL_emscriptenaudio.c b/src/audio/emscripten/SDL_emscriptenaudio.c
index 4da99df..792f12c 100644
--- a/src/audio/emscripten/SDL_emscriptenaudio.c
+++ b/src/audio/emscripten/SDL_emscriptenaudio.c
@@ -263,6 +263,10 @@ Emscripten_Init(SDL_AudioDriverImpl * impl)
return 0;
});
+ if (!available) {
+ SDL_SetError("No audio context available");
+ }
+
return available;
}
diff --git a/src/joystick/emscripten/SDL_sysjoystick.c b/src/joystick/emscripten/SDL_sysjoystick.c
index 16e9713..df963e5 100644
--- a/src/joystick/emscripten/SDL_sysjoystick.c
+++ b/src/joystick/emscripten/SDL_sysjoystick.c
@@ -200,6 +200,7 @@ SDL_SYS_JoystickInit(void)
/* Check if gamepad is supported by browser */
if (numjs == EMSCRIPTEN_RESULT_NOT_SUPPORTED) {
+ SDL_SetError("Gamepads not supported");
return -1;
}
@@ -221,6 +222,7 @@ SDL_SYS_JoystickInit(void)
if(retval != EMSCRIPTEN_RESULT_SUCCESS) {
SDL_SYS_JoystickQuit();
+ SDL_SetError("Could not set gamepad connect callback");
return -1;
}
@@ -229,6 +231,7 @@ SDL_SYS_JoystickInit(void)
Emscripten_JoyStickDisconnected);
if(retval != EMSCRIPTEN_RESULT_SUCCESS) {
SDL_SYS_JoystickQuit();
+ SDL_SetError("Could not set gamepad disconnect callback");
return -1;
}