diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2021-03-06 16:15:09 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-06 16:15:09 +0100 |
commit | a4b5edf468888a1f26009ce6748c338831319064 (patch) | |
tree | a7f28a3054df9aa76f1ad7eebae2eaa9fe0eaa7f /platform/javascript/js/libs/library_godot_runtime.js | |
parent | ac249032bf5868e2f88eb206d3c5b261ed63c375 (diff) | |
parent | fd7697718311338fa1d546ded4f8dc4a8a9ae8eb (diff) |
Merge pull request #46728 from Faless/js/4.x_fetch_world
[HTML5] Replace XMLHttpRequest(s) with Fetch.
Diffstat (limited to 'platform/javascript/js/libs/library_godot_runtime.js')
-rw-r--r-- | platform/javascript/js/libs/library_godot_runtime.js | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/platform/javascript/js/libs/library_godot_runtime.js b/platform/javascript/js/libs/library_godot_runtime.js index 7e36ff8ab5..3da1ed8f06 100644 --- a/platform/javascript/js/libs/library_godot_runtime.js +++ b/platform/javascript/js/libs/library_godot_runtime.js @@ -72,11 +72,16 @@ const GodotRuntime = { return p_heap.subarray(p_ptr / bytes, p_ptr / bytes + p_len); }, - heapCopy: function (p_heap, p_ptr, p_len) { + heapSlice: function (p_heap, p_ptr, p_len) { const bytes = p_heap.BYTES_PER_ELEMENT; return p_heap.slice(p_ptr / bytes, p_ptr / bytes + p_len); }, + heapCopy: function (p_dst, p_src, p_ptr) { + const bytes = p_src.BYTES_PER_ELEMENT; + return p_dst.set(p_src, p_ptr / bytes); + }, + /* * Strings */ @@ -84,6 +89,15 @@ const GodotRuntime = { return UTF8ToString(p_ptr); // eslint-disable-line no-undef }, + parseStringArray: function (p_ptr, p_size) { + const strings = []; + const ptrs = GodotRuntime.heapSub(HEAP32, p_ptr, p_size); // TODO wasm64 + ptrs.forEach(function (ptr) { + strings.push(GodotRuntime.parseString(ptr)); + }); + return strings; + }, + strlen: function (p_str) { return lengthBytesUTF8(p_str); // eslint-disable-line no-undef }, |