diff options
author | mattkae <mattkae@protonmail.com> | 2021-12-29 16:13:13 -0500 |
---|---|---|
committer | mattkae <mattkae@protonmail.com> | 2021-12-29 16:13:13 -0500 |
commit | 216f0a949c123be69410d855a3a389d3100bf741 (patch) | |
tree | c551d7643b60bde6ec71b3b1934696b7ec5dd939 /themes | |
parent | 2a8544e2d2534b138b7100ea8cfb30c21358adaf (diff) |
Fix for a terrible orange color
Diffstat (limited to 'themes')
-rw-r--r-- | themes/dist/output.js | 218 | ||||
-rwxr-xr-x | themes/dist/output.wasm | bin | 58861 -> 65641 bytes | |||
-rw-r--r-- | themes/main.cpp | 4 |
3 files changed, 143 insertions, 79 deletions
diff --git a/themes/dist/output.js b/themes/dist/output.js index 79b5f23..9a83997 100644 --- a/themes/dist/output.js +++ b/themes/dist/output.js @@ -68,6 +68,22 @@ var read_, readBinary, setWindowTitle; +// Normally we don't log exceptions but instead let them bubble out the top +// level where the embedding environment (e.g. the browser) can handle +// them. +// However under v8 and node we sometimes exit the process direcly in which case +// its up to use us to log the exception before exiting. +// If we fix https://github.com/emscripten-core/emscripten/issues/15080 +// this may no longer be needed under node. +function logExceptionOnExit(e) { + if (e instanceof ExitStatus) return; + var toLog = e; + if (e && typeof e === 'object' && e.stack) { + toLog = [e, e.stack]; + } + err('exiting due to exception: ' + toLog); +} + var nodeFS; var nodePath; @@ -126,13 +142,19 @@ readAsync = function readAsync(filename, onload, onerror) { } }); - process['on']('unhandledRejection', abort); + // Without this older versions of node (< v15) will log unhandled rejections + // but return 0, which is not normally the desired behaviour. This is + // not be needed with node v15 and about because it is now the default + // behaviour: + // See https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode + process['on']('unhandledRejection', function(reason) { throw reason; }); quit_ = function(status, toThrow) { if (keepRuntimeAlive()) { process['exitCode'] = status; throw toThrow; } + logExceptionOnExit(toThrow); process['exit'](status); }; @@ -170,7 +192,8 @@ if (ENVIRONMENT_IS_SHELL) { } if (typeof quit === 'function') { - quit_ = function(status) { + quit_ = function(status, toThrow) { + logExceptionOnExit(toThrow); quit(status); }; } @@ -197,8 +220,10 @@ if (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER) { // otherwise, slice off the final part of the url to find the script directory. // if scriptDirectory does not contain a slash, lastIndexOf will return -1, // and scriptDirectory will correctly be replaced with an empty string. + // If scriptDirectory contains a query (starting with ?) or a fragment (starting with #), + // they are removed because they could contain a slash. if (scriptDirectory.indexOf('blob:') !== 0) { - scriptDirectory = scriptDirectory.substr(0, scriptDirectory.lastIndexOf('/')+1); + scriptDirectory = scriptDirectory.substr(0, scriptDirectory.replace(/[?#].*/, "").lastIndexOf('/')+1); } else { scriptDirectory = ''; } @@ -253,8 +278,6 @@ if (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER) { throw new Error('environment detection error'); } -// Set up the out() and err() hooks, which are how we can print to stdout or -// stderr, respectively. var out = Module['print'] || console.log.bind(console); var err = Module['printErr'] || console.warn.bind(console); @@ -362,6 +385,7 @@ assert(!ENVIRONMENT_IS_SHELL, "shell environment detected but not enabled at bui var STACK_ALIGN = 16; +var POINTER_SIZE = 4; function getNativeTypeSize(type) { switch (type) { @@ -373,7 +397,7 @@ function getNativeTypeSize(type) { case 'double': return 8; default: { if (type[type.length-1] === '*') { - return 4; // A pointer + return POINTER_SIZE; } else if (type[0] === 'i') { var bits = Number(type.substr(1)); assert(bits % 8 === 0, 'getNativeTypeSize invalid bits ' + bits + ', type ' + type); @@ -502,19 +526,26 @@ function getEmptyTableSlot() { return wasmTable.length - 1; } -// Add a wasm function to the table. -function addFunctionWasm(func, sig) { +function updateTableMap(offset, count) { + for (var i = offset; i < offset + count; i++) { + var item = getWasmTableEntry(i); + // Ignore null values. + if (item) { + functionsInTableMap.set(item, i); + } + } +} + +// Add a function to the table. +// 'sig' parameter is required if the function being added is a JS function. +function addFunction(func, sig) { + assert(typeof func !== 'undefined'); + // Check if the function is already in the table, to ensure each function // gets a unique index. First, create the map if this is the first use. if (!functionsInTableMap) { functionsInTableMap = new WeakMap(); - for (var i = 0; i < wasmTable.length; i++) { - var item = wasmTable.get(i); - // Ignore null values. - if (item) { - functionsInTableMap.set(item, i); - } - } + updateTableMap(0, wasmTable.length); } if (functionsInTableMap.has(func)) { return functionsInTableMap.get(func); @@ -527,14 +558,14 @@ function addFunctionWasm(func, sig) { // Set the new value. try { // Attempting to call this with JS function will cause of table.set() to fail - wasmTable.set(ret, func); + setWasmTableEntry(ret, func); } catch (err) { if (!(err instanceof TypeError)) { throw err; } assert(typeof sig !== 'undefined', 'Missing signature argument to addFunction: ' + func); var wrapped = convertJsFunctionToWasm(func, sig); - wasmTable.set(ret, wrapped); + setWasmTableEntry(ret, wrapped); } functionsInTableMap.set(func, ret); @@ -543,18 +574,10 @@ function addFunctionWasm(func, sig) { } function removeFunction(index) { - functionsInTableMap.delete(wasmTable.get(index)); + functionsInTableMap.delete(getWasmTableEntry(index)); freeTableIndexes.push(index); } -// 'sig' parameter is required for the llvm backend but only when func is not -// already a WebAssembly function. -function addFunction(func, sig) { - assert(typeof func !== 'undefined'); - - return addFunctionWasm(func, sig); -} - // end include: runtime_functions.js // include: runtime_debug.js @@ -618,7 +641,7 @@ if (typeof WebAssembly !== 'object') { @param {number|boolean=} noSafe */ function setValue(ptr, value, type, noSafe) { type = type || 'i8'; - if (type.charAt(type.length-1) === '*') type = 'i32'; // pointers are 32-bit + if (type.charAt(type.length-1) === '*') type = 'i32'; switch (type) { case 'i1': HEAP8[((ptr)>>0)] = value; break; case 'i8': HEAP8[((ptr)>>0)] = value; break; @@ -636,7 +659,7 @@ function setValue(ptr, value, type, noSafe) { @param {number|boolean=} noSafe */ function getValue(ptr, type, noSafe) { type = type || 'i8'; - if (type.charAt(type.length-1) === '*') type = 'i32'; // pointers are 32-bit + if (type.charAt(type.length-1) === '*') type = 'i32'; switch (type) { case 'i1': return HEAP8[((ptr)>>0)]; case 'i8': return HEAP8[((ptr)>>0)]; @@ -644,7 +667,7 @@ function getValue(ptr, type, noSafe) { case 'i32': return HEAP32[((ptr)>>2)]; case 'i64': return HEAP32[((ptr)>>2)]; case 'float': return HEAPF32[((ptr)>>2)]; - case 'double': return HEAPF64[((ptr)>>3)]; + case 'double': return Number(HEAPF64[((ptr)>>3)]); default: abort('invalid type for getValue: ' + type); } return null; @@ -852,6 +875,7 @@ function UTF8ArrayToString(heap, idx, maxBytesToRead) { * @return {string} */ function UTF8ToString(ptr, maxBytesToRead) { + ; return ptr ? UTF8ArrayToString(HEAPU8, ptr, maxBytesToRead) : ''; } @@ -897,7 +921,7 @@ function stringToUTF8Array(str, heap, outIdx, maxBytesToWrite) { heap[outIdx++] = 0x80 | (u & 63); } else { if (outIdx + 3 >= endIdx) break; - if (u >= 0x200000) warnOnce('Invalid Unicode code point 0x' + u.toString(16) + ' encountered when serializing a JS string to a UTF-8 string in wasm memory! (Valid unicode code points should be in range 0-0x1FFFFF).'); + if (u > 0x10FFFF) warnOnce('Invalid Unicode code point 0x' + u.toString(16) + ' encountered when serializing a JS string to a UTF-8 string in wasm memory! (Valid unicode code points should be in range 0-0x10FFFF).'); heap[outIdx++] = 0xF0 | (u >> 18); heap[outIdx++] = 0x80 | ((u >> 12) & 63); heap[outIdx++] = 0x80 | ((u >> 6) & 63); @@ -1156,7 +1180,7 @@ function writeArrayToMemory(array, buffer) { /** @param {boolean=} dontAddNull */ function writeAsciiToMemory(str, buffer, dontAddNull) { for (var i = 0; i < str.length; ++i) { - assert(str.charCodeAt(i) === str.charCodeAt(i)&0xff); + assert(str.charCodeAt(i) === (str.charCodeAt(i) & 0xff)); HEAP8[((buffer++)>>0)] = str.charCodeAt(i); } // Null-terminate the pointer to the HEAP. @@ -1243,8 +1267,8 @@ function writeStackCookie() { var max = _emscripten_stack_get_end(); assert((max & 3) == 0); // The stack grows downwards - HEAPU32[(max >> 2)+1] = 0x2135467; - HEAPU32[(max >> 2)+2] = 0x89BACDFE; + HEAP32[((max + 4)>>2)] = 0x2135467; + HEAP32[((max + 8)>>2)] = 0x89BACDFE; // Also test the global address 0 for integrity. HEAP32[0] = 0x63736d65; /* 'emsc' */ } @@ -1252,10 +1276,10 @@ function writeStackCookie() { function checkStackCookie() { if (ABORT) return; var max = _emscripten_stack_get_end(); - var cookie1 = HEAPU32[(max >> 2)+1]; - var cookie2 = HEAPU32[(max >> 2)+2]; + var cookie1 = HEAPU32[((max + 4)>>2)]; + var cookie2 = HEAPU32[((max + 8)>>2)]; if (cookie1 != 0x2135467 || cookie2 != 0x89BACDFE) { - abort('Stack overflow! Stack cookie has been overwritten, expected hex dwords 0x89BACDFE and 0x2135467, but received 0x' + cookie2.toString(16) + ' ' + cookie1.toString(16)); + abort('Stack overflow! Stack cookie has been overwritten, expected hex dwords 0x89BACDFE and 0x2135467, but received 0x' + cookie2.toString(16) + ' 0x' + cookie1.toString(16)); } // Also test the global address 0 for integrity. if (HEAP32[0] !== 0x63736d65 /* 'emsc' */) abort('Runtime error: The application has corrupted its heap memory area (address zero)!'); @@ -1456,19 +1480,20 @@ Module["preloadedAudios"] = {}; // maps url to audio data /** @param {string|number=} what */ function abort(what) { - if (Module['onAbort']) { - Module['onAbort'](what); + { + if (Module['onAbort']) { + Module['onAbort'](what); + } } - what += ''; + what = 'Aborted(' + what + ')'; + // TODO(sbc): Should we remove printing and leave it up to whoever + // catches the exception? err(what); ABORT = true; EXITSTATUS = 1; - var output = 'abort(' + what + ') at ' + stackTrace(); - what = output; - // Use a wasm runtime error, because a JS error might be seen as a foreign // exception, which means we'd run destructors on it. We need the error to // simply make the program stop. @@ -1728,9 +1753,9 @@ var ASM_CONSTS = { var func = callback.func; if (typeof func === 'number') { if (callback.arg === undefined) { - wasmTable.get(func)(); + getWasmTableEntry(func)(); } else { - wasmTable.get(func)(callback.arg); + getWasmTableEntry(func)(callback.arg); } } else { func(callback.arg === undefined ? null : callback.arg); @@ -1738,6 +1763,12 @@ var ASM_CONSTS = { } } + function withStackSave(f) { + var stack = stackSave(); + var ret = f(); + stackRestore(stack); + return ret; + } function demangle(func) { warnOnce('warning: build with -s DEMANGLE_SUPPORT=1 to link in libcxxabi demangling'); return func; @@ -1753,6 +1784,29 @@ var ASM_CONSTS = { }); } + var wasmTableMirror = []; + function getWasmTableEntry(funcPtr) { + var func = wasmTableMirror[funcPtr]; + if (!func) { + if (funcPtr >= wasmTableMirror.length) wasmTableMirror.length = funcPtr + 1; + wasmTableMirror[funcPtr] = func = wasmTable.get(funcPtr); + } + assert(wasmTable.get(funcPtr) == func, "JavaScript-side Wasm function table mirror is out of date!"); + return func; + } + + function handleException(e) { + // Certain exception types we do not treat as errors since they are used for + // internal control flow. + // 1. ExitStatus, which is thrown by exit() + // 2. "unwind", which is thrown by emscripten_unwind_to_js_event_loop() and others + // that wish to return to JS event loop. + if (e instanceof ExitStatus || e == 'unwind') { + return EXITSTATUS; + } + quit_(1, e); + } + function jsStackTrace() { var error = new Error(); if (!error.stack) { @@ -1770,6 +1824,11 @@ var ASM_CONSTS = { return error.stack.toString(); } + function setWasmTableEntry(idx, func) { + wasmTable.set(idx, func); + wasmTableMirror[idx] = func; + } + function stackTrace() { var js = jsStackTrace(); if (Module['extraStackTrace']) js += '\n' + Module['extraStackTrace'](); @@ -1777,7 +1836,7 @@ var ASM_CONSTS = { } function _abort() { - abort(); + abort('native code called abort()'); } var JSEvents = {inEventHandler:0,removeAllEventListeners:function() { @@ -1920,7 +1979,7 @@ var ASM_CONSTS = { function _emscripten_request_animation_frame_loop(cb, userData) { function tick(timeStamp) { - if (wasmTable.get(cb)(timeStamp, userData)) { + if (getWasmTableEntry(cb)(timeStamp, userData)) { requestAnimationFrame(tick); } } @@ -1947,7 +2006,7 @@ var ASM_CONSTS = { // Memory resize rules: // 1. Always increase heap size to at least the requested size, rounded up to next page multiple. - // 2a. If MEMORY_GROWTH_LINEAR_STEP == -1, excessively resize the heap geometrically: increase the heap size according to + // 2a. If MEMORY_GROWTH_LINEAR_STEP == -1, excessively resize the heap geometrically: increase the heap size according to // MEMORY_GROWTH_GEOMETRIC_STEP factor (default +20%), // At most overreserve by MEMORY_GROWTH_GEOMETRIC_CAP bytes (default 96MB). // 2b. If MEMORY_GROWTH_LINEAR_STEP != -1, excessively resize the heap linearly: increase the heap size by at least MEMORY_GROWTH_LINEAR_STEP bytes. @@ -2030,7 +2089,7 @@ var ASM_CONSTS = { // TODO: Make this access thread safe, or this could update live while app is reading it. fillMouseEventData(JSEvents.mouseEvent, e, target); - if (wasmTable.get(callbackfunc)(eventTypeId, JSEvents.mouseEvent, userData)) e.preventDefault(); + if (getWasmTableEntry(callbackfunc)(eventTypeId, JSEvents.mouseEvent, userData)) e.preventDefault(); }; var eventHandler = { @@ -2077,7 +2136,7 @@ var ASM_CONSTS = { HEAP32[(((uiEvent)+(24))>>2)] = outerHeight; HEAP32[(((uiEvent)+(28))>>2)] = pageXOffset; HEAP32[(((uiEvent)+(32))>>2)] = pageYOffset; - if (wasmTable.get(callbackfunc)(eventTypeId, uiEvent, userData)) e.preventDefault(); + if (getWasmTableEntry(callbackfunc)(eventTypeId, uiEvent, userData)) e.preventDefault(); }; var eventHandler = { @@ -2455,14 +2514,6 @@ var ASM_CONSTS = { } Module["_emscripten_webgl_make_context_current"] = _emscripten_webgl_make_context_current; - function flush_NO_FILESYSTEM() { - // flush anything remaining in the buffers during shutdown - if (typeof _fflush !== 'undefined') _fflush(0); - var buffers = SYSCALLS.buffers; - if (buffers[1].length) SYSCALLS.printChar(1, 10); - if (buffers[2].length) SYSCALLS.printChar(2, 10); - } - var SYSCALLS = {mappings:{},buffers:[null,[],[]],printChar:function(stream, curr) { var buffer = SYSCALLS.buffers[stream]; assert(buffer); @@ -2485,18 +2536,36 @@ var ASM_CONSTS = { else assert(high === -1); return low; }}; + function _fd_close(fd) { + abort('it should not be possible to operate on streams when !SYSCALLS_REQUIRE_FILESYSTEM'); + return 0; + } + + function _fd_seek(fd, offset_low, offset_high, whence, newOffset) { + abort('it should not be possible to operate on streams when !SYSCALLS_REQUIRE_FILESYSTEM'); + } + + function flush_NO_FILESYSTEM() { + // flush anything remaining in the buffers during shutdown + if (typeof _fflush !== 'undefined') _fflush(0); + var buffers = SYSCALLS.buffers; + if (buffers[1].length) SYSCALLS.printChar(1, 10); + if (buffers[2].length) SYSCALLS.printChar(2, 10); + } function _fd_write(fd, iov, iovcnt, pnum) { + ; // hack to support printf in SYSCALLS_REQUIRE_FILESYSTEM=0 var num = 0; for (var i = 0; i < iovcnt; i++) { - var ptr = HEAP32[(((iov)+(i*8))>>2)]; - var len = HEAP32[(((iov)+(i*8 + 4))>>2)]; + var ptr = HEAP32[((iov)>>2)]; + var len = HEAP32[(((iov)+(4))>>2)]; + iov += 8; for (var j = 0; j < len; j++) { SYSCALLS.printChar(fd, HEAPU8[ptr+j]); } num += len; } - HEAP32[((pnum)>>2)] = num + HEAP32[((pnum)>>2)] = num; return 0; } @@ -2971,6 +3040,7 @@ var ASM_CONSTS = { } function _time(ptr) { + ; var ret = (Date.now()/1000)|0; if (ptr) { HEAP32[((ptr)>>2)] = ret; @@ -3024,6 +3094,8 @@ var asmLibraryArg = { "emscripten_webgl_create_context": _emscripten_webgl_create_context, "emscripten_webgl_init_context_attributes": _emscripten_webgl_init_context_attributes, "emscripten_webgl_make_context_current": _emscripten_webgl_make_context_current, + "fd_close": _fd_close, + "fd_seek": _fd_seek, "fd_write": _fd_write, "glAttachShader": _glAttachShader, "glBindBuffer": _glBindBuffer, @@ -3167,6 +3239,7 @@ if (!Object.getOwnPropertyDescriptor(Module, "stringToNewUTF8")) Module["stringT if (!Object.getOwnPropertyDescriptor(Module, "setFileTime")) Module["setFileTime"] = function() { abort("'setFileTime' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)") }; if (!Object.getOwnPropertyDescriptor(Module, "emscripten_realloc_buffer")) Module["emscripten_realloc_buffer"] = function() { abort("'emscripten_realloc_buffer' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)") }; if (!Object.getOwnPropertyDescriptor(Module, "ENV")) Module["ENV"] = function() { abort("'ENV' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)") }; +if (!Object.getOwnPropertyDescriptor(Module, "withStackSave")) Module["withStackSave"] = function() { abort("'withStackSave' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)") }; if (!Object.getOwnPropertyDescriptor(Module, "ERRNO_CODES")) Module["ERRNO_CODES"] = function() { abort("'ERRNO_CODES' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)") }; if (!Object.getOwnPropertyDescriptor(Module, "ERRNO_MESSAGES")) Module["ERRNO_MESSAGES"] = function() { abort("'ERRNO_MESSAGES' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)") }; if (!Object.getOwnPropertyDescriptor(Module, "setErrNo")) Module["setErrNo"] = function() { abort("'setErrNo' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)") }; @@ -3184,7 +3257,6 @@ if (!Object.getOwnPropertyDescriptor(Module, "Sockets")) Module["Sockets"] = fun if (!Object.getOwnPropertyDescriptor(Module, "getRandomDevice")) Module["getRandomDevice"] = function() { abort("'getRandomDevice' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)") }; if (!Object.getOwnPropertyDescriptor(Module, "traverseStack")) Module["traverseStack"] = function() { abort("'traverseStack' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)") }; if (!Object.getOwnPropertyDescriptor(Module, "UNWIND_CACHE")) Module["UNWIND_CACHE"] = function() { abort("'UNWIND_CACHE' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)") }; -if (!Object.getOwnPropertyDescriptor(Module, "withBuiltinMalloc")) Module["withBuiltinMalloc"] = function() { abort("'withBuiltinMalloc' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)") }; if (!Object.getOwnPropertyDescriptor(Module, "readAsmConstArgsArray")) Module["readAsmConstArgsArray"] = function() { abort("'readAsmConstArgsArray' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)") }; if (!Object.getOwnPropertyDescriptor(Module, "readAsmConstArgs")) Module["readAsmConstArgs"] = function() { abort("'readAsmConstArgs' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)") }; if (!Object.getOwnPropertyDescriptor(Module, "mainThreadEM_ASM")) Module["mainThreadEM_ASM"] = function() { abort("'mainThreadEM_ASM' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)") }; @@ -3197,6 +3269,9 @@ if (!Object.getOwnPropertyDescriptor(Module, "dynCallLegacy")) Module["dynCallLe if (!Object.getOwnPropertyDescriptor(Module, "getDynCaller")) Module["getDynCaller"] = function() { abort("'getDynCaller' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)") }; if (!Object.getOwnPropertyDescriptor(Module, "dynCall")) Module["dynCall"] = function() { abort("'dynCall' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)") }; if (!Object.getOwnPropertyDescriptor(Module, "callRuntimeCallbacks")) Module["callRuntimeCallbacks"] = function() { abort("'callRuntimeCallbacks' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)") }; +if (!Object.getOwnPropertyDescriptor(Module, "wasmTableMirror")) Module["wasmTableMirror"] = function() { abort("'wasmTableMirror' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)") }; +if (!Object.getOwnPropertyDescriptor(Module, "setWasmTableEntry")) Module["setWasmTableEntry"] = function() { abort("'setWasmTableEntry' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)") }; +if (!Object.getOwnPropertyDescriptor(Module, "getWasmTableEntry")) Module["getWasmTableEntry"] = function() { abort("'getWasmTableEntry' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)") }; if (!Object.getOwnPropertyDescriptor(Module, "handleException")) Module["handleException"] = function() { abort("'handleException' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)") }; if (!Object.getOwnPropertyDescriptor(Module, "runtimeKeepalivePush")) Module["runtimeKeepalivePush"] = function() { abort("'runtimeKeepalivePush' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)") }; if (!Object.getOwnPropertyDescriptor(Module, "runtimeKeepalivePop")) Module["runtimeKeepalivePop"] = function() { abort("'runtimeKeepalivePop' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)") }; @@ -3262,7 +3337,6 @@ if (!Object.getOwnPropertyDescriptor(Module, "battery")) Module["battery"] = fun if (!Object.getOwnPropertyDescriptor(Module, "registerBatteryEventCallback")) Module["registerBatteryEventCallback"] = function() { abort("'registerBatteryEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)") }; if (!Object.getOwnPropertyDescriptor(Module, "setCanvasElementSize")) Module["setCanvasElementSize"] = function() { abort("'setCanvasElementSize' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)") }; if (!Object.getOwnPropertyDescriptor(Module, "getCanvasElementSize")) Module["getCanvasElementSize"] = function() { abort("'getCanvasElementSize' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)") }; -if (!Object.getOwnPropertyDescriptor(Module, "polyfillSetImmediate")) Module["polyfillSetImmediate"] = function() { abort("'polyfillSetImmediate' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)") }; if (!Object.getOwnPropertyDescriptor(Module, "demangle")) Module["demangle"] = function() { abort("'demangle' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)") }; if (!Object.getOwnPropertyDescriptor(Module, "demangleAll")) Module["demangleAll"] = function() { abort("'demangleAll' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)") }; if (!Object.getOwnPropertyDescriptor(Module, "jsStackTrace")) Module["jsStackTrace"] = function() { abort("'jsStackTrace' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)") }; @@ -3279,6 +3353,9 @@ if (!Object.getOwnPropertyDescriptor(Module, "readI53FromI64")) Module["readI53F if (!Object.getOwnPropertyDescriptor(Module, "readI53FromU64")) Module["readI53FromU64"] = function() { abort("'readI53FromU64' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)") }; if (!Object.getOwnPropertyDescriptor(Module, "convertI32PairToI53")) Module["convertI32PairToI53"] = function() { abort("'convertI32PairToI53' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)") }; if (!Object.getOwnPropertyDescriptor(Module, "convertU32PairToI53")) Module["convertU32PairToI53"] = function() { abort("'convertU32PairToI53' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)") }; +if (!Object.getOwnPropertyDescriptor(Module, "setImmediateWrapped")) Module["setImmediateWrapped"] = function() { abort("'setImmediateWrapped' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)") }; +if (!Object.getOwnPropertyDescriptor(Module, "clearImmediateWrapped")) Module["clearImmediateWrapped"] = function() { abort("'clearImmediateWrapped' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)") }; +if (!Object.getOwnPropertyDescriptor(Module, "polyfillSetImmediate")) Module["polyfillSetImmediate"] = function() { abort("'polyfillSetImmediate' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)") }; if (!Object.getOwnPropertyDescriptor(Module, "uncaughtExceptionCount")) Module["uncaughtExceptionCount"] = function() { abort("'uncaughtExceptionCount' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)") }; if (!Object.getOwnPropertyDescriptor(Module, "exceptionLast")) Module["exceptionLast"] = function() { abort("'exceptionLast' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)") }; if (!Object.getOwnPropertyDescriptor(Module, "exceptionCaught")) Module["exceptionCaught"] = function() { abort("'exceptionCaught' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)") }; @@ -3390,23 +3467,10 @@ function callMain(args) { // execution is asynchronously handed off to a pthread. // if we're not running an evented main loop, it's time to exit exit(ret, /* implicit = */ true); + return ret; } catch (e) { - // Certain exception types we do not treat as errors since they are used for - // internal control flow. - // 1. ExitStatus, which is thrown by exit() - // 2. "unwind", which is thrown by emscripten_unwind_to_js_event_loop() and others - // that wish to return to JS event loop. - if (e instanceof ExitStatus || e == 'unwind') { - return; - } - // Anything else is an unexpected exception and we treat it as hard error. - var toLog = e; - if (e && typeof e === 'object' && e.stack) { - toLog = [e, e.stack]; - } - err('exception thrown: ' + toLog); - quit_(1, e); + return handleException(e); } finally { calledMain = true; diff --git a/themes/dist/output.wasm b/themes/dist/output.wasm Binary files differindex dff138e..202295c 100755 --- a/themes/dist/output.wasm +++ b/themes/dist/output.wasm diff --git a/themes/main.cpp b/themes/main.cpp index e037dcf..54d303d 100644 --- a/themes/main.cpp +++ b/themes/main.cpp @@ -113,9 +113,9 @@ EM_BOOL selectAutumn(int eventType, const EmscriptenMouseEvent* mouseEvent, void return true; } -// -- Autumn theme3 +// -- Autumn theme void AutumnTheme::load(Renderer2d* renderer) { - renderer->clearColor = Vector4(252,76,2, 0.5).toNormalizedColor(); + renderer->clearColor = Vector4(252, 210, 153, 125).toNormalizedColor(); auto lr = tree.load(renderer); leafParticles.load(renderer, &lr); } |