Skip to content

Commit

Permalink
Emscripten: Added missing error messages for audio and joystick init …
Browse files Browse the repository at this point in the history
…failures.
  • Loading branch information
philippwiesemann committed Aug 5, 2015
1 parent 2d8c49f commit fcc5940
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/audio/emscripten/SDL_emscriptenaudio.c
Expand Up @@ -263,6 +263,10 @@ Emscripten_Init(SDL_AudioDriverImpl * impl)
return 0;
});

if (!available) {
SDL_SetError("No audio context available");
}

return available;
}

Expand Down
3 changes: 3 additions & 0 deletions src/joystick/emscripten/SDL_sysjoystick.c
Expand Up @@ -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;
}

Expand All @@ -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;
}

Expand All @@ -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;
}

Expand Down

0 comments on commit fcc5940

Please sign in to comment.