summaryrefslogtreecommitdiff
path: root/themes
diff options
context:
space:
mode:
authormattkae <mattkae@protonmail.com>2022-12-23 12:34:10 -0500
committermattkae <mattkae@protonmail.com>2022-12-23 12:34:10 -0500
commitf63d0af456f76d713e56ca17be114fba0af22f6c (patch)
tree87fd6b84882ad08fc3c47d3c4b899d0119eb044c /themes
parent4ac5e377a8ff514180082d92b38369a920ef02d1 (diff)
Yeeting all of the snowflakes at once
Diffstat (limited to 'themes')
-rw-r--r--themes/Snowflake.cpp27
-rw-r--r--themes/Snowflake.h1
-rw-r--r--themes/dist/output.js279
-rwxr-xr-xthemes/dist/output.wasmbin134949 -> 135615 bytes
-rw-r--r--themes/list.h4
5 files changed, 154 insertions, 157 deletions
diff --git a/themes/Snowflake.cpp b/themes/Snowflake.cpp
index 186c97a..1cb056a 100644
--- a/themes/Snowflake.cpp
+++ b/themes/Snowflake.cpp
@@ -2,6 +2,7 @@
#include "Renderer2d.h"
#include "mathlib.h"
#include "list.h"
+#include <cstdio>
const Vector4 snowColor = Vector4(1.0, 0.98, 0.98, 1);
@@ -36,22 +37,8 @@ inline void initFlake(SnowflakeParticleRenderer* renderer, SnowflakeUpdateData*
ud->vtxIdx = renderer->vertices.numElements;
generateSnowflakeShape(&renderer->vertices, randomIntBetween(4, 16), randomFloatBetween(8.f, 16.f), randomFloatBetween(2.f, 6.f));
ud->numVertices = renderer->vertices.numElements - ud->vtxIdx;
- ud->isAlive = false;
-}
-
-inline void spawnFlake(SnowflakeParticleRenderer* renderer, SnowflakeUpdateData* ud) {
ud->velocity = Vector2(randomFloatBetween(-10, 10), randomFloatBetween(-100, -85));
ud->position = Vector2(randomFloatBetween(0, renderer->xMax), randomFloatBetween(renderer->yMax, renderer->yMax + 256));
- ud->isAlive = true;
-}
-
-inline void findAndSpawnNextFlake(SnowflakeParticleRenderer* renderer) {
- for (i32 i = 0; i < renderer->numSnowflakes; i++) {
- if (!renderer->updateData[i].isAlive) {
- spawnFlake(renderer, &renderer->updateData[i]);
- break;
- }
- }
}
void SnowflakeParticleRenderer::load(SnowflakeLoadParameters params, Renderer2d* renderer) {
@@ -63,6 +50,9 @@ void SnowflakeParticleRenderer::load(SnowflakeLoadParameters params, Renderer2d*
xMax = static_cast<f32>(renderer->context->width);
yMax = static_cast<f32>(renderer->context->height);
+ vertices.deallocate();
+ vertices.growDynamically = true;
+
// Initialize each snow flake with its shape
for (i32 s = 0; s < numSnowflakes; s++) {
auto ud = &updateData[s];
@@ -101,17 +91,9 @@ void SnowflakeParticleRenderer::load(SnowflakeLoadParameters params, Renderer2d*
}
inline void updateFlake(SnowflakeParticleRenderer* renderer, SnowflakeUpdateData* ud, i32 s, f32 dtSeconds, bool addWind) {
- if (!ud->isAlive) {
- return;
- }
-
if (addWind) ud->velocity += renderer->windSpeed;
ud->position += ud->velocity * dtSeconds;
- if (ud->position.y < 0) {
- ud->isAlive = false;
- }
-
Mat4x4 m = Mat4x4().translateByVec2(ud->position);
for (i32 v = ud->vtxIdx; v < (ud->vtxIdx + ud->numVertices); v++) {
renderer->vertices.data[v].vMatrix = m;
@@ -122,7 +104,6 @@ void SnowflakeParticleRenderer::update(f32 dtSeconds) {
timeUntilNextSpawnSeconds -= dtSeconds;
if (timeUntilNextSpawnSeconds < 0) {
timeUntilNextSpawnSeconds = spawnIntervalSeconds;
- findAndSpawnNextFlake(this);
}
bool addWind = false;
diff --git a/themes/Snowflake.h b/themes/Snowflake.h
index ae0c82f..5ad2670 100644
--- a/themes/Snowflake.h
+++ b/themes/Snowflake.h
@@ -21,7 +21,6 @@ struct SnowflakeUpdateData {
Vector2 velocity;
Vector2 position;
f32 rotation;
- bool isAlive = false;
bool onGround = false;
i32 vtxIdx = 0;
diff --git a/themes/dist/output.js b/themes/dist/output.js
index 83ee836..079be8d 100644
--- a/themes/dist/output.js
+++ b/themes/dist/output.js
@@ -479,13 +479,15 @@ function assert(condition, text) {
// include: runtime_strings.js
-// runtime_strings.js: Strings related runtime functions that are part of both MINIMAL_RUNTIME and regular runtime.
+// runtime_strings.js: String related runtime functions that are part of both
+// MINIMAL_RUNTIME and regular runtime.
var UTF8Decoder = typeof TextDecoder != 'undefined' ? new TextDecoder('utf8') : undefined;
-// Given a pointer 'ptr' to a null-terminated UTF8-encoded string in the given array that contains uint8 values, returns
-// a copy of that string as a Javascript String object.
/**
+ * Given a pointer 'idx' to a null-terminated UTF8-encoded string in the given
+ * array that contains uint8 values, returns a copy of that string as a
+ * Javascript String object.
* heapOrArray is either a regular array, or a JavaScript typed array view.
* @param {number} idx
* @param {number=} maxBytesToRead
@@ -494,16 +496,19 @@ var UTF8Decoder = typeof TextDecoder != 'undefined' ? new TextDecoder('utf8') :
function UTF8ArrayToString(heapOrArray, idx, maxBytesToRead) {
var endIdx = idx + maxBytesToRead;
var endPtr = idx;
- // TextDecoder needs to know the byte length in advance, it doesn't stop on null terminator by itself.
- // Also, use the length info to avoid running tiny strings through TextDecoder, since .subarray() allocates garbage.
- // (As a tiny code save trick, compare endPtr against endIdx using a negation, so that undefined means Infinity)
+ // TextDecoder needs to know the byte length in advance, it doesn't stop on
+ // null terminator by itself. Also, use the length info to avoid running tiny
+ // strings through TextDecoder, since .subarray() allocates garbage.
+ // (As a tiny code save trick, compare endPtr against endIdx using a negation,
+ // so that undefined means Infinity)
while (heapOrArray[endPtr] && !(endPtr >= endIdx)) ++endPtr;
if (endPtr - idx > 16 && heapOrArray.buffer && UTF8Decoder) {
return UTF8Decoder.decode(heapOrArray.subarray(idx, endPtr));
}
var str = '';
- // If building with TextDecoder, we have already computed the string length above, so test loop end condition against that
+ // If building with TextDecoder, we have already computed the string length
+ // above, so test loop end condition against that
while (idx < endPtr) {
// For UTF8 byte structure, see:
// http://en.wikipedia.org/wiki/UTF-8#Description
@@ -531,48 +536,63 @@ function UTF8ArrayToString(heapOrArray, idx, maxBytesToRead) {
return str;
}
-// Given a pointer 'ptr' to a null-terminated UTF8-encoded string in the emscripten HEAP, returns a
-// copy of that string as a Javascript String object.
-// maxBytesToRead: an optional length that specifies the maximum number of bytes to read. You can omit
-// this parameter to scan the string until the first \0 byte. If maxBytesToRead is
-// passed, and the string at [ptr, ptr+maxBytesToReadr[ contains a null byte in the
-// middle, then the string will cut short at that byte index (i.e. maxBytesToRead will
-// not produce a string of exact length [ptr, ptr+maxBytesToRead[)
-// N.B. mixing frequent uses of UTF8ToString() with and without maxBytesToRead may
-// throw JS JIT optimizations off, so it is worth to consider consistently using one
-// style or the other.
/**
+ * Given a pointer 'ptr' to a null-terminated UTF8-encoded string in the
+ * emscripten HEAP, returns a copy of that string as a Javascript String object.
+ *
* @param {number} ptr
- * @param {number=} maxBytesToRead
+ * @param {number=} maxBytesToRead - An optional length that specifies the
+ * maximum number of bytes to read. You can omit this parameter to scan the
+ * string until the first \0 byte. If maxBytesToRead is passed, and the string
+ * at [ptr, ptr+maxBytesToReadr[ contains a null byte in the middle, then the
+ * string will cut short at that byte index (i.e. maxBytesToRead will not
+ * produce a string of exact length [ptr, ptr+maxBytesToRead[) N.B. mixing
+ * frequent uses of UTF8ToString() with and without maxBytesToRead may throw
+ * JS JIT optimizations off, so it is worth to consider consistently using one
* @return {string}
*/
function UTF8ToString(ptr, maxBytesToRead) {
return ptr ? UTF8ArrayToString(HEAPU8, ptr, maxBytesToRead) : '';
}
-// Copies the given Javascript String object 'str' to the given byte array at address 'outIdx',
-// encoded in UTF8 form and null-terminated. The copy will require at most str.length*4+1 bytes of space in the HEAP.
-// Use the function lengthBytesUTF8 to compute the exact number of bytes (excluding null terminator) that this function will write.
-// Parameters:
-// str: the Javascript string to copy.
-// heap: the array to copy to. Each index in this array is assumed to be one 8-byte element.
-// outIdx: The starting offset in the array to begin the copying.
-// maxBytesToWrite: The maximum number of bytes this function can write to the array.
-// This count should include the null terminator,
-// i.e. if maxBytesToWrite=1, only the null terminator will be written and nothing else.
-// maxBytesToWrite=0 does not write any bytes to the output, not even the null terminator.
-// Returns the number of bytes written, EXCLUDING the null terminator.
-
+/**
+ * Copies the given Javascript String object 'str' to the given byte array at
+ * address 'outIdx', encoded in UTF8 form and null-terminated. The copy will
+ * require at most str.length*4+1 bytes of space in the HEAP. Use the function
+ * lengthBytesUTF8 to compute the exact number of bytes (excluding null
+ * terminator) that this function will write.
+ *
+ * @param {string} str - The Javascript string to copy.
+ * @param {ArrayBufferView|Array<number>} heap - The array to copy to. Each
+ * index in this array is assumed
+ * to be one 8-byte element.
+ * @param {number} outIdx - The starting offset in the array to begin the copying.
+ * @param {number} maxBytesToWrite - The maximum number of bytes this function
+ * can write to the array. This count should
+ * include the null terminator, i.e. if
+ * maxBytesToWrite=1, only the null terminator
+ * will be written and nothing else.
+ * maxBytesToWrite=0 does not write any bytes
+ * to the output, not even the null
+ * terminator.
+ * @return {number} The number of bytes written, EXCLUDING the null terminator.
+ */
function stringToUTF8Array(str, heap, outIdx, maxBytesToWrite) {
- if (!(maxBytesToWrite > 0)) // Parameter maxBytesToWrite is not optional. Negative values, 0, null, undefined and false each don't write out any bytes.
+ // Parameter maxBytesToWrite is not optional. Negative values, 0, null,
+ // undefined and false each don't write out any bytes.
+ if (!(maxBytesToWrite > 0))
return 0;
var startIdx = outIdx;
var endIdx = outIdx + maxBytesToWrite - 1; // -1 for string null terminator.
for (var i = 0; i < str.length; ++i) {
- // Gotcha: charCodeAt returns a 16-bit word that is a UTF-16 encoded code unit, not a Unicode code point of the character! So decode UTF16->UTF32->UTF8.
+ // Gotcha: charCodeAt returns a 16-bit word that is a UTF-16 encoded code
+ // unit, not a Unicode code point of the character! So decode
+ // UTF16->UTF32->UTF8.
// See http://unicode.org/faq/utf_bom.html#utf16-3
- // For UTF8 byte structure, see http://en.wikipedia.org/wiki/UTF-8#Description and https://www.ietf.org/rfc/rfc2279.txt and https://tools.ietf.org/html/rfc3629
+ // For UTF8 byte structure, see http://en.wikipedia.org/wiki/UTF-8#Description
+ // and https://www.ietf.org/rfc/rfc2279.txt
+ // and https://tools.ietf.org/html/rfc3629
var u = str.charCodeAt(i); // possibly a lead surrogate
if (u >= 0xD800 && u <= 0xDFFF) {
var u1 = str.charCodeAt(++i);
@@ -604,21 +624,33 @@ function stringToUTF8Array(str, heap, outIdx, maxBytesToWrite) {
return outIdx - startIdx;
}
-// Copies the given Javascript String object 'str' to the emscripten HEAP at address 'outPtr',
-// null-terminated and encoded in UTF8 form. The copy will require at most str.length*4+1 bytes of space in the HEAP.
-// Use the function lengthBytesUTF8 to compute the exact number of bytes (excluding null terminator) that this function will write.
-// Returns the number of bytes written, EXCLUDING the null terminator.
-
+/**
+ * Copies the given Javascript String object 'str' to the emscripten HEAP at
+ * address 'outPtr', null-terminated and encoded in UTF8 form. The copy will
+ * require at most str.length*4+1 bytes of space in the HEAP.
+ * Use the function lengthBytesUTF8 to compute the exact number of bytes
+ * (excluding null terminator) that this function will write.
+ *
+ * @return {number} The number of bytes written, EXCLUDING the null terminator.
+ */
function stringToUTF8(str, outPtr, maxBytesToWrite) {
assert(typeof maxBytesToWrite == 'number', 'stringToUTF8(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!');
return stringToUTF8Array(str, HEAPU8,outPtr, maxBytesToWrite);
}
-// Returns the number of bytes the given Javascript string takes if encoded as a UTF8 byte array, EXCLUDING the null terminator byte.
+/**
+ * Returns the number of bytes the given Javascript string takes if encoded as a
+ * UTF8 byte array, EXCLUDING the null terminator byte.
+ *
+ * @param {string} str - JavaScript string to operator on
+ * @return {number} Length, in bytes, of the UTF8 encoded string.
+ */
function lengthBytesUTF8(str) {
var len = 0;
for (var i = 0; i < str.length; ++i) {
- // Gotcha: charCodeAt returns a 16-bit word that is a UTF-16 encoded code unit, not a Unicode code point of the character! So decode UTF16->UTF32->UTF8.
+ // Gotcha: charCodeAt returns a 16-bit word that is a UTF-16 encoded code
+ // unit, not a Unicode code point of the character! So decode
+ // UTF16->UTF32->UTF8.
// See http://unicode.org/faq/utf_bom.html#utf16-3
var c = str.charCodeAt(i); // possibly a lead surrogate
if (c <= 0x7F) {
@@ -669,12 +701,12 @@ function updateGlobalBufferAndViews(buf) {
Module['HEAPF64'] = HEAPF64 = new Float64Array(buf);
}
-var TOTAL_STACK = 5242880;
-if (Module['TOTAL_STACK']) assert(TOTAL_STACK === Module['TOTAL_STACK'], 'the stack size can no longer be determined at runtime')
+var STACK_SIZE = 5242880;
+if (Module['STACK_SIZE']) assert(STACK_SIZE === Module['STACK_SIZE'], 'the stack size can no longer be determined at runtime')
var INITIAL_MEMORY = Module['INITIAL_MEMORY'] || 16777216;legacyModuleProp('INITIAL_MEMORY', 'INITIAL_MEMORY');
-assert(INITIAL_MEMORY >= TOTAL_STACK, 'INITIAL_MEMORY should be larger than TOTAL_STACK, was ' + INITIAL_MEMORY + '! (TOTAL_STACK=' + TOTAL_STACK + ')');
+assert(INITIAL_MEMORY >= STACK_SIZE, 'INITIAL_MEMORY should be larger than STACK_SIZE, was ' + INITIAL_MEMORY + '! (STACK_SIZE=' + STACK_SIZE + ')');
// check for full engine support (use string 'subarray' to avoid closure compiler confusion)
assert(typeof Int32Array != 'undefined' && typeof Float64Array !== 'undefined' && Int32Array.prototype.subarray != undefined && Int32Array.prototype.set != undefined,
@@ -905,10 +937,8 @@ function removeRunDependency(id) {
/** @param {string|number=} what */
function abort(what) {
- {
- if (Module['onAbort']) {
- Module['onAbort'](what);
- }
+ if (Module['onAbort']) {
+ Module['onAbort'](what);
}
what = 'Aborted(' + what + ')';
@@ -1206,27 +1236,6 @@ var ASM_CONSTS = {
}
}
- function withStackSave(f) {
- var stack = stackSave();
- var ret = f();
- stackRestore(stack);
- return ret;
- }
- function demangle(func) {
- warnOnce('warning: build with -sDEMANGLE_SUPPORT to link in libcxxabi demangling');
- return func;
- }
-
- function demangleAll(text) {
- var regex =
- /\b_Z[\w\d_]+/g;
- return text.replace(regex,
- function(x) {
- var y = demangle(x);
- return x === y ? x : (y + ' [' + x + ']');
- });
- }
-
/**
* @param {number} ptr
@@ -1248,35 +1257,6 @@ var ASM_CONSTS = {
return null;
}
- 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) {
- // IE10+ special cases: It does have callstack info, but it is only
- // populated if an Error object is thrown, so try that as a special-case.
- try {
- throw new Error();
- } catch(e) {
- error = e;
- }
- if (!error.stack) {
- return '(no stack trace available)';
- }
- }
- return error.stack.toString();
- }
-
/**
* @param {number} ptr
@@ -1298,12 +1278,6 @@ var ASM_CONSTS = {
}
}
- function stackTrace() {
- var js = jsStackTrace();
- if (Module['extraStackTrace']) js += '\n' + Module['extraStackTrace']();
- return demangleAll(js);
- }
-
function warnOnce(text) {
if (!warnOnce.shown) warnOnce.shown = {};
if (!warnOnce.shown[text]) {
@@ -1313,11 +1287,6 @@ var ASM_CONSTS = {
}
}
- function writeArrayToMemory(array, buffer) {
- assert(array.length >= 0, 'writeArrayToMemory array must have a length (should be an array or typed array)')
- HEAP8.set(array, buffer);
- }
-
function __emscripten_fetch_free(id) {
var xhr = Fetch.xhrs[id];
if (xhr) {
@@ -1332,6 +1301,21 @@ var ASM_CONSTS = {
function readI53FromI64(ptr) {
return HEAPU32[ptr>>2] + HEAP32[ptr+4>>2] * 4294967296;
}
+
+ function __isLeapYear(year) {
+ return year%4 === 0 && (year%100 !== 0 || year%400 === 0);
+ }
+
+ var __MONTH_DAYS_LEAP_CUMULATIVE = [0,31,60,91,121,152,182,213,244,274,305,335];
+
+ var __MONTH_DAYS_REGULAR_CUMULATIVE = [0,31,59,90,120,151,181,212,243,273,304,334];
+ function __yday_from_date(date) {
+ var isLeapYear = __isLeapYear(date.getFullYear());
+ var monthDaysCumulative = (isLeapYear ? __MONTH_DAYS_LEAP_CUMULATIVE : __MONTH_DAYS_REGULAR_CUMULATIVE);
+ var yday = monthDaysCumulative[date.getMonth()] + date.getDate() - 1; // -1 since it's days since Jan 1
+
+ return yday;
+ }
function __localtime_js(time, tmPtr) {
var date = new Date(readI53FromI64(time)*1000);
HEAP32[((tmPtr)>>2)] = date.getSeconds();
@@ -1342,12 +1326,12 @@ var ASM_CONSTS = {
HEAP32[(((tmPtr)+(20))>>2)] = date.getFullYear()-1900;
HEAP32[(((tmPtr)+(24))>>2)] = date.getDay();
- var start = new Date(date.getFullYear(), 0, 1);
- var yday = ((date.getTime() - start.getTime()) / (1000 * 60 * 60 * 24))|0;
+ var yday = __yday_from_date(date)|0;
HEAP32[(((tmPtr)+(28))>>2)] = yday;
HEAP32[(((tmPtr)+(36))>>2)] = -(date.getTimezoneOffset() * 60);
// Attention: DST is in December in South, and some regions don't have DST at all.
+ var start = new Date(date.getFullYear(), 0, 1);
var summerOffset = new Date(date.getFullYear(), 6, 1).getTimezoneOffset();
var winterOffset = start.getTimezoneOffset();
var dst = (summerOffset != winterOffset && date.getTimezoneOffset() == Math.min(winterOffset, summerOffset))|0;
@@ -1360,7 +1344,8 @@ var ASM_CONSTS = {
if (ret) stringToUTF8Array(str, HEAP8, ret, size);
return ret;
}
- function _tzset_impl(timezone, daylight, tzname) {
+ function __tzset_js(timezone, daylight, tzname) {
+ // TODO: Use (malleable) environment variables instead of system settings.
var currentYear = new Date().getFullYear();
var winter = new Date(currentYear, 0, 1);
var summer = new Date(currentYear, 6, 1);
@@ -1377,7 +1362,7 @@ var ASM_CONSTS = {
// Coordinated Universal Time (UTC) and local standard time."), the same
// as returned by stdTimezoneOffset.
// See http://pubs.opengroup.org/onlinepubs/009695399/functions/tzset.html
- HEAP32[((timezone)>>2)] = stdTimezoneOffset * 60;
+ HEAPU32[((timezone)>>2)] = stdTimezoneOffset * 60;
HEAP32[((daylight)>>2)] = Number(winterOffset != summerOffset);
@@ -1398,12 +1383,6 @@ var ASM_CONSTS = {
HEAPU32[(((tzname)+(4))>>2)] = winterNamePtr;
}
}
- function __tzset_js(timezone, daylight, tzname) {
- // TODO: Use (malleable) environment variables instead of system settings.
- if (__tzset_js.called) return;
- __tzset_js.called = true;
- _tzset_impl(timezone, daylight, tzname);
- }
function _abort() {
abort('native code called abort()');
@@ -1413,6 +1392,12 @@ var ASM_CONSTS = {
return Date.now();
}
+ function withStackSave(f) {
+ var stack = stackSave();
+ var ret = f();
+ stackRestore(stack);
+ return ret;
+ }
var JSEvents = {inEventHandler:0,removeAllEventListeners:function() {
for (var i = JSEvents.eventHandlers.length-1; i >= 0; --i) {
JSEvents._removeHandler(i);
@@ -1963,6 +1948,17 @@ var ASM_CONSTS = {
}
}
+ 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 callUserCallback(func) {
if (ABORT) {
err('user callback triggered after runtime exited or application aborted. Ignoring.');
@@ -2555,6 +2551,28 @@ var ASM_CONSTS = {
return success ? 0 : -5;
}
+ var SYSCALLS = {varargs:undefined,get:function() {
+ assert(SYSCALLS.varargs != undefined);
+ SYSCALLS.varargs += 4;
+ var ret = HEAP32[(((SYSCALLS.varargs)-(4))>>2)];
+ return ret;
+ },getStr:function(ptr) {
+ var ret = UTF8ToString(ptr);
+ return ret;
+ }};
+ function _fd_close(fd) {
+ abort('fd_close called without SYSCALLS_REQUIRE_FILESYSTEM');
+ }
+
+ function convertI32PairToI53Checked(lo, hi) {
+ assert(lo == (lo >>> 0) || lo == (lo|0)); // lo should either be a i32 or a u32
+ assert(hi === (hi|0)); // hi should be a i32
+ return ((hi + 0x200000) >>> 0 < 0x400001 - !!lo) ? (lo >>> 0) + hi * 4294967296 : NaN;
+ }
+ function _fd_seek(fd, offset_low, offset_high, whence, newOffset) {
+ return 70;
+ }
+
var printCharBuffers = [null,[],[]];
function printChar(stream, curr) {
var buffer = printCharBuffers[stream];
@@ -2572,16 +2590,6 @@ var ASM_CONSTS = {
if (printCharBuffers[1].length) printChar(1, 10);
if (printCharBuffers[2].length) printChar(2, 10);
}
-
- var SYSCALLS = {varargs:undefined,get:function() {
- assert(SYSCALLS.varargs != undefined);
- SYSCALLS.varargs += 4;
- var ret = HEAP32[(((SYSCALLS.varargs)-(4))>>2)];
- return ret;
- },getStr:function(ptr) {
- var ret = UTF8ToString(ptr);
- return ret;
- }};
function _fd_write(fd, iov, iovcnt, pnum) {
// hack to support printf in SYSCALLS_REQUIRE_FILESYSTEM=0
var num = 0;
@@ -3118,6 +3126,7 @@ var ASM_CONSTS = {
_proc_exit(status);
}
+
Fetch.staticInit();;
var GLctx;;
var miniTempWebGLFloatBuffersStorage = new Float32Array(288);
@@ -3148,6 +3157,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,
@@ -3272,8 +3283,8 @@ var unexportedRuntimeSymbols = [
'registerFunctions',
'prettyPrint',
'getCompilerSetting',
- 'print',
- 'printErr',
+ 'out',
+ 'err',
'callMain',
'abort',
'keepRuntimeAlive',
@@ -3535,7 +3546,6 @@ var missingLibrarySymbols = [
'writeI53ToU64Signaling',
'readI53FromU64',
'convertI32PairToI53',
- 'convertI32PairToI53Checked',
'convertU32PairToI53',
'getCFunc',
'ccall',
@@ -3565,6 +3575,7 @@ var missingLibrarySymbols = [
'lengthBytesUTF32',
'allocateUTF8OnStack',
'writeStringToMemory',
+ 'writeArrayToMemory',
'writeAsciiToMemory',
'getSocketFromFD',
'getSocketAddress',
@@ -3603,6 +3614,10 @@ var missingLibrarySymbols = [
'registerBatteryEventCallback',
'setCanvasElementSize',
'getCanvasElementSize',
+ 'demangle',
+ 'demangleAll',
+ 'jsStackTrace',
+ 'stackTrace',
'getEnvStrings',
'checkWasiClock',
'createDyncallWrapper',
diff --git a/themes/dist/output.wasm b/themes/dist/output.wasm
index 4e62096..33cd231 100755
--- a/themes/dist/output.wasm
+++ b/themes/dist/output.wasm
Binary files differ
diff --git a/themes/list.h b/themes/list.h
index 0c5b0a1..25b236a 100644
--- a/themes/list.h
+++ b/themes/list.h
@@ -73,10 +73,12 @@ namespace matte {
template <typename T>
bool List<T>::grow(size_t newSize) {
if (!growDynamically) {
+ logger_error("Cannot grow list: growDynamically is disabled");
return false;
}
if (newSize == 0) {
+ logger_error("Cannot grow list: newSize is zero!");
return false;
}
@@ -240,4 +242,4 @@ namespace matte {
memmove(&data[idx], &temp, sizeof(T));
}
}
-} \ No newline at end of file
+}