workaround to make SDL behave with latest emscripten

This commit is contained in:
Andrei Alexeyev 2019-03-20 09:33:57 +02:00
parent cc68cca430
commit 52742d8d99
No known key found for this signature in database
GPG key ID: 363707CD4C7FE8A4
2 changed files with 14 additions and 3 deletions

View file

@ -7,6 +7,14 @@ Module['preRun'].push(function() {
FS.mkdir('/persistent');
FS.mount(IDBFS, {}, '/persistent');
// This function has been removed from Emscripten, but SDL still uses it...
Module['Pointer_stringify'] = function(ptr) {
return UTF8ToString(ptr);
}
Pointer_stringify = Module['Pointer_stringify']
window.Pointer_stringify = Module['Pointer_stringify']
});
function SyncFS(is_load, ccptr) {

View file

@ -76,9 +76,12 @@ static bool em_audio_workaround(SDL_Event *event, void *arg) {
// Will start playing audio as soon as the first input occurs.
(__extension__ EM_ASM({
var audioctx = Module['SDL2'].audioContext;
if(audioctx !== undefined) {
audioctx.resume();
var sdl2 = Module['SDL2'];
if(sdl2 !== undefined) {
var audioctx = sdl2.audioContext;
if(audioctx !== undefined) {
audioctx.resume();
}
}
}));