summaryrefslogtreecommitdiff
path: root/index.htm
diff options
context:
space:
mode:
authorMitya Selivanov <automainint@guattari.tech>2025-01-14 08:28:56 +0100
committerMitya Selivanov <automainint@guattari.tech>2025-01-14 08:28:56 +0100
commitbefe5320de589d223baeff8914515753a5896b61 (patch)
tree2620aac301bdb9df19349ea9a5d80c7a84f006a2 /index.htm
parentdced6f7768e02252af11f9b41017d75c66b47d81 (diff)
downloadreduced_system_layer-befe5320de589d223baeff8914515753a5896b61.zip
wasm fixes
Diffstat (limited to 'index.htm')
-rw-r--r--index.htm24
1 files changed, 14 insertions, 10 deletions
diff --git a/index.htm b/index.htm
index e06e63b..0e5b1fb 100644
--- a/index.htm
+++ b/index.htm
@@ -63,22 +63,26 @@
},
}
).then((program) => {
- program.exports.js_main(
- options.processorOptions.href // FIXME
- );
+ this.memory_buffer = program.exports.memory.buffer;
+
+ let href_bytes = options.processorOptions.href;
+ let href_address = program.exports.js_href();
+ let href_len = Math.min(program.exports.js_href_size(), href_bytes.length);
+ new Uint8Array(this.memory_buffer, href_address, href_len).set(href_bytes.subarray(0, href_len));
+
+ program.exports.js_main();
- this.memory_buffer = program.exports.memory.buffer;
this.sound_buffer_address = program.exports.js_sound_buffer();
this.pixels_address = program.exports.js_pixels();
this.frames = new Float32Array(this.memory_buffer, this.sound_buffer_address, program.exports.js_max_num_audio_frames());
let bytes = new Uint8Array(this.memory_buffer);
let title_address = program.exports.js_title();
- let len = 0;
- while (bytes[title_address + len] != 0)
- ++len;
- let title_buffer = new ArrayBuffer(len);
- new Uint8Array(title_buffer).set(bytes.subarray(title_address, title_address + len));
+ let title_len = 0;
+ while (bytes[title_address + title_len] != 0)
+ ++title_len;
+ let title_buffer = new ArrayBuffer(title_len);
+ new Uint8Array(title_buffer).set(bytes.subarray(title_address, title_address + title_len));
this.port.postMessage({
id : "init",
@@ -385,7 +389,7 @@
"Sound_Node",
{ numberOfInputs : 0,
outputChannelCount : [ sound_num_channels ],
- processorOptions : { href : document.location.href }, }
+ processorOptions : { href : new TextEncoder("utf8").encode(document.location.href) }, }
);
sound_node.connect(sound_context.destination);