Skip to content

Instantly share code, notes, and snippets.

@JohannesDeml
Created June 29, 2021 08:09
Show Gist options
  • Save JohannesDeml/76dd1ba3b27a20c3521f42bf3fff6262 to your computer and use it in GitHub Desktop.
Save JohannesDeml/76dd1ba3b27a20c3521f42bf3fff6262 to your computer and use it in GitHub Desktop.
Unity WebGL framework code

Unity WebGL engine code

This includes the framework and loader. I took a look at the webassembly code with wasm2js , but it is not that interesting for finding hidden variables.

This gist is meant to help find variables and methods that can help you in development such as UTF8ToString or TOTAL_MEMORY.

// Unminified unity framework from Unity 2020.3.12f1
function unityFramework(Module) {
var Module = typeof Module !== "undefined" ? Module : {};
var stackTraceReference = "(^|\\n)(\\s+at\\s+|)jsStackTrace(\\s+\\(|@)([^\\n]+):\\d+:\\d+(\\)|)(\\n|$)";
var stackTraceReferenceMatch = jsStackTrace().match(new RegExp(stackTraceReference));
if (stackTraceReferenceMatch) Module.stackTraceRegExp = new RegExp(stackTraceReference.replace("([^\\n]+)", stackTraceReferenceMatch[4].replace(/[\\^${}[\]().*+?|]/g, "\\$&")).replace("jsStackTrace", "[^\\n]+"));
var abort = function (what) {
if (ABORT) return;
ABORT = true;
EXITSTATUS = 1;
if (typeof ENVIRONMENT_IS_PTHREAD !== "undefined" && ENVIRONMENT_IS_PTHREAD) console.error("Pthread aborting at " + new Error().stack);
if (what !== undefined) {
out(what);
err(what);
what = JSON.stringify(what);
} else {
what = "";
}
var message = "abort(" + what + ") at " + stackTrace();
if (Module.abortHandler && Module.abortHandler(message)) return;
throw message;
};
if (typeof ENVIRONMENT_IS_PTHREAD === "undefined" || !ENVIRONMENT_IS_PTHREAD) {
Module["preRun"].push(function () {
var unityFileSystemInit =
Module["unityFileSystemInit"] ||
function () {
FS.mkdir("/idbfs");
FS.mount(IDBFS, {}, "/idbfs");
Module.addRunDependency("JS_FileSystem_Mount");
FS.syncfs(true, function (err) {
if (err) console.log("IndexedDB is not available. Data will not persist in cache and PlayerPrefs will not be saved.");
Module.removeRunDependency("JS_FileSystem_Mount");
});
};
unityFileSystemInit();
});
}
Module["SetFullscreen"] = function (fullscreen) {
if (typeof runtimeInitialized === "undefined" || !runtimeInitialized) {
console.log("Runtime not initialized yet.");
} else if (typeof JSEvents === "undefined") {
console.log("Player not loaded yet.");
} else {
var tmp = JSEvents.canPerformEventHandlerRequests;
JSEvents.canPerformEventHandlerRequests = function () {
return 1;
};
Module.ccall("SetFullscreen", null, ["number"], [fullscreen]);
JSEvents.canPerformEventHandlerRequests = tmp;
}
};
var MediaDevices = [];
if (typeof ENVIRONMENT_IS_PTHREAD === "undefined" || !ENVIRONMENT_IS_PTHREAD) {
Module["preRun"].push(function () {
var enumerateMediaDevices = function () {
var getMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.msGetUserMedia;
if (!getMedia) return;
function addDevice(label) {
label = label ? label : "device #" + MediaDevices.length;
var device = { deviceName: label, refCount: 0, video: null };
MediaDevices.push(device);
}
if (!navigator.mediaDevices || !navigator.mediaDevices.enumerateDevices) {
if (typeof MediaStreamTrack == "undefined" || typeof MediaStreamTrack.getSources == "undefined") {
console.log("Media Devices cannot be enumerated on this browser.");
return;
}
function gotSources(sourceInfos) {
for (var i = 0; i !== sourceInfos.length; ++i) {
var sourceInfo = sourceInfos[i];
if (sourceInfo.kind === "video") addDevice(sourceInfo.label);
}
}
MediaStreamTrack.getSources(gotSources);
}
navigator.mediaDevices
.enumerateDevices()
.then(function (devices) {
devices.forEach(function (device) {
if (device.kind == "videoinput") addDevice(device.label);
});
})
.catch(function (err) {
console.log(err.name + ": " + error.message);
});
};
enumerateMediaDevices();
});
}
function SendMessage(gameObject, func, param) {
if (param === undefined) Module.ccall("SendMessage", null, ["string", "string"], [gameObject, func]);
else if (typeof param === "string") Module.ccall("SendMessageString", null, ["string", "string", "string"], [gameObject, func, param]);
else if (typeof param === "number") Module.ccall("SendMessageFloat", null, ["string", "string", "number"], [gameObject, func, param]);
else throw "" + param + " is does not have a type which is supported by SendMessage.";
}
Module["SendMessage"] = SendMessage;
var moduleOverrides = {};
var key;
for (key in Module) {
if (Module.hasOwnProperty(key)) {
moduleOverrides[key] = Module[key];
}
}
Module["arguments"] = [];
Module["thisProgram"] = "./this.program";
Module["quit"] = function (status, toThrow) {
throw toThrow;
};
Module["preRun"] = [];
Module["postRun"] = [];
var ENVIRONMENT_IS_WEB = false;
var ENVIRONMENT_IS_WORKER = false;
var ENVIRONMENT_IS_NODE = false;
var ENVIRONMENT_IS_SHELL = false;
ENVIRONMENT_IS_WEB = typeof window === "object";
ENVIRONMENT_IS_WORKER = typeof importScripts === "function";
ENVIRONMENT_IS_NODE = typeof process === "object" && typeof require === "function" && !ENVIRONMENT_IS_WEB && !ENVIRONMENT_IS_WORKER;
ENVIRONMENT_IS_SHELL = !ENVIRONMENT_IS_WEB && !ENVIRONMENT_IS_NODE && !ENVIRONMENT_IS_WORKER;
var scriptDirectory = "";
function locateFile(path) {
if (Module["locateFile"]) {
return Module["locateFile"](path, scriptDirectory);
} else {
return scriptDirectory + path;
}
}
if (ENVIRONMENT_IS_NODE) {
scriptDirectory = __dirname + "/";
var nodeFS;
var nodePath;
Module["read"] = function shell_read(filename, binary) {
var ret;
if (!nodeFS) nodeFS = require("fs");
if (!nodePath) nodePath = require("path");
filename = nodePath["normalize"](filename);
ret = nodeFS["readFileSync"](filename);
return binary ? ret : ret.toString();
};
Module["readBinary"] = function readBinary(filename) {
var ret = Module["read"](filename, true);
if (!ret.buffer) {
ret = new Uint8Array(ret);
}
assert(ret.buffer);
return ret;
};
if (process["argv"].length > 1) {
Module["thisProgram"] = process["argv"][1].replace(/\\/g, "/");
}
Module["arguments"] = process["argv"].slice(2);
if (typeof module !== "undefined") {
module["exports"] = Module;
}
process["on"]("uncaughtException", function (ex) {
if (!(ex instanceof ExitStatus)) {
throw ex;
}
});
process["on"]("unhandledRejection", function (reason, p) {
process["exit"](1);
});
Module["quit"] = function (status) {
process["exit"](status);
};
Module["inspect"] = function () {
return "[Emscripten Module object]";
};
} else if (ENVIRONMENT_IS_SHELL) {
if (typeof read != "undefined") {
Module["read"] = function shell_read(f) {
return read(f);
};
}
Module["readBinary"] = function readBinary(f) {
var data;
if (typeof readbuffer === "function") {
return new Uint8Array(readbuffer(f));
}
data = read(f, "binary");
assert(typeof data === "object");
return data;
};
if (typeof scriptArgs != "undefined") {
Module["arguments"] = scriptArgs;
} else if (typeof arguments != "undefined") {
Module["arguments"] = arguments;
}
if (typeof quit === "function") {
Module["quit"] = function (status) {
quit(status);
};
}
} else if (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER) {
if (ENVIRONMENT_IS_WEB) {
if (document.currentScript) {
scriptDirectory = document.currentScript.src;
}
} else {
scriptDirectory = self.location.href;
}
if (scriptDirectory.indexOf("blob:") !== 0) {
scriptDirectory = scriptDirectory.split("/").slice(0, -1).join("/") + "/";
} else {
scriptDirectory = "";
}
Module["read"] = function shell_read(url) {
var xhr = new XMLHttpRequest();
xhr.open("GET", url, false);
xhr.send(null);
return xhr.responseText;
};
if (ENVIRONMENT_IS_WORKER) {
Module["readBinary"] = function readBinary(url) {
var xhr = new XMLHttpRequest();
xhr.open("GET", url, false);
xhr.responseType = "arraybuffer";
xhr.send(null);
return new Uint8Array(xhr.response);
};
}
Module["readAsync"] = function readAsync(url, onload, onerror) {
var xhr = new XMLHttpRequest();
xhr.open("GET", url, true);
xhr.responseType = "arraybuffer";
xhr.onload = function xhr_onload() {
if (xhr.status == 200 || (xhr.status == 0 && xhr.response)) {
onload(xhr.response);
return;
}
onerror();
};
xhr.onerror = onerror;
xhr.send(null);
};
Module["setWindowTitle"] = function (title) {
document.title = title;
};
} else {
}
var out = Module["print"] || (typeof console !== "undefined" ? console.log.bind(console) : typeof print !== "undefined" ? print : null);
var err = Module["printErr"] || (typeof printErr !== "undefined" ? printErr : (typeof console !== "undefined" && console.warn.bind(console)) || out);
for (key in moduleOverrides) {
if (moduleOverrides.hasOwnProperty(key)) {
Module[key] = moduleOverrides[key];
}
}
moduleOverrides = undefined;
var STACK_ALIGN = 16;
function staticAlloc(size) {
var ret = STATICTOP;
STATICTOP = (STATICTOP + size + 15) & -16;
return ret;
}
function dynamicAlloc(size) {
var ret = HEAP32[DYNAMICTOP_PTR >> 2];
var end = (ret + size + 15) & -16;
HEAP32[DYNAMICTOP_PTR >> 2] = end;
if (end >= TOTAL_MEMORY) {
var success = enlargeMemory();
if (!success) {
HEAP32[DYNAMICTOP_PTR >> 2] = ret;
return 0;
}
}
return ret;
}
function alignMemory(size, factor) {
if (!factor) factor = STACK_ALIGN;
var ret = (size = Math.ceil(size / factor) * factor);
return ret;
}
function getNativeTypeSize(type) {
switch (type) {
case "i1":
case "i8":
return 1;
case "i16":
return 2;
case "i32":
return 4;
case "i64":
return 8;
case "float":
return 4;
case "double":
return 8;
default: {
if (type[type.length - 1] === "*") {
return 4;
} else if (type[0] === "i") {
var bits = parseInt(type.substr(1));
assert(bits % 8 === 0);
return bits / 8;
} else {
return 0;
}
}
}
}
function warnOnce(text) {
if (!warnOnce.shown) warnOnce.shown = {};
if (!warnOnce.shown[text]) {
warnOnce.shown[text] = 1;
err(text);
}
}
var asm2wasmImports = {
"f64-rem": function (x, y) {
return x % y;
},
debugger: function () {
debugger;
},
};
var jsCallStartIndex = 1;
var functionPointers = new Array(0);
function addFunction(func, sig) {
var base = 0;
for (var i = base; i < base + 0; i++) {
if (!functionPointers[i]) {
functionPointers[i] = func;
return jsCallStartIndex + i;
}
}
throw "Finished up all reserved function pointers. Use a higher value for RESERVED_FUNCTION_POINTERS.";
}
var funcWrappers = {};
function getFuncWrapper(func, sig) {
if (!func) return;
assert(sig);
if (!funcWrappers[sig]) {
funcWrappers[sig] = {};
}
var sigCache = funcWrappers[sig];
if (!sigCache[func]) {
if (sig.length === 1) {
sigCache[func] = function dynCall_wrapper() {
return dynCall(sig, func);
};
} else if (sig.length === 2) {
sigCache[func] = function dynCall_wrapper(arg) {
return dynCall(sig, func, [arg]);
};
} else {
sigCache[func] = function dynCall_wrapper() {
return dynCall(sig, func, Array.prototype.slice.call(arguments));
};
}
}
return sigCache[func];
}
function makeBigInt(low, high, unsigned) {
return unsigned ? +(low >>> 0) + +(high >>> 0) * 4294967296 : +(low >>> 0) + +(high | 0) * 4294967296;
}
function dynCall(sig, ptr, args) {
if (args && args.length) {
return Module["dynCall_" + sig].apply(null, [ptr].concat(args));
} else {
return Module["dynCall_" + sig].call(null, ptr);
}
}
var GLOBAL_BASE = 1024;
var ABORT = 0;
var EXITSTATUS = 0;
function assert(condition, text) {
if (!condition) {
abort("Assertion failed: " + text);
}
}
function getCFunc(ident) {
var func = Module["_" + ident];
assert(func, "Cannot call unknown function " + ident + ", make sure it is exported");
return func;
}
var JSfuncs = {
stackSave: function () {
stackSave();
},
stackRestore: function () {
stackRestore();
},
arrayToC: function (arr) {
var ret = stackAlloc(arr.length);
writeArrayToMemory(arr, ret);
return ret;
},
stringToC: function (str) {
var ret = 0;
if (str !== null && str !== undefined && str !== 0) {
var len = (str.length << 2) + 1;
ret = stackAlloc(len);
stringToUTF8(str, ret, len);
}
return ret;
},
};
var toC = { string: JSfuncs["stringToC"], array: JSfuncs["arrayToC"] };
function ccall(ident, returnType, argTypes, args, opts) {
function convertReturnValue(ret) {
if (returnType === "string") return Pointer_stringify(ret);
if (returnType === "boolean") return Boolean(ret);
return ret;
}
var func = getCFunc(ident);
var cArgs = [];
var stack = 0;
if (args) {
for (var i = 0; i < args.length; i++) {
var converter = toC[argTypes[i]];
if (converter) {
if (stack === 0) stack = stackSave();
cArgs[i] = converter(args[i]);
} else {
cArgs[i] = args[i];
}
}
}
var ret = func.apply(null, cArgs);
ret = convertReturnValue(ret);
if (stack !== 0) stackRestore(stack);
return ret;
}
function cwrap(ident, returnType, argTypes, opts) {
argTypes = argTypes || [];
var numericArgs = argTypes.every(function (type) {
return type === "number";
});
var numericRet = returnType !== "string";
if (numericRet && numericArgs && !opts) {
return getCFunc(ident);
}
return function () {
return ccall(ident, returnType, argTypes, arguments, opts);
};
}
function setValue(ptr, value, type, noSafe) {
type = type || "i8";
if (type.charAt(type.length - 1) === "*") type = "i32";
switch (type) {
case "i1":
HEAP8[ptr >> 0] = value;
break;
case "i8":
HEAP8[ptr >> 0] = value;
break;
case "i16":
HEAP16[ptr >> 1] = value;
break;
case "i32":
HEAP32[ptr >> 2] = value;
break;
case "i64":
(tempI64 = [
value >>> 0,
((tempDouble = value), +Math_abs(tempDouble) >= 1 ? (tempDouble > 0 ? (Math_min(+Math_floor(tempDouble / 4294967296), 4294967295) | 0) >>> 0 : ~~+Math_ceil((tempDouble - +(~~tempDouble >>> 0)) / 4294967296) >>> 0) : 0),
]),
(HEAP32[ptr >> 2] = tempI64[0]),
(HEAP32[(ptr + 4) >> 2] = tempI64[1]);
break;
case "float":
HEAPF32[ptr >> 2] = value;
break;
case "double":
HEAPF64[ptr >> 3] = value;
break;
default:
abort("invalid type for setValue: " + type);
}
}
var ALLOC_NORMAL = 0;
var ALLOC_STATIC = 2;
var ALLOC_NONE = 4;
function allocate(slab, types, allocator, ptr) {
var zeroinit, size;
if (typeof slab === "number") {
zeroinit = true;
size = slab;
} else {
zeroinit = false;
size = slab.length;
}
var singleType = typeof types === "string" ? types : null;
var ret;
if (allocator == ALLOC_NONE) {
ret = ptr;
} else {
ret = [typeof _malloc === "function" ? _malloc : staticAlloc, stackAlloc, staticAlloc, dynamicAlloc][allocator === undefined ? ALLOC_STATIC : allocator](Math.max(size, singleType ? 1 : types.length));
}
if (zeroinit) {
var stop;
ptr = ret;
assert((ret & 3) == 0);
stop = ret + (size & ~3);
for (; ptr < stop; ptr += 4) {
HEAP32[ptr >> 2] = 0;
}
stop = ret + size;
while (ptr < stop) {
HEAP8[ptr++ >> 0] = 0;
}
return ret;
}
if (singleType === "i8") {
if (slab.subarray || slab.slice) {
HEAPU8.set(slab, ret);
} else {
HEAPU8.set(new Uint8Array(slab), ret);
}
return ret;
}
var i = 0,
type,
typeSize,
previousType;
while (i < size) {
var curr = slab[i];
type = singleType || types[i];
if (type === 0) {
i++;
continue;
}
if (type == "i64") type = "i32";
setValue(ret + i, curr, type);
if (previousType !== type) {
typeSize = getNativeTypeSize(type);
previousType = type;
}
i += typeSize;
}
return ret;
}
function getMemory(size) {
if (!staticSealed) return staticAlloc(size);
if (!runtimeInitialized) return dynamicAlloc(size);
return _malloc(size);
}
function Pointer_stringify(ptr, length) {
if (length === 0 || !ptr) return "";
var hasUtf = 0;
var t;
var i = 0;
while (1) {
t = HEAPU8[(ptr + i) >> 0];
hasUtf |= t;
if (t == 0 && !length) break;
i++;
if (length && i == length) break;
}
if (!length) length = i;
var ret = "";
if (hasUtf < 128) {
var MAX_CHUNK = 1024;
var curr;
while (length > 0) {
curr = String.fromCharCode.apply(String, HEAPU8.subarray(ptr, ptr + Math.min(length, MAX_CHUNK)));
ret = ret ? ret + curr : curr;
ptr += MAX_CHUNK;
length -= MAX_CHUNK;
}
return ret;
}
return UTF8ToString(ptr);
}
var UTF8Decoder = typeof TextDecoder !== "undefined" ? new TextDecoder("utf8") : undefined;
function UTF8ArrayToString(u8Array, idx) {
var endPtr = idx;
while (u8Array[endPtr]) ++endPtr;
if (endPtr - idx > 16 && u8Array.subarray && UTF8Decoder) {
return UTF8Decoder.decode(u8Array.subarray(idx, endPtr));
} else {
var u0, u1, u2, u3, u4, u5;
var str = "";
while (1) {
u0 = u8Array[idx++];
if (!u0) return str;
if (!(u0 & 128)) {
str += String.fromCharCode(u0);
continue;
}
u1 = u8Array[idx++] & 63;
if ((u0 & 224) == 192) {
str += String.fromCharCode(((u0 & 31) << 6) | u1);
continue;
}
u2 = u8Array[idx++] & 63;
if ((u0 & 240) == 224) {
u0 = ((u0 & 15) << 12) | (u1 << 6) | u2;
} else {
u3 = u8Array[idx++] & 63;
if ((u0 & 248) == 240) {
u0 = ((u0 & 7) << 18) | (u1 << 12) | (u2 << 6) | u3;
} else {
u4 = u8Array[idx++] & 63;
if ((u0 & 252) == 248) {
u0 = ((u0 & 3) << 24) | (u1 << 18) | (u2 << 12) | (u3 << 6) | u4;
} else {
u5 = u8Array[idx++] & 63;
u0 = ((u0 & 1) << 30) | (u1 << 24) | (u2 << 18) | (u3 << 12) | (u4 << 6) | u5;
}
}
}
if (u0 < 65536) {
str += String.fromCharCode(u0);
} else {
var ch = u0 - 65536;
str += String.fromCharCode(55296 | (ch >> 10), 56320 | (ch & 1023));
}
}
}
}
function UTF8ToString(ptr) {
return UTF8ArrayToString(HEAPU8, ptr);
}
function stringToUTF8Array(str, outU8Array, outIdx, maxBytesToWrite) {
if (!(maxBytesToWrite > 0)) return 0;
var startIdx = outIdx;
var endIdx = outIdx + maxBytesToWrite - 1;
for (var i = 0; i < str.length; ++i) {
var u = str.charCodeAt(i);
if (u >= 55296 && u <= 57343) {
var u1 = str.charCodeAt(++i);
u = (65536 + ((u & 1023) << 10)) | (u1 & 1023);
}
if (u <= 127) {
if (outIdx >= endIdx) break;
outU8Array[outIdx++] = u;
} else if (u <= 2047) {
if (outIdx + 1 >= endIdx) break;
outU8Array[outIdx++] = 192 | (u >> 6);
outU8Array[outIdx++] = 128 | (u & 63);
} else if (u <= 65535) {
if (outIdx + 2 >= endIdx) break;
outU8Array[outIdx++] = 224 | (u >> 12);
outU8Array[outIdx++] = 128 | ((u >> 6) & 63);
outU8Array[outIdx++] = 128 | (u & 63);
} else if (u <= 2097151) {
if (outIdx + 3 >= endIdx) break;
outU8Array[outIdx++] = 240 | (u >> 18);
outU8Array[outIdx++] = 128 | ((u >> 12) & 63);
outU8Array[outIdx++] = 128 | ((u >> 6) & 63);
outU8Array[outIdx++] = 128 | (u & 63);
} else if (u <= 67108863) {
if (outIdx + 4 >= endIdx) break;
outU8Array[outIdx++] = 248 | (u >> 24);
outU8Array[outIdx++] = 128 | ((u >> 18) & 63);
outU8Array[outIdx++] = 128 | ((u >> 12) & 63);
outU8Array[outIdx++] = 128 | ((u >> 6) & 63);
outU8Array[outIdx++] = 128 | (u & 63);
} else {
if (outIdx + 5 >= endIdx) break;
outU8Array[outIdx++] = 252 | (u >> 30);
outU8Array[outIdx++] = 128 | ((u >> 24) & 63);
outU8Array[outIdx++] = 128 | ((u >> 18) & 63);
outU8Array[outIdx++] = 128 | ((u >> 12) & 63);
outU8Array[outIdx++] = 128 | ((u >> 6) & 63);
outU8Array[outIdx++] = 128 | (u & 63);
}
}
outU8Array[outIdx] = 0;
return outIdx - startIdx;
}
function stringToUTF8(str, outPtr, maxBytesToWrite) {
return stringToUTF8Array(str, HEAPU8, outPtr, maxBytesToWrite);
}
function lengthBytesUTF8(str) {
var len = 0;
for (var i = 0; i < str.length; ++i) {
var u = str.charCodeAt(i);
if (u >= 55296 && u <= 57343) u = (65536 + ((u & 1023) << 10)) | (str.charCodeAt(++i) & 1023);
if (u <= 127) {
++len;
} else if (u <= 2047) {
len += 2;
} else if (u <= 65535) {
len += 3;
} else if (u <= 2097151) {
len += 4;
} else if (u <= 67108863) {
len += 5;
} else {
len += 6;
}
}
return len;
}
var UTF16Decoder = typeof TextDecoder !== "undefined" ? new TextDecoder("utf-16le") : undefined;
function allocateUTF8(str) {
var size = lengthBytesUTF8(str) + 1;
var ret = _malloc(size);
if (ret) stringToUTF8Array(str, HEAP8, ret, size);
return ret;
}
function allocateUTF8OnStack(str) {
var size = lengthBytesUTF8(str) + 1;
var ret = stackAlloc(size);
stringToUTF8Array(str, HEAP8, ret, size);
return ret;
}
function demangle(func) {
return func;
}
function demangleAll(text) {
var regex = /__Z[\w\d_]+/g;
return text.replace(regex, function (x) {
var y = demangle(x);
return x === y ? x : x + " [" + y + "]";
});
}
function jsStackTrace() {
var err = new Error();
if (!err.stack) {
try {
throw new Error(0);
} catch (e) {
err = e;
}
if (!err.stack) {
return "(no stack trace available)";
}
}
return err.stack.toString();
}
function stackTrace() {
var js = jsStackTrace();
if (Module["extraStackTrace"]) js += "\n" + Module["extraStackTrace"]();
return demangleAll(js);
}
var PAGE_SIZE = 16384;
var WASM_PAGE_SIZE = 65536;
var ASMJS_PAGE_SIZE = 16777216;
var MIN_TOTAL_MEMORY = 16777216;
function alignUp(x, multiple) {
if (x % multiple > 0) {
x += multiple - (x % multiple);
}
return x;
}
var buffer, HEAP8, HEAPU8, HEAP16, HEAPU16, HEAP32, HEAPU32, HEAPF32, HEAPF64;
function updateGlobalBuffer(buf) {
Module["buffer"] = buffer = buf;
}
function updateGlobalBufferViews() {
Module["HEAP8"] = HEAP8 = new Int8Array(buffer);
Module["HEAP16"] = HEAP16 = new Int16Array(buffer);
Module["HEAP32"] = HEAP32 = new Int32Array(buffer);
Module["HEAPU8"] = HEAPU8 = new Uint8Array(buffer);
Module["HEAPU16"] = HEAPU16 = new Uint16Array(buffer);
Module["HEAPU32"] = HEAPU32 = new Uint32Array(buffer);
Module["HEAPF32"] = HEAPF32 = new Float32Array(buffer);
Module["HEAPF64"] = HEAPF64 = new Float64Array(buffer);
}
var STATIC_BASE, STATICTOP, staticSealed;
var STACK_BASE, STACKTOP, STACK_MAX;
var DYNAMIC_BASE, DYNAMICTOP_PTR;
STATIC_BASE = STATICTOP = STACK_BASE = STACKTOP = STACK_MAX = DYNAMIC_BASE = DYNAMICTOP_PTR = 0;
staticSealed = false;
function abortOnCannotGrowMemory() {
abort(
"Cannot enlarge memory arrays. Either (1) compile with -s TOTAL_MEMORY=X with X higher than the current value " +
TOTAL_MEMORY +
", (2) compile with -s ALLOW_MEMORY_GROWTH=1 which allows increasing the size at runtime, or (3) if you want malloc to return NULL (0) instead of this abort, compile with -s ABORTING_MALLOC=0 "
);
}
if (!Module["reallocBuffer"])
Module["reallocBuffer"] = function (size) {
var ret;
try {
if (ArrayBuffer.transfer) {
ret = ArrayBuffer.transfer(buffer, size);
} else {
var oldHEAP8 = HEAP8;
ret = new ArrayBuffer(size);
var temp = new Int8Array(ret);
temp.set(oldHEAP8);
}
} catch (e) {
return false;
}
var success = _emscripten_replace_memory(ret);
if (!success) return false;
return ret;
};
function enlargeMemory() {
var PAGE_MULTIPLE = Module["usingWasm"] ? WASM_PAGE_SIZE : ASMJS_PAGE_SIZE;
var LIMIT = 2147483648 - PAGE_MULTIPLE;
if (HEAP32[DYNAMICTOP_PTR >> 2] > LIMIT) {
return false;
}
var OLD_TOTAL_MEMORY = TOTAL_MEMORY;
TOTAL_MEMORY = Math.max(TOTAL_MEMORY, MIN_TOTAL_MEMORY);
while (TOTAL_MEMORY < HEAP32[DYNAMICTOP_PTR >> 2]) {
if (TOTAL_MEMORY <= 536870912) {
TOTAL_MEMORY = alignUp(2 * TOTAL_MEMORY, PAGE_MULTIPLE);
} else {
TOTAL_MEMORY = Math.min(alignUp((3 * TOTAL_MEMORY + 2147483648) / 4, PAGE_MULTIPLE), LIMIT);
}
}
var replacement = Module["reallocBuffer"](TOTAL_MEMORY);
if (!replacement || replacement.byteLength != TOTAL_MEMORY) {
TOTAL_MEMORY = OLD_TOTAL_MEMORY;
return false;
}
updateGlobalBuffer(replacement);
updateGlobalBufferViews();
return true;
}
var byteLength;
try {
byteLength = Function.prototype.call.bind(Object.getOwnPropertyDescriptor(ArrayBuffer.prototype, "byteLength").get);
byteLength(new ArrayBuffer(4));
} catch (e) {
byteLength = function (buffer) {
return buffer.byteLength;
};
}
var TOTAL_STACK = Module["TOTAL_STACK"] || 5242880;
var TOTAL_MEMORY = Module["TOTAL_MEMORY"] || 33554432;
if (TOTAL_MEMORY < TOTAL_STACK) err("TOTAL_MEMORY should be larger than TOTAL_STACK, was " + TOTAL_MEMORY + "! (TOTAL_STACK=" + TOTAL_STACK + ")");
if (Module["buffer"]) {
buffer = Module["buffer"];
} else {
if (typeof WebAssembly === "object" && typeof WebAssembly.Memory === "function") {
Module["wasmMemory"] = new WebAssembly.Memory({ initial: TOTAL_MEMORY / WASM_PAGE_SIZE });
buffer = Module["wasmMemory"].buffer;
} else {
buffer = new ArrayBuffer(TOTAL_MEMORY);
}
Module["buffer"] = buffer;
}
updateGlobalBufferViews();
function getTotalMemory() {
return TOTAL_MEMORY;
}
function callRuntimeCallbacks(callbacks) {
while (callbacks.length > 0) {
var callback = callbacks.shift();
if (typeof callback == "function") {
callback();
continue;
}
var func = callback.func;
if (typeof func === "number") {
if (callback.arg === undefined) {
Module["dynCall_v"](func);
} else {
Module["dynCall_vi"](func, callback.arg);
}
} else {
func(callback.arg === undefined ? null : callback.arg);
}
}
}
var __ATPRERUN__ = [];
var __ATINIT__ = [];
var __ATMAIN__ = [];
var __ATEXIT__ = [];
var __ATPOSTRUN__ = [];
var runtimeInitialized = false;
var runtimeExited = false;
function preRun() {
if (Module["preRun"]) {
if (typeof Module["preRun"] == "function") Module["preRun"] = [Module["preRun"]];
while (Module["preRun"].length) {
addOnPreRun(Module["preRun"].shift());
}
}
callRuntimeCallbacks(__ATPRERUN__);
}
function ensureInitRuntime() {
if (runtimeInitialized) return;
runtimeInitialized = true;
callRuntimeCallbacks(__ATINIT__);
}
function preMain() {
callRuntimeCallbacks(__ATMAIN__);
}
function exitRuntime() {
callRuntimeCallbacks(__ATEXIT__);
runtimeExited = true;
}
function postRun() {
if (Module["postRun"]) {
if (typeof Module["postRun"] == "function") Module["postRun"] = [Module["postRun"]];
while (Module["postRun"].length) {
addOnPostRun(Module["postRun"].shift());
}
}
callRuntimeCallbacks(__ATPOSTRUN__);
}
function addOnPreRun(cb) {
__ATPRERUN__.unshift(cb);
}
function addOnPostRun(cb) {
__ATPOSTRUN__.unshift(cb);
}
function writeArrayToMemory(array, buffer) {
HEAP8.set(array, buffer);
}
function writeAsciiToMemory(str, buffer, dontAddNull) {
for (var i = 0; i < str.length; ++i) {
HEAP8[buffer++ >> 0] = str.charCodeAt(i);
}
if (!dontAddNull) HEAP8[buffer >> 0] = 0;
}
function unSign(value, bits, ignore) {
if (value >= 0) {
return value;
}
return bits <= 32 ? 2 * Math.abs(1 << (bits - 1)) + value : Math.pow(2, bits) + value;
}
function reSign(value, bits, ignore) {
if (value <= 0) {
return value;
}
var half = bits <= 32 ? Math.abs(1 << (bits - 1)) : Math.pow(2, bits - 1);
if (value >= half && (bits <= 32 || value > half)) {
value = -2 * half + value;
}
return value;
}
var Math_abs = Math.abs;
var Math_sqrt = Math.sqrt;
var Math_ceil = Math.ceil;
var Math_floor = Math.floor;
var Math_min = Math.min;
var Math_clz32 = Math.clz32;
var runDependencies = 0;
var runDependencyWatcher = null;
var dependenciesFulfilled = null;
function getUniqueRunDependency(id) {
return id;
}
function addRunDependency(id) {
runDependencies++;
if (Module["monitorRunDependencies"]) {
Module["monitorRunDependencies"](runDependencies);
}
}
function removeRunDependency(id) {
runDependencies--;
if (Module["monitorRunDependencies"]) {
Module["monitorRunDependencies"](runDependencies);
}
if (runDependencies == 0) {
if (runDependencyWatcher !== null) {
clearInterval(runDependencyWatcher);
runDependencyWatcher = null;
}
if (dependenciesFulfilled) {
var callback = dependenciesFulfilled;
dependenciesFulfilled = null;
callback();
}
}
}
Module["preloadedImages"] = {};
Module["preloadedAudios"] = {};
var dataURIPrefix = "data:application/octet-stream;base64,";
function isDataURI(filename) {
return String.prototype.startsWith ? filename.startsWith(dataURIPrefix) : filename.indexOf(dataURIPrefix) === 0;
}
function integrateWasmJS() {
var wasmTextFile = "build.wast";
var wasmBinaryFile = "build.wasm";
var asmjsCodeFile = "build.temp.asm.js";
if (!isDataURI(wasmTextFile)) {
wasmTextFile = locateFile(wasmTextFile);
}
if (!isDataURI(wasmBinaryFile)) {
wasmBinaryFile = locateFile(wasmBinaryFile);
}
if (!isDataURI(asmjsCodeFile)) {
asmjsCodeFile = locateFile(asmjsCodeFile);
}
var wasmPageSize = 64 * 1024;
var info = { global: null, env: null, asm2wasm: asm2wasmImports, parent: Module };
var exports = null;
function mergeMemory(newBuffer) {
var oldBuffer = Module["buffer"];
if (newBuffer.byteLength < oldBuffer.byteLength) {
err("the new buffer in mergeMemory is smaller than the previous one. in native wasm, we should grow memory here");
}
var oldView = new Int8Array(oldBuffer);
var newView = new Int8Array(newBuffer);
newView.set(oldView);
updateGlobalBuffer(newBuffer);
updateGlobalBufferViews();
}
function fixImports(imports) {
return imports;
}
function getBinary() {
try {
if (Module["wasmBinary"]) {
return new Uint8Array(Module["wasmBinary"]);
}
if (Module["readBinary"]) {
return Module["readBinary"](wasmBinaryFile);
} else {
throw "both async and sync fetching of the wasm failed";
}
} catch (err) {
abort(err);
}
}
function getBinaryPromise() {
if (!Module["wasmBinary"] && (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER) && typeof fetch === "function") {
return fetch(wasmBinaryFile, { credentials: "same-origin" })
.then(function (response) {
if (!response["ok"]) {
throw "failed to load wasm binary file at '" + wasmBinaryFile + "'";
}
return response["arrayBuffer"]();
})
.catch(function () {
return getBinary();
});
}
return new Promise(function (resolve, reject) {
resolve(getBinary());
});
}
function doNativeWasm(global, env, providedBuffer) {
if (typeof WebAssembly !== "object") {
err("no native wasm support detected");
return false;
}
if (!(Module["wasmMemory"] instanceof WebAssembly.Memory)) {
err("no native wasm Memory in use");
return false;
}
env["memory"] = Module["wasmMemory"];
info["global"] = { NaN: NaN, Infinity: Infinity };
info["global.Math"] = Math;
info["env"] = env;
function receiveInstance(instance, module) {
exports = instance.exports;
if (exports.memory) mergeMemory(exports.memory);
Module["asm"] = exports;
Module["usingWasm"] = true;
removeRunDependency("wasm-instantiate");
}
addRunDependency("wasm-instantiate");
if (Module["instantiateWasm"]) {
try {
return Module["instantiateWasm"](info, receiveInstance);
} catch (e) {
err("Module.instantiateWasm callback failed with error: " + e);
return false;
}
}
function receiveInstantiatedSource(output) {
receiveInstance(output["instance"], output["module"]);
}
function instantiateArrayBuffer(receiver) {
getBinaryPromise()
.then(function (binary) {
return WebAssembly.instantiate(binary, info);
})
.then(receiver)
.catch(function (reason) {
err("failed to asynchronously prepare wasm: " + reason);
abort(reason);
});
}
if (!Module["wasmBinary"] && typeof WebAssembly.instantiateStreaming === "function" && !isDataURI(wasmBinaryFile) && typeof fetch === "function") {
WebAssembly.instantiateStreaming(fetch(wasmBinaryFile, { credentials: "same-origin" }), info)
.then(receiveInstantiatedSource)
.catch(function (reason) {
err("wasm streaming compile failed: " + reason);
err("falling back to ArrayBuffer instantiation");
instantiateArrayBuffer(receiveInstantiatedSource);
});
} else {
instantiateArrayBuffer(receiveInstantiatedSource);
}
return {};
}
Module["asmPreload"] = Module["asm"];
var asmjsReallocBuffer = Module["reallocBuffer"];
var wasmReallocBuffer = function (size) {
var PAGE_MULTIPLE = Module["usingWasm"] ? WASM_PAGE_SIZE : ASMJS_PAGE_SIZE;
size = alignUp(size, PAGE_MULTIPLE);
var old = Module["buffer"];
var oldSize = old.byteLength;
if (Module["usingWasm"]) {
try {
var result = Module["wasmMemory"].grow((size - oldSize) / wasmPageSize);
if (result !== (-1 | 0)) {
return (Module["buffer"] = Module["wasmMemory"].buffer);
} else {
return null;
}
} catch (e) {
return null;
}
}
};
Module["reallocBuffer"] = function (size) {
if (finalMethod === "asmjs") {
return asmjsReallocBuffer(size);
} else {
return wasmReallocBuffer(size);
}
};
var finalMethod = "";
Module["asm"] = function (global, env, providedBuffer) {
env = fixImports(env);
if (!env["table"]) {
var TABLE_SIZE = Module["wasmTableSize"];
if (TABLE_SIZE === undefined) TABLE_SIZE = 1024;
var MAX_TABLE_SIZE = Module["wasmMaxTableSize"];
if (typeof WebAssembly === "object" && typeof WebAssembly.Table === "function") {
if (MAX_TABLE_SIZE !== undefined) {
env["table"] = new WebAssembly.Table({ initial: TABLE_SIZE, maximum: MAX_TABLE_SIZE, element: "anyfunc" });
} else {
env["table"] = new WebAssembly.Table({ initial: TABLE_SIZE, element: "anyfunc" });
}
} else {
env["table"] = new Array(TABLE_SIZE);
}
Module["wasmTable"] = env["table"];
}
if (!env["memoryBase"]) {
env["memoryBase"] = Module["STATIC_BASE"];
}
if (!env["tableBase"]) {
env["tableBase"] = 0;
}
var exports;
exports = doNativeWasm(global, env, providedBuffer);
assert(exports, "no binaryen method succeeded.");
return exports;
};
}
integrateWasmJS();
var ASM_CONSTS = [
function () {
return Module.webglContextAttributes.premultipliedAlpha;
},
function () {
return Module.webglContextAttributes.preserveDrawingBuffer;
},
function ($0) {
throw new Error('Internal Unity error: gles::GetProcAddress("' + Pointer_stringify($0) + '") was called but gles::GetProcAddress() is not implemented on Unity WebGL. Please report a bug.');
},
function () {
return typeof Module.shouldQuit != "undefined";
},
function () {
for (var id in Module.intervals) {
window.clearInterval(id);
}
Module.intervals = {};
for (var i = 0; i < Module.deinitializers.length; i++) {
Module.deinitializers[i]();
}
Module.deinitializers = [];
if (typeof Module.onQuit == "function") Module.onQuit();
},
];
function _emscripten_asm_const_i(code) {
return ASM_CONSTS[code]();
}
function _emscripten_asm_const_sync_on_main_thread_i(code) {
return ASM_CONSTS[code]();
}
function _emscripten_asm_const_ii(code, a0) {
return ASM_CONSTS[code](a0);
}
STATIC_BASE = GLOBAL_BASE;
STATICTOP = STATIC_BASE + 1860320;
__ATINIT__.push(
{
func: function () {
__GLOBAL__sub_I_AccessibilityScriptingClasses_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_AIScriptingClasses_cpp();
},
},
{
func: function () {
___cxx_global_var_init();
},
},
{
func: function () {
__GLOBAL__sub_I_AndroidJNIScriptingClasses_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_AnimationScriptingClasses_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Modules_Animation_0_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Modules_Animation_2_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Modules_Animation_7_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Modules_Animation_Constraints_0_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_AnimationClip_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_AssetBundleScriptingClasses_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Modules_AssetBundle_Public_0_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_AudioScriptingClasses_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Runtime_Video_0_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Modules_Audio_Public_0_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Modules_Audio_Public_1_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Modules_Audio_Public_3_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Modules_Audio_Public_ScriptBindings_1_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Modules_Audio_Public_sound_0_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_ClothScriptingClasses_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Modules_Cloth_0_cpp();
},
},
{
func: function () {
___cxx_global_var_init_18();
},
},
{
func: function () {
__GLOBAL__sub_I_nvcloth_src_0_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_nvcloth_src_1_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_SwInterCollision_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_SwSolverKernel_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_artifacts_WebGL_codegenerator_0_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Runtime_GfxDevice_opengles_0_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Runtime_VirtualFileSystem_0_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Runtime_Input_0_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_GfxDeviceNull_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_External_ProphecySDK_BlitOperations_1_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Runtime_2D_Renderer_0_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Runtime_2D_Sorting_0_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Runtime_2D_SpriteAtlas_0_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Runtime_Allocator_2_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Runtime_Application_0_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Runtime_BaseClasses_0_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Runtime_BaseClasses_1_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Runtime_BaseClasses_2_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Runtime_BaseClasses_3_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Runtime_Burst_0_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Runtime_Camera_0_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Runtime_Camera_1_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Runtime_Camera_2_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Runtime_Camera_6_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Runtime_Camera_7_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Runtime_Camera_8_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Shadows_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Runtime_Camera_Culling_0_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_GUITexture_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Runtime_Camera_RenderLoops_0_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Runtime_Camera_RenderLoops_2_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Runtime_Containers_0_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Runtime_Core_Callbacks_0_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Runtime_File_0_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Runtime_Geometry_2_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Runtime_Graphics_0_cpp();
},
},
{
func: function () {
___cxx_global_var_init_104();
},
},
{
func: function () {
__GLOBAL__sub_I_Runtime_Graphics_1_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Runtime_Graphics_2_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Runtime_Graphics_4_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Runtime_Graphics_5_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Runtime_Graphics_6_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Runtime_Graphics_8_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Runtime_Graphics_10_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Runtime_Graphics_11_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Runtime_Graphics_Billboard_0_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Runtime_Graphics_CommandBuffer_0_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Runtime_Graphics_LOD_0_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Runtime_Graphics_Mesh_0_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Runtime_Graphics_Mesh_1_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Runtime_Graphics_Mesh_2_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Runtime_Graphics_Mesh_4_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Runtime_Graphics_Mesh_5_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Runtime_Graphics_ScriptableRenderLoop_0_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Runtime_Interfaces_0_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Runtime_Interfaces_1_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Runtime_Interfaces_2_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Runtime_Jobs_0_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Runtime_Jobs_1_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Runtime_Jobs_Internal_1_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Runtime_Jobs_ScriptBindings_0_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Runtime_Math_2_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Runtime_Math_Random_0_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Runtime_Misc_0_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Runtime_Misc_2_cpp();
},
},
{
func: function () {
___cxx_global_var_init_131();
},
},
{
func: function () {
__GLOBAL__sub_I_Runtime_Misc_4_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Runtime_Misc_5_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Runtime_PreloadManager_0_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Runtime_Profiler_0_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Runtime_Profiler_2_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Runtime_Profiler_ExternalGPUProfiler_0_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Runtime_Profiler_ScriptBindings_0_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Runtime_SceneManager_0_cpp();
},
},
{
func: function () {
___cxx_global_var_init_7754();
},
},
{
func: function () {
__GLOBAL__sub_I_Runtime_Shaders_1_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Runtime_Shaders_3_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Runtime_Shaders_GpuPrograms_0_cpp();
},
},
{
func: function () {
___cxx_global_var_init_9();
},
},
{
func: function () {
__GLOBAL__sub_I_Runtime_Shaders_ShaderImpl_2_cpp();
},
},
{
func: function () {
___cxx_global_var_init_8911();
},
},
{
func: function () {
__GLOBAL__sub_I_Runtime_Transform_0_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Runtime_Transform_1_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Runtime_Utilities_2_cpp();
},
},
{
func: function () {
___cxx_global_var_init_9307();
},
},
{
func: function () {
__GLOBAL__sub_I_Runtime_Utilities_5_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Runtime_Utilities_6_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Runtime_Utilities_7_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Runtime_Utilities_9_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_AssetBundleFileSystem_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Runtime_Modules_0_cpp();
},
},
{
func: function () {
___cxx_global_var_init_18_1180();
},
},
{
func: function () {
___cxx_global_var_init_19();
},
},
{
func: function () {
___cxx_global_var_init_20();
},
},
{
func: function () {
__GLOBAL__sub_I_Modules_Profiler_Public_1_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Modules_Profiler_Runtime_1_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Runtime_Export_Unsafe_0_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Runtime_GfxDevice_1_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Runtime_GfxDevice_2_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Runtime_GfxDevice_3_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Runtime_GfxDevice_4_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Runtime_GfxDevice_5_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Runtime_PluginInterface_0_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Runtime_Director_Core_1_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Runtime_ScriptingBackend_Il2Cpp_0_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Runtime_Scripting_0_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Runtime_Scripting_2_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Runtime_Scripting_3_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Runtime_Mono_SerializationBackend_DirectMemoryAccess_0_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Runtime_Mono_SerializationBackend_DirectMemoryAccess_1_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_TemplateInstantiations_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Runtime_Scripting_APIUpdating_0_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Runtime_Serialize_1_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Runtime_Serialize_2_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Runtime_Serialize_TransferFunctions_0_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Runtime_Serialize_TransferFunctions_1_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_PlatformDependent_WebGL_Source_0_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_PlatformDependent_WebGL_Source_2_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Mesh_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_LogAssert_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Shader_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_PlatformDependent_WebGL_External_baselib_builds_Source_0_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_DirectorScriptingClasses_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Modules_DSPGraph_Public_1_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_GridScriptingClasses_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Modules_Grid_Public_0_cpp();
},
},
{
func: function () {
___cxx_global_var_init_3785();
},
},
{
func: function () {
__GLOBAL__sub_I_IMGUIScriptingClasses_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Modules_IMGUI_0_cpp();
},
},
{
func: function () {
___cxx_global_var_init_23();
},
},
{
func: function () {
__GLOBAL__sub_I_Modules_IMGUI_1_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_InputLegacyScriptingClasses_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_InputScriptingClasses_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Modules_Input_Private_0_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_ParticleSystemScriptingClasses_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Modules_ParticleSystem_0_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_ShapeModule_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_UVModule_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Physics2DScriptingClasses_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Modules_Physics2D_Public_0_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Modules_Physics2D_Public_1_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_PhysicsScriptingClasses_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Modules_Physics_0_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Modules_Physics_2_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_PhysicsQuery_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_SubsystemsScriptingClasses_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Modules_Subsystems_0_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_TerrainScriptingClasses_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Modules_Terrain_Public_0_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Modules_Terrain_Public_1_cpp();
},
},
{
func: function () {
___cxx_global_var_init_89();
},
},
{
func: function () {
__GLOBAL__sub_I_Modules_Terrain_Public_2_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Modules_Terrain_Public_3_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Modules_Terrain_VR_0_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_TextCoreScriptingClasses_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Modules_TextCore_Native_FontEngine_0_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_TextRenderingScriptingClasses_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Modules_TextRendering_Public_0_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_TilemapScriptingClasses_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Modules_Tilemap_0_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Modules_Tilemap_Public_0_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_UIElementsNativeScriptingClasses_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_External_Yoga_Yoga_0_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_UIScriptingClasses_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Modules_UI_0_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Modules_UI_1_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Modules_UI_2_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_umbra_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_UnityAnalyticsScriptingClasses_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_UnityAdsSettings_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_UnityWebRequestScriptingClasses_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Modules_UnityWebRequest_Public_0_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_VFXScriptingClasses_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Modules_VFX_Public_0_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Modules_VFX_Public_1_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Modules_VFX_Public_Systems_0_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_VisualEffectAsset_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_VideoScriptingClasses_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Modules_Video_Public_Base_0_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_VRScriptingClasses_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Modules_VR_0_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Modules_VR_1_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_PluginInterfaceVR_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Wind_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_XRScriptingClasses_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Modules_XR_0_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_XRAudio_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_XRPreInit_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Modules_XR_Public_0_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Modules_XR_Stats_0_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Modules_XR_Subsystems_Display_0_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Modules_XR_Subsystems_Input_Public_0_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Modules_XR_Subsystems_Input_Public_1_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Modules_XR_Subsystems_Meshing_0_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Modules_XR_Tracing_0_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_XRWindowsLocatableCamera_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_External_il2cpp_builds_external_baselib_Platforms_WebGL_Source_0_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Lump_libil2cpp_os_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Lump_libil2cpp_icalls_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Lump_libil2cpp_vm_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Lump_libil2cpp_metadata_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Lump_libil2cpp_utils_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Lump_libil2cpp_vm_utils_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Lump_libil2cpp_mono_cpp();
},
},
{
func: function () {
__GLOBAL__sub_I_Lump_libil2cpp_gc_cpp();
},
},
{
func: function () {
___emscripten_environ_constructor();
},
}
);
var STATIC_BUMP = 1860320;
Module["STATIC_BASE"] = STATIC_BASE;
Module["STATIC_BUMP"] = STATIC_BUMP;
var tempDoublePtr = STATICTOP;
STATICTOP += 16;
function _JS_Cursor_SetImage(ptr, length) {
var binary = "";
for (var i = 0; i < length; i++) binary += String.fromCharCode(HEAPU8[ptr + i]);
Module.canvas.style.cursor = "url(data:image/cur;base64," + btoa(binary) + "),default";
}
function _JS_Cursor_SetShow(show) {
Module.canvas.style.cursor = show ? "default" : "none";
}
function _JS_Eval_ClearInterval(id) {
window.clearInterval(id);
}
function _JS_Eval_SetInterval(func, arg, millis) {
Module["noExitRuntime"] = true;
function wrapper() {
getFuncWrapper(func, "vi")(arg);
}
return Browser.safeSetInterval(wrapper, millis);
}
var fs = {
numPendingSync: 0,
syncInternal: 1e3,
syncInProgress: false,
sync: function (onlyPendingSync) {
if (onlyPendingSync) {
if (fs.numPendingSync == 0) return;
} else if (fs.syncInProgress) {
fs.numPendingSync++;
return;
}
fs.syncInProgress = true;
FS.syncfs(false, function (err) {
fs.syncInProgress = false;
});
fs.numPendingSync = 0;
},
};
function _JS_FileSystem_Initialize() {
Module.setInterval(function () {
fs.sync(true);
}, fs.syncInternal);
}
function _JS_FileSystem_Sync() {
fs.sync(false);
}
function _JS_Log_Dump(ptr, type) {
var str = Pointer_stringify(ptr);
if (typeof dump == "function") dump(str);
switch (type) {
case 0:
case 1:
case 4:
console.error(str);
return;
case 2:
console.warn(str);
return;
case 3:
case 5:
console.log(str);
return;
default:
console.error("Unknown console message type!");
console.error(str);
}
}
function _JS_Log_StackTrace(buffer, bufferSize) {
var trace = stackTrace();
if (buffer) stringToUTF8(trace, buffer, bufferSize);
return lengthBytesUTF8(trace);
}
var WEBAudio = { audioInstances: [], audioContext: {}, audioWebEnabled: 0 };
function _JS_Sound_Create_Channel(callback, userData) {
if (WEBAudio.audioWebEnabled == 0) return;
var channel = {
gain: WEBAudio.audioContext.createGain(),
panner: WEBAudio.audioContext.createPanner(),
threeD: false,
playBuffer: function (delay, buffer, offset) {
this.source.buffer = buffer;
var chan = this;
this.source.onended = function () {
if (callback) dynCall("vi", callback, [userData]);
chan.setup();
};
this.source.start(delay, offset);
},
setup: function () {
this.source = WEBAudio.audioContext.createBufferSource();
this.setupPanning();
},
setupPanning: function () {
if (this.threeD) {
this.source.disconnect();
this.source.connect(this.panner);
this.panner.connect(this.gain);
} else {
this.panner.disconnect();
this.source.connect(this.gain);
}
},
};
channel.panner.rolloffFactor = 0;
channel.gain.connect(WEBAudio.audioContext.destination);
channel.setup();
return WEBAudio.audioInstances.push(channel) - 1;
}
function _JS_Sound_GetLength(bufferInstance) {
if (WEBAudio.audioWebEnabled == 0) return 0;
var sound = WEBAudio.audioInstances[bufferInstance];
var sampleRateRatio = 44100 / sound.buffer.sampleRate;
return sound.buffer.length * sampleRateRatio;
}
function _JS_Sound_GetLoadState(bufferInstance) {
if (WEBAudio.audioWebEnabled == 0) return 2;
var sound = WEBAudio.audioInstances[bufferInstance];
if (sound.error) return 2;
if (sound.buffer) return 0;
return 1;
}
function _JS_Sound_Init() {
try {
window.AudioContext = window.AudioContext || window.webkitAudioContext;
WEBAudio.audioContext = new AudioContext();
var tryToResumeAudioContext = function () {
if (WEBAudio.audioContext.state === "suspended") WEBAudio.audioContext.resume();
else Module.clearInterval(resumeInterval);
};
var resumeInterval = Module.setInterval(tryToResumeAudioContext, 400);
WEBAudio.audioWebEnabled = 1;
} catch (e) {
alert("Web Audio API is not supported in this browser");
}
}
function _JS_Sound_Load(ptr, length) {
if (WEBAudio.audioWebEnabled == 0) return 0;
var sound = { buffer: null, error: false };
var instance = WEBAudio.audioInstances.push(sound) - 1;
var audioData = HEAPU8.buffer.slice(ptr, ptr + length);
WEBAudio.audioContext.decodeAudioData(
audioData,
function (buffer) {
sound.buffer = buffer;
},
function () {
sound.error = true;
console.log("Decode error.");
}
);
return instance;
}
function _JS_Sound_Load_PCM(channels, length, sampleRate, ptr) {
if (WEBAudio.audioWebEnabled == 0) return 0;
var sound = { buffer: WEBAudio.audioContext.createBuffer(channels, length, sampleRate), error: false };
for (var i = 0; i < channels; i++) {
var offs = (ptr >> 2) + length * i;
var buffer = sound.buffer;
var copyToChannel =
buffer["copyToChannel"] ||
function (source, channelNumber, startInChannel) {
var clipped = source.subarray(0, Math.min(source.length, this.length - (startInChannel | 0)));
this.getChannelData(channelNumber | 0).set(clipped, startInChannel | 0);
};
copyToChannel.apply(buffer, [HEAPF32.subarray(offs, offs + length), i, 0]);
}
var instance = WEBAudio.audioInstances.push(sound) - 1;
return instance;
}
function _JS_Sound_Play(bufferInstance, channelInstance, offset, delay) {
_JS_Sound_Stop(channelInstance, 0);
if (WEBAudio.audioWebEnabled == 0) return;
var sound = WEBAudio.audioInstances[bufferInstance];
var channel = WEBAudio.audioInstances[channelInstance];
if (sound.buffer) {
try {
channel.playBuffer(WEBAudio.audioContext.currentTime + delay, sound.buffer, offset);
} catch (e) {
console.error("playBuffer error. Exception: " + e);
}
} else console.log("Trying to play sound which is not loaded.");
}
function _JS_Sound_ReleaseInstance(instance) {
WEBAudio.audioInstances[instance] = null;
}
function _JS_Sound_ResumeIfNeeded() {
if (WEBAudio.audioWebEnabled == 0) return;
if (WEBAudio.audioContext.state === "suspended") WEBAudio.audioContext.resume();
}
function _JS_Sound_Set3D(channelInstance, threeD) {
var channel = WEBAudio.audioInstances[channelInstance];
if (channel.threeD != threeD) {
channel.threeD = threeD;
channel.setupPanning();
}
}
function _JS_Sound_SetListenerOrientation(x, y, z, xUp, yUp, zUp) {
if (WEBAudio.audioWebEnabled == 0) return;
if (WEBAudio.audioContext.listener.forwardX) {
WEBAudio.audioContext.listener.forwardX.setValueAtTime(-x, WEBAudio.audioContext.currentTime);
WEBAudio.audioContext.listener.forwardY.setValueAtTime(-y, WEBAudio.audioContext.currentTime);
WEBAudio.audioContext.listener.forwardZ.setValueAtTime(-z, WEBAudio.audioContext.currentTime);
WEBAudio.audioContext.listener.upX.setValueAtTime(xUp, WEBAudio.audioContext.currentTime);
WEBAudio.audioContext.listener.upY.setValueAtTime(yUp, WEBAudio.audioContext.currentTime);
WEBAudio.audioContext.listener.upZ.setValueAtTime(zUp, WEBAudio.audioContext.currentTime);
} else {
WEBAudio.audioContext.listener.setOrientation(-x, -y, -z, xUp, yUp, zUp);
}
}
function _JS_Sound_SetListenerPosition(x, y, z) {
if (WEBAudio.audioWebEnabled == 0) return;
if (WEBAudio.audioContext.listener.positionX) {
WEBAudio.audioContext.listener.positionX.setValueAtTime(x, WEBAudio.audioContext.currentTime);
WEBAudio.audioContext.listener.positionY.setValueAtTime(y, WEBAudio.audioContext.currentTime);
WEBAudio.audioContext.listener.positionZ.setValueAtTime(z, WEBAudio.audioContext.currentTime);
} else {
WEBAudio.audioContext.listener.setPosition(x, y, z);
}
}
function _JS_Sound_SetLoop(channelInstance, loop) {
if (WEBAudio.audioWebEnabled == 0) return;
WEBAudio.audioInstances[channelInstance].source.loop = loop;
}
function _JS_Sound_SetLoopPoints(channelInstance, loopStart, loopEnd) {
if (WEBAudio.audioWebEnabled == 0) return;
var channel = WEBAudio.audioInstances[channelInstance];
channel.source.loopStart = loopStart;
channel.source.loopEnd = loopEnd;
}
function _JS_Sound_SetPitch(channelInstance, v) {
if (WEBAudio.audioWebEnabled == 0) return;
try {
WEBAudio.audioInstances[channelInstance].source.playbackRate.setValueAtTime(v, WEBAudio.audioContext.currentTime);
} catch (e) {
console.error("Invalid audio pitch " + v + " specified to WebAudio backend!");
}
}
function _JS_Sound_SetPosition(channelInstance, x, y, z) {
if (WEBAudio.audioWebEnabled == 0) return;
WEBAudio.audioInstances[channelInstance].panner.setPosition(x, y, z);
}
function _JS_Sound_SetVolume(channelInstance, v) {
if (WEBAudio.audioWebEnabled == 0) return;
try {
WEBAudio.audioInstances[channelInstance].gain.gain.setValueAtTime(v, WEBAudio.audioContext.currentTime);
} catch (e) {
console.error("Invalid audio volume " + v + " specified to WebAudio backend!");
}
}
function _JS_Sound_Stop(channelInstance, delay) {
if (WEBAudio.audioWebEnabled == 0) return;
var channel = WEBAudio.audioInstances[channelInstance];
if (channel.source.buffer) {
try {
channel.source.stop(WEBAudio.audioContext.currentTime + delay);
} catch (e) {
channel.source.disconnect();
}
if (delay == 0) {
channel.source.onended = function () {};
channel.setup();
}
}
}
function _JS_SystemInfo_GetCanvasClientSize(domElementSelector, outWidth, outHeight) {
var selector = UTF8ToString(domElementSelector);
var canvas = selector == "#canvas" ? Module["canvas"] : document.querySelector(selector);
HEAPF64[outWidth >> 3] = canvas ? canvas.clientWidth : 0;
HEAPF64[outHeight >> 3] = canvas ? canvas.clientHeight : 0;
}
function _JS_SystemInfo_GetDocumentURL(buffer, bufferSize) {
if (buffer) stringToUTF8(document.URL, buffer, bufferSize);
return lengthBytesUTF8(document.URL);
}
function _JS_SystemInfo_GetGPUInfo(buffer, bufferSize) {
var gpuinfo = Module.SystemInfo.gpu;
if (buffer) stringToUTF8(gpuinfo, buffer, bufferSize);
return lengthBytesUTF8(gpuinfo);
}
function _JS_SystemInfo_GetMatchWebGLToCanvasSize() {
return Module.matchWebGLToCanvasSize || Module.matchWebGLToCanvasSize === undefined;
}
function _JS_SystemInfo_GetMemory() {
return TOTAL_MEMORY / (1024 * 1024);
}
function _JS_SystemInfo_GetOS(buffer, bufferSize) {
var browser = Module.SystemInfo.os + " " + Module.SystemInfo.osVersion;
if (buffer) stringToUTF8(browser, buffer, bufferSize);
return lengthBytesUTF8(browser);
}
function _JS_SystemInfo_GetPreferredDevicePixelRatio() {
return Module.devicePixelRatio || window.devicePixelRatio || 1;
}
function _JS_SystemInfo_GetScreenSize(outWidth, outHeight) {
HEAPF64[outWidth >> 3] = Module.SystemInfo.width;
HEAPF64[outHeight >> 3] = Module.SystemInfo.height;
}
function _JS_SystemInfo_HasCursorLock() {
return Module.SystemInfo.hasCursorLock;
}
function _JS_SystemInfo_HasFullscreen() {
return Module.SystemInfo.hasFullscreen;
}
function _JS_SystemInfo_HasWebGL() {
return Module.SystemInfo.hasWebGL;
}
function ___atomic_compare_exchange_8(ptr, expected, desiredl, desiredh, weak, success_memmodel, failure_memmodel) {
var pl = HEAP32[ptr >> 2];
var ph = HEAP32[(ptr + 4) >> 2];
var el = HEAP32[expected >> 2];
var eh = HEAP32[(expected + 4) >> 2];
if (pl === el && ph === eh) {
HEAP32[ptr >> 2] = desiredl;
HEAP32[(ptr + 4) >> 2] = desiredh;
return 1;
} else {
HEAP32[expected >> 2] = pl;
HEAP32[(expected + 4) >> 2] = ph;
return 0;
}
}
function ___atomic_fetch_add_8(ptr, vall, valh, memmodel) {
var l = HEAP32[ptr >> 2];
var h = HEAP32[(ptr + 4) >> 2];
HEAP32[ptr >> 2] = _i64Add(l, h, vall, valh);
HEAP32[(ptr + 4) >> 2] = getTempRet0();
return (setTempRet0(h), l) | 0;
}
var ENV = {};
function ___buildEnvironment(environ) {
var MAX_ENV_VALUES = 64;
var TOTAL_ENV_SIZE = 1024;
var poolPtr;
var envPtr;
if (!___buildEnvironment.called) {
___buildEnvironment.called = true;
ENV["USER"] = ENV["LOGNAME"] = "web_user";
ENV["PATH"] = "/";
ENV["PWD"] = "/";
ENV["HOME"] = "/home/web_user";
ENV["LANG"] = "C.UTF-8";
ENV["_"] = Module["thisProgram"];
poolPtr = getMemory(TOTAL_ENV_SIZE);
envPtr = getMemory(MAX_ENV_VALUES * 4);
HEAP32[envPtr >> 2] = poolPtr;
HEAP32[environ >> 2] = envPtr;
} else {
envPtr = HEAP32[environ >> 2];
poolPtr = HEAP32[envPtr >> 2];
}
var strings = [];
var totalSize = 0;
for (var key in ENV) {
if (typeof ENV[key] === "string") {
var line = key + "=" + ENV[key];
strings.push(line);
totalSize += line.length;
}
}
if (totalSize > TOTAL_ENV_SIZE) {
throw new Error("Environment size exceeded TOTAL_ENV_SIZE!");
}
var ptrSize = 4;
for (var i = 0; i < strings.length; i++) {
var line = strings[i];
writeAsciiToMemory(line, poolPtr);
HEAP32[(envPtr + i * ptrSize) >> 2] = poolPtr;
poolPtr += line.length + 1;
}
HEAP32[(envPtr + strings.length * ptrSize) >> 2] = 0;
}
function ___cxa_allocate_exception(size) {
return _malloc(size);
}
function __ZSt18uncaught_exceptionv() {
return !!__ZSt18uncaught_exceptionv.uncaught_exception;
}
var EXCEPTIONS = {
last: 0,
caught: [],
infos: {},
deAdjust: function (adjusted) {
if (!adjusted || EXCEPTIONS.infos[adjusted]) return adjusted;
for (var key in EXCEPTIONS.infos) {
var ptr = +key;
var info = EXCEPTIONS.infos[ptr];
if (info.adjusted === adjusted) {
return ptr;
}
}
return adjusted;
},
addRef: function (ptr) {
if (!ptr) return;
var info = EXCEPTIONS.infos[ptr];
info.refcount++;
},
decRef: function (ptr) {
if (!ptr) return;
var info = EXCEPTIONS.infos[ptr];
assert(info.refcount > 0);
info.refcount--;
if (info.refcount === 0 && !info.rethrown) {
if (info.destructor) {
Module["dynCall_vi"](info.destructor, ptr);
}
delete EXCEPTIONS.infos[ptr];
___cxa_free_exception(ptr);
}
},
clearRef: function (ptr) {
if (!ptr) return;
var info = EXCEPTIONS.infos[ptr];
info.refcount = 0;
},
};
function ___cxa_begin_catch(ptr) {
var info = EXCEPTIONS.infos[ptr];
if (info && !info.caught) {
info.caught = true;
__ZSt18uncaught_exceptionv.uncaught_exception--;
}
if (info) info.rethrown = false;
EXCEPTIONS.caught.push(ptr);
EXCEPTIONS.addRef(EXCEPTIONS.deAdjust(ptr));
return ptr;
}
function ___cxa_free_exception(ptr) {
try {
return _free(ptr);
} catch (e) {}
}
function ___cxa_end_catch() {
Module["setThrew"](0);
var ptr = EXCEPTIONS.caught.pop();
if (ptr) {
EXCEPTIONS.decRef(EXCEPTIONS.deAdjust(ptr));
EXCEPTIONS.last = 0;
}
}
function ___cxa_find_matching_catch_2() {
return ___cxa_find_matching_catch.apply(null, arguments);
}
function ___cxa_find_matching_catch_3() {
return ___cxa_find_matching_catch.apply(null, arguments);
}
function ___cxa_find_matching_catch_4() {
return ___cxa_find_matching_catch.apply(null, arguments);
}
function ___cxa_pure_virtual() {
ABORT = true;
throw "Pure virtual function called!";
}
function ___cxa_rethrow() {
var ptr = EXCEPTIONS.caught.pop();
ptr = EXCEPTIONS.deAdjust(ptr);
if (!EXCEPTIONS.infos[ptr].rethrown) {
EXCEPTIONS.caught.push(ptr);
EXCEPTIONS.infos[ptr].rethrown = true;
}
EXCEPTIONS.last = ptr;
throw ptr;
}
function ___resumeException(ptr) {
if (!EXCEPTIONS.last) {
EXCEPTIONS.last = ptr;
}
throw ptr;
}
function ___cxa_find_matching_catch() {
var thrown = EXCEPTIONS.last;
if (!thrown) {
return (setTempRet0(0), 0) | 0;
}
var info = EXCEPTIONS.infos[thrown];
var throwntype = info.type;
if (!throwntype) {
return (setTempRet0(0), thrown) | 0;
}
var typeArray = Array.prototype.slice.call(arguments);
var pointer = Module["___cxa_is_pointer_type"](throwntype);
if (!___cxa_find_matching_catch.buffer) ___cxa_find_matching_catch.buffer = _malloc(4);
HEAP32[___cxa_find_matching_catch.buffer >> 2] = thrown;
thrown = ___cxa_find_matching_catch.buffer;
for (var i = 0; i < typeArray.length; i++) {
if (typeArray[i] && Module["___cxa_can_catch"](typeArray[i], throwntype, thrown)) {
thrown = HEAP32[thrown >> 2];
info.adjusted = thrown;
return (setTempRet0(typeArray[i]), thrown) | 0;
}
}
thrown = HEAP32[thrown >> 2];
return (setTempRet0(throwntype), thrown) | 0;
}
function ___cxa_throw(ptr, type, destructor) {
EXCEPTIONS.infos[ptr] = { ptr: ptr, adjusted: ptr, type: type, destructor: destructor, refcount: 0, caught: false, rethrown: false };
EXCEPTIONS.last = ptr;
if (!("uncaught_exception" in __ZSt18uncaught_exceptionv)) {
__ZSt18uncaught_exceptionv.uncaught_exception = 1;
} else {
__ZSt18uncaught_exceptionv.uncaught_exception++;
}
throw ptr;
}
function ___gxx_personality_v0() {}
function ___lock() {}
var ERRNO_CODES = {
EPERM: 1,
ENOENT: 2,
ESRCH: 3,
EINTR: 4,
EIO: 5,
ENXIO: 6,
E2BIG: 7,
ENOEXEC: 8,
EBADF: 9,
ECHILD: 10,
EAGAIN: 11,
EWOULDBLOCK: 11,
ENOMEM: 12,
EACCES: 13,
EFAULT: 14,
ENOTBLK: 15,
EBUSY: 16,
EEXIST: 17,
EXDEV: 18,
ENODEV: 19,
ENOTDIR: 20,
EISDIR: 21,
EINVAL: 22,
ENFILE: 23,
EMFILE: 24,
ENOTTY: 25,
ETXTBSY: 26,
EFBIG: 27,
ENOSPC: 28,
ESPIPE: 29,
EROFS: 30,
EMLINK: 31,
EPIPE: 32,
EDOM: 33,
ERANGE: 34,
ENOMSG: 42,
EIDRM: 43,
ECHRNG: 44,
EL2NSYNC: 45,
EL3HLT: 46,
EL3RST: 47,
ELNRNG: 48,
EUNATCH: 49,
ENOCSI: 50,
EL2HLT: 51,
EDEADLK: 35,
ENOLCK: 37,
EBADE: 52,
EBADR: 53,
EXFULL: 54,
ENOANO: 55,
EBADRQC: 56,
EBADSLT: 57,
EDEADLOCK: 35,
EBFONT: 59,
ENOSTR: 60,
ENODATA: 61,
ETIME: 62,
ENOSR: 63,
ENONET: 64,
ENOPKG: 65,
EREMOTE: 66,
ENOLINK: 67,
EADV: 68,
ESRMNT: 69,
ECOMM: 70,
EPROTO: 71,
EMULTIHOP: 72,
EDOTDOT: 73,
EBADMSG: 74,
ENOTUNIQ: 76,
EBADFD: 77,
EREMCHG: 78,
ELIBACC: 79,
ELIBBAD: 80,
ELIBSCN: 81,
ELIBMAX: 82,
ELIBEXEC: 83,
ENOSYS: 38,
ENOTEMPTY: 39,
ENAMETOOLONG: 36,
ELOOP: 40,
EOPNOTSUPP: 95,
EPFNOSUPPORT: 96,
ECONNRESET: 104,
ENOBUFS: 105,
EAFNOSUPPORT: 97,
EPROTOTYPE: 91,
ENOTSOCK: 88,
ENOPROTOOPT: 92,
ESHUTDOWN: 108,
ECONNREFUSED: 111,
EADDRINUSE: 98,
ECONNABORTED: 103,
ENETUNREACH: 101,
ENETDOWN: 100,
ETIMEDOUT: 110,
EHOSTDOWN: 112,
EHOSTUNREACH: 113,
EINPROGRESS: 115,
EALREADY: 114,
EDESTADDRREQ: 89,
EMSGSIZE: 90,
EPROTONOSUPPORT: 93,
ESOCKTNOSUPPORT: 94,
EADDRNOTAVAIL: 99,
ENETRESET: 102,
EISCONN: 106,
ENOTCONN: 107,
ETOOMANYREFS: 109,
EUSERS: 87,
EDQUOT: 122,
ESTALE: 116,
ENOTSUP: 95,
ENOMEDIUM: 123,
EILSEQ: 84,
EOVERFLOW: 75,
ECANCELED: 125,
ENOTRECOVERABLE: 131,
EOWNERDEAD: 130,
ESTRPIPE: 86,
};
function ___setErrNo(value) {
if (Module["___errno_location"]) HEAP32[Module["___errno_location"]() >> 2] = value;
return value;
}
function ___map_file(pathname, size) {
___setErrNo(ERRNO_CODES.EPERM);
return -1;
}
var ERRNO_MESSAGES = {
0: "Success",
1: "Not super-user",
2: "No such file or directory",
3: "No such process",
4: "Interrupted system call",
5: "I/O error",
6: "No such device or address",
7: "Arg list too long",
8: "Exec format error",
9: "Bad file number",
10: "No children",
11: "No more processes",
12: "Not enough core",
13: "Permission denied",
14: "Bad address",
15: "Block device required",
16: "Mount device busy",
17: "File exists",
18: "Cross-device link",
19: "No such device",
20: "Not a directory",
21: "Is a directory",
22: "Invalid argument",
23: "Too many open files in system",
24: "Too many open files",
25: "Not a typewriter",
26: "Text file busy",
27: "File too large",
28: "No space left on device",
29: "Illegal seek",
30: "Read only file system",
31: "Too many links",
32: "Broken pipe",
33: "Math arg out of domain of func",
34: "Math result not representable",
35: "File locking deadlock error",
36: "File or path name too long",
37: "No record locks available",
38: "Function not implemented",
39: "Directory not empty",
40: "Too many symbolic links",
42: "No message of desired type",
43: "Identifier removed",
44: "Channel number out of range",
45: "Level 2 not synchronized",
46: "Level 3 halted",
47: "Level 3 reset",
48: "Link number out of range",
49: "Protocol driver not attached",
50: "No CSI structure available",
51: "Level 2 halted",
52: "Invalid exchange",
53: "Invalid request descriptor",
54: "Exchange full",
55: "No anode",
56: "Invalid request code",
57: "Invalid slot",
59: "Bad font file fmt",
60: "Device not a stream",
61: "No data (for no delay io)",
62: "Timer expired",
63: "Out of streams resources",
64: "Machine is not on the network",
65: "Package not installed",
66: "The object is remote",
67: "The link has been severed",
68: "Advertise error",
69: "Srmount error",
70: "Communication error on send",
71: "Protocol error",
72: "Multihop attempted",
73: "Cross mount point (not really error)",
74: "Trying to read unreadable message",
75: "Value too large for defined data type",
76: "Given log. name not unique",
77: "f.d. invalid for this operation",
78: "Remote address changed",
79: "Can access a needed shared lib",
80: "Accessing a corrupted shared lib",
81: ".lib section in a.out corrupted",
82: "Attempting to link in too many libs",
83: "Attempting to exec a shared library",
84: "Illegal byte sequence",
86: "Streams pipe error",
87: "Too many users",
88: "Socket operation on non-socket",
89: "Destination address required",
90: "Message too long",
91: "Protocol wrong type for socket",
92: "Protocol not available",
93: "Unknown protocol",
94: "Socket type not supported",
95: "Not supported",
96: "Protocol family not supported",
97: "Address family not supported by protocol family",
98: "Address already in use",
99: "Address not available",
100: "Network interface is not configured",
101: "Network is unreachable",
102: "Connection reset by network",
103: "Connection aborted",
104: "Connection reset by peer",
105: "No buffer space available",
106: "Socket is already connected",
107: "Socket is not connected",
108: "Can't send after socket shutdown",
109: "Too many references",
110: "Connection timed out",
111: "Connection refused",
112: "Host is down",
113: "Host is unreachable",
114: "Socket already connected",
115: "Connection already in progress",
116: "Stale file handle",
122: "Quota exceeded",
123: "No medium (in tape drive)",
125: "Operation canceled",
130: "Previous owner died",
131: "State not recoverable",
};
var PATH = {
splitPath: function (filename) {
var splitPathRe = /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;
return splitPathRe.exec(filename).slice(1);
},
normalizeArray: function (parts, allowAboveRoot) {
var up = 0;
for (var i = parts.length - 1; i >= 0; i--) {
var last = parts[i];
if (last === ".") {
parts.splice(i, 1);
} else if (last === "..") {
parts.splice(i, 1);
up++;
} else if (up) {
parts.splice(i, 1);
up--;
}
}
if (allowAboveRoot) {
for (; up; up--) {
parts.unshift("..");
}
}
return parts;
},
normalize: function (path) {
var isAbsolute = path.charAt(0) === "/",
trailingSlash = path.substr(-1) === "/";
path = PATH.normalizeArray(
path.split("/").filter(function (p) {
return !!p;
}),
!isAbsolute
).join("/");
if (!path && !isAbsolute) {
path = ".";
}
if (path && trailingSlash) {