From fcc5940935a15a3a45356a0c55b4120156c93e97 Mon Sep 17 00:00:00 2001 From: Philipp Wiesemann Date: Wed, 5 Aug 2015 21:04:10 +0200 Subject: [PATCH] Emscripten: Added missing error messages for audio and joystick init failures. --- src/audio/emscripten/SDL_emscriptenaudio.c | 4 ++++ src/joystick/emscripten/SDL_sysjoystick.c | 3 +++ 2 files changed, 7 insertions(+) diff --git a/src/audio/emscripten/SDL_emscriptenaudio.c b/src/audio/emscripten/SDL_emscriptenaudio.c index 4da99df11..792f12c11 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 16e971344..df963e5d4 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; }