diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/library_browser.js | 17 | ||||
-rw-r--r-- | src/library_sdl.js | 1 | ||||
-rw-r--r-- | src/runtime.js | 9 |
3 files changed, 24 insertions, 3 deletions
diff --git a/src/library_browser.js b/src/library_browser.js index 2317ca47..fce7bdd5 100644 --- a/src/library_browser.js +++ b/src/library_browser.js @@ -702,15 +702,22 @@ mergeInto(LibraryManager.library, { emscripten_async_wget: function(url, file, onload, onerror) { var _url = Pointer_stringify(url); var _file = Pointer_stringify(file); + function doCallback(callback) { + if (callback) { + var stack = Runtime.stackSave(); + Runtime.dynCall('vi', callback, [allocate(intArrayFromString(_file), 'i8', ALLOC_STACK)]); + Runtime.stackRestore(stack); + } + } FS.createPreloadedFile( PATH.dirname(_file), PATH.basename(_file), _url, true, true, function() { - if (onload) Runtime.dynCall('vi', onload, [file]); + doCallback(onload); }, function() { - if (onerror) Runtime.dynCall('vi', onerror, [file]); + doCallback(onerror); } ); }, @@ -741,7 +748,11 @@ mergeInto(LibraryManager.library, { http.onload = function http_onload(e) { if (http.status == 200) { FS.createDataFile( _file.substr(0, index), _file.substr(index + 1), new Uint8Array(http.response), true, true); - if (onload) Runtime.dynCall('vii', onload, [arg, file]); + if (onload) { + var stack = Runtime.stackSave(); + Runtime.dynCall('vii', onload, [arg, allocate(intArrayFromString(_file), 'i8', ALLOC_STACK)]); + Runtime.stackRestore(stack); + } } else { if (onerror) Runtime.dynCall('vii', onerror, [arg, http.status]); } diff --git a/src/library_sdl.js b/src/library_sdl.js index b630ca5c..ae384d22 100644 --- a/src/library_sdl.js +++ b/src/library_sdl.js @@ -814,6 +814,7 @@ var LibrarySDL = { } case 'touchstart': case 'touchend': case 'touchmove': { var touch = event.touch; + if (!Browser.touches[touch.identifier]) break; var w = Module['canvas'].width; var h = Module['canvas'].height; var x = Browser.touches[touch.identifier].x / w; diff --git a/src/runtime.js b/src/runtime.js index 63610d3b..4466a308 100644 --- a/src/runtime.js +++ b/src/runtime.js @@ -96,6 +96,15 @@ function unInline(name_, params) { } var Runtime = { + // When a 64 bit long is returned from a compiled function the least significant + // 32 bit word is passed in the return value, but the most significant 32 bit + // word is placed in tempRet0. This provides an accessor for that value. + setTempRet0: function(value) { + tempRet0 = value; + }, + getTempRet0: function() { + return tempRet0; + }, stackSave: function() { return STACKTOP; }, |