Module
Script automatically generated by Emscripten during compilation of zombs_wasm.wasm. It serves as a JavaScript entry module instantiating and interacting with the WASM instance in BinCodec methods.
Module
INFO
Due to the script being automatically generated and later obfuscated during bundling, only relevant properties and methods are mentioned.
Properties
| Name | Type | Description |
|---|---|---|
asm | WebAssembly.Instance.prototype.exports | Raw exports of the instantiated zombs_wasm.wasm instance. The core export function is j, which is then wrapped as _MakeBlendField. |
HEAP8 | Int8Array | Signed 8-bit view over the WASM linear memory. |
HEAP32 | Int32Array | Signed 32-bit view over the WASM linear memory. |
HEAPU8 | Uint8Array | Unsigned 8-bit view over the WASM linear memory. |
Methods
_main()
function _main(argc?: number, argv?: number): numberGenerated wrapper for program entrypoint representing C/C++ main() function. The generated wrapper calls it after __wasm_call_ctors() has run. Calls imported function _emscripten_run_script_int() to set a random seed for the Mersenne Twister PRNG used during the PoW process.
_MakeBlendField()
function _MakeBlendField(opcode: MBF_COMMAND, value: number): numberRuns the obfuscated MBF entrypoint. Despite the name, this function is not only a pure "make blend field" function; it behaves like a compact command dispatcher. The first argument selects an operation and the second argument provides that operation's parameter. Calls imported functions _emscripten_run_script_string() or _emscripten_run_script_int() depending on return value type to perform environment checks via evaluation of strings with eval() during specific calls. May call _emscripten_resize_heap() to grow and update memory views during _MakeBlendField(172, 36).
Every call used by BinCodec, their respective usage and strings evaluated during runtime is shown as follows:
| Call | Usage | Evaluated Strings |
|---|---|---|
_MakeBlendField(255, 140) | Prepares the module before decoding the first PACKET_PRE_ENTER_WORLD challenge by setting chall_count to 0. | - |
_MakeBlendField(24, 132) | Resets the decoder state before the input bytes are copied. | - |
_MakeBlendField(228, buffer.remaining()) | Returns a pointer to writable WASM memory where BinCodec copies the incoming challenge bytes. buffer.remaining() is usually 132; this call also stores the pointer and length for the later solve step. | - |
_MakeBlendField(172, 36) | Solves the copied challenge and prepares the 64-byte PoW response. May call _emscripten_resize_heap() when challenge signals a memory grow. | typeof window === "undefined" ? 1 : 0;typeof process !== 'undefined' ? 1 : 0;Game.currentGame.network.connected ? 1 : 0Game.currentGame.network.connectionOptions.ipAddressGame.currentGame.world.myUid === null ? 0 : Game.currentGame.world.myUid; |
_MakeBlendField(4, 152) | Returns a pointer to the 64-byte PoW response used by PACKET_ENTER_WORLD or PACKET_BLEND. | document.getElementById("hud").children.length; |
_MakeBlendField(187, 22) | Returns a pointer to the 16-byte PACKET_ENTER_WORLD2 payload. | - |
WARNING
The numeric command values are taken from the bundled client and are not self-describing API constants. Treat them as version-specific WASM protocol details.
WASM Imports / Exports
INFO
The short names (a, b, c and g, h, i, etc.) are minified Emscripten import/export names. They are stable only for the analyzed generated file, not for every possible rebuild of zombs_wasm.wasm, as name shuffling has already happened more than once.
Imports
wasmImports is the JavaScript import object passed into the WASM instance. The generated wrapper places it under module namespace a:
const info = {
a: wasmImports
};That means a WASM import written as (import "a" "d" ...) resolves to wasmImports.d in JavaScript. These imports let the compiled C++ code call back into JavaScript for browser/runtime services.
| Import | JavaScript Function | Type | Description |
|---|---|---|---|
a | _abort_js | () => void | Aborts the Emscripten runtime. |
b | _emscripten_run_script_string | (ptr: number) => number | Runs JavaScript from a UTF-8 string in WASM memory and returns a pointer to the string result. |
c | _emscripten_run_script_int | (ptr: number) => number | Runs JavaScript from a UTF-8 string in WASM memory and returns the numeric result. |
d | _emscripten_get_now | () => number | Returns performance.now(). Called by _main() to obtain seed for random number generation. |
e | _emscripten_resize_heap | (requestedSize: number) => boolean | Attempts to grow WASM linear memory and refreshes the heap views. |
f | __emscripten_memcpy_js | (dest: number, src: number, num: number) => Uint8Array | Implements memory copying through HEAPU8.copyWithin(). |
Exports
The generated script maps short WASM export names into readable Module properties:
| WASM Export | Module Wrapper | Type | Notes |
|---|---|---|---|
g | - | WebAssembly.Memory | Linear memory. updateMemoryViews() rebuilds all HEAP* views from this buffer. |
h | __wasm_call_ctors | () => void | C/C++ static constructor hook registered by the generated wrapper. |
i | _main | () => number | Program entrypoint representing C/C++ main() function. |
j | _MakeBlendField | (opcode: number, value: number) => number | MBF command dispatcher. |
k | - | WebAssembly.Table | Function table used internally by the WASM instance. |
l | _malloc | (size: number) => number | Memory allocator wrapper used by Emscripten helpers. |
m | stackSave | () => number | Saves the stack pointer for temporary conversions. |
n | stackRestore | (ptr: number) => void | Restores the stack pointer. |
o | stackAlloc | (size: number) => number | Allocates temporary stack memory. |
DANGER
Generated Emscripten helper paths can expect a wrapper representing the C/C++ free() function when replacing allocated memory, but the stock zombs_wasm.wasm used by the client does not provide a usable _free() export. See the reconnection bug described in _MakeBlendField/overview.
Data Interfaces
These interfaces are inferred from their usage by BinCodec.
MBF_COMMAND
type MBF_COMMAND = 4 | 24 | 172 | 187 | 228 | 255;_MakeBlendField accepts plain numbers, but only the command values above are visible in the client-side network path.
MBF_CHALLENGE
interface MBF_CHALLENGE {
opcode: 5 | 10,
challenge: Uint8Array
}Represents the 132-byte payload received from PACKET_PRE_ENTER_WORLD or PACKET_BLEND before it is copied into HEAPU8.
MBF_RESULT
interface MBF_RESULT {
extra: ArrayBuffer
}Returned from BinCodec.decodePreEnterWorldResponse() and BinCodec.decodeBlend(). The extra buffer is 64 bytes long and is later sent back through PACKET_ENTER_WORLD or PACKET_BLEND.
ENTER_WORLD2_PAYLOAD
type ENTER_WORLD2_PAYLOAD = Uint8Array;The first 16 bytes at the pointer returned by _MakeBlendField(187, 22). BinCodec.encodeEnterWorld2() writes these bytes directly into a PACKET_ENTER_WORLD2 packet.