@onimaxxing/worldgen 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +442 -0
- package/editor_settings.d.ts +1034 -0
- package/index.d.ts +682 -0
- package/index.js +286 -0
- package/package.json +35 -0
- package/parallel/LICENSE +21 -0
- package/parallel/index.js +13 -0
- package/parallel/oni_wasm.d.ts +852 -0
- package/parallel/oni_wasm.js +2368 -0
- package/parallel/oni_wasm_bg.wasm +0 -0
- package/parallel/oni_wasm_bg.wasm.d.ts +99 -0
- package/parallel/snippets/wasm-bindgen-rayon-38edf6e439f6d70d/src/workerHelpers.js +107 -0
- package/serial/LICENSE +21 -0
- package/serial/oni_wasm.d.ts +346 -0
- package/serial/oni_wasm.js +1109 -0
- package/serial/oni_wasm_bg.wasm +0 -0
- package/serial/oni_wasm_bg.wasm.d.ts +47 -0
- package/yaml.d.ts +19 -0
- package/yaml.js +97 -0
|
@@ -0,0 +1,1109 @@
|
|
|
1
|
+
/* @ts-self-types="./oni_wasm.d.ts" */
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Drop the cached cluster. Snapshot edits persist.
|
|
5
|
+
*/
|
|
6
|
+
export function clear_cluster_cache() {
|
|
7
|
+
wasm.clear_cluster_cache();
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Evaluate a noise tree over a `width × height` 2D grid and return
|
|
12
|
+
* one `f32` per cell, row-major (`y * width + x`). Values are
|
|
13
|
+
* unnormalised; the consumer applies any colour ramp.
|
|
14
|
+
*
|
|
15
|
+
* `tree_kind`:
|
|
16
|
+
* - `"named"`: look up `tree_value` in the live `SettingsCache.noise`
|
|
17
|
+
* map (the same map the editor mutates).
|
|
18
|
+
* - `"inline"`: parse `tree_value` as a YAML document in isolation.
|
|
19
|
+
*
|
|
20
|
+
* Output is bit-identical to the engine's own evaluation at the
|
|
21
|
+
* given seed. Sample coords map `width × height` linearly onto the
|
|
22
|
+
* tree's `settings.lowerBound..upperBound` rectangle (cell-centred),
|
|
23
|
+
* at `z = 0` (worldgen samples the XZ plane at y = 0).
|
|
24
|
+
* @param {string} tree_kind
|
|
25
|
+
* @param {string} tree_value
|
|
26
|
+
* @param {number} width
|
|
27
|
+
* @param {number} height
|
|
28
|
+
* @param {number} seed
|
|
29
|
+
* @returns {Float32Array}
|
|
30
|
+
*/
|
|
31
|
+
export function evaluate_noise(tree_kind, tree_value, width, height, seed) {
|
|
32
|
+
const ptr0 = passStringToWasm0(tree_kind, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
33
|
+
const len0 = WASM_VECTOR_LEN;
|
|
34
|
+
const ptr1 = passStringToWasm0(tree_value, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
35
|
+
const len1 = WASM_VECTOR_LEN;
|
|
36
|
+
const ret = wasm.evaluate_noise(ptr0, len0, ptr1, len1, width, height, seed);
|
|
37
|
+
if (ret[3]) {
|
|
38
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
39
|
+
}
|
|
40
|
+
var v3 = getArrayF32FromWasm0(ret[0], ret[1]).slice();
|
|
41
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
42
|
+
return v3;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* The ONI game build this WASM was parity-baselined against (e.g.
|
|
47
|
+
* `"737195"`).
|
|
48
|
+
* @returns {string}
|
|
49
|
+
*/
|
|
50
|
+
export function game_version() {
|
|
51
|
+
let deferred1_0;
|
|
52
|
+
let deferred1_1;
|
|
53
|
+
try {
|
|
54
|
+
const ret = wasm.game_version();
|
|
55
|
+
deferred1_0 = ret[0];
|
|
56
|
+
deferred1_1 = ret[1];
|
|
57
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
58
|
+
} finally {
|
|
59
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Generate a cluster by cluster id + seed. Returns a `ClusterResult`
|
|
65
|
+
* JSON envelope. For the coordinate-string form (story traits +
|
|
66
|
+
* mixing) use `generate_from_coordinate`.
|
|
67
|
+
* @param {number} seed
|
|
68
|
+
* @param {string} cluster_id
|
|
69
|
+
* @returns {string}
|
|
70
|
+
*/
|
|
71
|
+
export function generate_cluster(seed, cluster_id) {
|
|
72
|
+
let deferred2_0;
|
|
73
|
+
let deferred2_1;
|
|
74
|
+
try {
|
|
75
|
+
const ptr0 = passStringToWasm0(cluster_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
76
|
+
const len0 = WASM_VECTOR_LEN;
|
|
77
|
+
const ret = wasm.generate_cluster(seed, ptr0, len0);
|
|
78
|
+
deferred2_0 = ret[0];
|
|
79
|
+
deferred2_1 = ret[1];
|
|
80
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
81
|
+
} finally {
|
|
82
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Generate all worlds in a cluster and return per-cell polygon data for each.
|
|
88
|
+
*
|
|
89
|
+
* Returns JSON: `{ "cluster_id", "seed", "worlds": [{ "name", "width", "height", "is_starting", "cells": [...] }] }`
|
|
90
|
+
* @param {number} seed
|
|
91
|
+
* @param {string} cluster_id
|
|
92
|
+
* @returns {string}
|
|
93
|
+
*/
|
|
94
|
+
export function generate_cluster_cells(seed, cluster_id) {
|
|
95
|
+
let deferred2_0;
|
|
96
|
+
let deferred2_1;
|
|
97
|
+
try {
|
|
98
|
+
const ptr0 = passStringToWasm0(cluster_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
99
|
+
const len0 = WASM_VECTOR_LEN;
|
|
100
|
+
const ret = wasm.generate_cluster_cells(seed, ptr0, len0);
|
|
101
|
+
deferred2_0 = ret[0];
|
|
102
|
+
deferred2_1 = ret[1];
|
|
103
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
104
|
+
} finally {
|
|
105
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Generate a cluster with provided cluster YAML config override.
|
|
111
|
+
* @param {number} seed
|
|
112
|
+
* @param {string} cluster_id
|
|
113
|
+
* @param {string} cluster_yaml
|
|
114
|
+
* @param {string} _world_yamls
|
|
115
|
+
* @returns {string}
|
|
116
|
+
*/
|
|
117
|
+
export function generate_cluster_with_configs(seed, cluster_id, cluster_yaml, _world_yamls) {
|
|
118
|
+
let deferred4_0;
|
|
119
|
+
let deferred4_1;
|
|
120
|
+
try {
|
|
121
|
+
const ptr0 = passStringToWasm0(cluster_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
122
|
+
const len0 = WASM_VECTOR_LEN;
|
|
123
|
+
const ptr1 = passStringToWasm0(cluster_yaml, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
124
|
+
const len1 = WASM_VECTOR_LEN;
|
|
125
|
+
const ptr2 = passStringToWasm0(_world_yamls, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
126
|
+
const len2 = WASM_VECTOR_LEN;
|
|
127
|
+
const ret = wasm.generate_cluster_with_configs(seed, ptr0, len0, ptr1, len1, ptr2, len2);
|
|
128
|
+
deferred4_0 = ret[0];
|
|
129
|
+
deferred4_1 = ret[1];
|
|
130
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
131
|
+
} finally {
|
|
132
|
+
wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Generate a cluster from a game coordinate string (e.g.
|
|
138
|
+
* `"SNDST-A-42-0-4A-MUWF1"`). Returns a `ClusterResult` JSON
|
|
139
|
+
* envelope; for the typed-array `MapData` shape use
|
|
140
|
+
* `generate_map_data`.
|
|
141
|
+
* @param {string} coordinate
|
|
142
|
+
* @returns {string}
|
|
143
|
+
*/
|
|
144
|
+
export function generate_from_coordinate(coordinate) {
|
|
145
|
+
let deferred2_0;
|
|
146
|
+
let deferred2_1;
|
|
147
|
+
try {
|
|
148
|
+
const ptr0 = passStringToWasm0(coordinate, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
149
|
+
const len0 = WASM_VECTOR_LEN;
|
|
150
|
+
const ret = wasm.generate_from_coordinate(ptr0, len0);
|
|
151
|
+
deferred2_0 = ret[0];
|
|
152
|
+
deferred2_1 = ret[1];
|
|
153
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
154
|
+
} finally {
|
|
155
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Generate the layout for a cluster's starting world and return
|
|
161
|
+
* per-cell data as JSON: `{ cells: [{ site_id, x, y, type }, ...] }`.
|
|
162
|
+
* Used for cell-level comparison against C# reference snapshots.
|
|
163
|
+
* @param {number} seed
|
|
164
|
+
* @param {string} cluster_id
|
|
165
|
+
* @returns {string}
|
|
166
|
+
*/
|
|
167
|
+
export function generate_layout_cells(seed, cluster_id) {
|
|
168
|
+
let deferred2_0;
|
|
169
|
+
let deferred2_1;
|
|
170
|
+
try {
|
|
171
|
+
const ptr0 = passStringToWasm0(cluster_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
172
|
+
const len0 = WASM_VECTOR_LEN;
|
|
173
|
+
const ret = wasm.generate_layout_cells(seed, ptr0, len0);
|
|
174
|
+
deferred2_0 = ret[0];
|
|
175
|
+
deferred2_1 = ret[1];
|
|
176
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
177
|
+
} finally {
|
|
178
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* Generate a cluster from a game coordinate and return a `MapData`
|
|
184
|
+
* value: per-world element grids, biome cell polygons, entity spawns,
|
|
185
|
+
* and starmap locations. Caches the cluster for the two-phase API
|
|
186
|
+
* (`settle_cluster_advance`, `get_entity_spawners`).
|
|
187
|
+
*
|
|
188
|
+
* Per-cell grids ship as typed arrays (`Uint16Array`, `Float32Array`,
|
|
189
|
+
* etc.) on `JsValue` so JS consumers don't pay a JSON parse.
|
|
190
|
+
* @param {string} coordinate
|
|
191
|
+
* @returns {any}
|
|
192
|
+
*/
|
|
193
|
+
export function generate_map_data(coordinate) {
|
|
194
|
+
const ptr0 = passStringToWasm0(coordinate, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
195
|
+
const len0 = WASM_VECTOR_LEN;
|
|
196
|
+
const ret = wasm.generate_map_data(ptr0, len0);
|
|
197
|
+
return ret;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* Re-run ambient mob spawning against the cached cluster's current
|
|
202
|
+
* cell state and return the refreshed entity lists. Call after
|
|
203
|
+
* `settle_cluster_advance` chunks when settled liquid/gas flow may
|
|
204
|
+
* have invalidated earlier mob placements. Requires a prior
|
|
205
|
+
* `generate_map_data`. Template-placed entities (geysers, oil wells,
|
|
206
|
+
* props) persist across calls.
|
|
207
|
+
* @returns {string}
|
|
208
|
+
*/
|
|
209
|
+
export function get_entity_spawners() {
|
|
210
|
+
let deferred1_0;
|
|
211
|
+
let deferred1_1;
|
|
212
|
+
try {
|
|
213
|
+
const ret = wasm.get_entity_spawners();
|
|
214
|
+
deferred1_0 = ret[0];
|
|
215
|
+
deferred1_1 = ret[1];
|
|
216
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
217
|
+
} finally {
|
|
218
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* Returns a JSON-encoded `NoiseNodeKindSpec[]` enumerating every
|
|
224
|
+
* noise node variant the engine recognises (primitives, filters,
|
|
225
|
+
* modifiers, transformers, selectors, combiners) plus its param
|
|
226
|
+
* schema. Static across the lifetime of the build.
|
|
227
|
+
* @returns {string}
|
|
228
|
+
*/
|
|
229
|
+
export function noise_node_kinds() {
|
|
230
|
+
let deferred1_0;
|
|
231
|
+
let deferred1_1;
|
|
232
|
+
try {
|
|
233
|
+
const ret = wasm.noise_node_kinds();
|
|
234
|
+
deferred1_0 = ret[0];
|
|
235
|
+
deferred1_1 = ret[1];
|
|
236
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
237
|
+
} finally {
|
|
238
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
/**
|
|
243
|
+
* Toggle template placement. WASM-side counterpart of the native
|
|
244
|
+
* `SKIP_TEMPLATES` env var.
|
|
245
|
+
* @param {boolean} skip
|
|
246
|
+
*/
|
|
247
|
+
export function set_skip_templates(skip) {
|
|
248
|
+
wasm.set_skip_templates(skip);
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* Drop both the SettingsCache and the cluster cache. The next
|
|
253
|
+
* `generate_*` call reloads the embedded stock defaults.
|
|
254
|
+
*/
|
|
255
|
+
export function settings_reset() {
|
|
256
|
+
wasm.settings_reset();
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
/**
|
|
260
|
+
* Advance the cached cluster's settle sim to `target_tick` and
|
|
261
|
+
* return a binary snapshot at that tick covering every world. Call
|
|
262
|
+
* repeatedly with increasing ticks to paint intermediate frames;
|
|
263
|
+
* `target_tick = 499` finalises the cluster.
|
|
264
|
+
*
|
|
265
|
+
* `target_tick` must be in `1..=499`. A tick `<=` the current cached
|
|
266
|
+
* tick re-emits the current frame. Returns an empty buffer on
|
|
267
|
+
* out-of-range tick or empty/stale cache; call `generate_map_data`
|
|
268
|
+
* first to populate.
|
|
269
|
+
*
|
|
270
|
+
* Binary format (all little-endian, v5):
|
|
271
|
+
* - `u32` version tag (= 5)
|
|
272
|
+
* - `u32` tick
|
|
273
|
+
* - `u32` world count
|
|
274
|
+
* - per world: `u32` width, `u32` height, then `width * height`
|
|
275
|
+
* cells of 25 bytes each: `u16 elem, f32 mass, f32 temp, u8 dis,
|
|
276
|
+
* i32 dis_count, u16 bw_elem, f32 bw_mass, f32 bw_temp`. Worlds
|
|
277
|
+
* without `backwallNoise` emit Vacuum + 0 mass + 0 temp.
|
|
278
|
+
* @param {number} target_tick
|
|
279
|
+
* @returns {Uint8Array}
|
|
280
|
+
*/
|
|
281
|
+
export function settle_cluster_advance(target_tick) {
|
|
282
|
+
const ret = wasm.settle_cluster_advance(target_tick);
|
|
283
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
284
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
285
|
+
return v1;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
/**
|
|
289
|
+
* Drain the in-memory log buffer for `channel` (e.g. `"ppc_prng"`).
|
|
290
|
+
* WASM-side stand-in for native diag sites that would write to
|
|
291
|
+
* `std::fs::*`.
|
|
292
|
+
* @param {string} channel
|
|
293
|
+
* @returns {string}
|
|
294
|
+
*/
|
|
295
|
+
export function sim_env_drain_log(channel) {
|
|
296
|
+
let deferred2_0;
|
|
297
|
+
let deferred2_1;
|
|
298
|
+
try {
|
|
299
|
+
const ptr0 = passStringToWasm0(channel, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
300
|
+
const len0 = WASM_VECTOR_LEN;
|
|
301
|
+
const ret = wasm.sim_env_drain_log(ptr0, len0);
|
|
302
|
+
deferred2_0 = ret[0];
|
|
303
|
+
deferred2_1 = ret[1];
|
|
304
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
305
|
+
} finally {
|
|
306
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
/**
|
|
311
|
+
* Set a `(key, value)` in the cross-target env overlay read by
|
|
312
|
+
* `oni_sim::sim_env::var`. WASM-side stand-in for the `SIM_*_PATH` /
|
|
313
|
+
* `SIM_*_TICK` env vars used by native diag sites.
|
|
314
|
+
* @param {string} key
|
|
315
|
+
* @param {string} value
|
|
316
|
+
*/
|
|
317
|
+
export function sim_env_set(key, value) {
|
|
318
|
+
const ptr0 = passStringToWasm0(key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
319
|
+
const len0 = WASM_VECTOR_LEN;
|
|
320
|
+
const ptr1 = passStringToWasm0(value, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
321
|
+
const len1 = WASM_VECTOR_LEN;
|
|
322
|
+
wasm.sim_env_set(ptr0, len0, ptr1, len1);
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
/**
|
|
326
|
+
* Stable hex hash of a snapshot JSON. Alias of
|
|
327
|
+
* `snapshot_checksum_canonical`; same content always hashes to the
|
|
328
|
+
* same value regardless of HashMap/IndexMap iteration order.
|
|
329
|
+
* @param {string} snapshot_json
|
|
330
|
+
* @returns {string}
|
|
331
|
+
*/
|
|
332
|
+
export function snapshot_checksum(snapshot_json) {
|
|
333
|
+
let deferred3_0;
|
|
334
|
+
let deferred3_1;
|
|
335
|
+
try {
|
|
336
|
+
const ptr0 = passStringToWasm0(snapshot_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
337
|
+
const len0 = WASM_VECTOR_LEN;
|
|
338
|
+
const ret = wasm.snapshot_checksum(ptr0, len0);
|
|
339
|
+
var ptr2 = ret[0];
|
|
340
|
+
var len2 = ret[1];
|
|
341
|
+
if (ret[3]) {
|
|
342
|
+
ptr2 = 0; len2 = 0;
|
|
343
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
344
|
+
}
|
|
345
|
+
deferred3_0 = ptr2;
|
|
346
|
+
deferred3_1 = len2;
|
|
347
|
+
return getStringFromWasm0(ptr2, len2);
|
|
348
|
+
} finally {
|
|
349
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
/**
|
|
354
|
+
* Byte-hash variant: FNV-1a-64 over the raw input bytes. Weak
|
|
355
|
+
* contract; same logical content with different HashMap/IndexMap
|
|
356
|
+
* iteration orders produces different hashes. Only safe when the
|
|
357
|
+
* consumer caches the exact bytes it hashed.
|
|
358
|
+
* @param {string} snapshot_json
|
|
359
|
+
* @returns {string}
|
|
360
|
+
*/
|
|
361
|
+
export function snapshot_checksum_bytes(snapshot_json) {
|
|
362
|
+
let deferred2_0;
|
|
363
|
+
let deferred2_1;
|
|
364
|
+
try {
|
|
365
|
+
const ptr0 = passStringToWasm0(snapshot_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
366
|
+
const len0 = WASM_VECTOR_LEN;
|
|
367
|
+
const ret = wasm.snapshot_checksum_bytes(ptr0, len0);
|
|
368
|
+
deferred2_0 = ret[0];
|
|
369
|
+
deferred2_1 = ret[1];
|
|
370
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
371
|
+
} finally {
|
|
372
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
/**
|
|
377
|
+
* Canonical-form variant: parses to a `serde_json::Value` (sorted
|
|
378
|
+
* keys at every level), then FNV-1a-64 with type tags + length
|
|
379
|
+
* prefixes. Same logical content always produces the same hash;
|
|
380
|
+
* what `snapshot_checksum` (the default) and `snapshot_state_checksum`
|
|
381
|
+
* route through.
|
|
382
|
+
* @param {string} snapshot_json
|
|
383
|
+
* @returns {string}
|
|
384
|
+
*/
|
|
385
|
+
export function snapshot_checksum_canonical(snapshot_json) {
|
|
386
|
+
let deferred3_0;
|
|
387
|
+
let deferred3_1;
|
|
388
|
+
try {
|
|
389
|
+
const ptr0 = passStringToWasm0(snapshot_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
390
|
+
const len0 = WASM_VECTOR_LEN;
|
|
391
|
+
const ret = wasm.snapshot_checksum_canonical(ptr0, len0);
|
|
392
|
+
var ptr2 = ret[0];
|
|
393
|
+
var len2 = ret[1];
|
|
394
|
+
if (ret[3]) {
|
|
395
|
+
ptr2 = 0; len2 = 0;
|
|
396
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
397
|
+
}
|
|
398
|
+
deferred3_0 = ptr2;
|
|
399
|
+
deferred3_1 = len2;
|
|
400
|
+
return getStringFromWasm0(ptr2, len2);
|
|
401
|
+
} finally {
|
|
402
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
/**
|
|
407
|
+
* Build a `WorldgenSnapshot` from a `{path: JSON-string}` files map,
|
|
408
|
+
* apply it to SETTINGS, and return the resulting snapshot JSON.
|
|
409
|
+
* Strict mode.
|
|
410
|
+
* @param {string} files_json
|
|
411
|
+
* @returns {string}
|
|
412
|
+
*/
|
|
413
|
+
export function snapshot_from_files(files_json) {
|
|
414
|
+
let deferred3_0;
|
|
415
|
+
let deferred3_1;
|
|
416
|
+
try {
|
|
417
|
+
const ptr0 = passStringToWasm0(files_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
418
|
+
const len0 = WASM_VECTOR_LEN;
|
|
419
|
+
const ret = wasm.snapshot_from_files(ptr0, len0);
|
|
420
|
+
var ptr2 = ret[0];
|
|
421
|
+
var len2 = ret[1];
|
|
422
|
+
if (ret[3]) {
|
|
423
|
+
ptr2 = 0; len2 = 0;
|
|
424
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
425
|
+
}
|
|
426
|
+
deferred3_0 = ptr2;
|
|
427
|
+
deferred3_1 = len2;
|
|
428
|
+
return getStringFromWasm0(ptr2, len2);
|
|
429
|
+
} finally {
|
|
430
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
/**
|
|
435
|
+
* Extensions-mode counterpart of `snapshot_from_files`.
|
|
436
|
+
* @param {string} files_json
|
|
437
|
+
* @returns {string}
|
|
438
|
+
*/
|
|
439
|
+
export function snapshot_from_files_extensions(files_json) {
|
|
440
|
+
let deferred3_0;
|
|
441
|
+
let deferred3_1;
|
|
442
|
+
try {
|
|
443
|
+
const ptr0 = passStringToWasm0(files_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
444
|
+
const len0 = WASM_VECTOR_LEN;
|
|
445
|
+
const ret = wasm.snapshot_from_files_extensions(ptr0, len0);
|
|
446
|
+
var ptr2 = ret[0];
|
|
447
|
+
var len2 = ret[1];
|
|
448
|
+
if (ret[3]) {
|
|
449
|
+
ptr2 = 0; len2 = 0;
|
|
450
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
451
|
+
}
|
|
452
|
+
deferred3_0 = ptr2;
|
|
453
|
+
deferred3_1 = len2;
|
|
454
|
+
return getStringFromWasm0(ptr2, len2);
|
|
455
|
+
} finally {
|
|
456
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
/**
|
|
461
|
+
* Reset SETTINGS to the embedded U59 vanilla baseline and return the
|
|
462
|
+
* vanilla snapshot as a JSON string. Strict mode.
|
|
463
|
+
* @returns {string}
|
|
464
|
+
*/
|
|
465
|
+
export function snapshot_load_vanilla() {
|
|
466
|
+
let deferred2_0;
|
|
467
|
+
let deferred2_1;
|
|
468
|
+
try {
|
|
469
|
+
const ret = wasm.snapshot_load_vanilla();
|
|
470
|
+
var ptr1 = ret[0];
|
|
471
|
+
var len1 = ret[1];
|
|
472
|
+
if (ret[3]) {
|
|
473
|
+
ptr1 = 0; len1 = 0;
|
|
474
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
475
|
+
}
|
|
476
|
+
deferred2_0 = ptr1;
|
|
477
|
+
deferred2_1 = len1;
|
|
478
|
+
return getStringFromWasm0(ptr1, len1);
|
|
479
|
+
} finally {
|
|
480
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
/**
|
|
485
|
+
* Extensions-mode counterpart of `snapshot_load_vanilla`. Subsequent
|
|
486
|
+
* `merge_files` calls accept mod-defined enum extensions.
|
|
487
|
+
* @returns {string}
|
|
488
|
+
*/
|
|
489
|
+
export function snapshot_load_vanilla_extensions() {
|
|
490
|
+
let deferred2_0;
|
|
491
|
+
let deferred2_1;
|
|
492
|
+
try {
|
|
493
|
+
const ret = wasm.snapshot_load_vanilla_extensions();
|
|
494
|
+
var ptr1 = ret[0];
|
|
495
|
+
var len1 = ret[1];
|
|
496
|
+
if (ret[3]) {
|
|
497
|
+
ptr1 = 0; len1 = 0;
|
|
498
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
499
|
+
}
|
|
500
|
+
deferred2_0 = ptr1;
|
|
501
|
+
deferred2_1 = len1;
|
|
502
|
+
return getStringFromWasm0(ptr1, len1);
|
|
503
|
+
} finally {
|
|
504
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
/**
|
|
509
|
+
* Merge a `{path: JSON-string}` files map into an existing snapshot
|
|
510
|
+
* JSON. Last-wins on duplicate paths. Applies the merged snapshot to
|
|
511
|
+
* SETTINGS as a side effect.
|
|
512
|
+
* @param {string} snapshot_json
|
|
513
|
+
* @param {string} files_json
|
|
514
|
+
* @returns {string}
|
|
515
|
+
*/
|
|
516
|
+
export function snapshot_merge_files(snapshot_json, files_json) {
|
|
517
|
+
let deferred4_0;
|
|
518
|
+
let deferred4_1;
|
|
519
|
+
try {
|
|
520
|
+
const ptr0 = passStringToWasm0(snapshot_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
521
|
+
const len0 = WASM_VECTOR_LEN;
|
|
522
|
+
const ptr1 = passStringToWasm0(files_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
523
|
+
const len1 = WASM_VECTOR_LEN;
|
|
524
|
+
const ret = wasm.snapshot_merge_files(ptr0, len0, ptr1, len1);
|
|
525
|
+
var ptr3 = ret[0];
|
|
526
|
+
var len3 = ret[1];
|
|
527
|
+
if (ret[3]) {
|
|
528
|
+
ptr3 = 0; len3 = 0;
|
|
529
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
530
|
+
}
|
|
531
|
+
deferred4_0 = ptr3;
|
|
532
|
+
deferred4_1 = len3;
|
|
533
|
+
return getStringFromWasm0(ptr3, len3);
|
|
534
|
+
} finally {
|
|
535
|
+
wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
/**
|
|
540
|
+
* Drop `paths_json` (a JSON array of path strings) from a snapshot
|
|
541
|
+
* JSON, apply the result to SETTINGS, and return the updated
|
|
542
|
+
* snapshot JSON. Paths not present are silently ignored; mode and
|
|
543
|
+
* element overrides are preserved.
|
|
544
|
+
* @param {string} snapshot_json
|
|
545
|
+
* @param {string} paths_json
|
|
546
|
+
* @returns {string}
|
|
547
|
+
*/
|
|
548
|
+
export function snapshot_remove_paths(snapshot_json, paths_json) {
|
|
549
|
+
let deferred4_0;
|
|
550
|
+
let deferred4_1;
|
|
551
|
+
try {
|
|
552
|
+
const ptr0 = passStringToWasm0(snapshot_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
553
|
+
const len0 = WASM_VECTOR_LEN;
|
|
554
|
+
const ptr1 = passStringToWasm0(paths_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
555
|
+
const len1 = WASM_VECTOR_LEN;
|
|
556
|
+
const ret = wasm.snapshot_remove_paths(ptr0, len0, ptr1, len1);
|
|
557
|
+
var ptr3 = ret[0];
|
|
558
|
+
var len3 = ret[1];
|
|
559
|
+
if (ret[3]) {
|
|
560
|
+
ptr3 = 0; len3 = 0;
|
|
561
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
562
|
+
}
|
|
563
|
+
deferred4_0 = ptr3;
|
|
564
|
+
deferred4_1 = len3;
|
|
565
|
+
return getStringFromWasm0(ptr3, len3);
|
|
566
|
+
} finally {
|
|
567
|
+
wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
/**
|
|
572
|
+
* Stable hex hash of the resident snapshot. Same content produces
|
|
573
|
+
* the same hash regardless of HashMap/IndexMap iteration order or
|
|
574
|
+
* load history. Auto-loads vanilla if empty.
|
|
575
|
+
* @returns {string}
|
|
576
|
+
*/
|
|
577
|
+
export function snapshot_state_checksum() {
|
|
578
|
+
let deferred2_0;
|
|
579
|
+
let deferred2_1;
|
|
580
|
+
try {
|
|
581
|
+
const ret = wasm.snapshot_state_checksum();
|
|
582
|
+
var ptr1 = ret[0];
|
|
583
|
+
var len1 = ret[1];
|
|
584
|
+
if (ret[3]) {
|
|
585
|
+
ptr1 = 0; len1 = 0;
|
|
586
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
587
|
+
}
|
|
588
|
+
deferred2_0 = ptr1;
|
|
589
|
+
deferred2_1 = len1;
|
|
590
|
+
return getStringFromWasm0(ptr1, len1);
|
|
591
|
+
} finally {
|
|
592
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
/**
|
|
597
|
+
* Drop the listed paths from the resident snapshot. `paths_json` is
|
|
598
|
+
* a JSON array of path strings; paths not present are silently
|
|
599
|
+
* ignored.
|
|
600
|
+
* @param {string} paths_json
|
|
601
|
+
* @returns {number}
|
|
602
|
+
*/
|
|
603
|
+
export function snapshot_state_drop_paths(paths_json) {
|
|
604
|
+
const ptr0 = passStringToWasm0(paths_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
605
|
+
const len0 = WASM_VECTOR_LEN;
|
|
606
|
+
const ret = wasm.snapshot_state_drop_paths(ptr0, len0);
|
|
607
|
+
if (ret[2]) {
|
|
608
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
609
|
+
}
|
|
610
|
+
return ret[0];
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
/**
|
|
614
|
+
* Return the resident snapshot as a JSON-encoded
|
|
615
|
+
* `{path: JSON-string}` files map. Auto-loads vanilla if empty.
|
|
616
|
+
* @returns {string}
|
|
617
|
+
*/
|
|
618
|
+
export function snapshot_state_files() {
|
|
619
|
+
let deferred2_0;
|
|
620
|
+
let deferred2_1;
|
|
621
|
+
try {
|
|
622
|
+
const ret = wasm.snapshot_state_files();
|
|
623
|
+
var ptr1 = ret[0];
|
|
624
|
+
var len1 = ret[1];
|
|
625
|
+
if (ret[3]) {
|
|
626
|
+
ptr1 = 0; len1 = 0;
|
|
627
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
628
|
+
}
|
|
629
|
+
deferred2_0 = ptr1;
|
|
630
|
+
deferred2_1 = len1;
|
|
631
|
+
return getStringFromWasm0(ptr1, len1);
|
|
632
|
+
} finally {
|
|
633
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
634
|
+
}
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
/**
|
|
638
|
+
* Replace the resident snapshot from a `{path: JSON-string}` files
|
|
639
|
+
* map. Strict; atomic. Throws and leaves the snapshot untouched on
|
|
640
|
+
* invalid input.
|
|
641
|
+
* @param {string} files_json
|
|
642
|
+
* @returns {number}
|
|
643
|
+
*/
|
|
644
|
+
export function snapshot_state_load(files_json) {
|
|
645
|
+
const ptr0 = passStringToWasm0(files_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
646
|
+
const len0 = WASM_VECTOR_LEN;
|
|
647
|
+
const ret = wasm.snapshot_state_load(ptr0, len0);
|
|
648
|
+
if (ret[2]) {
|
|
649
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
650
|
+
}
|
|
651
|
+
return ret[0];
|
|
652
|
+
}
|
|
653
|
+
|
|
654
|
+
/**
|
|
655
|
+
* Extensions-mode counterpart of `snapshot_state_load`. Subsequent
|
|
656
|
+
* merges inherit the Extensions mode from the loaded snapshot.
|
|
657
|
+
* @param {string} files_json
|
|
658
|
+
* @returns {number}
|
|
659
|
+
*/
|
|
660
|
+
export function snapshot_state_load_extensions(files_json) {
|
|
661
|
+
const ptr0 = passStringToWasm0(files_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
662
|
+
const len0 = WASM_VECTOR_LEN;
|
|
663
|
+
const ret = wasm.snapshot_state_load_extensions(ptr0, len0);
|
|
664
|
+
if (ret[2]) {
|
|
665
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
666
|
+
}
|
|
667
|
+
return ret[0];
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
/**
|
|
671
|
+
* Merge a `{path: JSON-string}` files map into the resident snapshot.
|
|
672
|
+
* Last-wins on duplicate paths. Auto-loads vanilla if empty; atomic
|
|
673
|
+
* on parse failure. Mode is inherited from the resident snapshot.
|
|
674
|
+
* @param {string} files_json
|
|
675
|
+
* @returns {number}
|
|
676
|
+
*/
|
|
677
|
+
export function snapshot_state_merge(files_json) {
|
|
678
|
+
const ptr0 = passStringToWasm0(files_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
679
|
+
const len0 = WASM_VECTOR_LEN;
|
|
680
|
+
const ret = wasm.snapshot_state_merge(ptr0, len0);
|
|
681
|
+
if (ret[2]) {
|
|
682
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
683
|
+
}
|
|
684
|
+
return ret[0];
|
|
685
|
+
}
|
|
686
|
+
|
|
687
|
+
/**
|
|
688
|
+
* Clear the resident snapshot and bump the version. The next
|
|
689
|
+
* `snapshot_state_*` call auto-loads vanilla.
|
|
690
|
+
*/
|
|
691
|
+
export function snapshot_state_reset() {
|
|
692
|
+
wasm.snapshot_state_reset();
|
|
693
|
+
}
|
|
694
|
+
|
|
695
|
+
/**
|
|
696
|
+
* Reset the resident snapshot to the embedded vanilla baseline.
|
|
697
|
+
* Strict mode.
|
|
698
|
+
* @returns {number}
|
|
699
|
+
*/
|
|
700
|
+
export function snapshot_state_vanilla() {
|
|
701
|
+
const ret = wasm.snapshot_state_vanilla();
|
|
702
|
+
return ret;
|
|
703
|
+
}
|
|
704
|
+
|
|
705
|
+
/**
|
|
706
|
+
* Same as `snapshot_state_vanilla`, Extensions mode. Subsequent
|
|
707
|
+
* merges accept mod-defined enum extensions.
|
|
708
|
+
* @returns {number}
|
|
709
|
+
*/
|
|
710
|
+
export function snapshot_state_vanilla_extensions() {
|
|
711
|
+
const ret = wasm.snapshot_state_vanilla_extensions();
|
|
712
|
+
return ret;
|
|
713
|
+
}
|
|
714
|
+
|
|
715
|
+
/**
|
|
716
|
+
* Monotonic mutation counter. Bumps on every successful mutation;
|
|
717
|
+
* 0 if the slot has never been touched.
|
|
718
|
+
* @returns {number}
|
|
719
|
+
*/
|
|
720
|
+
export function snapshot_state_version() {
|
|
721
|
+
const ret = wasm.snapshot_state_version();
|
|
722
|
+
return ret;
|
|
723
|
+
}
|
|
724
|
+
|
|
725
|
+
/**
|
|
726
|
+
* Convert a snapshot JSON into a `{path: JSON-string}` files map.
|
|
727
|
+
* Round-trips back through `snapshot_from_files`.
|
|
728
|
+
* @param {string} snapshot_json
|
|
729
|
+
* @returns {string}
|
|
730
|
+
*/
|
|
731
|
+
export function snapshot_to_files(snapshot_json) {
|
|
732
|
+
let deferred3_0;
|
|
733
|
+
let deferred3_1;
|
|
734
|
+
try {
|
|
735
|
+
const ptr0 = passStringToWasm0(snapshot_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
736
|
+
const len0 = WASM_VECTOR_LEN;
|
|
737
|
+
const ret = wasm.snapshot_to_files(ptr0, len0);
|
|
738
|
+
var ptr2 = ret[0];
|
|
739
|
+
var len2 = ret[1];
|
|
740
|
+
if (ret[3]) {
|
|
741
|
+
ptr2 = 0; len2 = 0;
|
|
742
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
743
|
+
}
|
|
744
|
+
deferred3_0 = ptr2;
|
|
745
|
+
deferred3_1 = len2;
|
|
746
|
+
return getStringFromWasm0(ptr2, len2);
|
|
747
|
+
} finally {
|
|
748
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
749
|
+
}
|
|
750
|
+
}
|
|
751
|
+
|
|
752
|
+
function __wbg_get_imports() {
|
|
753
|
+
const import0 = {
|
|
754
|
+
__proto__: null,
|
|
755
|
+
__wbg_Error_83742b46f01ce22d: function(arg0, arg1) {
|
|
756
|
+
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
757
|
+
return ret;
|
|
758
|
+
},
|
|
759
|
+
__wbg_String_8564e559799eccda: function(arg0, arg1) {
|
|
760
|
+
const ret = String(arg1);
|
|
761
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
762
|
+
const len1 = WASM_VECTOR_LEN;
|
|
763
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
764
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
765
|
+
},
|
|
766
|
+
__wbg___wbindgen_is_string_7ef6b97b02428fae: function(arg0) {
|
|
767
|
+
const ret = typeof(arg0) === 'string';
|
|
768
|
+
return ret;
|
|
769
|
+
},
|
|
770
|
+
__wbg___wbindgen_throw_6ddd609b62940d55: function(arg0, arg1) {
|
|
771
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
772
|
+
},
|
|
773
|
+
__wbg_get_3ef1eba1850ade27: function() { return handleError(function (arg0, arg1) {
|
|
774
|
+
const ret = Reflect.get(arg0, arg1);
|
|
775
|
+
return ret;
|
|
776
|
+
}, arguments); },
|
|
777
|
+
__wbg_get_a8ee5c45dabc1b3b: function(arg0, arg1) {
|
|
778
|
+
const ret = arg0[arg1 >>> 0];
|
|
779
|
+
return ret;
|
|
780
|
+
},
|
|
781
|
+
__wbg_new_49d5571bd3f0c4d4: function() {
|
|
782
|
+
const ret = new Map();
|
|
783
|
+
return ret;
|
|
784
|
+
},
|
|
785
|
+
__wbg_new_a70fbab9066b301f: function() {
|
|
786
|
+
const ret = new Array();
|
|
787
|
+
return ret;
|
|
788
|
+
},
|
|
789
|
+
__wbg_new_ab79df5bd7c26067: function() {
|
|
790
|
+
const ret = new Object();
|
|
791
|
+
return ret;
|
|
792
|
+
},
|
|
793
|
+
__wbg_new_from_slice_22da9388ac046e50: function(arg0, arg1) {
|
|
794
|
+
const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1));
|
|
795
|
+
return ret;
|
|
796
|
+
},
|
|
797
|
+
__wbg_new_from_slice_c62f8165d6102476: function(arg0, arg1) {
|
|
798
|
+
const ret = new Int32Array(getArrayI32FromWasm0(arg0, arg1));
|
|
799
|
+
return ret;
|
|
800
|
+
},
|
|
801
|
+
__wbg_new_from_slice_dddccc7a7dc2cc04: function(arg0, arg1) {
|
|
802
|
+
const ret = new Uint16Array(getArrayU16FromWasm0(arg0, arg1));
|
|
803
|
+
return ret;
|
|
804
|
+
},
|
|
805
|
+
__wbg_new_from_slice_ff2c15e8e05ffdfc: function(arg0, arg1) {
|
|
806
|
+
const ret = new Float32Array(getArrayF32FromWasm0(arg0, arg1));
|
|
807
|
+
return ret;
|
|
808
|
+
},
|
|
809
|
+
__wbg_now_16f0c993d5dd6c27: function() {
|
|
810
|
+
const ret = Date.now();
|
|
811
|
+
return ret;
|
|
812
|
+
},
|
|
813
|
+
__wbg_set_282384002438957f: function(arg0, arg1, arg2) {
|
|
814
|
+
arg0[arg1 >>> 0] = arg2;
|
|
815
|
+
},
|
|
816
|
+
__wbg_set_6be42768c690e380: function(arg0, arg1, arg2) {
|
|
817
|
+
arg0[arg1] = arg2;
|
|
818
|
+
},
|
|
819
|
+
__wbg_set_7eaa4f96924fd6b3: function() { return handleError(function (arg0, arg1, arg2) {
|
|
820
|
+
const ret = Reflect.set(arg0, arg1, arg2);
|
|
821
|
+
return ret;
|
|
822
|
+
}, arguments); },
|
|
823
|
+
__wbg_set_bf7251625df30a02: function(arg0, arg1, arg2) {
|
|
824
|
+
const ret = arg0.set(arg1, arg2);
|
|
825
|
+
return ret;
|
|
826
|
+
},
|
|
827
|
+
__wbindgen_cast_0000000000000001: function(arg0) {
|
|
828
|
+
// Cast intrinsic for `F64 -> Externref`.
|
|
829
|
+
const ret = arg0;
|
|
830
|
+
return ret;
|
|
831
|
+
},
|
|
832
|
+
__wbindgen_cast_0000000000000002: function(arg0) {
|
|
833
|
+
// Cast intrinsic for `I64 -> Externref`.
|
|
834
|
+
const ret = arg0;
|
|
835
|
+
return ret;
|
|
836
|
+
},
|
|
837
|
+
__wbindgen_cast_0000000000000003: function(arg0, arg1) {
|
|
838
|
+
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
839
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
840
|
+
return ret;
|
|
841
|
+
},
|
|
842
|
+
__wbindgen_cast_0000000000000004: function(arg0) {
|
|
843
|
+
// Cast intrinsic for `U64 -> Externref`.
|
|
844
|
+
const ret = BigInt.asUintN(64, arg0);
|
|
845
|
+
return ret;
|
|
846
|
+
},
|
|
847
|
+
__wbindgen_init_externref_table: function() {
|
|
848
|
+
const table = wasm.__wbindgen_externrefs;
|
|
849
|
+
const offset = table.grow(4);
|
|
850
|
+
table.set(0, undefined);
|
|
851
|
+
table.set(offset + 0, undefined);
|
|
852
|
+
table.set(offset + 1, null);
|
|
853
|
+
table.set(offset + 2, true);
|
|
854
|
+
table.set(offset + 3, false);
|
|
855
|
+
},
|
|
856
|
+
};
|
|
857
|
+
return {
|
|
858
|
+
__proto__: null,
|
|
859
|
+
"./oni_wasm_bg.js": import0,
|
|
860
|
+
};
|
|
861
|
+
}
|
|
862
|
+
|
|
863
|
+
function addToExternrefTable0(obj) {
|
|
864
|
+
const idx = wasm.__externref_table_alloc();
|
|
865
|
+
wasm.__wbindgen_externrefs.set(idx, obj);
|
|
866
|
+
return idx;
|
|
867
|
+
}
|
|
868
|
+
|
|
869
|
+
function getArrayF32FromWasm0(ptr, len) {
|
|
870
|
+
ptr = ptr >>> 0;
|
|
871
|
+
return getFloat32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
|
|
872
|
+
}
|
|
873
|
+
|
|
874
|
+
function getArrayI32FromWasm0(ptr, len) {
|
|
875
|
+
ptr = ptr >>> 0;
|
|
876
|
+
return getInt32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
|
|
877
|
+
}
|
|
878
|
+
|
|
879
|
+
function getArrayU16FromWasm0(ptr, len) {
|
|
880
|
+
ptr = ptr >>> 0;
|
|
881
|
+
return getUint16ArrayMemory0().subarray(ptr / 2, ptr / 2 + len);
|
|
882
|
+
}
|
|
883
|
+
|
|
884
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
885
|
+
ptr = ptr >>> 0;
|
|
886
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
887
|
+
}
|
|
888
|
+
|
|
889
|
+
let cachedDataViewMemory0 = null;
|
|
890
|
+
function getDataViewMemory0() {
|
|
891
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
892
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
893
|
+
}
|
|
894
|
+
return cachedDataViewMemory0;
|
|
895
|
+
}
|
|
896
|
+
|
|
897
|
+
let cachedFloat32ArrayMemory0 = null;
|
|
898
|
+
function getFloat32ArrayMemory0() {
|
|
899
|
+
if (cachedFloat32ArrayMemory0 === null || cachedFloat32ArrayMemory0.byteLength === 0) {
|
|
900
|
+
cachedFloat32ArrayMemory0 = new Float32Array(wasm.memory.buffer);
|
|
901
|
+
}
|
|
902
|
+
return cachedFloat32ArrayMemory0;
|
|
903
|
+
}
|
|
904
|
+
|
|
905
|
+
let cachedInt32ArrayMemory0 = null;
|
|
906
|
+
function getInt32ArrayMemory0() {
|
|
907
|
+
if (cachedInt32ArrayMemory0 === null || cachedInt32ArrayMemory0.byteLength === 0) {
|
|
908
|
+
cachedInt32ArrayMemory0 = new Int32Array(wasm.memory.buffer);
|
|
909
|
+
}
|
|
910
|
+
return cachedInt32ArrayMemory0;
|
|
911
|
+
}
|
|
912
|
+
|
|
913
|
+
function getStringFromWasm0(ptr, len) {
|
|
914
|
+
ptr = ptr >>> 0;
|
|
915
|
+
return decodeText(ptr, len);
|
|
916
|
+
}
|
|
917
|
+
|
|
918
|
+
let cachedUint16ArrayMemory0 = null;
|
|
919
|
+
function getUint16ArrayMemory0() {
|
|
920
|
+
if (cachedUint16ArrayMemory0 === null || cachedUint16ArrayMemory0.byteLength === 0) {
|
|
921
|
+
cachedUint16ArrayMemory0 = new Uint16Array(wasm.memory.buffer);
|
|
922
|
+
}
|
|
923
|
+
return cachedUint16ArrayMemory0;
|
|
924
|
+
}
|
|
925
|
+
|
|
926
|
+
let cachedUint8ArrayMemory0 = null;
|
|
927
|
+
function getUint8ArrayMemory0() {
|
|
928
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
929
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
930
|
+
}
|
|
931
|
+
return cachedUint8ArrayMemory0;
|
|
932
|
+
}
|
|
933
|
+
|
|
934
|
+
function handleError(f, args) {
|
|
935
|
+
try {
|
|
936
|
+
return f.apply(this, args);
|
|
937
|
+
} catch (e) {
|
|
938
|
+
const idx = addToExternrefTable0(e);
|
|
939
|
+
wasm.__wbindgen_exn_store(idx);
|
|
940
|
+
}
|
|
941
|
+
}
|
|
942
|
+
|
|
943
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
944
|
+
if (realloc === undefined) {
|
|
945
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
946
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
947
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
948
|
+
WASM_VECTOR_LEN = buf.length;
|
|
949
|
+
return ptr;
|
|
950
|
+
}
|
|
951
|
+
|
|
952
|
+
let len = arg.length;
|
|
953
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
954
|
+
|
|
955
|
+
const mem = getUint8ArrayMemory0();
|
|
956
|
+
|
|
957
|
+
let offset = 0;
|
|
958
|
+
|
|
959
|
+
for (; offset < len; offset++) {
|
|
960
|
+
const code = arg.charCodeAt(offset);
|
|
961
|
+
if (code > 0x7F) break;
|
|
962
|
+
mem[ptr + offset] = code;
|
|
963
|
+
}
|
|
964
|
+
if (offset !== len) {
|
|
965
|
+
if (offset !== 0) {
|
|
966
|
+
arg = arg.slice(offset);
|
|
967
|
+
}
|
|
968
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
969
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
970
|
+
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
971
|
+
|
|
972
|
+
offset += ret.written;
|
|
973
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
974
|
+
}
|
|
975
|
+
|
|
976
|
+
WASM_VECTOR_LEN = offset;
|
|
977
|
+
return ptr;
|
|
978
|
+
}
|
|
979
|
+
|
|
980
|
+
function takeFromExternrefTable0(idx) {
|
|
981
|
+
const value = wasm.__wbindgen_externrefs.get(idx);
|
|
982
|
+
wasm.__externref_table_dealloc(idx);
|
|
983
|
+
return value;
|
|
984
|
+
}
|
|
985
|
+
|
|
986
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
987
|
+
cachedTextDecoder.decode();
|
|
988
|
+
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
989
|
+
let numBytesDecoded = 0;
|
|
990
|
+
function decodeText(ptr, len) {
|
|
991
|
+
numBytesDecoded += len;
|
|
992
|
+
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
993
|
+
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
994
|
+
cachedTextDecoder.decode();
|
|
995
|
+
numBytesDecoded = len;
|
|
996
|
+
}
|
|
997
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
998
|
+
}
|
|
999
|
+
|
|
1000
|
+
const cachedTextEncoder = new TextEncoder();
|
|
1001
|
+
|
|
1002
|
+
if (!('encodeInto' in cachedTextEncoder)) {
|
|
1003
|
+
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
1004
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
1005
|
+
view.set(buf);
|
|
1006
|
+
return {
|
|
1007
|
+
read: arg.length,
|
|
1008
|
+
written: buf.length
|
|
1009
|
+
};
|
|
1010
|
+
};
|
|
1011
|
+
}
|
|
1012
|
+
|
|
1013
|
+
let WASM_VECTOR_LEN = 0;
|
|
1014
|
+
|
|
1015
|
+
let wasmModule, wasm;
|
|
1016
|
+
function __wbg_finalize_init(instance, module) {
|
|
1017
|
+
wasm = instance.exports;
|
|
1018
|
+
wasmModule = module;
|
|
1019
|
+
cachedDataViewMemory0 = null;
|
|
1020
|
+
cachedFloat32ArrayMemory0 = null;
|
|
1021
|
+
cachedInt32ArrayMemory0 = null;
|
|
1022
|
+
cachedUint16ArrayMemory0 = null;
|
|
1023
|
+
cachedUint8ArrayMemory0 = null;
|
|
1024
|
+
wasm.__wbindgen_start();
|
|
1025
|
+
return wasm;
|
|
1026
|
+
}
|
|
1027
|
+
|
|
1028
|
+
async function __wbg_load(module, imports) {
|
|
1029
|
+
if (typeof Response === 'function' && module instanceof Response) {
|
|
1030
|
+
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
|
1031
|
+
try {
|
|
1032
|
+
return await WebAssembly.instantiateStreaming(module, imports);
|
|
1033
|
+
} catch (e) {
|
|
1034
|
+
const validResponse = module.ok && expectedResponseType(module.type);
|
|
1035
|
+
|
|
1036
|
+
if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
|
|
1037
|
+
console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
|
|
1038
|
+
|
|
1039
|
+
} else { throw e; }
|
|
1040
|
+
}
|
|
1041
|
+
}
|
|
1042
|
+
|
|
1043
|
+
const bytes = await module.arrayBuffer();
|
|
1044
|
+
return await WebAssembly.instantiate(bytes, imports);
|
|
1045
|
+
} else {
|
|
1046
|
+
const instance = await WebAssembly.instantiate(module, imports);
|
|
1047
|
+
|
|
1048
|
+
if (instance instanceof WebAssembly.Instance) {
|
|
1049
|
+
return { instance, module };
|
|
1050
|
+
} else {
|
|
1051
|
+
return instance;
|
|
1052
|
+
}
|
|
1053
|
+
}
|
|
1054
|
+
|
|
1055
|
+
function expectedResponseType(type) {
|
|
1056
|
+
switch (type) {
|
|
1057
|
+
case 'basic': case 'cors': case 'default': return true;
|
|
1058
|
+
}
|
|
1059
|
+
return false;
|
|
1060
|
+
}
|
|
1061
|
+
}
|
|
1062
|
+
|
|
1063
|
+
function initSync(module) {
|
|
1064
|
+
if (wasm !== undefined) return wasm;
|
|
1065
|
+
|
|
1066
|
+
|
|
1067
|
+
if (module !== undefined) {
|
|
1068
|
+
if (Object.getPrototypeOf(module) === Object.prototype) {
|
|
1069
|
+
({module} = module)
|
|
1070
|
+
} else {
|
|
1071
|
+
console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
|
|
1072
|
+
}
|
|
1073
|
+
}
|
|
1074
|
+
|
|
1075
|
+
const imports = __wbg_get_imports();
|
|
1076
|
+
if (!(module instanceof WebAssembly.Module)) {
|
|
1077
|
+
module = new WebAssembly.Module(module);
|
|
1078
|
+
}
|
|
1079
|
+
const instance = new WebAssembly.Instance(module, imports);
|
|
1080
|
+
return __wbg_finalize_init(instance, module);
|
|
1081
|
+
}
|
|
1082
|
+
|
|
1083
|
+
async function __wbg_init(module_or_path) {
|
|
1084
|
+
if (wasm !== undefined) return wasm;
|
|
1085
|
+
|
|
1086
|
+
|
|
1087
|
+
if (module_or_path !== undefined) {
|
|
1088
|
+
if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
|
|
1089
|
+
({module_or_path} = module_or_path)
|
|
1090
|
+
} else {
|
|
1091
|
+
console.warn('using deprecated parameters for the initialization function; pass a single object instead')
|
|
1092
|
+
}
|
|
1093
|
+
}
|
|
1094
|
+
|
|
1095
|
+
if (module_or_path === undefined) {
|
|
1096
|
+
module_or_path = new URL('oni_wasm_bg.wasm', import.meta.url);
|
|
1097
|
+
}
|
|
1098
|
+
const imports = __wbg_get_imports();
|
|
1099
|
+
|
|
1100
|
+
if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
|
|
1101
|
+
module_or_path = fetch(module_or_path);
|
|
1102
|
+
}
|
|
1103
|
+
|
|
1104
|
+
const { instance, module } = await __wbg_load(await module_or_path, imports);
|
|
1105
|
+
|
|
1106
|
+
return __wbg_finalize_init(instance, module);
|
|
1107
|
+
}
|
|
1108
|
+
|
|
1109
|
+
export { initSync, __wbg_init as default };
|