diff options
author | Adam Scott <ascott.ca@gmail.com> | 2023-07-20 09:42:03 -0400 |
---|---|---|
committer | Adam Scott <ascott.ca@gmail.com> | 2023-10-09 11:50:01 -0400 |
commit | 78c2a08fae9dddb262a0e86ec49ebee2267b4a51 (patch) | |
tree | 0b61d1c4a4b43cd57aa5b3d3f94464f2b4d52263 /platform/web/js | |
parent | c2b916751d7a52e7f002eb7361fe2b12c1cbc488 (diff) | |
download | redot-engine-78c2a08fae9dddb262a0e86ec49ebee2267b4a51.tar.gz |
Add `proxy_to_pthread` option to `platform=web`
Co-authored-by: Fabio Alessandrelli <fabio.alessandrelli@gmail.com>
Diffstat (limited to 'platform/web/js')
-rw-r--r-- | platform/web/js/libs/library_godot_audio.js | 9 | ||||
-rw-r--r-- | platform/web/js/libs/library_godot_display.js | 40 | ||||
-rw-r--r-- | platform/web/js/libs/library_godot_fetch.js | 7 | ||||
-rw-r--r-- | platform/web/js/libs/library_godot_input.js | 12 | ||||
-rw-r--r-- | platform/web/js/libs/library_godot_javascript_singleton.js | 10 | ||||
-rw-r--r-- | platform/web/js/libs/library_godot_os.js | 13 | ||||
-rw-r--r-- | platform/web/js/libs/library_godot_webgl2.js | 13 |
7 files changed, 104 insertions, 0 deletions
diff --git a/platform/web/js/libs/library_godot_audio.js b/platform/web/js/libs/library_godot_audio.js index cc86c81096..b54c5cac85 100644 --- a/platform/web/js/libs/library_godot_audio.js +++ b/platform/web/js/libs/library_godot_audio.js @@ -159,16 +159,19 @@ const GodotAudio = { return 1; }, + godot_audio_has_worklet__proxy: 'sync', godot_audio_has_worklet__sig: 'i', godot_audio_has_worklet: function () { return (GodotAudio.ctx && GodotAudio.ctx.audioWorklet) ? 1 : 0; }, + godot_audio_has_script_processor__proxy: 'sync', godot_audio_has_script_processor__sig: 'i', godot_audio_has_script_processor: function () { return (GodotAudio.ctx && GodotAudio.ctx.createScriptProcessor) ? 1 : 0; }, + godot_audio_init__proxy: 'sync', godot_audio_init__sig: 'iiiii', godot_audio_init: function (p_mix_rate, p_latency, p_state_change, p_latency_update) { const statechange = GodotRuntime.get_func(p_state_change); @@ -179,6 +182,7 @@ const GodotAudio = { return channels; }, + godot_audio_resume__proxy: 'sync', godot_audio_resume__sig: 'v', godot_audio_resume: function () { if (GodotAudio.ctx && GodotAudio.ctx.state !== 'running') { @@ -358,6 +362,7 @@ const GodotAudioWorklet = { }, }, + godot_audio_worklet_create__proxy: 'sync', godot_audio_worklet_create__sig: 'ii', godot_audio_worklet_create: function (channels) { try { @@ -369,6 +374,7 @@ const GodotAudioWorklet = { return 0; }, + godot_audio_worklet_start__proxy: 'sync', godot_audio_worklet_start__sig: 'viiiii', godot_audio_worklet_start: function (p_in_buf, p_in_size, p_out_buf, p_out_size, p_state) { const out_buffer = GodotRuntime.heapSub(HEAPF32, p_out_buf, p_out_size); @@ -377,6 +383,7 @@ const GodotAudioWorklet = { GodotAudioWorklet.start(in_buffer, out_buffer, state); }, + godot_audio_worklet_start_no_threads__proxy: 'sync', godot_audio_worklet_start_no_threads__sig: 'viiiiii', godot_audio_worklet_start_no_threads: function (p_out_buf, p_out_size, p_out_callback, p_in_buf, p_in_size, p_in_callback) { const out_callback = GodotRuntime.get_func(p_out_callback); @@ -465,6 +472,7 @@ const GodotAudioScript = { }, }, + godot_audio_script_create__proxy: 'sync', godot_audio_script_create__sig: 'iii', godot_audio_script_create: function (buffer_length, channel_count) { const buf_len = GodotRuntime.getHeapValue(buffer_length, 'i32'); @@ -478,6 +486,7 @@ const GodotAudioScript = { return 0; }, + godot_audio_script_start__proxy: 'sync', godot_audio_script_start__sig: 'viiiii', godot_audio_script_start: function (p_in_buf, p_in_size, p_out_buf, p_out_size, p_cb) { const onprocess = GodotRuntime.get_func(p_cb); diff --git a/platform/web/js/libs/library_godot_display.js b/platform/web/js/libs/library_godot_display.js index c60e6899f2..99fc429d8f 100644 --- a/platform/web/js/libs/library_godot_display.js +++ b/platform/web/js/libs/library_godot_display.js @@ -345,6 +345,7 @@ const GodotDisplay = { }, }, + godot_js_display_is_swap_ok_cancel__proxy: 'sync', godot_js_display_is_swap_ok_cancel__sig: 'i', godot_js_display_is_swap_ok_cancel: function () { const win = (['Windows', 'Win64', 'Win32', 'WinCE']); @@ -355,16 +356,19 @@ const GodotDisplay = { return 0; }, + godot_js_tts_is_speaking__proxy: 'sync', godot_js_tts_is_speaking__sig: 'i', godot_js_tts_is_speaking: function () { return window.speechSynthesis.speaking; }, + godot_js_tts_is_paused__proxy: 'sync', godot_js_tts_is_paused__sig: 'i', godot_js_tts_is_paused: function () { return window.speechSynthesis.paused; }, + godot_js_tts_get_voices__proxy: 'sync', godot_js_tts_get_voices__sig: 'vi', godot_js_tts_get_voices: function (p_callback) { const func = GodotRuntime.get_func(p_callback); @@ -382,6 +386,7 @@ const GodotDisplay = { } }, + godot_js_tts_speak__proxy: 'sync', godot_js_tts_speak__sig: 'viiiffii', godot_js_tts_speak: function (p_text, p_voice, p_volume, p_pitch, p_rate, p_utterance_id, p_callback) { const func = GodotRuntime.get_func(p_callback); @@ -424,53 +429,63 @@ const GodotDisplay = { window.speechSynthesis.speak(utterance); }, + godot_js_tts_pause__proxy: 'sync', godot_js_tts_pause__sig: 'v', godot_js_tts_pause: function () { window.speechSynthesis.pause(); }, + godot_js_tts_resume__proxy: 'sync', godot_js_tts_resume__sig: 'v', godot_js_tts_resume: function () { window.speechSynthesis.resume(); }, + godot_js_tts_stop__proxy: 'sync', godot_js_tts_stop__sig: 'v', godot_js_tts_stop: function () { window.speechSynthesis.cancel(); window.speechSynthesis.resume(); }, + godot_js_display_alert__proxy: 'sync', godot_js_display_alert__sig: 'vi', godot_js_display_alert: function (p_text) { window.alert(GodotRuntime.parseString(p_text)); // eslint-disable-line no-alert }, + godot_js_display_screen_dpi_get__proxy: 'sync', godot_js_display_screen_dpi_get__sig: 'i', godot_js_display_screen_dpi_get: function () { return GodotDisplay.getDPI(); }, + godot_js_display_pixel_ratio_get__proxy: 'sync', godot_js_display_pixel_ratio_get__sig: 'f', godot_js_display_pixel_ratio_get: function () { return GodotDisplayScreen.getPixelRatio(); }, + godot_js_display_fullscreen_request__proxy: 'sync', godot_js_display_fullscreen_request__sig: 'i', godot_js_display_fullscreen_request: function () { return GodotDisplayScreen.requestFullscreen(); }, + godot_js_display_fullscreen_exit__proxy: 'sync', godot_js_display_fullscreen_exit__sig: 'i', godot_js_display_fullscreen_exit: function () { return GodotDisplayScreen.exitFullscreen(); }, + godot_js_display_desired_size_set__proxy: 'sync', godot_js_display_desired_size_set__sig: 'vii', godot_js_display_desired_size_set: function (width, height) { GodotDisplayScreen.desired_size = [width, height]; GodotDisplayScreen.updateSize(); }, + godot_js_display_size_update__proxy: 'sync', godot_js_display_size_update__sig: 'i', godot_js_display_size_update: function () { const updated = GodotDisplayScreen.updateSize(); @@ -480,6 +495,7 @@ const GodotDisplay = { return updated; }, + godot_js_display_screen_size_get__proxy: 'sync', godot_js_display_screen_size_get__sig: 'vii', godot_js_display_screen_size_get: function (width, height) { const scale = GodotDisplayScreen.getPixelRatio(); @@ -487,12 +503,14 @@ const GodotDisplay = { GodotRuntime.setHeapValue(height, window.screen.height * scale, 'i32'); }, + godot_js_display_window_size_get__proxy: 'sync', godot_js_display_window_size_get__sig: 'vii', godot_js_display_window_size_get: function (p_width, p_height) { GodotRuntime.setHeapValue(p_width, GodotConfig.canvas.width, 'i32'); GodotRuntime.setHeapValue(p_height, GodotConfig.canvas.height, 'i32'); }, + godot_js_display_has_webgl__proxy: 'sync', godot_js_display_has_webgl__sig: 'ii', godot_js_display_has_webgl: function (p_version) { if (p_version !== 1 && p_version !== 2) { @@ -507,11 +525,13 @@ const GodotDisplay = { /* * Canvas */ + godot_js_display_canvas_focus__proxy: 'sync', godot_js_display_canvas_focus__sig: 'v', godot_js_display_canvas_focus: function () { GodotConfig.canvas.focus(); }, + godot_js_display_canvas_is_focused__proxy: 'sync', godot_js_display_canvas_is_focused__sig: 'i', godot_js_display_canvas_is_focused: function () { return document.activeElement === GodotConfig.canvas; @@ -520,6 +540,7 @@ const GodotDisplay = { /* * Touchscreen */ + godot_js_display_touchscreen_is_available__proxy: 'sync', godot_js_display_touchscreen_is_available__sig: 'i', godot_js_display_touchscreen_is_available: function () { return 'ontouchstart' in window; @@ -528,6 +549,7 @@ const GodotDisplay = { /* * Clipboard */ + godot_js_display_clipboard_set__proxy: 'sync', godot_js_display_clipboard_set__sig: 'ii', godot_js_display_clipboard_set: function (p_text) { const text = GodotRuntime.parseString(p_text); @@ -541,6 +563,7 @@ const GodotDisplay = { return 0; }, + godot_js_display_clipboard_get__proxy: 'sync', godot_js_display_clipboard_get__sig: 'ii', godot_js_display_clipboard_get: function (callback) { const func = GodotRuntime.get_func(callback); @@ -560,11 +583,13 @@ const GodotDisplay = { /* * Window */ + godot_js_display_window_title_set__proxy: 'sync', godot_js_display_window_title_set__sig: 'vi', godot_js_display_window_title_set: function (p_data) { document.title = GodotRuntime.parseString(p_data); }, + godot_js_display_window_icon_set__proxy: 'sync', godot_js_display_window_icon_set__sig: 'vii', godot_js_display_window_icon_set: function (p_ptr, p_len) { let link = document.getElementById('-gd-engine-icon'); @@ -593,6 +618,7 @@ const GodotDisplay = { /* * Cursor */ + godot_js_display_cursor_set_visible__proxy: 'sync', godot_js_display_cursor_set_visible__sig: 'vi', godot_js_display_cursor_set_visible: function (p_visible) { const visible = p_visible !== 0; @@ -607,16 +633,19 @@ const GodotDisplay = { } }, + godot_js_display_cursor_is_hidden__proxy: 'sync', godot_js_display_cursor_is_hidden__sig: 'i', godot_js_display_cursor_is_hidden: function () { return !GodotDisplayCursor.visible; }, + godot_js_display_cursor_set_shape__proxy: 'sync', godot_js_display_cursor_set_shape__sig: 'vi', godot_js_display_cursor_set_shape: function (p_string) { GodotDisplayCursor.set_shape(GodotRuntime.parseString(p_string)); }, + godot_js_display_cursor_set_custom_shape__proxy: 'sync', godot_js_display_cursor_set_custom_shape__sig: 'viiiii', godot_js_display_cursor_set_custom_shape: function (p_shape, p_ptr, p_len, p_hotspot_x, p_hotspot_y) { const shape = GodotRuntime.parseString(p_shape); @@ -640,6 +669,7 @@ const GodotDisplay = { } }, + godot_js_display_cursor_lock_set__proxy: 'sync', godot_js_display_cursor_lock_set__sig: 'vi', godot_js_display_cursor_lock_set: function (p_lock) { if (p_lock) { @@ -649,6 +679,7 @@ const GodotDisplay = { } }, + godot_js_display_cursor_is_locked__proxy: 'sync', godot_js_display_cursor_is_locked__sig: 'i', godot_js_display_cursor_is_locked: function () { return GodotDisplayCursor.isPointerLocked() ? 1 : 0; @@ -657,6 +688,7 @@ const GodotDisplay = { /* * Listeners */ + godot_js_display_fullscreen_cb__proxy: 'sync', godot_js_display_fullscreen_cb__sig: 'vi', godot_js_display_fullscreen_cb: function (callback) { const canvas = GodotConfig.canvas; @@ -671,6 +703,7 @@ const GodotDisplay = { GodotEventListeners.add(document, 'webkitfullscreenchange', change_cb, false); }, + godot_js_display_window_blur_cb__proxy: 'sync', godot_js_display_window_blur_cb__sig: 'vi', godot_js_display_window_blur_cb: function (callback) { const func = GodotRuntime.get_func(callback); @@ -679,6 +712,7 @@ const GodotDisplay = { }, false); }, + godot_js_display_notification_cb__proxy: 'sync', godot_js_display_notification_cb__sig: 'viiiii', godot_js_display_notification_cb: function (callback, p_enter, p_exit, p_in, p_out) { const canvas = GodotConfig.canvas; @@ -691,6 +725,7 @@ const GodotDisplay = { }); }, + godot_js_display_setup_canvas__proxy: 'sync', godot_js_display_setup_canvas__sig: 'viiii', godot_js_display_setup_canvas: function (p_width, p_height, p_fullscreen, p_hidpi) { const canvas = GodotConfig.canvas; @@ -725,6 +760,7 @@ const GodotDisplay = { /* * Virtual Keyboard */ + godot_js_display_vk_show__proxy: 'sync', godot_js_display_vk_show__sig: 'viiii', godot_js_display_vk_show: function (p_text, p_type, p_start, p_end) { const text = GodotRuntime.parseString(p_text); @@ -733,21 +769,25 @@ const GodotDisplay = { GodotDisplayVK.show(text, p_type, start, end); }, + godot_js_display_vk_hide__proxy: 'sync', godot_js_display_vk_hide__sig: 'v', godot_js_display_vk_hide: function () { GodotDisplayVK.hide(); }, + godot_js_display_vk_available__proxy: 'sync', godot_js_display_vk_available__sig: 'i', godot_js_display_vk_available: function () { return GodotDisplayVK.available(); }, + godot_js_display_tts_available__proxy: 'sync', godot_js_display_tts_available__sig: 'i', godot_js_display_tts_available: function () { return 'speechSynthesis' in window; }, + godot_js_display_vk_cb__proxy: 'sync', godot_js_display_vk_cb__sig: 'vi', godot_js_display_vk_cb: function (p_input_cb) { const input_cb = GodotRuntime.get_func(p_input_cb); diff --git a/platform/web/js/libs/library_godot_fetch.js b/platform/web/js/libs/library_godot_fetch.js index 4ef24903e3..00616bc1a5 100644 --- a/platform/web/js/libs/library_godot_fetch.js +++ b/platform/web/js/libs/library_godot_fetch.js @@ -125,6 +125,7 @@ const GodotFetch = { }, }, + godot_js_fetch_create__proxy: 'sync', godot_js_fetch_create__sig: 'iiiiiii', godot_js_fetch_create: function (p_method, p_url, p_headers, p_headers_size, p_body, p_body_size) { const method = GodotRuntime.parseString(p_method); @@ -145,6 +146,7 @@ const GodotFetch = { }), body); }, + godot_js_fetch_state_get__proxy: 'sync', godot_js_fetch_state_get__sig: 'ii', godot_js_fetch_state_get: function (p_id) { const obj = IDHandler.get(p_id); @@ -166,6 +168,7 @@ const GodotFetch = { return -1; }, + godot_js_fetch_http_status_get__proxy: 'sync', godot_js_fetch_http_status_get__sig: 'ii', godot_js_fetch_http_status_get: function (p_id) { const obj = IDHandler.get(p_id); @@ -175,6 +178,7 @@ const GodotFetch = { return obj.status; }, + godot_js_fetch_read_headers__proxy: 'sync', godot_js_fetch_read_headers__sig: 'iiii', godot_js_fetch_read_headers: function (p_id, p_parse_cb, p_ref) { const obj = IDHandler.get(p_id); @@ -192,6 +196,7 @@ const GodotFetch = { return 0; }, + godot_js_fetch_read_chunk__proxy: 'sync', godot_js_fetch_read_chunk__sig: 'iiii', godot_js_fetch_read_chunk: function (p_id, p_buf, p_buf_size) { const obj = IDHandler.get(p_id); @@ -218,6 +223,7 @@ const GodotFetch = { return p_buf_size - to_read; }, + godot_js_fetch_is_chunked__proxy: 'sync', godot_js_fetch_is_chunked__sig: 'ii', godot_js_fetch_is_chunked: function (p_id) { const obj = IDHandler.get(p_id); @@ -227,6 +233,7 @@ const GodotFetch = { return obj.chunked ? 1 : 0; }, + godot_js_fetch_free__proxy: 'sync', godot_js_fetch_free__sig: 'vi', godot_js_fetch_free: function (id) { GodotFetch.free(id); diff --git a/platform/web/js/libs/library_godot_input.js b/platform/web/js/libs/library_godot_input.js index 1b221e78b3..92113e85c9 100644 --- a/platform/web/js/libs/library_godot_input.js +++ b/platform/web/js/libs/library_godot_input.js @@ -356,6 +356,7 @@ const GodotInput = { /* * Mouse API */ + godot_js_input_mouse_move_cb__proxy: 'sync', godot_js_input_mouse_move_cb__sig: 'vi', godot_js_input_mouse_move_cb: function (callback) { const func = GodotRuntime.get_func(callback); @@ -374,6 +375,7 @@ const GodotInput = { GodotEventListeners.add(window, 'mousemove', move_cb, false); }, + godot_js_input_mouse_wheel_cb__proxy: 'sync', godot_js_input_mouse_wheel_cb__sig: 'vi', godot_js_input_mouse_wheel_cb: function (callback) { const func = GodotRuntime.get_func(callback); @@ -385,6 +387,7 @@ const GodotInput = { GodotEventListeners.add(GodotConfig.canvas, 'wheel', wheel_cb, false); }, + godot_js_input_mouse_button_cb__proxy: 'sync', godot_js_input_mouse_button_cb__sig: 'vi', godot_js_input_mouse_button_cb: function (callback) { const func = GodotRuntime.get_func(callback); @@ -409,6 +412,7 @@ const GodotInput = { /* * Touch API */ + godot_js_input_touch_cb__proxy: 'sync', godot_js_input_touch_cb__sig: 'viii', godot_js_input_touch_cb: function (callback, ids, coords) { const func = GodotRuntime.get_func(callback); @@ -442,6 +446,7 @@ const GodotInput = { /* * Key API */ + godot_js_input_key_cb__proxy: 'sync', godot_js_input_key_cb__sig: 'viii', godot_js_input_key_cb: function (callback, code, key) { const func = GodotRuntime.get_func(callback); @@ -459,23 +464,27 @@ const GodotInput = { /* * Gamepad API */ + godot_js_input_gamepad_cb__proxy: 'sync', godot_js_input_gamepad_cb__sig: 'vi', godot_js_input_gamepad_cb: function (change_cb) { const onchange = GodotRuntime.get_func(change_cb); GodotInputGamepads.init(onchange); }, + godot_js_input_gamepad_sample_count__proxy: 'sync', godot_js_input_gamepad_sample_count__sig: 'i', godot_js_input_gamepad_sample_count: function () { return GodotInputGamepads.get_samples().length; }, + godot_js_input_gamepad_sample__proxy: 'sync', godot_js_input_gamepad_sample__sig: 'i', godot_js_input_gamepad_sample: function () { GodotInputGamepads.sample(); return 0; }, + godot_js_input_gamepad_sample_get__proxy: 'sync', godot_js_input_gamepad_sample_get__sig: 'iiiiiii', godot_js_input_gamepad_sample_get: function (p_index, r_btns, r_btns_num, r_axes, r_axes_num, r_standard) { const sample = GodotInputGamepads.get_sample(p_index); @@ -502,6 +511,7 @@ const GodotInput = { /* * Drag/Drop API */ + godot_js_input_drop_files_cb__proxy: 'sync', godot_js_input_drop_files_cb__sig: 'vi', godot_js_input_drop_files_cb: function (callback) { const func = GodotRuntime.get_func(callback); @@ -524,6 +534,7 @@ const GodotInput = { }, /* Paste API */ + godot_js_input_paste_cb__proxy: 'sync', godot_js_input_paste_cb__sig: 'vi', godot_js_input_paste_cb: function (callback) { const func = GodotRuntime.get_func(callback); @@ -535,6 +546,7 @@ const GodotInput = { }, false); }, + godot_js_input_vibrate_handheld__proxy: 'sync', godot_js_input_vibrate_handheld__sig: 'vi', godot_js_input_vibrate_handheld: function (p_duration_ms) { if (typeof navigator.vibrate !== 'function') { diff --git a/platform/web/js/libs/library_godot_javascript_singleton.js b/platform/web/js/libs/library_godot_javascript_singleton.js index 1764c9a026..b17fde1544 100644 --- a/platform/web/js/libs/library_godot_javascript_singleton.js +++ b/platform/web/js/libs/library_godot_javascript_singleton.js @@ -121,6 +121,7 @@ const GodotJSWrapper = { }, }, + godot_js_wrapper_interface_get__proxy: 'sync', godot_js_wrapper_interface_get__sig: 'ii', godot_js_wrapper_interface_get: function (p_name) { const name = GodotRuntime.parseString(p_name); @@ -130,6 +131,7 @@ const GodotJSWrapper = { return 0; }, + godot_js_wrapper_object_get__proxy: 'sync', godot_js_wrapper_object_get__sig: 'iiii', godot_js_wrapper_object_get: function (p_id, p_exchange, p_prop) { const obj = GodotJSWrapper.get_proxied_value(p_id); @@ -148,6 +150,7 @@ const GodotJSWrapper = { return GodotJSWrapper.js2variant(obj, p_exchange); }, + godot_js_wrapper_object_set__proxy: 'sync', godot_js_wrapper_object_set__sig: 'viiii', godot_js_wrapper_object_set: function (p_id, p_name, p_type, p_exchange) { const obj = GodotJSWrapper.get_proxied_value(p_id); @@ -162,6 +165,7 @@ const GodotJSWrapper = { } }, + godot_js_wrapper_object_call__proxy: 'sync', godot_js_wrapper_object_call__sig: 'iiiiiiiii', godot_js_wrapper_object_call: function (p_id, p_method, p_args, p_argc, p_convert_callback, p_exchange, p_lock, p_free_lock_callback) { const obj = GodotJSWrapper.get_proxied_value(p_id); @@ -189,6 +193,7 @@ const GodotJSWrapper = { } }, + godot_js_wrapper_object_unref__proxy: 'sync', godot_js_wrapper_object_unref__sig: 'vi', godot_js_wrapper_object_unref: function (p_id) { const proxy = IDHandler.get(p_id); @@ -197,6 +202,7 @@ const GodotJSWrapper = { } }, + godot_js_wrapper_create_cb__proxy: 'sync', godot_js_wrapper_create_cb__sig: 'iii', godot_js_wrapper_create_cb: function (p_ref, p_func) { const func = GodotRuntime.get_func(p_func); @@ -221,11 +227,13 @@ const GodotJSWrapper = { return id; }, + godot_js_wrapper_object_set_cb_ret__proxy: 'sync', godot_js_wrapper_object_set_cb_ret__sig: 'vii', godot_js_wrapper_object_set_cb_ret: function (p_val_type, p_val_ex) { GodotJSWrapper.cb_ret = GodotJSWrapper.variant2js(p_val_type, p_val_ex); }, + godot_js_wrapper_object_getvar__proxy: 'sync', godot_js_wrapper_object_getvar__sig: 'iiii', godot_js_wrapper_object_getvar: function (p_id, p_type, p_exchange) { const obj = GodotJSWrapper.get_proxied_value(p_id); @@ -244,6 +252,7 @@ const GodotJSWrapper = { } }, + godot_js_wrapper_object_setvar__proxy: 'sync', godot_js_wrapper_object_setvar__sig: 'iiiiii', godot_js_wrapper_object_setvar: function (p_id, p_key_type, p_key_ex, p_val_type, p_val_ex) { const obj = GodotJSWrapper.get_proxied_value(p_id); @@ -260,6 +269,7 @@ const GodotJSWrapper = { } }, + godot_js_wrapper_create_object__proxy: 'sync', godot_js_wrapper_create_object__sig: 'iiiiiiii', godot_js_wrapper_create_object: function (p_object, p_args, p_argc, p_convert_callback, p_exchange, p_lock, p_free_lock_callback) { const name = GodotRuntime.parseString(p_object); diff --git a/platform/web/js/libs/library_godot_os.js b/platform/web/js/libs/library_godot_os.js index 00ae399583..92635cb6ae 100644 --- a/platform/web/js/libs/library_godot_os.js +++ b/platform/web/js/libs/library_godot_os.js @@ -91,11 +91,13 @@ const GodotConfig = { }, }, + godot_js_config_canvas_id_get__proxy: 'sync', godot_js_config_canvas_id_get__sig: 'vii', godot_js_config_canvas_id_get: function (p_ptr, p_ptr_max) { GodotRuntime.stringToHeap(`#${GodotConfig.canvas.id}`, p_ptr, p_ptr_max); }, + godot_js_config_locale_get__proxy: 'sync', godot_js_config_locale_get__sig: 'vii', godot_js_config_locale_get: function (p_ptr, p_ptr_max) { GodotRuntime.stringToHeap(GodotConfig.locale, p_ptr, p_ptr_max); @@ -266,22 +268,26 @@ const GodotOS = { }, }, + godot_js_os_finish_async__proxy: 'sync', godot_js_os_finish_async__sig: 'vi', godot_js_os_finish_async: function (p_callback) { const func = GodotRuntime.get_func(p_callback); GodotOS.finish_async(func); }, + godot_js_os_request_quit_cb__proxy: 'sync', godot_js_os_request_quit_cb__sig: 'vi', godot_js_os_request_quit_cb: function (p_callback) { GodotOS.request_quit = GodotRuntime.get_func(p_callback); }, + godot_js_os_fs_is_persistent__proxy: 'sync', godot_js_os_fs_is_persistent__sig: 'i', godot_js_os_fs_is_persistent: function () { return GodotFS.is_persistent(); }, + godot_js_os_fs_sync__proxy: 'sync', godot_js_os_fs_sync__sig: 'vi', godot_js_os_fs_sync: function (callback) { const func = GodotRuntime.get_func(callback); @@ -291,6 +297,7 @@ const GodotOS = { }); }, + godot_js_os_has_feature__proxy: 'sync', godot_js_os_has_feature__sig: 'ii', godot_js_os_has_feature: function (p_ftr) { const ftr = GodotRuntime.parseString(p_ftr); @@ -313,6 +320,7 @@ const GodotOS = { return 0; }, + godot_js_os_execute__proxy: 'sync', godot_js_os_execute__sig: 'ii', godot_js_os_execute: function (p_json) { const json_args = GodotRuntime.parseString(p_json); @@ -324,11 +332,13 @@ const GodotOS = { return 1; }, + godot_js_os_shell_open__proxy: 'sync', godot_js_os_shell_open__sig: 'vi', godot_js_os_shell_open: function (p_uri) { window.open(GodotRuntime.parseString(p_uri), '_blank'); }, + godot_js_os_hw_concurrency_get__proxy: 'sync', godot_js_os_hw_concurrency_get__sig: 'i', godot_js_os_hw_concurrency_get: function () { // TODO Godot core needs fixing to avoid spawning too many threads (> 24). @@ -336,6 +346,7 @@ const GodotOS = { return concurrency < 2 ? concurrency : 2; }, + godot_js_os_download_buffer__proxy: 'sync', godot_js_os_download_buffer__sig: 'viiii', godot_js_os_download_buffer: function (p_ptr, p_size, p_name, p_mime) { const buf = GodotRuntime.heapSlice(HEAP8, p_ptr, p_size); @@ -426,6 +437,7 @@ const GodotPWA = { }, }, + godot_js_pwa_cb__proxy: 'sync', godot_js_pwa_cb__sig: 'vi', godot_js_pwa_cb: function (p_update_cb) { if ('serviceWorker' in navigator) { @@ -434,6 +446,7 @@ const GodotPWA = { } }, + godot_js_pwa_update__proxy: 'sync', godot_js_pwa_update__sig: 'i', godot_js_pwa_update: function () { if ('serviceWorker' in navigator && GodotPWA.hasUpdate) { diff --git a/platform/web/js/libs/library_godot_webgl2.js b/platform/web/js/libs/library_godot_webgl2.js index 3c6de4a071..dbaec9f01b 100644 --- a/platform/web/js/libs/library_godot_webgl2.js +++ b/platform/web/js/libs/library_godot_webgl2.js @@ -32,6 +32,19 @@ const GodotWebGL2 = { $GodotWebGL2__deps: ['$GL', '$GodotRuntime'], $GodotWebGL2: {}, + // This is implemented as "glGetBufferSubData" in new emscripten versions. + // Since we have to support older (pre 2.0.17) emscripten versions, we add this wrapper function instead. + godot_webgl2_glGetBufferSubData__proxy: 'sync', + godot_webgl2_glGetBufferSubData__sig: 'vippp', + godot_webgl2_glGetBufferSubData__deps: ['$GL', 'emscripten_webgl_get_current_context'], + godot_webgl2_glGetBufferSubData: function (target, offset, size, data) { + const gl_context_handle = _emscripten_webgl_get_current_context(); // eslint-disable-line no-undef + const gl = GL.getContext(gl_context_handle); + if (gl) { + gl.GLctx['getBufferSubData'](target, offset, HEAPU8, data, size); + } + }, + godot_webgl2_glFramebufferTextureMultiviewOVR__deps: ['emscripten_webgl_get_current_context'], godot_webgl2_glFramebufferTextureMultiviewOVR__proxy: 'sync', godot_webgl2_glFramebufferTextureMultiviewOVR__sig: 'viiiiii', |