Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save JohannesDeml/4d070136245c95c3efb4b7b326ffd89a to your computer and use it in GitHub Desktop.
Save JohannesDeml/4d070136245c95c3efb4b7b326ffd89a to your computer and use it in GitHub Desktop.
Untiy 2022.3.21f1 wasm decompiled with wasm2js with readable method names
This file has been truncated, but you can view the full file.
// Unity Project: https://github.com/JohannesDeml/UnityWebGL-LoadingTest with commit de7bdf9ac13edc7619f17ebe0713546a44c004f0
// Decompiled with wasm2js (https://github.com/WebAssembly/binaryen) - If you use debug builds you get proper method names
import * as env from 'env';
import * as wasi_snapshot_preview1 from 'wasi_snapshot_preview1';
function Table(ret) {
// grow method not included; table is not growable
ret.set = function(i, func) {
this[i] = func;
};
ret.get = function(i) {
return this[i];
};
return ret;
}
var bufferView;
var base64ReverseLookup = new Uint8Array(123/*'z'+1*/);
for (var i = 25; i >= 0; --i) {
base64ReverseLookup[48+i] = 52+i; // '0-9'
base64ReverseLookup[65+i] = i; // 'A-Z'
base64ReverseLookup[97+i] = 26+i; // 'a-z'
}
base64ReverseLookup[43] = 62; // '+'
base64ReverseLookup[47] = 63; // '/'
/** @noinline Inlining this function would mean expanding the base64 string 4x times in the source code, which Closure seems to be happy to do. */
function base64DecodeToExistingUint8Array(uint8Array, offset, b64) {
var b1, b2, i = 0, j = offset, bLength = b64.length, end = offset + (bLength*3>>2) - (b64[bLength-2] == '=') - (b64[bLength-1] == '=');
for (; i < bLength; i += 4) {
b1 = base64ReverseLookup[b64.charCodeAt(i+1)];
b2 = base64ReverseLookup[b64.charCodeAt(i+2)];
uint8Array[j++] = base64ReverseLookup[b64.charCodeAt(i)] << 2 | b1 >> 4;
if (j < end) uint8Array[j++] = b1 << 4 | b2 >> 2;
if (j < end) uint8Array[j++] = b2 << 6 | base64ReverseLookup[b64.charCodeAt(i+3)];
}
}
function initActiveSegments(imports) {
View raw

(Sorry about that, but we can’t show files that are this big right now.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment