1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-24 15:26:15 +00:00

Merge pull request #49592 from Faless/js/4.x_fix_sigs

[HTML5] Fix build without eval, library functions signatures.
This commit is contained in:
Rémi Verschelde
2021-06-15 00:01:54 +02:00
committed by GitHub
6 changed files with 13 additions and 10 deletions

View File

@@ -41,7 +41,7 @@
// JavaScript functions defined in library_godot_editor_tools.js // JavaScript functions defined in library_godot_editor_tools.js
extern "C" { extern "C" {
extern int godot_js_os_download_buffer(const uint8_t *p_buf, int p_buf_size, const char *p_name, const char *p_mime); extern void godot_js_os_download_buffer(const uint8_t *p_buf, int p_buf_size, const char *p_name, const char *p_mime);
} }
static void _javascript_editor_init_callback() { static void _javascript_editor_init_callback() {

View File

@@ -84,7 +84,7 @@ extern void godot_js_display_cursor_set_custom_shape(const char *p_shape, const
extern void godot_js_display_cursor_set_visible(int p_visible); extern void godot_js_display_cursor_set_visible(int p_visible);
// Display gamepad // Display gamepad
extern char *godot_js_display_gamepad_cb(void (*p_on_change)(int p_index, int p_connected, const char *p_id, const char *p_guid)); extern void godot_js_display_gamepad_cb(void (*p_on_change)(int p_index, int p_connected, const char *p_id, const char *p_guid));
extern int godot_js_display_gamepad_sample(); extern int godot_js_display_gamepad_sample();
extern int godot_js_display_gamepad_sample_count(); extern int godot_js_display_gamepad_sample_count();
extern int godot_js_display_gamepad_sample_get(int p_idx, float r_btns[16], int32_t *r_btns_num, float r_axes[10], int32_t *r_axes_num, int32_t *r_standard); extern int godot_js_display_gamepad_sample_get(int p_idx, float r_btns[16], int32_t *r_btns_num, float r_axes[10], int32_t *r_axes_num, int32_t *r_standard);

View File

@@ -28,11 +28,15 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/ /*************************************************************************/
#ifdef JAVASCRIPT_EVAL_ENABLED
#include "api/javascript_singleton.h" #include "api/javascript_singleton.h"
#include "emscripten.h" #include "emscripten.h"
extern "C" {
extern void godot_js_os_download_buffer(const uint8_t *p_buf, int p_buf_size, const char *p_name, const char *p_mime);
}
#ifdef JAVASCRIPT_EVAL_ENABLED
extern "C" { extern "C" {
typedef union { typedef union {
int64_t i; int64_t i;
@@ -301,7 +305,6 @@ union js_eval_ret {
}; };
extern int godot_js_eval(const char *p_js, int p_use_global_ctx, union js_eval_ret *p_union_ptr, void *p_byte_arr, void *p_byte_arr_write, void *(*p_callback)(void *p_ptr, void *p_ptr2, int p_len)); extern int godot_js_eval(const char *p_js, int p_use_global_ctx, union js_eval_ret *p_union_ptr, void *p_byte_arr, void *p_byte_arr_write, void *(*p_callback)(void *p_ptr, void *p_ptr2, int p_len));
extern int godot_js_os_download_buffer(const uint8_t *p_buf, int p_buf_size, const char *p_name, const char *p_mime);
} }
void *resize_PackedByteArray_and_open_write(void *p_arr, void *r_write, int p_len) { void *resize_PackedByteArray_and_open_write(void *p_arr, void *r_write, int p_len) {

View File

@@ -683,7 +683,7 @@ const GodotDisplay = {
return GodotDisplayScreen.exitFullscreen(); return GodotDisplayScreen.exitFullscreen();
}, },
godot_js_display_desired_size_set__sig: 'v', godot_js_display_desired_size_set__sig: 'vii',
godot_js_display_desired_size_set: function (width, height) { godot_js_display_desired_size_set: function (width, height) {
GodotDisplayScreen.desired_size = [width, height]; GodotDisplayScreen.desired_size = [width, height];
GodotDisplayScreen.updateSize(); GodotDisplayScreen.updateSize();

View File

@@ -126,7 +126,7 @@ const GodotFetch = {
}, },
}, },
godot_js_fetch_create__sig: 'iii', 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) { 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); const method = GodotRuntime.parseString(p_method);
const url = GodotRuntime.parseString(p_url); const url = GodotRuntime.parseString(p_url);
@@ -176,7 +176,7 @@ const GodotFetch = {
return obj.status; return obj.status;
}, },
godot_js_fetch_read_headers__sig: 'iii', godot_js_fetch_read_headers__sig: 'iiii',
godot_js_fetch_read_headers: function (p_id, p_parse_cb, p_ref) { godot_js_fetch_read_headers: function (p_id, p_parse_cb, p_ref) {
const obj = IDHandler.get(p_id); const obj = IDHandler.get(p_id);
if (!obj || !obj.response) { if (!obj || !obj.response) {
@@ -193,7 +193,7 @@ const GodotFetch = {
return 0; return 0;
}, },
godot_js_fetch_read_chunk__sig: 'ii', godot_js_fetch_read_chunk__sig: 'iiii',
godot_js_fetch_read_chunk: function (p_id, p_buf, p_buf_size) { godot_js_fetch_read_chunk: function (p_id, p_buf, p_buf_size) {
const obj = IDHandler.get(p_id); const obj = IDHandler.get(p_id);
if (!obj || !obj.response) { if (!obj || !obj.response) {

View File

@@ -196,7 +196,7 @@ const GodotJSWrapper = {
} }
}, },
godot_js_wrapper_create_cb__sig: 'vii', godot_js_wrapper_create_cb__sig: 'iii',
godot_js_wrapper_create_cb: function (p_ref, p_func) { godot_js_wrapper_create_cb: function (p_ref, p_func) {
const func = GodotRuntime.get_func(p_func); const func = GodotRuntime.get_func(p_func);
let id = 0; let id = 0;