summaryrefslogtreecommitdiff
path: root/index.htm
diff options
context:
space:
mode:
authorMitya Selivanov <automainint@guattari.tech>2024-11-02 00:00:35 +0100
committerMitya Selivanov <automainint@guattari.tech>2024-11-02 00:00:35 +0100
commit48c5d9b83afd1cd56e73449aebaf461cb48360d9 (patch)
tree41127704d20b1ee53fa1034e53339c22ca4c820d /index.htm
parent2afdeaedbfb488f20cdc1cca7ce01a915df4d53a (diff)
downloadreduced_system_layer-48c5d9b83afd1cd56e73449aebaf461cb48360d9.zip
wasm: Fix memcpy, memset
Diffstat (limited to 'index.htm')
-rw-r--r--index.htm16
1 files changed, 6 insertions, 10 deletions
diff --git a/index.htm b/index.htm
index e3e6872..3b1fd3b 100644
--- a/index.htm
+++ b/index.htm
@@ -9,13 +9,11 @@
<body style="margin: 0; height: 100%; overflow: hidden; overflow-x: hidden;">
<canvas style="margin: 0; width: 100%; height: 100%;" id="frame" oncontextmenu="event.preventDefault()"></canvas>
<script type="text/javascript">
- function string_from_memory(memory, offset) {
+ function string_from_memory(bytes, offset) {
let len = 0;
- console.log(memory);
- while (memory[offset + len] != 0) {
+ while (bytes[offset + len] != 0)
++len;
- }
- return new TextDecoder().decode(memory.subarray(offset, offset + len));
+ return new TextDecoder("utf8").decode(bytes.subarray(offset, offset + len));
}
async function run(attrs) {
@@ -78,18 +76,16 @@
floor : Math.floor,
ceil : Math.ceil,
memset : (dst, val, num) => {
- for (let i = 0; i < num; ++i)
- dst[i] = val;
+ program.instance.exports.js_memset(dst, val, num);
},
memcpy : (dst, src, num) => {
- for (let i = 0; i < num; ++i)
- dst[i] = src[i];
+ program.instance.exports.js_memcpy(dst, src, num);
},
},
}
);
- program.instance.exports.js_main();
+ program.instance.exports.js_main(document.location.href);
animation_frame = (time) => {
if (attrs.fit_window) {