Emscripten: Added missing error messages for audio and joystick init failures.
authorPhilipp Wiesemann <philipp.wiesemann@arcor.de>
Wed, 05 Aug 2015 21:04:10 +0200
changeset 98316c7e2f0747f7
parent 9830 0ada01db0923
child 9832 5fa8cf552d05
Emscripten: Added missing error messages for audio and joystick init failures.
src/audio/emscripten/SDL_emscriptenaudio.c
src/joystick/emscripten/SDL_sysjoystick.c
     1.1 --- a/src/audio/emscripten/SDL_emscriptenaudio.c	Wed Aug 05 21:03:31 2015 +0200
     1.2 +++ b/src/audio/emscripten/SDL_emscriptenaudio.c	Wed Aug 05 21:04:10 2015 +0200
     1.3 @@ -263,6 +263,10 @@
     1.4          return 0;
     1.5      });
     1.6  
     1.7 +    if (!available) {
     1.8 +        SDL_SetError("No audio context available");
     1.9 +    }
    1.10 +
    1.11      return available;
    1.12  }
    1.13  
     2.1 --- a/src/joystick/emscripten/SDL_sysjoystick.c	Wed Aug 05 21:03:31 2015 +0200
     2.2 +++ b/src/joystick/emscripten/SDL_sysjoystick.c	Wed Aug 05 21:04:10 2015 +0200
     2.3 @@ -200,6 +200,7 @@
     2.4  
     2.5      /* Check if gamepad is supported by browser */
     2.6      if (numjs == EMSCRIPTEN_RESULT_NOT_SUPPORTED) {
     2.7 +        SDL_SetError("Gamepads not supported");
     2.8          return -1;
     2.9      }
    2.10  
    2.11 @@ -221,6 +222,7 @@
    2.12  
    2.13      if(retval != EMSCRIPTEN_RESULT_SUCCESS) {
    2.14          SDL_SYS_JoystickQuit();
    2.15 +        SDL_SetError("Could not set gamepad connect callback");
    2.16          return -1;
    2.17      }
    2.18  
    2.19 @@ -229,6 +231,7 @@
    2.20                                                           Emscripten_JoyStickDisconnected);
    2.21      if(retval != EMSCRIPTEN_RESULT_SUCCESS) {
    2.22          SDL_SYS_JoystickQuit();
    2.23 +        SDL_SetError("Could not set gamepad disconnect callback");
    2.24          return -1;
    2.25      }
    2.26