Merge pull request #50480 from Faless/js/4.x_ci
This commit is contained in:
commit
9427bf3842
8 changed files with 22 additions and 24 deletions
|
@ -4,9 +4,9 @@ on: [push, pull_request]
|
|||
# Global Settings
|
||||
env:
|
||||
GODOT_BASE_BRANCH: master
|
||||
SCONSFLAGS: platform=javascript verbose=yes warnings=extra werror=yes debug_symbols=no --jobs=2
|
||||
SCONSFLAGS: platform=javascript verbose=yes warnings=extra debug_symbols=no module_webxr_enabled=no --jobs=2
|
||||
SCONS_CACHE_LIMIT: 4096
|
||||
EM_VERSION: 1.39.20
|
||||
EM_VERSION: 2.0.25
|
||||
EM_CACHE_FOLDER: 'emsdk-cache'
|
||||
|
||||
jobs:
|
||||
|
@ -62,7 +62,7 @@ jobs:
|
|||
scons --version
|
||||
|
||||
- name: Set up Emscripten latest
|
||||
uses: mymindstorm/setup-emsdk@v6
|
||||
uses: mymindstorm/setup-emsdk@v10
|
||||
with:
|
||||
version: ${{env.EM_VERSION}}
|
||||
actions-cache-folder: ${{env.EM_CACHE_FOLDER}}
|
|
@ -34,7 +34,6 @@
|
|||
|
||||
#include "webrtc_data_channel_js.h"
|
||||
|
||||
#include "core/io/json.h"
|
||||
#include "emscripten.h"
|
||||
|
||||
void WebRTCPeerConnectionJS::_on_ice_candidate(void *p_obj, const char *p_mid_name, int p_mline_idx, const char *p_candidate) {
|
||||
|
@ -100,7 +99,7 @@ Error WebRTCPeerConnectionJS::initialize(Dictionary p_config) {
|
|||
}
|
||||
_conn_state = STATE_NEW;
|
||||
|
||||
String config = JSON::print(p_config);
|
||||
String config = Variant(p_config).to_json_string();
|
||||
_js_id = godot_js_rtc_pc_create(config.utf8().get_data(), this, &_on_connection_state_changed, &_on_ice_candidate, &_on_data_channel);
|
||||
return _js_id ? OK : FAILED;
|
||||
}
|
||||
|
@ -108,7 +107,7 @@ Error WebRTCPeerConnectionJS::initialize(Dictionary p_config) {
|
|||
Ref<WebRTCDataChannel> WebRTCPeerConnectionJS::create_data_channel(String p_channel, Dictionary p_channel_config) {
|
||||
ERR_FAIL_COND_V(_conn_state != STATE_NEW, nullptr);
|
||||
|
||||
String config = JSON::print(p_channel_config);
|
||||
String config = Variant(p_channel_config).to_json_string();
|
||||
int id = godot_js_rtc_pc_datachannel_create(_js_id, p_channel.utf8().get_data(), config.utf8().get_data());
|
||||
ERR_FAIL_COND_V(id == 0, nullptr);
|
||||
return memnew(WebRTCDataChannelJS(id));
|
||||
|
|
|
@ -202,8 +202,8 @@ int WebXRInterfaceJS::get_capabilities() const {
|
|||
return XRInterface::XR_STEREO | XRInterface::XR_MONO;
|
||||
};
|
||||
|
||||
bool WebXRInterfaceJS::is_stereo() {
|
||||
return godot_webxr_get_view_count() == 2;
|
||||
uint32_t WebXRInterfaceJS::get_view_count() {
|
||||
return godot_webxr_get_view_count();
|
||||
};
|
||||
|
||||
bool WebXRInterfaceJS::is_initialized() const {
|
||||
|
@ -425,7 +425,7 @@ void WebXRInterfaceJS::_update_tracker(int p_controller_id) {
|
|||
int *buttons = godot_webxr_get_controller_buttons(p_controller_id);
|
||||
if (buttons) {
|
||||
for (int i = 0; i < buttons[0]; i++) {
|
||||
input->joy_button(p_controller_id + 100, i, *((float *)buttons + (i + 1)));
|
||||
input->joy_button(p_controller_id + 100, (JoyButton)i, *((float *)buttons + (i + 1)));
|
||||
}
|
||||
free(buttons);
|
||||
}
|
||||
|
@ -436,7 +436,7 @@ void WebXRInterfaceJS::_update_tracker(int p_controller_id) {
|
|||
Input::JoyAxisValue joy_axis;
|
||||
joy_axis.min = -1;
|
||||
joy_axis.value = *((float *)axes + (i + 1));
|
||||
input->joy_axis(p_controller_id + 100, i, joy_axis);
|
||||
input->joy_axis(p_controller_id + 100, (JoyAxis)i, joy_axis);
|
||||
}
|
||||
free(axes);
|
||||
}
|
||||
|
|
|
@ -83,7 +83,7 @@ public:
|
|||
virtual void uninitialize() override;
|
||||
|
||||
virtual Size2 get_render_targetsize() override;
|
||||
virtual bool is_stereo() override;
|
||||
virtual uint32_t get_view_count() override;
|
||||
virtual Transform3D get_camera_transform() override;
|
||||
virtual Transform3D get_transform_for_view(uint32_t p_view, const Transform3D &p_cam_transform) override;
|
||||
virtual CameraMatrix get_projection_for_view(uint32_t p_view, real_t p_aspect, real_t p_z_near, real_t p_z_far) override;
|
||||
|
|
|
@ -38,7 +38,7 @@ def get_opts():
|
|||
BoolVariable("use_safe_heap", "Use Emscripten SAFE_HEAP sanitizer", False),
|
||||
# eval() can be a security concern, so it can be disabled.
|
||||
BoolVariable("javascript_eval", "Enable JavaScript eval interface", True),
|
||||
BoolVariable("threads_enabled", "Enable WebAssembly Threads support (limited browser support)", False),
|
||||
BoolVariable("threads_enabled", "Enable WebAssembly Threads support (limited browser support)", True),
|
||||
BoolVariable("gdnative_enabled", "Enable WebAssembly GDNative support (produces bigger binaries)", False),
|
||||
BoolVariable("use_closure_compiler", "Use closure compiler to minimize JavaScript code", False),
|
||||
]
|
||||
|
|
|
@ -229,7 +229,7 @@ EM_BOOL DisplayServerJavaScript::mouse_button_callback(int p_event_type, const E
|
|||
}
|
||||
|
||||
Input *input = Input::get_singleton();
|
||||
MouseButton mask = input->get_mouse_button_mask();
|
||||
int mask = input->get_mouse_button_mask();
|
||||
MouseButton button_flag = MouseButton(1 << (ev->get_button_index() - 1));
|
||||
if (ev->is_pressed()) {
|
||||
// Since the event is consumed, focus manually. The containing iframe,
|
||||
|
@ -605,17 +605,17 @@ void DisplayServerJavaScript::process_joypads() {
|
|||
Input::JoyAxisValue joy_axis;
|
||||
joy_axis.min = 0;
|
||||
joy_axis.value = value;
|
||||
int a = b == 6 ? JOY_AXIS_TRIGGER_LEFT : JOY_AXIS_TRIGGER_RIGHT;
|
||||
JoyAxis a = b == 6 ? JOY_AXIS_TRIGGER_LEFT : JOY_AXIS_TRIGGER_RIGHT;
|
||||
input->joy_axis(idx, a, joy_axis);
|
||||
} else {
|
||||
input->joy_button(idx, b, value);
|
||||
input->joy_button(idx, (JoyButton)b, value);
|
||||
}
|
||||
}
|
||||
for (int a = 0; a < s_axes_num; a++) {
|
||||
Input::JoyAxisValue joy_axis;
|
||||
joy_axis.min = -1;
|
||||
joy_axis.value = s_axes[a];
|
||||
input->joy_axis(idx, a, joy_axis);
|
||||
input->joy_axis(idx, (JoyAxis)a, joy_axis);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -710,18 +710,18 @@ void DisplayServerJavaScript::_dispatch_input_event(const Ref<InputEvent> &p_eve
|
|||
}
|
||||
}
|
||||
|
||||
DisplayServer *DisplayServerJavaScript::create_func(const String &p_rendering_driver, DisplayServer::WindowMode p_mode, uint32_t p_flags, const Vector2i &p_resolution, Error &r_error) {
|
||||
return memnew(DisplayServerJavaScript(p_rendering_driver, p_mode, p_flags, p_resolution, r_error));
|
||||
DisplayServer *DisplayServerJavaScript::create_func(const String &p_rendering_driver, WindowMode p_window_mode, VSyncMode p_vsync_mode, uint32_t p_flags, const Size2i &p_resolution, Error &r_error) {
|
||||
return memnew(DisplayServerJavaScript(p_rendering_driver, p_window_mode, p_vsync_mode, p_flags, p_resolution, r_error));
|
||||
}
|
||||
|
||||
DisplayServerJavaScript::DisplayServerJavaScript(const String &p_rendering_driver, WindowMode p_mode, uint32_t p_flags, const Vector2i &p_resolution, Error &r_error) {
|
||||
DisplayServerJavaScript::DisplayServerJavaScript(const String &p_rendering_driver, WindowMode p_window_mode, VSyncMode p_vsync_mode, uint32_t p_flags, const Size2i &p_resolution, Error &r_error) {
|
||||
r_error = OK; // Always succeeds for now.
|
||||
|
||||
// Ensure the canvas ID.
|
||||
godot_js_config_canvas_id_get(canvas_id, 256);
|
||||
|
||||
// Handle contextmenu, webglcontextlost
|
||||
godot_js_display_setup_canvas(p_resolution.x, p_resolution.y, p_mode == WINDOW_MODE_FULLSCREEN, OS::get_singleton()->is_hidpi_allowed() ? 1 : 0);
|
||||
godot_js_display_setup_canvas(p_resolution.x, p_resolution.y, p_window_mode == WINDOW_MODE_FULLSCREEN, OS::get_singleton()->is_hidpi_allowed() ? 1 : 0);
|
||||
|
||||
// Check if it's windows.
|
||||
swap_cancel_ok = godot_js_display_is_swap_ok_cancel() == 1;
|
||||
|
|
|
@ -89,7 +89,7 @@ private:
|
|||
void process_joypads();
|
||||
|
||||
static Vector<String> get_rendering_drivers_func();
|
||||
static DisplayServer *create_func(const String &p_rendering_driver, DisplayServer::WindowMode p_mode, uint32_t p_flags, const Vector2i &p_resolution, Error &r_error);
|
||||
static DisplayServer *create_func(const String &p_rendering_driver, WindowMode p_window_mode, VSyncMode p_vsync_mode, uint32_t p_flags, const Vector2i &p_resolution, Error &r_error);
|
||||
|
||||
static void _dispatch_input_event(const Ref<InputEvent> &p_event);
|
||||
|
||||
|
@ -201,7 +201,7 @@ public:
|
|||
void swap_buffers() override;
|
||||
|
||||
static void register_javascript_driver();
|
||||
DisplayServerJavaScript(const String &p_rendering_driver, WindowMode p_mode, uint32_t p_flags, const Vector2i &p_resolution, Error &r_error);
|
||||
DisplayServerJavaScript(const String &p_rendering_driver, WindowMode p_window_mode, VSyncMode p_vsync_mode, uint32_t p_flags, const Size2i &p_resolution, Error &r_error);
|
||||
~DisplayServerJavaScript();
|
||||
};
|
||||
|
||||
|
|
|
@ -31,7 +31,6 @@
|
|||
#include "os_javascript.h"
|
||||
|
||||
#include "core/debugger/engine_debugger.h"
|
||||
#include "core/io/json.h"
|
||||
#include "drivers/unix/dir_access_unix.h"
|
||||
#include "drivers/unix/file_access_unix.h"
|
||||
#include "main/main.h"
|
||||
|
@ -115,7 +114,7 @@ Error OS_JavaScript::create_process(const String &p_path, const List<String> &p_
|
|||
for (const List<String>::Element *E = p_arguments.front(); E; E = E->next()) {
|
||||
args.push_back(E->get());
|
||||
}
|
||||
String json_args = JSON::print(args);
|
||||
String json_args = Variant(args).to_json_string();
|
||||
int failed = godot_js_os_execute(json_args.utf8().get_data());
|
||||
ERR_FAIL_COND_V_MSG(failed, ERR_UNAVAILABLE, "OS::execute() or create_process() must be implemented in JavaScript via 'engine.setOnExecute' if required.");
|
||||
return OK;
|
||||
|
|
Loading…
Reference in a new issue