diff options
Diffstat (limited to 'platform')
72 files changed, 981 insertions, 2010 deletions
diff --git a/platform/android/SCsub b/platform/android/SCsub index 7e9dac926c..56fbd2f7e4 100644 --- a/platform/android/SCsub +++ b/platform/android/SCsub @@ -9,7 +9,6 @@ android_files = [ "dir_access_jandroid.cpp", "thread_jandroid.cpp", "net_socket_android.cpp", - "audio_driver_jandroid.cpp", "java_godot_lib_jni.cpp", "java_class_wrapper.cpp", "java_godot_wrapper.cpp", diff --git a/platform/android/api/java_class_wrapper.h b/platform/android/api/java_class_wrapper.h index d6c7a1abe5..ff7bf43573 100644 --- a/platform/android/api/java_class_wrapper.h +++ b/platform/android/api/java_class_wrapper.h @@ -31,7 +31,7 @@ #ifndef JAVA_CLASS_WRAPPER_H #define JAVA_CLASS_WRAPPER_H -#include "core/object/reference.h" +#include "core/object/ref_counted.h" #ifdef ANDROID_ENABLED #include <android/log.h> @@ -42,8 +42,8 @@ class JavaObject; #endif -class JavaClass : public Reference { - GDCLASS(JavaClass, Reference); +class JavaClass : public RefCounted { + GDCLASS(JavaClass, RefCounted); #ifdef ANDROID_ENABLED enum ArgumentType{ @@ -184,8 +184,8 @@ public: JavaClass(); }; -class JavaObject : public Reference { - GDCLASS(JavaObject, Reference); +class JavaObject : public RefCounted { + GDCLASS(JavaObject, RefCounted); #ifdef ANDROID_ENABLED Ref<JavaClass> base_class; diff --git a/platform/android/audio_driver_jandroid.cpp b/platform/android/audio_driver_jandroid.cpp deleted file mode 100644 index 3a2ccac481..0000000000 --- a/platform/android/audio_driver_jandroid.cpp +++ /dev/null @@ -1,185 +0,0 @@ -/*************************************************************************/ -/* audio_driver_jandroid.cpp */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ - -#include "audio_driver_jandroid.h" - -#include "core/config/project_settings.h" -#include "core/os/os.h" -#include "thread_jandroid.h" - -AudioDriverAndroid *AudioDriverAndroid::s_ad = nullptr; - -jobject AudioDriverAndroid::io; -jmethodID AudioDriverAndroid::_init_audio; -jmethodID AudioDriverAndroid::_write_buffer; -jmethodID AudioDriverAndroid::_quit; -jmethodID AudioDriverAndroid::_pause; -bool AudioDriverAndroid::active = false; -jclass AudioDriverAndroid::cls; -int AudioDriverAndroid::audioBufferFrames = 0; -int AudioDriverAndroid::mix_rate = 44100; -bool AudioDriverAndroid::quit = false; -jobject AudioDriverAndroid::audioBuffer = nullptr; -void *AudioDriverAndroid::audioBufferPinned = nullptr; -Mutex AudioDriverAndroid::mutex; -int32_t *AudioDriverAndroid::audioBuffer32 = nullptr; - -const char *AudioDriverAndroid::get_name() const { - return "Android"; -} - -Error AudioDriverAndroid::init() { - /* - // TODO: pass in/return a (Java) device ID, also whether we're opening for input or output - this->spec.samples = Android_JNI_OpenAudioDevice(this->spec.freq, this->spec.format == AUDIO_U8 ? 0 : 1, this->spec.channels, this->spec.samples); - SDL_CalculateAudioSpec(&this->spec); - - if (this->spec.samples == 0) { - // Init failed? - SDL_SetError("Java-side initialization failed!"); - return 0; - } -*/ - - //Android_JNI_SetupThread(); - - // __android_log_print(ANDROID_LOG_VERBOSE, "SDL", "SDL audio: opening device"); - - JNIEnv *env = get_jni_env(); - int mix_rate = GLOBAL_GET("audio/driver/mix_rate"); - - int latency = GLOBAL_GET("audio/driver/output_latency"); - unsigned int buffer_size = next_power_of_2(latency * mix_rate / 1000); - print_verbose("Audio buffer size: " + itos(buffer_size)); - - audioBuffer = env->CallObjectMethod(io, _init_audio, mix_rate, buffer_size); - - ERR_FAIL_COND_V(audioBuffer == nullptr, ERR_INVALID_PARAMETER); - - audioBuffer = env->NewGlobalRef(audioBuffer); - - jboolean isCopy = JNI_FALSE; - audioBufferPinned = env->GetShortArrayElements((jshortArray)audioBuffer, &isCopy); - audioBufferFrames = env->GetArrayLength((jshortArray)audioBuffer); - audioBuffer32 = memnew_arr(int32_t, audioBufferFrames); - - return OK; -} - -void AudioDriverAndroid::start() { - active = true; -} - -void AudioDriverAndroid::setup(jobject p_io) { - JNIEnv *env = get_jni_env(); - io = p_io; - - jclass c = env->GetObjectClass(io); - cls = (jclass)env->NewGlobalRef(c); - - _init_audio = env->GetMethodID(cls, "audioInit", "(II)Ljava/lang/Object;"); - _write_buffer = env->GetMethodID(cls, "audioWriteShortBuffer", "([S)V"); - _quit = env->GetMethodID(cls, "audioQuit", "()V"); - _pause = env->GetMethodID(cls, "audioPause", "(Z)V"); -} - -void AudioDriverAndroid::thread_func(JNIEnv *env) { - jclass cls = env->FindClass("org/godotengine/godot/Godot"); - if (cls) { - cls = (jclass)env->NewGlobalRef(cls); - } - jfieldID fid = env->GetStaticFieldID(cls, "io", "Lorg/godotengine/godot/GodotIO;"); - jobject ob = env->GetStaticObjectField(cls, fid); - jobject gob = env->NewGlobalRef(ob); - jclass c = env->GetObjectClass(gob); - jclass lcls = (jclass)env->NewGlobalRef(c); - _write_buffer = env->GetMethodID(lcls, "audioWriteShortBuffer", "([S)V"); - - while (!quit) { - int16_t *ptr = (int16_t *)audioBufferPinned; - int fc = audioBufferFrames; - - if (!s_ad->active || mutex.try_lock() != OK) { - for (int i = 0; i < fc; i++) { - ptr[i] = 0; - } - - } else { - s_ad->audio_server_process(fc / 2, audioBuffer32); - - mutex.unlock(); - - for (int i = 0; i < fc; i++) { - ptr[i] = audioBuffer32[i] >> 16; - } - } - env->ReleaseShortArrayElements((jshortArray)audioBuffer, (jshort *)ptr, JNI_COMMIT); - env->CallVoidMethod(gob, _write_buffer, (jshortArray)audioBuffer); - } -} - -int AudioDriverAndroid::get_mix_rate() const { - return mix_rate; -} - -AudioDriver::SpeakerMode AudioDriverAndroid::get_speaker_mode() const { - return SPEAKER_MODE_STEREO; -} - -void AudioDriverAndroid::lock() { - mutex.lock(); -} - -void AudioDriverAndroid::unlock() { - mutex.unlock(); -} - -void AudioDriverAndroid::finish() { - JNIEnv *env = get_jni_env(); - env->CallVoidMethod(io, _quit); - - if (audioBuffer) { - env->DeleteGlobalRef(audioBuffer); - audioBuffer = nullptr; - audioBufferPinned = nullptr; - } - - active = false; -} - -void AudioDriverAndroid::set_pause(bool p_pause) { - JNIEnv *env = get_jni_env(); - env->CallVoidMethod(io, _pause, p_pause); -} - -AudioDriverAndroid::AudioDriverAndroid() { - s_ad = this; - active = false; -} diff --git a/platform/android/audio_driver_jandroid.h b/platform/android/audio_driver_jandroid.h deleted file mode 100644 index 9007fd2f81..0000000000 --- a/platform/android/audio_driver_jandroid.h +++ /dev/null @@ -1,78 +0,0 @@ -/*************************************************************************/ -/* audio_driver_jandroid.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ - -#ifndef AUDIO_DRIVER_ANDROID_H -#define AUDIO_DRIVER_ANDROID_H - -#include "servers/audio_server.h" - -#include "java_godot_lib_jni.h" - -class AudioDriverAndroid : public AudioDriver { - static Mutex mutex; - static AudioDriverAndroid *s_ad; - static jobject io; - static jmethodID _init_audio; - static jmethodID _write_buffer; - static jmethodID _quit; - static jmethodID _pause; - static bool active; - static bool quit; - - static jclass cls; - - static jobject audioBuffer; - static void *audioBufferPinned; - static int32_t *audioBuffer32; - static int audioBufferFrames; - static int mix_rate; - -public: - void set_singleton(); - - virtual const char *get_name() const; - - virtual Error init(); - virtual void start(); - virtual int get_mix_rate() const; - virtual SpeakerMode get_speaker_mode() const; - virtual void lock(); - virtual void unlock(); - virtual void finish(); - - virtual void set_pause(bool p_pause); - - static void setup(jobject p_io); - static void thread_func(JNIEnv *env); - - AudioDriverAndroid(); -}; - -#endif // AUDIO_DRIVER_ANDROID_H diff --git a/platform/android/dir_access_jandroid.h b/platform/android/dir_access_jandroid.h index 7b9cbeea47..cdf98187ed 100644 --- a/platform/android/dir_access_jandroid.h +++ b/platform/android/dir_access_jandroid.h @@ -31,7 +31,7 @@ #ifndef DIR_ACCESS_JANDROID_H #define DIR_ACCESS_JANDROID_H -#include "core/os/dir_access.h" +#include "core/io/dir_access.h" #include "java_godot_lib_jni.h" #include <stdio.h> diff --git a/platform/android/display_server_android.cpp b/platform/android/display_server_android.cpp index ff61eeaee1..66a2013c4e 100644 --- a/platform/android/display_server_android.cpp +++ b/platform/android/display_server_android.cpp @@ -410,8 +410,6 @@ DisplayServerAndroid::DisplayServerAndroid(const String &p_rendering_driver, Dis keep_screen_on = GLOBAL_GET("display/window/energy_saving/keep_screen_on"); - buttons_state = 0; - #if defined(OPENGL_ENABLED) if (rendering_driver == "opengl") { bool gl_initialization_error = false; @@ -484,16 +482,16 @@ DisplayServerAndroid::~DisplayServerAndroid() { void DisplayServerAndroid::process_joy_event(DisplayServerAndroid::JoypadEvent p_event) { switch (p_event.type) { case JOY_EVENT_BUTTON: - Input::get_singleton()->joy_button(p_event.device, p_event.index, p_event.pressed); + Input::get_singleton()->joy_button(p_event.device, (JoyButton)p_event.index, p_event.pressed); break; case JOY_EVENT_AXIS: Input::JoyAxisValue value; value.min = -1; value.value = p_event.value; - Input::get_singleton()->joy_axis(p_event.device, p_event.index, value); + Input::get_singleton()->joy_axis(p_event.device, (JoyAxis)p_event.index, value); break; case JOY_EVENT_HAT: - Input::get_singleton()->joy_hat(p_event.device, p_event.hat); + Input::get_singleton()->joy_hat(p_event.device, (HatMask)p_event.hat); break; default: return; @@ -528,7 +526,7 @@ void DisplayServerAndroid::process_key_event(int p_keycode, int p_scancode, int } Ref<InputEventKey> ev; - ev.instance(); + ev.instantiate(); int val = unicode; int keycode = android_get_keysym(p_keycode); int phy_keycode = android_get_keysym(p_scancode); @@ -575,7 +573,7 @@ void DisplayServerAndroid::process_touch(int p_event, int p_pointer, const Vecto //end all if exist for (int i = 0; i < touch.size(); i++) { Ref<InputEventScreenTouch> ev; - ev.instance(); + ev.instantiate(); ev->set_index(touch[i].id); ev->set_pressed(false); ev->set_position(touch[i].pos); @@ -592,7 +590,7 @@ void DisplayServerAndroid::process_touch(int p_event, int p_pointer, const Vecto //send touch for (int i = 0; i < touch.size(); i++) { Ref<InputEventScreenTouch> ev; - ev.instance(); + ev.instantiate(); ev->set_index(touch[i].id); ev->set_pressed(true); ev->set_position(touch[i].pos); @@ -618,7 +616,7 @@ void DisplayServerAndroid::process_touch(int p_event, int p_pointer, const Vecto continue; //no move unncesearily Ref<InputEventScreenDrag> ev; - ev.instance(); + ev.instantiate(); ev->set_index(touch[i].id); ev->set_position(p_points[idx].pos); ev->set_relative(p_points[idx].pos - touch[i].pos); @@ -633,7 +631,7 @@ void DisplayServerAndroid::process_touch(int p_event, int p_pointer, const Vecto //end all if exist for (int i = 0; i < touch.size(); i++) { Ref<InputEventScreenTouch> ev; - ev.instance(); + ev.instantiate(); ev->set_index(touch[i].id); ev->set_pressed(false); ev->set_position(touch[i].pos); @@ -649,7 +647,7 @@ void DisplayServerAndroid::process_touch(int p_event, int p_pointer, const Vecto touch.push_back(tp); Ref<InputEventScreenTouch> ev; - ev.instance(); + ev.instantiate(); ev->set_index(tp.id); ev->set_pressed(true); @@ -664,7 +662,7 @@ void DisplayServerAndroid::process_touch(int p_event, int p_pointer, const Vecto for (int i = 0; i < touch.size(); i++) { if (touch[i].id == p_pointer) { Ref<InputEventScreenTouch> ev; - ev.instance(); + ev.instantiate(); ev->set_index(touch[i].id); ev->set_pressed(false); ev->set_position(touch[i].pos); @@ -685,7 +683,7 @@ void DisplayServerAndroid::process_hover(int p_type, Point2 p_pos) { case AMOTION_EVENT_ACTION_HOVER_ENTER: // hover enter case AMOTION_EVENT_ACTION_HOVER_EXIT: { // hover exit Ref<InputEventMouseMotion> ev; - ev.instance(); + ev.instantiate(); _set_key_modifier_state(ev); ev->set_position(p_pos); ev->set_global_position(p_pos); @@ -697,12 +695,12 @@ void DisplayServerAndroid::process_hover(int p_type, Point2 p_pos) { } void DisplayServerAndroid::process_mouse_event(int input_device, int event_action, int event_android_buttons_mask, Point2 event_pos, float event_vertical_factor, float event_horizontal_factor) { - int event_buttons_mask = _android_button_mask_to_godot_button_mask(event_android_buttons_mask); + MouseButton event_buttons_mask = _android_button_mask_to_godot_button_mask(event_android_buttons_mask); switch (event_action) { case AMOTION_EVENT_ACTION_BUTTON_PRESS: case AMOTION_EVENT_ACTION_BUTTON_RELEASE: { Ref<InputEventMouseButton> ev; - ev.instance(); + ev.instantiate(); _set_key_modifier_state(ev); if ((input_device & AINPUT_SOURCE_MOUSE) == AINPUT_SOURCE_MOUSE) { ev->set_position(event_pos); @@ -712,7 +710,7 @@ void DisplayServerAndroid::process_mouse_event(int input_device, int event_actio ev->set_global_position(hover_prev_pos); } ev->set_pressed(event_action == AMOTION_EVENT_ACTION_BUTTON_PRESS); - int changed_button_mask = buttons_state ^ event_buttons_mask; + MouseButton changed_button_mask = MouseButton(buttons_state ^ event_buttons_mask); buttons_state = event_buttons_mask; @@ -723,7 +721,7 @@ void DisplayServerAndroid::process_mouse_event(int input_device, int event_actio case AMOTION_EVENT_ACTION_MOVE: { Ref<InputEventMouseMotion> ev; - ev.instance(); + ev.instantiate(); _set_key_modifier_state(ev); if ((input_device & AINPUT_SOURCE_MOUSE) == AINPUT_SOURCE_MOUSE) { ev->set_position(event_pos); @@ -740,7 +738,7 @@ void DisplayServerAndroid::process_mouse_event(int input_device, int event_actio } break; case AMOTION_EVENT_ACTION_SCROLL: { Ref<InputEventMouseButton> ev; - ev.instance(); + ev.instantiate(); if ((input_device & AINPUT_SOURCE_MOUSE) == AINPUT_SOURCE_MOUSE) { ev->set_position(event_pos); ev->set_global_position(event_pos); @@ -765,11 +763,11 @@ void DisplayServerAndroid::process_mouse_event(int input_device, int event_actio } } -void DisplayServerAndroid::_wheel_button_click(int event_buttons_mask, const Ref<InputEventMouseButton> &ev, int wheel_button, float factor) { +void DisplayServerAndroid::_wheel_button_click(MouseButton event_buttons_mask, const Ref<InputEventMouseButton> &ev, MouseButton wheel_button, float factor) { Ref<InputEventMouseButton> evd = ev->duplicate(); _set_key_modifier_state(evd); evd->set_button_index(wheel_button); - evd->set_button_mask(event_buttons_mask ^ (1 << (wheel_button - 1))); + evd->set_button_mask(MouseButton(event_buttons_mask ^ (1 << (wheel_button - 1)))); evd->set_factor(factor); Input::get_singleton()->accumulate_input_event(evd); Ref<InputEventMouseButton> evdd = evd->duplicate(); @@ -779,9 +777,9 @@ void DisplayServerAndroid::_wheel_button_click(int event_buttons_mask, const Ref } void DisplayServerAndroid::process_double_tap(int event_android_button_mask, Point2 p_pos) { - int event_button_mask = _android_button_mask_to_godot_button_mask(event_android_button_mask); + MouseButton event_button_mask = _android_button_mask_to_godot_button_mask(event_android_button_mask); Ref<InputEventMouseButton> ev; - ev.instance(); + ev.instantiate(); _set_key_modifier_state(ev); ev->set_position(p_pos); ev->set_global_position(p_pos); @@ -792,7 +790,7 @@ void DisplayServerAndroid::process_double_tap(int event_android_button_mask, Poi Input::get_singleton()->accumulate_input_event(ev); } -int DisplayServerAndroid::_button_index_from_mask(int button_mask) { +MouseButton DisplayServerAndroid::_button_index_from_mask(MouseButton button_mask) { switch (button_mask) { case MOUSE_BUTTON_MASK_LEFT: return MOUSE_BUTTON_LEFT; @@ -805,13 +803,13 @@ int DisplayServerAndroid::_button_index_from_mask(int button_mask) { case MOUSE_BUTTON_MASK_XBUTTON2: return MOUSE_BUTTON_XBUTTON2; default: - return 0; + return MOUSE_BUTTON_NONE; } } void DisplayServerAndroid::process_scroll(Point2 p_pos) { Ref<InputEventPanGesture> ev; - ev.instance(); + ev.instantiate(); _set_key_modifier_state(ev); ev->set_position(p_pos); ev->set_delta(p_pos - scroll_prev_pos); @@ -863,12 +861,12 @@ Point2i DisplayServerAndroid::mouse_get_position() const { return hover_prev_pos; } -int DisplayServerAndroid::mouse_get_button_state() const { +MouseButton DisplayServerAndroid::mouse_get_button_state() const { return buttons_state; } -int DisplayServerAndroid::_android_button_mask_to_godot_button_mask(int android_button_mask) { - int godot_button_mask = 0; +MouseButton DisplayServerAndroid::_android_button_mask_to_godot_button_mask(int android_button_mask) { + MouseButton godot_button_mask = MOUSE_BUTTON_NONE; if (android_button_mask & AMOTION_EVENT_BUTTON_PRIMARY) { godot_button_mask |= MOUSE_BUTTON_MASK_LEFT; } diff --git a/platform/android/display_server_android.h b/platform/android/display_server_android.h index 1379baf154..a39271d524 100644 --- a/platform/android/display_server_android.h +++ b/platform/android/display_server_android.h @@ -68,7 +68,7 @@ private: bool control_mem = false; bool meta_mem = false; - int buttons_state; + MouseButton buttons_state = MOUSE_BUTTON_NONE; // https://developer.android.com/reference/android/view/PointerIcon // mapping between Godot's cursor shape to Android's' @@ -81,7 +81,7 @@ private: 1004, //CURSOR_BUSY 1021, //CURSOR_DRAG 1021, //CURSOR_CAN_DRO - 1000, //CURSOR_FORBIDD (no corresponding icon in Android's icon so fallback to default) + 1000, //CURSOR_FORBIDD (no corresponding icon in Android's icon so fallback to default) 1015, //CURSOR_VSIZE 1014, //CURSOR_HSIZE 1017, //CURSOR_BDIAGSI @@ -120,11 +120,11 @@ private: void _set_key_modifier_state(Ref<InputEventWithModifiers> ev); - static int _button_index_from_mask(int button_mask); + static MouseButton _button_index_from_mask(MouseButton button_mask); - static int _android_button_mask_to_godot_button_mask(int android_button_mask); + static MouseButton _android_button_mask_to_godot_button_mask(int android_button_mask); - void _wheel_button_click(int event_buttons_mask, const Ref<InputEventMouseButton> &ev, int wheel_button, float factor); + void _wheel_button_click(MouseButton event_buttons_mask, const Ref<InputEventMouseButton> &ev, MouseButton wheel_button, float factor); public: static DisplayServerAndroid *get_singleton(); @@ -219,7 +219,7 @@ public: void notify_surface_changed(int p_width, int p_height); virtual Point2i mouse_get_position() const; - virtual int mouse_get_button_state() const; + virtual MouseButton mouse_get_button_state() const; DisplayServerAndroid(const String &p_rendering_driver, WindowMode p_mode, uint32_t p_flags, const Vector2i &p_resolution, Error &r_error); ~DisplayServerAndroid(); diff --git a/platform/android/export/export.cpp b/platform/android/export/export.cpp index 1338b31a64..923435eec5 100644 --- a/platform/android/export/export.cpp +++ b/platform/android/export/export.cpp @@ -31,11 +31,11 @@ #include "export.h" #include "core/config/project_settings.h" +#include "core/io/dir_access.h" +#include "core/io/file_access.h" #include "core/io/image_loader.h" #include "core/io/marshalls.h" #include "core/io/zip_io.h" -#include "core/os/dir_access.h" -#include "core/os/file_access.h" #include "core/os/os.h" #include "core/templates/safe_refcount.h" #include "core/version.h" @@ -609,9 +609,9 @@ class EditorExportPlatformAndroid : public EditorExportPlatform { zip_fileinfo zipfi; zipfi.tmz_date.tm_hour = time.hour; zipfi.tmz_date.tm_mday = date.day; - zipfi.tmz_date.tm_min = time.min; + zipfi.tmz_date.tm_min = time.minute; zipfi.tmz_date.tm_mon = date.month - 1; // tm_mon is zero indexed - zipfi.tmz_date.tm_sec = time.sec; + zipfi.tmz_date.tm_sec = time.second; zipfi.tmz_date.tm_year = date.year; zipfi.dosDate = 0; zipfi.external_fa = 0; @@ -1461,7 +1461,7 @@ class EditorExportPlatformAndroid : public EditorExportPlatform { String project_splash_path = ProjectSettings::get_singleton()->get("application/boot_splash/image"); if (!project_splash_path.is_empty()) { - splash_image.instance(); + splash_image.instantiate(); print_verbose("Loading splash image: " + project_splash_path); const Error err = ImageLoader::load_image(project_splash_path, splash_image); if (err) { @@ -1501,7 +1501,7 @@ class EditorExportPlatformAndroid : public EditorExportPlatform { } print_verbose("Creating splash background color image."); - splash_bg_color_image.instance(); + splash_bg_color_image.instantiate(); splash_bg_color_image->create(splash_image->get_width(), splash_image->get_height(), false, splash_image->get_format()); splash_bg_color_image->fill(bg_color); @@ -1512,9 +1512,9 @@ class EditorExportPlatformAndroid : public EditorExportPlatform { void load_icon_refs(const Ref<EditorExportPreset> &p_preset, Ref<Image> &icon, Ref<Image> &foreground, Ref<Image> &background) { String project_icon_path = ProjectSettings::get_singleton()->get("application/config/icon"); - icon.instance(); - foreground.instance(); - background.instance(); + icon.instantiate(); + foreground.instantiate(); + background.instantiate(); // Regular icon: user selection -> project icon -> default. String path = static_cast<String>(p_preset->get(launcher_icon_option)).strip_edges(); @@ -1849,7 +1849,7 @@ public: err = OS::get_singleton()->execute(adb, args, &output, &rv, true); print_verbose(output); if (err || rv != 0) { - EditorNode::add_io_error("Could not install to device."); + EditorNode::add_io_error("Could not install to device: " + output); CLEANUP_AND_RETURN(ERR_CANT_CREATE); } @@ -2037,6 +2037,13 @@ public: // Validate the rest of the configuration. String dk = p_preset->get("keystore/debug"); + String dk_user = p_preset->get("keystore/debug_user"); + String dk_password = p_preset->get("keystore/debug_password"); + + if ((dk.is_empty() || dk_user.is_empty() || dk_password.is_empty()) && (!dk.is_empty() || !dk_user.is_empty() || !dk_password.is_empty())) { + valid = false; + err += TTR("Either Debug Keystore, Debug User AND Debug Password settings must be configured OR none of them.") + "\n"; + } if (!FileAccess::exists(dk)) { dk = EditorSettings::get_singleton()->get("export/android/debug_keystore"); @@ -2047,6 +2054,13 @@ public: } String rk = p_preset->get("keystore/release"); + String rk_user = p_preset->get("keystore/release_user"); + String rk_password = p_preset->get("keystore/release_password"); + + if ((rk.is_empty() || rk_user.is_empty() || rk_password.is_empty()) && (!rk.is_empty() || !rk_user.is_empty() || !rk_password.is_empty())) { + valid = false; + err += TTR("Either Release Keystore, Release User AND Release Password settings must be configured OR none of them.") + "\n"; + } if (!rk.is_empty() && !FileAccess::exists(rk)) { valid = false; @@ -2927,11 +2941,11 @@ public: EditorExportPlatformAndroid() { Ref<Image> img = memnew(Image(_android_logo)); - logo.instance(); + logo.instantiate(); logo->create_from_image(img); img = Ref<Image>(memnew(Image(_android_run_icon))); - run_icon.instance(); + run_icon.instantiate(); run_icon->create_from_image(img); devices_changed.set(); diff --git a/platform/android/export/gradle_export_util.h b/platform/android/export/gradle_export_util.h index 0bb94dcc97..6ab678b8a1 100644 --- a/platform/android/export/gradle_export_util.h +++ b/platform/android/export/gradle_export_util.h @@ -31,9 +31,9 @@ #ifndef GODOT_GRADLE_EXPORT_UTIL_H #define GODOT_GRADLE_EXPORT_UTIL_H +#include "core/io/dir_access.h" +#include "core/io/file_access.h" #include "core/io/zip_io.h" -#include "core/os/dir_access.h" -#include "core/os/file_access.h" #include "core/os/os.h" #include "editor/editor_export.h" diff --git a/platform/android/file_access_android.h b/platform/android/file_access_android.h index 8890e0f645..bb4ce36947 100644 --- a/platform/android/file_access_android.h +++ b/platform/android/file_access_android.h @@ -31,7 +31,7 @@ #ifndef FILE_ACCESS_ANDROID_H #define FILE_ACCESS_ANDROID_H -#include "core/os/file_access.h" +#include "core/io/file_access.h" #include <android/asset_manager.h> #include <android/log.h> #include <stdio.h> diff --git a/platform/android/java/build.gradle b/platform/android/java/build.gradle index a7fe500be2..a28888d80d 100644 --- a/platform/android/java/build.gradle +++ b/platform/android/java/build.gradle @@ -118,8 +118,8 @@ task zipCustomBuild(type: Zip) { } from(fileTree(dir: 'app', excludes: ['**/build/**', '**/.gradle/**', '**/*.iml']), fileTree(dir: '.', includes: ['gradle.properties', 'gradlew', 'gradlew.bat', 'gradle/**'])) include '**/*' - archiveName 'android_source.zip' - destinationDir(file(binDir)) + archiveFileName = 'android_source.zip' + destinationDirectory = file(binDir) } def templateExcludedBuildTask() { diff --git a/platform/android/java/gradlew.bat b/platform/android/java/gradlew.bat index f9553162f1..11cc30edb0 100644 --- a/platform/android/java/gradlew.bat +++ b/platform/android/java/gradlew.bat @@ -1,7 +1,7 @@ @if "%DEBUG%" == "" @echo off @rem ########################################################################## @rem -@rem Gradle startup script for Windows +@rem Gradle startup script for Windows @rem @rem ########################################################################## @@ -75,7 +75,7 @@ if "%ERRORLEVEL%"=="0" goto mainEnd :fail rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 exit /b 1 :mainEnd diff --git a/platform/android/java/lib/res/values/strings.xml b/platform/android/java/lib/res/values/strings.xml index 590b066d8a..010006b81e 100644 --- a/platform/android/java/lib/res/values/strings.xml +++ b/platform/android/java/lib/res/values/strings.xml @@ -6,7 +6,7 @@ <string name="text_button_resume_cellular">Resume download</string> <string name="text_button_wifi_settings">Wi-Fi settings</string> <string name="text_verifying_download">Verifying Download</string> - <string name="text_validation_complete">XAPK File Validation Complete. Select OK to exit.</string> + <string name="text_validation_complete">XAPK File Validation Complete. Select OK to exit.</string> <string name="text_validation_failed">XAPK File Validation Failed.</string> <string name="text_button_pause">Pause Download</string> <string name="text_button_resume">Resume Download</string> diff --git a/platform/android/java/lib/src/org/godotengine/godot/GodotIO.java b/platform/android/java/lib/src/org/godotengine/godot/GodotIO.java index c7c7c1b40c..12a8bdb90b 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/GodotIO.java +++ b/platform/android/java/lib/src/org/godotengine/godot/GodotIO.java @@ -328,95 +328,6 @@ public class GodotIO { } ///////////////////////// - // AUDIO - ///////////////////////// - - private Object buf; - private Thread mAudioThread; - private AudioTrack mAudioTrack; - - public Object audioInit(int sampleRate, int desiredFrames) { - int channelConfig = AudioFormat.CHANNEL_OUT_STEREO; - int audioFormat = AudioFormat.ENCODING_PCM_16BIT; - int frameSize = 4; - - System.out.printf("audioInit: initializing audio:\n"); - - //Log.v("Godot", "Godot audio: wanted " + (isStereo ? "stereo" : "mono") + " " + (is16Bit ? "16-bit" : "8-bit") + " " + ((float)sampleRate / 1000f) + "kHz, " + desiredFrames + " frames buffer"); - - // Let the user pick a larger buffer if they really want -- but ye - // gods they probably shouldn't, the minimums are horrifyingly high - // latency already - desiredFrames = Math.max(desiredFrames, (AudioTrack.getMinBufferSize(sampleRate, channelConfig, audioFormat) + frameSize - 1) / frameSize); - - mAudioTrack = new AudioTrack(AudioManager.STREAM_MUSIC, sampleRate, - channelConfig, audioFormat, desiredFrames * frameSize, AudioTrack.MODE_STREAM); - - audioStartThread(); - - //Log.v("Godot", "Godot audio: got " + ((mAudioTrack.getChannelCount() >= 2) ? "stereo" : "mono") + " " + ((mAudioTrack.getAudioFormat() == AudioFormat.ENCODING_PCM_16BIT) ? "16-bit" : "8-bit") + " " + ((float)mAudioTrack.getSampleRate() / 1000f) + "kHz, " + desiredFrames + " frames buffer"); - - buf = new short[desiredFrames * 2]; - return buf; - } - - public void audioStartThread() { - mAudioThread = new Thread(new Runnable() { - public void run() { - mAudioTrack.play(); - GodotLib.audio(); - } - }); - - // I'd take REALTIME if I could get it! - mAudioThread.setPriority(Thread.MAX_PRIORITY); - mAudioThread.start(); - } - - public void audioWriteShortBuffer(short[] buffer) { - for (int i = 0; i < buffer.length;) { - int result = mAudioTrack.write(buffer, i, buffer.length - i); - if (result > 0) { - i += result; - } else if (result == 0) { - try { - Thread.sleep(1); - } catch (InterruptedException e) { - // Nom nom - } - } else { - Log.w("Godot", "Godot audio: error return from write(short)"); - return; - } - } - } - - public void audioQuit() { - if (mAudioThread != null) { - try { - mAudioThread.join(); - } catch (Exception e) { - Log.v("Godot", "Problem stopping audio thread: " + e); - } - mAudioThread = null; - - //Log.v("Godot", "Finished waiting for audio thread"); - } - - if (mAudioTrack != null) { - mAudioTrack.stop(); - mAudioTrack = null; - } - } - - public void audioPause(boolean p_pause) { - if (p_pause) - mAudioTrack.pause(); - else - mAudioTrack.play(); - } - - ///////////////////////// // MISCELLANEOUS OS IO ///////////////////////// @@ -452,6 +363,10 @@ public class GodotIO { return activity.getFilesDir().getAbsolutePath(); } + public String getExternalDataDir() { + return activity.getExternalFilesDir(null).getAbsolutePath(); + } + public String getLocale() { return Locale.getDefault().toString(); } diff --git a/platform/android/java/lib/src/org/godotengine/godot/GodotLib.java b/platform/android/java/lib/src/org/godotengine/godot/GodotLib.java index 534a50e9ed..8108118388 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/GodotLib.java +++ b/platform/android/java/lib/src/org/godotengine/godot/GodotLib.java @@ -175,11 +175,6 @@ public class GodotLib { public static native void focusout(); /** - * Invoked when the audio thread is started. - */ - public static native void audio(); - - /** * Used to access Godot global properties. * @param p_key Property key * @return String value of the property diff --git a/platform/android/java/lib/src/org/godotengine/godot/vulkan/VkSurfaceView.kt b/platform/android/java/lib/src/org/godotengine/godot/vulkan/VkSurfaceView.kt index f0e37d80b8..b01dc2653a 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/vulkan/VkSurfaceView.kt +++ b/platform/android/java/lib/src/org/godotengine/godot/vulkan/VkSurfaceView.kt @@ -115,7 +115,7 @@ open internal class VkSurfaceView(context: Context) : SurfaceView(context), Surf /** * Tear down the rendering thread. * - * Must not be called before a [VkRenderer] has been set. + * Must not be called before a [VkRenderer] has been set. */ fun onDestroy() { vkThread.blockingExit() diff --git a/platform/android/java_class_wrapper.cpp b/platform/android/java_class_wrapper.cpp index f49b0e843a..ed6b5c3e14 100644 --- a/platform/android/java_class_wrapper.cpp +++ b/platform/android/java_class_wrapper.cpp @@ -102,7 +102,7 @@ bool JavaClass::_call_method(JavaObject *p_instance, const StringName &p_method, if (p_args[i]->get_type() != Variant::OBJECT) arg_expected = Variant::OBJECT; else { - Ref<Reference> ref = *p_args[i]; + Ref<RefCounted> ref = *p_args[i]; if (!ref.is_null()) { if (Object::cast_to<JavaObject>(ref.ptr())) { Ref<JavaObject> jo = ref; @@ -488,7 +488,7 @@ Variant JavaClass::call(const StringName &p_method, const Variant **p_args, int return ret; } - return Reference::call(p_method, p_args, p_argcount, r_error); + return RefCounted::call(p_method, p_args, p_argcount, r_error); } JavaClass::JavaClass() { diff --git a/platform/android/java_godot_io_wrapper.cpp b/platform/android/java_godot_io_wrapper.cpp index ec3b6f8ac0..5e99135498 100644 --- a/platform/android/java_godot_io_wrapper.cpp +++ b/platform/android/java_godot_io_wrapper.cpp @@ -49,6 +49,7 @@ GodotIOJavaWrapper::GodotIOJavaWrapper(JNIEnv *p_env, jobject p_godot_io_instanc _open_URI = p_env->GetMethodID(cls, "openURI", "(Ljava/lang/String;)I"); _get_data_dir = p_env->GetMethodID(cls, "getDataDir", "()Ljava/lang/String;"); + _get_external_data_dir = p_env->GetMethodID(cls, "getExternalDataDir", "()Ljava/lang/String;"); _get_locale = p_env->GetMethodID(cls, "getLocale", "()Ljava/lang/String;"); _get_model = p_env->GetMethodID(cls, "getModel", "()Ljava/lang/String;"); _get_screen_DPI = p_env->GetMethodID(cls, "getScreenDPI", "()I"); @@ -92,6 +93,17 @@ String GodotIOJavaWrapper::get_user_data_dir() { } } +String GodotIOJavaWrapper::get_external_data_dir() { + if (_get_external_data_dir) { + JNIEnv *env = get_jni_env(); + ERR_FAIL_COND_V(env == nullptr, String()); + jstring s = (jstring)env->CallObjectMethod(godot_io_instance, _get_external_data_dir); + return jstring_to_string(s, env); + } else { + return String(); + } +} + String GodotIOJavaWrapper::get_locale() { if (_get_locale) { JNIEnv *env = get_jni_env(); diff --git a/platform/android/java_godot_io_wrapper.h b/platform/android/java_godot_io_wrapper.h index 394e97effa..e4c0a4b2c7 100644 --- a/platform/android/java_godot_io_wrapper.h +++ b/platform/android/java_godot_io_wrapper.h @@ -47,6 +47,7 @@ private: jmethodID _open_URI = 0; jmethodID _get_data_dir = 0; + jmethodID _get_external_data_dir = 0; jmethodID _get_locale = 0; jmethodID _get_model = 0; jmethodID _get_screen_DPI = 0; @@ -66,6 +67,7 @@ public: Error open_uri(const String &p_uri); String get_user_data_dir(); + String get_external_data_dir(); String get_locale(); String get_model(); int get_screen_dpi(); diff --git a/platform/android/java_godot_lib_jni.cpp b/platform/android/java_godot_lib_jni.cpp index c7ff6cb2c0..4c66789a83 100644 --- a/platform/android/java_godot_lib_jni.cpp +++ b/platform/android/java_godot_lib_jni.cpp @@ -36,7 +36,6 @@ #include "android/asset_manager_jni.h" #include "api/java_class_wrapper.h" #include "api/jni_singleton.h" -#include "audio_driver_jandroid.h" #include "core/config/engine.h" #include "core/config/project_settings.h" #include "core/input/input.h" @@ -94,7 +93,6 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_initialize(JNIEnv *en FileAccessAndroid::asset_manager = AAssetManager_fromJava(env, amgr); DirAccessJAndroid::setup(godot_io_java->get_instance()); - AudioDriverAndroid::setup(godot_io_java->get_instance()); NetSocketAndroid::setup(godot_java->get_member_object("netUtils", "Lorg/godotengine/godot/utils/GodotNetUtils;", env)); os_android = new OS_Android(godot_java, godot_io_java, p_use_apk_expansion); @@ -326,15 +324,15 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_joyhat(JNIEnv *env, j int hat = 0; if (p_hat_x != 0) { if (p_hat_x < 0) - hat |= Input::HAT_MASK_LEFT; + hat |= HatMask::HAT_MASK_LEFT; else - hat |= Input::HAT_MASK_RIGHT; + hat |= HatMask::HAT_MASK_RIGHT; } if (p_hat_y != 0) { if (p_hat_y < 0) - hat |= Input::HAT_MASK_UP; + hat |= HatMask::HAT_MASK_UP; else - hat |= Input::HAT_MASK_DOWN; + hat |= HatMask::HAT_MASK_DOWN; } jevent.hat = hat; @@ -385,11 +383,6 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_focusout(JNIEnv *env, os_android->main_loop_focusout(); } -JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_audio(JNIEnv *env, jclass clazz) { - setup_android_thread(); - AudioDriverAndroid::thread_func(env); -} - JNIEXPORT jstring JNICALL Java_org_godotengine_godot_GodotLib_getGlobal(JNIEnv *env, jclass clazz, jstring path) { String js = jstring_to_string(path, env); diff --git a/platform/android/java_godot_lib_jni.h b/platform/android/java_godot_lib_jni.h index a3e2933185..63e9e6d8e5 100644 --- a/platform/android/java_godot_lib_jni.h +++ b/platform/android/java_godot_lib_jni.h @@ -56,7 +56,6 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_joybutton(JNIEnv *env JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_joyaxis(JNIEnv *env, jclass clazz, jint p_device, jint p_axis, jfloat p_value); JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_joyhat(JNIEnv *env, jclass clazz, jint p_device, jint p_hat_x, jint p_hat_y); JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_joyconnectionchanged(JNIEnv *env, jclass clazz, jint p_device, jboolean p_connected, jstring p_name); -JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_audio(JNIEnv *env, jclass clazz); JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_accelerometer(JNIEnv *env, jclass clazz, jfloat x, jfloat y, jfloat z); JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_gravity(JNIEnv *env, jclass clazz, jfloat x, jfloat y, jfloat z); JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_magnetometer(JNIEnv *env, jclass clazz, jfloat x, jfloat y, jfloat z); diff --git a/platform/android/os_android.cpp b/platform/android/os_android.cpp index 422814dd50..222976d948 100644 --- a/platform/android/os_android.cpp +++ b/platform/android/os_android.cpp @@ -45,6 +45,23 @@ #include "java_godot_io_wrapper.h" #include "java_godot_wrapper.h" +String _remove_symlink(const String &dir) { + // Workaround for Android 6.0+ using a symlink. + // Save the current directory. + char current_dir_name[2048]; + getcwd(current_dir_name, 2048); + // Change directory to the external data directory. + chdir(dir.utf8().get_data()); + // Get the actual directory without the potential symlink. + char dir_name_wihout_symlink[2048]; + getcwd(dir_name_wihout_symlink, 2048); + // Convert back to a String. + String dir_without_symlink(dir_name_wihout_symlink); + // Restore original current directory. + chdir(current_dir_name); + return dir_without_symlink; +} + class AndroidLogger : public Logger { public: virtual void logv(const char *p_format, va_list p_list, bool p_err) { @@ -199,26 +216,18 @@ String OS_Android::get_user_data_dir() const { String data_dir = godot_io_java->get_user_data_dir(); if (data_dir != "") { - //store current dir - char real_current_dir_name[2048]; - getcwd(real_current_dir_name, 2048); - - //go to data dir - chdir(data_dir.utf8().get_data()); - - //get actual data dir, so we resolve potential symlink (Android 6.0+ seems to use symlink) - char data_current_dir_name[2048]; - getcwd(data_current_dir_name, 2048); - - //cache by parsing utf8 - data_dir_cache.parse_utf8(data_current_dir_name); - - //restore original dir so we don't mess things up - chdir(real_current_dir_name); - + data_dir_cache = _remove_symlink(data_dir); return data_dir_cache; } + return "."; +} +String OS_Android::get_external_data_dir() const { + String data_dir = godot_io_java->get_external_data_dir(); + if (data_dir != "") { + data_dir = _remove_symlink(data_dir); + return data_dir; + } return "."; } diff --git a/platform/android/os_android.h b/platform/android/os_android.h index dd14b69cf9..1e89e9211d 100644 --- a/platform/android/os_android.h +++ b/platform/android/os_android.h @@ -31,7 +31,6 @@ #ifndef OS_ANDROID_H #define OS_ANDROID_H -#include "audio_driver_jandroid.h" #include "audio_driver_opensl.h" #include "core/os/main_loop.h" #include "drivers/unix/os_unix.h" @@ -59,7 +58,6 @@ private: mutable String data_dir_cache; - //AudioDriverAndroid audio_driver_android; AudioDriverOpenSL audio_driver_android; MainLoop *main_loop; @@ -111,6 +109,7 @@ public: virtual Error shell_open(String p_uri) override; virtual String get_user_data_dir() const override; + virtual String get_external_data_dir() const override; virtual String get_resource_dir() const override; virtual String get_locale() const override; virtual String get_model_name() const override; diff --git a/platform/android/plugin/godot_plugin_config.h b/platform/android/plugin/godot_plugin_config.h index 173ac115a2..6b708548ae 100644 --- a/platform/android/plugin/godot_plugin_config.h +++ b/platform/android/plugin/godot_plugin_config.h @@ -37,8 +37,8 @@ /* The `config` section and fields are required and defined as follow: -- **name**: name of the plugin -- **binary_type**: can be either `local` or `remote`. The type affects the **binary** field +- **name**: name of the plugin. +- **binary_type**: can be either `local` or `remote`. The type affects the **binary** field. - **binary**: - if **binary_type** is `local`, then this should be the filename of the plugin `aar` file in the `res://android/plugins` directory (e.g: `MyPlugin.aar`). - if **binary_type** is `remote`, then this should be a declaration for a remote gradle binary (e.g: "org.godot.example:my-plugin:0.0.0"). @@ -102,7 +102,7 @@ struct PluginConfigAndroid { static inline String resolve_local_dependency_path(String plugin_config_dir, String dependency_path) { String absolute_path; if (!dependency_path.is_empty()) { - if (dependency_path.is_abs_path()) { + if (dependency_path.is_absolute_path()) { absolute_path = ProjectSettings::get_singleton()->globalize_path(dependency_path); } else { absolute_path = plugin_config_dir.plus_file(dependency_path); diff --git a/platform/android/plugin/godot_plugin_jni.cpp b/platform/android/plugin/godot_plugin_jni.cpp index ba3e9fa20f..cf0c02e2bf 100644 --- a/platform/android/plugin/godot_plugin_jni.cpp +++ b/platform/android/plugin/godot_plugin_jni.cpp @@ -43,7 +43,7 @@ extern "C" { JNIEXPORT void JNICALL Java_org_godotengine_godot_plugin_GodotPlugin_nativeRegisterSingleton(JNIEnv *env, jclass clazz, jstring name, jobject obj) { String singname = jstring_to_string(name, env); - JNISingleton *s = (JNISingleton *)ClassDB::instance("JNISingleton"); + JNISingleton *s = (JNISingleton *)ClassDB::instantiate("JNISingleton"); s->set_instance(env->NewGlobalRef(obj)); jni_singletons[singname] = s; diff --git a/platform/iphone/display_server_iphone.mm b/platform/iphone/display_server_iphone.mm index 9e74de0842..74d7419715 100644 --- a/platform/iphone/display_server_iphone.mm +++ b/platform/iphone/display_server_iphone.mm @@ -224,7 +224,7 @@ void DisplayServerIPhone::_window_callback(const Callable &p_callable, const Var void DisplayServerIPhone::touch_press(int p_idx, int p_x, int p_y, bool p_pressed, bool p_double_click) { if (!GLOBAL_DEF("debug/disable_touch", false)) { Ref<InputEventScreenTouch> ev; - ev.instance(); + ev.instantiate(); ev->set_index(p_idx); ev->set_pressed(p_pressed); @@ -236,7 +236,7 @@ void DisplayServerIPhone::touch_press(int p_idx, int p_x, int p_y, bool p_presse void DisplayServerIPhone::touch_drag(int p_idx, int p_prev_x, int p_prev_y, int p_x, int p_y) { if (!GLOBAL_DEF("debug/disable_touch", false)) { Ref<InputEventScreenDrag> ev; - ev.instance(); + ev.instantiate(); ev->set_index(p_idx); ev->set_position(Vector2(p_x, p_y)); ev->set_relative(Vector2(p_x - p_prev_x, p_y - p_prev_y)); @@ -256,7 +256,7 @@ void DisplayServerIPhone::touches_cancelled(int p_idx) { void DisplayServerIPhone::key(uint32_t p_key, bool p_pressed) { Ref<InputEventKey> ev; - ev.instance(); + ev.instantiate(); ev->set_echo(false); ev->set_pressed(p_pressed); ev->set_keycode(p_key); diff --git a/platform/iphone/export/export.cpp b/platform/iphone/export/export.cpp index 9a19c883b8..1d1961ac2f 100644 --- a/platform/iphone/export/export.cpp +++ b/platform/iphone/export/export.cpp @@ -31,11 +31,11 @@ #include "export.h" #include "core/config/project_settings.h" +#include "core/io/file_access.h" #include "core/io/image_loader.h" #include "core/io/marshalls.h" #include "core/io/resource_saver.h" #include "core/io/zip_io.h" -#include "core/os/file_access.h" #include "core/os/os.h" #include "core/templates/safe_refcount.h" #include "core/version.h" @@ -840,7 +840,7 @@ Error EditorExportPlatformIOS::_export_loading_screen_file(const Ref<EditorExpor if (custom_launch_image_2x.length() > 0 && custom_launch_image_3x.length() > 0) { Ref<Image> image; String image_path = p_dest_dir.plus_file("splash@2x.png"); - image.instance(); + image.instantiate(); Error err = image->load(custom_launch_image_2x); if (err) { @@ -854,7 +854,7 @@ Error EditorExportPlatformIOS::_export_loading_screen_file(const Ref<EditorExpor image.unref(); image_path = p_dest_dir.plus_file("splash@3x.png"); - image.instance(); + image.instantiate(); err = image->load(custom_launch_image_3x); if (err) { @@ -871,7 +871,7 @@ Error EditorExportPlatformIOS::_export_loading_screen_file(const Ref<EditorExpor const String splash_path = ProjectSettings::get_singleton()->get("application/boot_splash/image"); if (!splash_path.is_empty()) { - splash.instance(); + splash.instantiate(); const Error err = splash->load(splash_path); if (err) { splash.unref(); @@ -2034,7 +2034,7 @@ bool EditorExportPlatformIOS::can_export(const Ref<EditorExportPreset> &p_preset EditorExportPlatformIOS::EditorExportPlatformIOS() { Ref<Image> img = memnew(Image(_iphone_logo)); - logo.instance(); + logo.instantiate(); logo->create_from_image(img); plugins_changed.set(); @@ -2049,7 +2049,7 @@ EditorExportPlatformIOS::~EditorExportPlatformIOS() { void register_iphone_exporter() { Ref<EditorExportPlatformIOS> platform; - platform.instance(); + platform.instantiate(); EditorExport::get_singleton()->add_export_platform(platform); } diff --git a/platform/iphone/os_iphone.mm b/platform/iphone/os_iphone.mm index 458834ce3a..1f08901082 100644 --- a/platform/iphone/os_iphone.mm +++ b/platform/iphone/os_iphone.mm @@ -33,9 +33,9 @@ #include "os_iphone.h" #import "app_delegate.h" #include "core/config/project_settings.h" +#include "core/io/dir_access.h" +#include "core/io/file_access.h" #include "core/io/file_access_pack.h" -#include "core/os/dir_access.h" -#include "core/os/file_access.h" #include "display_server_iphone.h" #include "drivers/unix/syslog_logger.h" #import "godot_view.h" diff --git a/platform/iphone/plugin/godot_plugin_config.h b/platform/iphone/plugin/godot_plugin_config.h index f8427e5a33..06770260aa 100644 --- a/platform/iphone/plugin/godot_plugin_config.h +++ b/platform/iphone/plugin/godot_plugin_config.h @@ -120,7 +120,7 @@ static inline String resolve_local_dependency_path(String plugin_config_dir, Str return absolute_path; } - if (dependency_path.is_abs_path()) { + if (dependency_path.is_absolute_path()) { return dependency_path; } @@ -137,7 +137,7 @@ static inline String resolve_system_dependency_path(String dependency_path) { return absolute_path; } - if (dependency_path.is_abs_path()) { + if (dependency_path.is_absolute_path()) { return dependency_path; } diff --git a/platform/javascript/api/javascript_singleton.h b/platform/javascript/api/javascript_singleton.h index 1615efa87e..9d7a392278 100644 --- a/platform/javascript/api/javascript_singleton.h +++ b/platform/javascript/api/javascript_singleton.h @@ -32,11 +32,11 @@ #define JAVASCRIPT_SINGLETON_H #include "core/object/class_db.h" -#include "core/object/reference.h" +#include "core/object/ref_counted.h" -class JavaScriptObject : public Reference { +class JavaScriptObject : public RefCounted { private: - GDCLASS(JavaScriptObject, Reference); + GDCLASS(JavaScriptObject, RefCounted); protected: virtual bool _set(const StringName &p_name, const Variant &p_value) { return false; } diff --git a/platform/javascript/api/javascript_tools_editor_plugin.cpp b/platform/javascript/api/javascript_tools_editor_plugin.cpp index b35ccd087f..54f541f607 100644 --- a/platform/javascript/api/javascript_tools_editor_plugin.cpp +++ b/platform/javascript/api/javascript_tools_editor_plugin.cpp @@ -33,15 +33,15 @@ #include "core/config/engine.h" #include "core/config/project_settings.h" -#include "core/os/dir_access.h" -#include "core/os/file_access.h" +#include "core/io/dir_access.h" +#include "core/io/file_access.h" #include "editor/editor_node.h" #include <emscripten/emscripten.h> // JavaScript functions defined in library_godot_editor_tools.js 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() { diff --git a/platform/javascript/detect.py b/platform/javascript/detect.py index d01e8a8bd4..da6adc4cd8 100644 --- a/platform/javascript/detect.py +++ b/platform/javascript/detect.py @@ -53,6 +53,7 @@ def get_flags(): # in this platform. For the available networking methods, the browser # manages TLS. ("module_mbedtls_enabled", False), + ("vulkan", False), ] diff --git a/platform/javascript/display_server_javascript.cpp b/platform/javascript/display_server_javascript.cpp index dae0b5f7e7..f1b92264e2 100644 --- a/platform/javascript/display_server_javascript.cpp +++ b/platform/javascript/display_server_javascript.cpp @@ -30,8 +30,8 @@ #include "platform/javascript/display_server_javascript.h" -#include "drivers/dummy/rasterizer_dummy.h" #include "platform/javascript/os_javascript.h" +#include "servers/rendering/rasterizer_dummy.h" #include <emscripten.h> #include <png.h> @@ -128,7 +128,7 @@ void DisplayServerJavaScript::dom2godot_mod(T *emscripten_event_ptr, Ref<InputEv Ref<InputEventKey> DisplayServerJavaScript::setup_key_event(const EmscriptenKeyboardEvent *emscripten_event) { Ref<InputEventKey> ev; - ev.instance(); + ev.instantiate(); ev->set_echo(emscripten_event->repeat); dom2godot_mod(emscripten_event, ev); ev->set_keycode(dom_code2godot_scancode(emscripten_event->code, emscripten_event->key, false)); @@ -181,7 +181,7 @@ EM_BOOL DisplayServerJavaScript::mouse_button_callback(int p_event_type, const E DisplayServerJavaScript *display = get_singleton(); Ref<InputEventMouseButton> ev; - ev.instance(); + ev.instantiate(); ev->set_pressed(p_event_type == EMSCRIPTEN_EVENT_MOUSEDOWN); ev->set_position(compute_position_in_canvas(p_event->clientX, p_event->clientY)); ev->set_global_position(ev->get_position()); @@ -229,8 +229,8 @@ EM_BOOL DisplayServerJavaScript::mouse_button_callback(int p_event_type, const E } Input *input = Input::get_singleton(); - int mask = input->get_mouse_button_mask(); - int button_flag = 1 << (ev->get_button_index() - 1); + MouseButton 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, // if exists, may not have focus yet, so focus even if already focused. @@ -261,7 +261,7 @@ EM_BOOL DisplayServerJavaScript::mousemove_callback(int p_event_type, const Emsc return false; Ref<InputEventMouseMotion> ev; - ev.instance(); + ev.instantiate(); dom2godot_mod(p_event, ev); ev->set_button_mask(input_mask); @@ -407,9 +407,10 @@ void DisplayServerJavaScript::cursor_set_custom_image(const RES &p_cursor, Curso // Mouse mode void DisplayServerJavaScript::mouse_set_mode(MouseMode p_mode) { - ERR_FAIL_COND_MSG(p_mode == MOUSE_MODE_CONFINED, "MOUSE_MODE_CONFINED is not supported for the HTML5 platform."); - if (p_mode == mouse_get_mode()) + ERR_FAIL_COND_MSG(p_mode == MOUSE_MODE_CONFINED || p_mode == MOUSE_MODE_CONFINED_HIDDEN, "MOUSE_MODE_CONFINED is not supported for the HTML5 platform."); + if (p_mode == mouse_get_mode()) { return; + } if (p_mode == MOUSE_MODE_VISIBLE) { godot_js_display_cursor_set_visible(1); @@ -451,7 +452,7 @@ EM_BOOL DisplayServerJavaScript::wheel_callback(int p_event_type, const Emscript Input *input = Input::get_singleton(); Ref<InputEventMouseButton> ev; - ev.instance(); + ev.instantiate(); ev->set_position(input->get_mouse_position()); ev->set_global_position(ev->get_position()); @@ -477,11 +478,11 @@ EM_BOOL DisplayServerJavaScript::wheel_callback(int p_event_type, const Emscript int button_flag = 1 << (ev->get_button_index() - 1); ev->set_pressed(true); - ev->set_button_mask(input->get_mouse_button_mask() | button_flag); + ev->set_button_mask(MouseButton(input->get_mouse_button_mask() | button_flag)); input->parse_input_event(ev); ev->set_pressed(false); - ev->set_button_mask(input->get_mouse_button_mask() & ~button_flag); + ev->set_button_mask(MouseButton(input->get_mouse_button_mask() & ~button_flag)); input->parse_input_event(ev); return true; @@ -491,7 +492,7 @@ EM_BOOL DisplayServerJavaScript::wheel_callback(int p_event_type, const Emscript EM_BOOL DisplayServerJavaScript::touch_press_callback(int p_event_type, const EmscriptenTouchEvent *p_event, void *p_user_data) { DisplayServerJavaScript *display = get_singleton(); Ref<InputEventScreenTouch> ev; - ev.instance(); + ev.instantiate(); int lowest_id_index = -1; for (int i = 0; i < p_event->numTouches; ++i) { const EmscriptenTouchPoint &touch = p_event->touches[i]; @@ -513,7 +514,7 @@ EM_BOOL DisplayServerJavaScript::touch_press_callback(int p_event_type, const Em EM_BOOL DisplayServerJavaScript::touchmove_callback(int p_event_type, const EmscriptenTouchEvent *p_event, void *p_user_data) { DisplayServerJavaScript *display = get_singleton(); Ref<InputEventScreenDrag> ev; - ev.instance(); + ev.instantiate(); int lowest_id_index = -1; for (int i = 0; i < p_event->numTouches; ++i) { const EmscriptenTouchPoint &touch = p_event->touches[i]; @@ -552,12 +553,12 @@ void DisplayServerJavaScript::vk_input_text_callback(const char *p_text, int p_c Input *input = Input::get_singleton(); Ref<InputEventKey> k; for (int i = 0; i < p_cursor; i++) { - k.instance(); + k.instantiate(); k->set_pressed(true); k->set_echo(false); k->set_keycode(KEY_RIGHT); input->parse_input_event(k); - k.instance(); + k.instantiate(); k->set_pressed(false); k->set_echo(false); k->set_keycode(KEY_RIGHT); diff --git a/platform/javascript/export/export.cpp b/platform/javascript/export/export.cpp index 8ce294f31b..58cecfef63 100644 --- a/platform/javascript/export/export.cpp +++ b/platform/javascript/export/export.cpp @@ -29,7 +29,6 @@ /*************************************************************************/ #include "core/io/image_loader.h" -#include "core/io/json.h" #include "core/io/stream_peer_ssl.h" #include "core/io/tcp_server.h" #include "core/io/zip_io.h" @@ -39,7 +38,7 @@ #include "platform/javascript/logo.gen.h" #include "platform/javascript/run_icon.gen.h" -class EditorHTTPServer : public Reference { +class EditorHTTPServer : public RefCounted { private: Ref<TCPServer> server; Map<String, String> mimes; @@ -91,7 +90,7 @@ public: mimes["png"] = "image/png"; mimes["svg"] = "image/svg"; mimes["wasm"] = "application/wasm"; - server.instance(); + server.instantiate(); stop(); } @@ -290,7 +289,7 @@ class EditorExportPlatformJavaScript : public EditorExportPlatform { Ref<Image> _get_project_icon() const { Ref<Image> icon; - icon.instance(); + icon.instantiate(); const String icon_path = String(GLOBAL_GET("application/config/icon")).strip_edges(); if (icon_path.is_empty() || ImageLoader::load_image(icon_path, icon) != OK) { return EditorNode::get_singleton()->get_editor_theme()->get_icon("DefaultProjectIcon", "EditorIcons")->get_image(); @@ -300,7 +299,7 @@ class EditorExportPlatformJavaScript : public EditorExportPlatform { Ref<Image> _get_project_splash() const { Ref<Image> splash; - splash.instance(); + splash.instantiate(); const String splash_path = String(GLOBAL_GET("application/boot_splash/image")).strip_edges(); if (splash_path.is_empty() || ImageLoader::load_image(splash_path, splash) != OK) { return Ref<Image>(memnew(Image(boot_splash_png))); @@ -465,7 +464,7 @@ void EditorExportPlatformJavaScript::_fix_html(Vector<uint8_t> &p_html, const Re } // Replaces HTML string - const String str_config = JSON::print(config); + const String str_config = Variant(config).to_json_string(); const String custom_head_include = p_preset->get("html/head_include"); Map<String, String> replaces; replaces["$GODOT_URL"] = p_name + ".js"; @@ -482,7 +481,7 @@ Error EditorExportPlatformJavaScript::_add_manifest_icon(const String &p_path, c Ref<Image> icon; if (!p_icon.is_empty()) { - icon.instance(); + icon.instantiate(); const Error err = ImageLoader::load_image(p_icon, icon); if (err != OK) { EditorNode::get_singleton()->show_warning(TTR("Could not read file:") + "\n" + p_icon); @@ -518,7 +517,7 @@ Error EditorExportPlatformJavaScript::_build_pwa(const Ref<EditorExportPreset> & replaces["@GODOT_NAME@"] = name; replaces["@GODOT_OFFLINE_PAGE@"] = name + ".offline.html"; Array files; - replaces["@GODOT_OPT_CACHE@"] = JSON::print(files); + replaces["@GODOT_OPT_CACHE@"] = Variant(files).to_json_string(); files.push_back(name + ".html"); files.push_back(name + ".js"); files.push_back(name + ".wasm"); @@ -537,7 +536,7 @@ Error EditorExportPlatformJavaScript::_build_pwa(const Ref<EditorExportPreset> & files.push_back(p_shared_objects[i].path.get_file()); } } - replaces["@GODOT_CACHE@"] = JSON::print(files); + replaces["@GODOT_CACHE@"] = Variant(files).to_json_string(); const String sw_path = dir.plus_file(name + ".service.worker.js"); Vector<uint8_t> sw; @@ -605,7 +604,7 @@ Error EditorExportPlatformJavaScript::_build_pwa(const Ref<EditorExportPreset> & } manifest["icons"] = icons_arr; - CharString cs = JSON::print(manifest).utf8(); + CharString cs = Variant(manifest).to_json_string().utf8(); err = _write_or_error((const uint8_t *)cs.get_data(), cs.length(), dir.plus_file(name + ".manifest.json")); if (err != OK) { return err; @@ -965,22 +964,22 @@ void EditorExportPlatformJavaScript::_server_thread_poll(void *data) { } EditorExportPlatformJavaScript::EditorExportPlatformJavaScript() { - server.instance(); + server.instantiate(); server_thread.start(_server_thread_poll, this); Ref<Image> img = memnew(Image(_javascript_logo)); - logo.instance(); + logo.instantiate(); logo->create_from_image(img); img = Ref<Image>(memnew(Image(_javascript_run_icon))); - run_icon.instance(); + run_icon.instantiate(); run_icon->create_from_image(img); Ref<Theme> theme = EditorNode::get_singleton()->get_editor_theme(); if (theme.is_valid()) { stop_icon = theme->get_icon("Stop", "EditorIcons"); } else { - stop_icon.instance(); + stop_icon.instantiate(); } } @@ -1001,6 +1000,6 @@ void register_javascript_exporter() { EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::STRING, "export/web/ssl_certificate", PROPERTY_HINT_GLOBAL_FILE, "*.crt,*.pem")); Ref<EditorExportPlatformJavaScript> platform; - platform.instance(); + platform.instantiate(); EditorExport::get_singleton()->add_export_platform(platform); } diff --git a/platform/javascript/godot_js.h b/platform/javascript/godot_js.h index 8927a83cb3..d332af2c31 100644 --- a/platform/javascript/godot_js.h +++ b/platform/javascript/godot_js.h @@ -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); // 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_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); diff --git a/platform/javascript/javascript_singleton.cpp b/platform/javascript/javascript_singleton.cpp index 5ef67c0cdd..9de2edc9a7 100644 --- a/platform/javascript/javascript_singleton.cpp +++ b/platform/javascript/javascript_singleton.cpp @@ -28,12 +28,16 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifdef JAVASCRIPT_EVAL_ENABLED - #include "api/javascript_singleton.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" { typedef union { int64_t i; double r; @@ -50,6 +54,7 @@ extern int godot_js_wrapper_object_setvar(int p_id, int p_key_type, godot_js_wra extern void godot_js_wrapper_object_set(int p_id, const char *p_name, int p_type, godot_js_wrapper_ex *p_val); extern void godot_js_wrapper_object_unref(int p_id); extern int godot_js_wrapper_create_cb(void *p_ref, void (*p_callback)(void *p_ref, int p_arg_id, int p_argc)); +extern void godot_js_wrapper_object_set_cb_ret(int p_type, godot_js_wrapper_ex *p_val); extern int godot_js_wrapper_create_object(const char *p_method, void **p_args, int p_argc, GodotJSWrapperVariant2JSCallback p_variant2js_callback, godot_js_wrapper_ex *p_cb_rval, void **p_lock, GodotJSWrapperFreeLockCallback p_lock_callback); }; @@ -253,6 +258,16 @@ void JavaScriptObjectImpl::_callback(void *p_ref, int p_args_id, int p_argc) { Callable::CallError err; Variant ret; obj->_callable.call(argv, 1, ret, err); + + // Set return value + godot_js_wrapper_ex exchange; + void *lock = nullptr; + const Variant *v = &ret; + int type = _variant2js((const void **)&v, 0, &exchange, &lock); + godot_js_wrapper_object_set_cb_ret(type, &exchange); + if (lock) { + _free_lock(&lock, type); + } } Ref<JavaScriptObject> JavaScript::create_callback(const Callable &p_callable) { @@ -301,7 +316,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_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) { diff --git a/platform/javascript/js/libs/library_godot_display.js b/platform/javascript/js/libs/library_godot_display.js index 91cab5eacc..affae90370 100644 --- a/platform/javascript/js/libs/library_godot_display.js +++ b/platform/javascript/js/libs/library_godot_display.js @@ -683,7 +683,7 @@ const GodotDisplay = { 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) { GodotDisplayScreen.desired_size = [width, height]; GodotDisplayScreen.updateSize(); diff --git a/platform/javascript/js/libs/library_godot_fetch.js b/platform/javascript/js/libs/library_godot_fetch.js index de5ae2b1ae..615f9de8b0 100644 --- a/platform/javascript/js/libs/library_godot_fetch.js +++ b/platform/javascript/js/libs/library_godot_fetch.js @@ -29,7 +29,7 @@ /*************************************************************************/ const GodotFetch = { - $GodotFetch__deps: ['$GodotRuntime'], + $GodotFetch__deps: ['$IDHandler', '$GodotRuntime'], $GodotFetch: { onread: function (id, result) { @@ -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) { const method = GodotRuntime.parseString(p_method); const url = GodotRuntime.parseString(p_url); @@ -176,7 +176,7 @@ const GodotFetch = { 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) { const obj = IDHandler.get(p_id); if (!obj || !obj.response) { @@ -193,7 +193,7 @@ const GodotFetch = { 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) { const obj = IDHandler.get(p_id); if (!obj || !obj.response) { diff --git a/platform/javascript/js/libs/library_godot_javascript_singleton.js b/platform/javascript/js/libs/library_godot_javascript_singleton.js index 09ef4a1a5d..22ce003cd2 100644 --- a/platform/javascript/js/libs/library_godot_javascript_singleton.js +++ b/platform/javascript/js/libs/library_godot_javascript_singleton.js @@ -34,6 +34,7 @@ const GodotJSWrapper = { $GodotJSWrapper__postset: 'GodotJSWrapper.proxies = new Map();', $GodotJSWrapper: { proxies: null, + cb_ret: null, MyProxy: function (val) { const id = IDHandler.add(this); @@ -196,21 +197,33 @@ 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) { const func = GodotRuntime.get_func(p_func); let id = 0; const cb = function () { if (!GodotJSWrapper.get_proxied_value(id)) { - return; + return undefined; } + // The callback will store the returned value in this variable via + // "godot_js_wrapper_object_set_cb_ret" upon calling the user function. + // This is safe! JavaScript is single threaded (and using it in threads is not a good idea anyway). + GodotJSWrapper.cb_ret = null; const args = Array.from(arguments); func(p_ref, GodotJSWrapper.get_proxied(args), args.length); + const ret = GodotJSWrapper.cb_ret; + GodotJSWrapper.cb_ret = null; + return ret; }; id = GodotJSWrapper.get_proxied(cb); return id; }, + 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__sig: 'iiii', godot_js_wrapper_object_getvar: function (p_id, p_type, p_exchange) { const obj = GodotJSWrapper.get_proxied_value(p_id); diff --git a/platform/javascript/package-lock.json b/platform/javascript/package-lock.json index 8bf5c52ff6..8003619576 100644 --- a/platform/javascript/package-lock.json +++ b/platform/javascript/package-lock.json @@ -5,27 +5,27 @@ "requires": true, "dependencies": { "@babel/code-frame": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.10.4.tgz", - "integrity": "sha512-vG6SvB6oYEhvgisZNFRmRCUkLz11c7rp+tbNTynGqc6mS1d5ATd/sGyV6W0KZZnXRKMTzZDRgQT3Ou9jhpAfUg==", + "version": "7.12.11", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.12.11.tgz", + "integrity": "sha512-Zt1yodBx1UcyiePMSkWnU4hPqhwq7hGi2nFL1LeA3EUl+q2LQx16MISgJ0+z7dnmgvP9QtIleuETGOiOH1RcIw==", "dev": true, "requires": { "@babel/highlight": "^7.10.4" } }, "@babel/helper-validator-identifier": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.10.4.tgz", - "integrity": "sha512-3U9y+43hz7ZM+rzG24Qe2mufW5KhvFg/NhnNph+i9mgCtdTCtMJuI1TMkrIUiK7Ix4PYlRF9I5dhqaLYA/ADXw==", + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.14.5.tgz", + "integrity": "sha512-5lsetuxCLilmVGyiLEfoHBRX8UCFD+1m2x3Rj97WrW3V7H3u4RWRXA4evMjImCsin2J2YT0QaVDGf+z8ondbAg==", "dev": true }, "@babel/highlight": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.10.4.tgz", - "integrity": "sha512-i6rgnR/YgPEQzZZnbTHHuZdlE8qyoBNalD6F+q4vAFlcMEcqmkoG+mPqJYJCo63qPf74+Y1UZsl3l6f7/RIkmA==", + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.14.5.tgz", + "integrity": "sha512-qf9u2WFWVV0MppaL877j2dBtQIDgmidgjGk5VIMw3OadXvYaXn66U1BFlH2t4+t3i+8PhedppRv+i40ABzd+gg==", "dev": true, "requires": { - "@babel/helper-validator-identifier": "^7.10.4", + "@babel/helper-validator-identifier": "^7.14.5", "chalk": "^2.0.0", "js-tokens": "^4.0.0" }, @@ -40,39 +40,38 @@ "escape-string-regexp": "^1.0.5", "supports-color": "^5.3.0" } + }, + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", + "dev": true } } }, "@babel/parser": { - "version": "7.14.1", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.14.1.tgz", - "integrity": "sha512-muUGEKu8E/ftMTPlNp+mc6zL3E9zKWmF5sDHZ5MSsoTP9Wyz64AhEf9kD08xYJ7w6Hdcu8H550ircnPyWSIF0Q==", + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.14.5.tgz", + "integrity": "sha512-TM8C+xtH/9n1qzX+JNHi7AN2zHMTiPUtspO0ZdHflW8KaskkALhMmuMHb4bCmNdv9VAPzJX3/bXqkVLnAvsPfg==", "dev": true }, "@eslint/eslintrc": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-0.1.3.tgz", - "integrity": "sha512-4YVwPkANLeNtRjMekzux1ci8hIaH5eGKktGqR0d3LWsKNn5B2X/1Z6Trxy7jQXl9EBGE6Yj02O+t09FMeRllaA==", + "version": "0.4.2", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-0.4.2.tgz", + "integrity": "sha512-8nmGq/4ycLpIwzvhI4tNDmQztZ8sp+hI7cyG8i1nQDhkAbRzHpXPidRAHlNvCZQpJTKw5ItIpMw9RSToGF00mg==", "dev": true, "requires": { "ajv": "^6.12.4", "debug": "^4.1.1", "espree": "^7.3.0", - "globals": "^12.1.0", + "globals": "^13.9.0", "ignore": "^4.0.6", "import-fresh": "^3.2.1", "js-yaml": "^3.13.1", - "lodash": "^4.17.19", "minimatch": "^3.0.4", "strip-json-comments": "^3.1.1" } }, - "@types/color-name": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/@types/color-name/-/color-name-1.1.1.tgz", - "integrity": "sha512-rr+OQyAjxze7GgWrSaJwydHStIhHq2lvY3BOC2Mj7KnzI7XK0Uw1TOOdI9lDoajEbSWLiYgoo4f1R51erQfhPQ==", - "dev": true - }, "@types/json5": { "version": "0.0.29", "resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz", @@ -80,9 +79,9 @@ "dev": true }, "acorn": { - "version": "7.4.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.0.tgz", - "integrity": "sha512-+G7P8jJmCHr+S+cLfQxygbWhXy+8YTVGzAkpEbcLo2mLoL7tij/VG41QSHACSf5QgYRhMZYHuNc6drJaO0Da+w==", + "version": "7.4.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz", + "integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==", "dev": true }, "acorn-jsx": { @@ -92,9 +91,9 @@ "dev": true }, "ajv": { - "version": "6.12.5", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.5.tgz", - "integrity": "sha512-lRF8RORchjpKG50/WFf8xmg7sgCLFiYNNnqdKflk63whMQcWR5ngGjiSXkL9bjxy6B2npOK2HSMN49jEBMSkag==", + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", "dev": true, "requires": { "fast-deep-equal": "^3.1.1", @@ -134,78 +133,39 @@ } }, "array-includes": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.1.1.tgz", - "integrity": "sha512-c2VXaCHl7zPsvpkFsw4nxvFie4fh1ur9bpcgsVkIjqn0H/Xwdg+7fv3n2r/isyS8EBj5b06M9kHyZuIr4El6WQ==", + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.1.3.tgz", + "integrity": "sha512-gcem1KlBU7c9rB+Rq8/3PPKsK2kjqeEBa3bD5kkQo4nYlOHQCJqIJFqBXDEfwaRuYTT4E+FxA9xez7Gf/e3Q7A==", "dev": true, "requires": { + "call-bind": "^1.0.2", "define-properties": "^1.1.3", - "es-abstract": "^1.17.0", + "es-abstract": "^1.18.0-next.2", + "get-intrinsic": "^1.1.1", "is-string": "^1.0.5" - }, - "dependencies": { - "es-abstract": { - "version": "1.17.6", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.17.6.tgz", - "integrity": "sha512-Fr89bON3WFyUi5EvAeI48QTWX0AyekGgLA8H+c+7fbfCkJwRWRMLd8CQedNEyJuoYYhmtEqY92pgte1FAhBlhw==", - "dev": true, - "requires": { - "es-to-primitive": "^1.2.1", - "function-bind": "^1.1.1", - "has": "^1.0.3", - "has-symbols": "^1.0.1", - "is-callable": "^1.2.0", - "is-regex": "^1.1.0", - "object-inspect": "^1.7.0", - "object-keys": "^1.1.1", - "object.assign": "^4.1.0", - "string.prototype.trimend": "^1.0.1", - "string.prototype.trimstart": "^1.0.1" - } - } } }, "array.prototype.flat": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/array.prototype.flat/-/array.prototype.flat-1.2.3.tgz", - "integrity": "sha512-gBlRZV0VSmfPIeWfuuy56XZMvbVfbEUnOXUvt3F/eUUUSyzlgLxhEX4YAEpxNAogRGehPSnfXyPtYyKAhkzQhQ==", + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/array.prototype.flat/-/array.prototype.flat-1.2.4.tgz", + "integrity": "sha512-4470Xi3GAPAjZqFcljX2xzckv1qeKPizoNkiS0+O4IoPR2ZNpcjE0pkhdihlDouK+x6QOast26B4Q/O9DJnwSg==", "dev": true, "requires": { + "call-bind": "^1.0.0", "define-properties": "^1.1.3", - "es-abstract": "^1.17.0-next.1" - }, - "dependencies": { - "es-abstract": { - "version": "1.17.6", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.17.6.tgz", - "integrity": "sha512-Fr89bON3WFyUi5EvAeI48QTWX0AyekGgLA8H+c+7fbfCkJwRWRMLd8CQedNEyJuoYYhmtEqY92pgte1FAhBlhw==", - "dev": true, - "requires": { - "es-to-primitive": "^1.2.1", - "function-bind": "^1.1.1", - "has": "^1.0.3", - "has-symbols": "^1.0.1", - "is-callable": "^1.2.0", - "is-regex": "^1.1.0", - "object-inspect": "^1.7.0", - "object-keys": "^1.1.1", - "object.assign": "^4.1.0", - "string.prototype.trimend": "^1.0.1", - "string.prototype.trimstart": "^1.0.1" - } - } + "es-abstract": "^1.18.0-next.1" } }, "astral-regex": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-1.0.0.tgz", - "integrity": "sha512-+Ryf6g3BKoRc7jfp7ad8tM4TtMiaWvbF/1/sQcZPkkS7ag3D5nMBCe2UfOTONtAkaG0tO0ij3C5Lwmf1EiyjHg==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-2.0.0.tgz", + "integrity": "sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ==", "dev": true }, "balanced-match": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", - "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", "dev": true }, "bluebird": { @@ -224,6 +184,16 @@ "concat-map": "0.0.1" } }, + "call-bind": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", + "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", + "dev": true, + "requires": { + "function-bind": "^1.1.1", + "get-intrinsic": "^1.0.2" + } + }, "callsites": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", @@ -231,18 +201,18 @@ "dev": true }, "catharsis": { - "version": "0.8.11", - "resolved": "https://registry.npmjs.org/catharsis/-/catharsis-0.8.11.tgz", - "integrity": "sha512-a+xUyMV7hD1BrDQA/3iPV7oc+6W26BgVJO05PGEoatMyIuPScQKsde6i3YorWX1qs+AZjnJ18NqdKoCtKiNh1g==", + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/catharsis/-/catharsis-0.9.0.tgz", + "integrity": "sha512-prMTQVpcns/tzFgFVkVp6ak6RykZyWb3gu8ckUpd6YkTlacOd3DXGJjIpD4Q6zJirizvaiAjSSHlOsA+6sNh2A==", "dev": true, "requires": { - "lodash": "^4.17.14" + "lodash": "^4.17.15" } }, "chalk": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.0.tgz", - "integrity": "sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A==", + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.1.tgz", + "integrity": "sha512-diHzdDKxcU+bAsUboHLPEDQiw0qEe0qd7SYUn3HgcFlWgbDcfLGswOHYeGrHKzG9z6UYf01d9VFMfZxPM1xZSg==", "dev": true, "requires": { "ansi-styles": "^4.1.0", @@ -250,12 +220,11 @@ }, "dependencies": { "ansi-styles": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", - "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", "dev": true, "requires": { - "@types/color-name": "^1.1.1", "color-convert": "^2.0.1" } }, @@ -313,15 +282,9 @@ "dev": true }, "confusing-browser-globals": { - "version": "1.0.9", - "resolved": "https://registry.npmjs.org/confusing-browser-globals/-/confusing-browser-globals-1.0.9.tgz", - "integrity": "sha512-KbS1Y0jMtyPgIxjO7ZzMAuUpAKMt1SzCL9fsrKsX6b0zJPTaT0SiSPmewwVZg9UAO83HVIlEhZF84LIjZ0lmAw==", - "dev": true - }, - "contains-path": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/contains-path/-/contains-path-0.1.0.tgz", - "integrity": "sha1-/ozxhP9mcLa67wGp1IYaXL7EEgo=", + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/confusing-browser-globals/-/confusing-browser-globals-1.0.10.tgz", + "integrity": "sha512-gNld/3lySHwuhaVluJUKLePYirM3QNCKzVxqAdhJII9/WXKVX5PURzMVJspS1jTslSqjeuG4KMVTSouit5YPHA==", "dev": true }, "cross-spawn": { @@ -336,12 +299,12 @@ } }, "debug": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", - "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", + "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", "dev": true, "requires": { - "ms": "^2.1.1" + "ms": "2.1.2" } }, "deep-is": { @@ -369,9 +332,9 @@ } }, "emoji-regex": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", - "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==", + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", "dev": true }, "enquirer": { @@ -399,23 +362,27 @@ } }, "es-abstract": { - "version": "1.18.0-next.0", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.18.0-next.0.tgz", - "integrity": "sha512-elZXTZXKn51hUBdJjSZGYRujuzilgXo8vSPQzjGYXLvSlGiCo8VO8ZGV3kjo9a0WNJJ57hENagwbtlRuHuzkcQ==", + "version": "1.18.3", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.18.3.tgz", + "integrity": "sha512-nQIr12dxV7SSxE6r6f1l3DtAeEYdsGpps13dR0TwJg1S8gyp4ZPgy3FZcHBgbiQqnoqSTb+oC+kO4UQ0C/J8vw==", "dev": true, "requires": { + "call-bind": "^1.0.2", "es-to-primitive": "^1.2.1", "function-bind": "^1.1.1", + "get-intrinsic": "^1.1.1", "has": "^1.0.3", - "has-symbols": "^1.0.1", - "is-callable": "^1.2.0", - "is-negative-zero": "^2.0.0", - "is-regex": "^1.1.1", - "object-inspect": "^1.8.0", + "has-symbols": "^1.0.2", + "is-callable": "^1.2.3", + "is-negative-zero": "^2.0.1", + "is-regex": "^1.1.3", + "is-string": "^1.0.6", + "object-inspect": "^1.10.3", "object-keys": "^1.1.1", - "object.assign": "^4.1.0", - "string.prototype.trimend": "^1.0.1", - "string.prototype.trimstart": "^1.0.1" + "object.assign": "^4.1.2", + "string.prototype.trimend": "^1.0.4", + "string.prototype.trimstart": "^1.0.4", + "unbox-primitive": "^1.0.1" } }, "es-to-primitive": { @@ -430,35 +397,37 @@ } }, "escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", "dev": true }, "eslint": { - "version": "7.9.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.9.0.tgz", - "integrity": "sha512-V6QyhX21+uXp4T+3nrNfI3hQNBDa/P8ga7LoQOenwrlEFXrEnUEE+ok1dMtaS3b6rmLXhT1TkTIsG75HMLbknA==", + "version": "7.28.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.28.0.tgz", + "integrity": "sha512-UMfH0VSjP0G4p3EWirscJEQ/cHqnT/iuH6oNZOB94nBjWbMnhGEPxsZm1eyIW0C/9jLI0Fow4W5DXLjEI7mn1g==", "dev": true, "requires": { - "@babel/code-frame": "^7.0.0", - "@eslint/eslintrc": "^0.1.3", + "@babel/code-frame": "7.12.11", + "@eslint/eslintrc": "^0.4.2", "ajv": "^6.10.0", "chalk": "^4.0.0", "cross-spawn": "^7.0.2", "debug": "^4.0.1", "doctrine": "^3.0.0", "enquirer": "^2.3.5", - "eslint-scope": "^5.1.0", + "escape-string-regexp": "^4.0.0", + "eslint-scope": "^5.1.1", "eslint-utils": "^2.1.0", - "eslint-visitor-keys": "^1.3.0", - "espree": "^7.3.0", - "esquery": "^1.2.0", + "eslint-visitor-keys": "^2.0.0", + "espree": "^7.3.1", + "esquery": "^1.4.0", "esutils": "^2.0.2", - "file-entry-cache": "^5.0.1", + "fast-deep-equal": "^3.1.3", + "file-entry-cache": "^6.0.1", "functional-red-black-tree": "^1.0.1", - "glob-parent": "^5.0.0", - "globals": "^12.1.0", + "glob-parent": "^5.1.2", + "globals": "^13.6.0", "ignore": "^4.0.6", "import-fresh": "^3.0.0", "imurmurhash": "^0.1.4", @@ -466,7 +435,7 @@ "js-yaml": "^3.13.1", "json-stable-stringify-without-jsonify": "^1.0.1", "levn": "^0.4.1", - "lodash": "^4.17.19", + "lodash.merge": "^4.6.2", "minimatch": "^3.0.4", "natural-compare": "^1.4.0", "optionator": "^0.9.1", @@ -475,19 +444,19 @@ "semver": "^7.2.1", "strip-ansi": "^6.0.0", "strip-json-comments": "^3.1.0", - "table": "^5.2.3", + "table": "^6.0.9", "text-table": "^0.2.0", "v8-compile-cache": "^2.0.3" } }, "eslint-config-airbnb-base": { - "version": "14.2.0", - "resolved": "https://registry.npmjs.org/eslint-config-airbnb-base/-/eslint-config-airbnb-base-14.2.0.tgz", - "integrity": "sha512-Snswd5oC6nJaevs3nZoLSTvGJBvzTfnBqOIArkf3cbyTyq9UD79wOk8s+RiL6bhca0p/eRO6veczhf6A/7Jy8Q==", + "version": "14.2.1", + "resolved": "https://registry.npmjs.org/eslint-config-airbnb-base/-/eslint-config-airbnb-base-14.2.1.tgz", + "integrity": "sha512-GOrQyDtVEc1Xy20U7vsB2yAoB4nBlfH5HZJeatRXHleO+OS5Ot+MWij4Dpltw4/DyIkqUfqz1epfhVR5XWWQPA==", "dev": true, "requires": { - "confusing-browser-globals": "^1.0.9", - "object.assign": "^4.1.0", + "confusing-browser-globals": "^1.0.10", + "object.assign": "^4.1.2", "object.entries": "^1.1.2" } }, @@ -519,50 +488,46 @@ } }, "eslint-module-utils": { - "version": "2.6.0", - "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.6.0.tgz", - "integrity": "sha512-6j9xxegbqe8/kZY8cYpcp0xhbK0EgJlg3g9mib3/miLaExuuwc3n5UEfSnU6hWMbT0FAYVvDbL9RrRgpUeQIvA==", + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.6.1.tgz", + "integrity": "sha512-ZXI9B8cxAJIH4nfkhTwcRTEAnrVfobYqwjWy/QMCZ8rHkZHFjf9yO4BzpiF9kCSfNlMG54eKigISHpX0+AaT4A==", "dev": true, "requires": { - "debug": "^2.6.9", + "debug": "^3.2.7", "pkg-dir": "^2.0.0" }, "dependencies": { "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", "dev": true, "requires": { - "ms": "2.0.0" + "ms": "^2.1.1" } - }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", - "dev": true } } }, "eslint-plugin-import": { - "version": "2.22.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.22.0.tgz", - "integrity": "sha512-66Fpf1Ln6aIS5Gr/55ts19eUuoDhAbZgnr6UxK5hbDx6l/QgQgx61AePq+BV4PP2uXQFClgMVzep5zZ94qqsxg==", + "version": "2.23.4", + "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.23.4.tgz", + "integrity": "sha512-6/wP8zZRsnQFiR3iaPFgh5ImVRM1WN5NUWfTIRqwOdeiGJlBcSk82o1FEVq8yXmy4lkIzTo7YhHCIxlU/2HyEQ==", "dev": true, "requires": { - "array-includes": "^3.1.1", - "array.prototype.flat": "^1.2.3", - "contains-path": "^0.1.0", + "array-includes": "^3.1.3", + "array.prototype.flat": "^1.2.4", "debug": "^2.6.9", - "doctrine": "1.5.0", - "eslint-import-resolver-node": "^0.3.3", - "eslint-module-utils": "^2.6.0", + "doctrine": "^2.1.0", + "eslint-import-resolver-node": "^0.3.4", + "eslint-module-utils": "^2.6.1", + "find-up": "^2.0.0", "has": "^1.0.3", + "is-core-module": "^2.4.0", "minimatch": "^3.0.4", - "object.values": "^1.1.1", - "read-pkg-up": "^2.0.0", - "resolve": "^1.17.0", + "object.values": "^1.1.3", + "pkg-up": "^2.0.0", + "read-pkg-up": "^3.0.0", + "resolve": "^1.20.0", "tsconfig-paths": "^3.9.0" }, "dependencies": { @@ -576,13 +541,12 @@ } }, "doctrine": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-1.5.0.tgz", - "integrity": "sha1-N53Ocw9hZvds76TmcHoVmwLFpvo=", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz", + "integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==", "dev": true, "requires": { - "esutils": "^2.0.2", - "isarray": "^1.0.0" + "esutils": "^2.0.2" } }, "ms": { @@ -610,23 +574,39 @@ "dev": true, "requires": { "eslint-visitor-keys": "^1.1.0" + }, + "dependencies": { + "eslint-visitor-keys": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", + "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==", + "dev": true + } } }, "eslint-visitor-keys": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", - "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz", + "integrity": "sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==", "dev": true }, "espree": { - "version": "7.3.0", - "resolved": "https://registry.npmjs.org/espree/-/espree-7.3.0.tgz", - "integrity": "sha512-dksIWsvKCixn1yrEXO8UosNSxaDoSYpq9reEjZSbHLpT5hpaCAKTLBwq0RHtLrIr+c0ByiYzWT8KTMRzoRCNlw==", + "version": "7.3.1", + "resolved": "https://registry.npmjs.org/espree/-/espree-7.3.1.tgz", + "integrity": "sha512-v3JCNCE64umkFpmkFGqzVKsOT0tN1Zr+ueqLZfpV1Ob8e+CEgPWa+OxCoGH3tnhimMKIaBm4m/vaRpJ/krRz2g==", "dev": true, "requires": { "acorn": "^7.4.0", - "acorn-jsx": "^5.2.0", + "acorn-jsx": "^5.3.1", "eslint-visitor-keys": "^1.3.0" + }, + "dependencies": { + "eslint-visitor-keys": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", + "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==", + "dev": true + } } }, "esprima": { @@ -636,9 +616,9 @@ "dev": true }, "esquery": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.3.1.tgz", - "integrity": "sha512-olpvt9QG0vniUBZspVRN6lwB7hOZoTRtT+jzR+tS4ffYx2mzbw+z0XCOk44aaLYKApNX5nMm+E+P6o25ip/DHQ==", + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.4.0.tgz", + "integrity": "sha512-cCDispWt5vHHtwMY2YrAQ4ibFkAL8RbH5YGBnZBc90MolvvfkkQcJro/aZiAQUlQ3qgrYS6D6v8Gc5G5CQsc9w==", "dev": true, "requires": { "estraverse": "^5.1.0" @@ -700,12 +680,12 @@ "dev": true }, "file-entry-cache": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-5.0.1.tgz", - "integrity": "sha512-bCg29ictuBaKUwwArK4ouCaqDgLZcysCFLmM/Yn/FDoqndh/9vNuQfXRDvTuXKLxfD/JtZQGKFT8MGcJBK644g==", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz", + "integrity": "sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==", "dev": true, "requires": { - "flat-cache": "^2.0.1" + "flat-cache": "^3.0.4" } }, "find-up": { @@ -718,20 +698,19 @@ } }, "flat-cache": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-2.0.1.tgz", - "integrity": "sha512-LoQe6yDuUMDzQAEH8sgmh4Md6oZnc/7PjtwjNFSzveXqSHt6ka9fPBuso7IGf9Rz4uqnSnWiFH2B/zj24a5ReA==", + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.0.4.tgz", + "integrity": "sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg==", "dev": true, "requires": { - "flatted": "^2.0.0", - "rimraf": "2.6.3", - "write": "1.0.3" + "flatted": "^3.1.0", + "rimraf": "^3.0.2" } }, "flatted": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/flatted/-/flatted-2.0.2.tgz", - "integrity": "sha512-r5wGx7YeOwNWNlCA0wQ86zKyDLMQr+/RB8xy74M4hTphfmjlijTSSXGuH8rnvKZnfT9i+75zmd8jcKdMR4O6jA==", + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.1.1.tgz", + "integrity": "sha512-zAoAQiudy+r5SvnSw3KJy5os/oRJYHzrzja/tBDqrZtNhUw8bt6y8OBzMWcjWr+8liV8Eb6yOhw8WZ7VFZ5ZzA==", "dev": true }, "fs.realpath": { @@ -752,10 +731,21 @@ "integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=", "dev": true }, + "get-intrinsic": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.1.tgz", + "integrity": "sha512-kWZrnVM42QCiEA2Ig1bG8zjoIMOgxWwYCEeNdwY6Tv/cOSeGpcoX4pXHfKUxNKVoArnrEr2e9srnAxxGIraS9Q==", + "dev": true, + "requires": { + "function-bind": "^1.1.1", + "has": "^1.0.3", + "has-symbols": "^1.0.1" + } + }, "glob": { - "version": "7.1.6", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", - "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", + "version": "7.1.7", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.7.tgz", + "integrity": "sha512-OvD9ENzPLbegENnYP5UUfJIirTg4+XwMWGaQfQTY0JenxNvvIKP3U3/tAQSPIu/lHxXYSZmpXlUHeqAIdKzBLQ==", "dev": true, "requires": { "fs.realpath": "^1.0.0", @@ -767,27 +757,27 @@ } }, "glob-parent": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.1.tgz", - "integrity": "sha512-FnI+VGOpnlGHWZxthPGR+QhR78fuiK0sNLkHQv+bL9fQi57lNNdquIbna/WrfROrolq8GK5Ek6BiMwqL/voRYQ==", + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", "dev": true, "requires": { "is-glob": "^4.0.1" } }, "globals": { - "version": "12.4.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-12.4.0.tgz", - "integrity": "sha512-BWICuzzDvDoH54NHKCseDanAhE3CeDorgDL5MT6LMXXj2WCnd9UC2szdk4AWLfjdgNBCXLUanXYcpBBKOSWGwg==", + "version": "13.9.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.9.0.tgz", + "integrity": "sha512-74/FduwI/JaIrr1H8e71UbDE+5x7pIPs1C2rrwC52SszOo043CsWOZEMW7o2Y58xwm9b+0RBKDxY5n2sUpEFxA==", "dev": true, "requires": { - "type-fest": "^0.8.1" + "type-fest": "^0.20.2" } }, "graceful-fs": { - "version": "4.2.4", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.4.tgz", - "integrity": "sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw==", + "version": "4.2.6", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.6.tgz", + "integrity": "sha512-nTnJ528pbqxYanhpDYsi4Rd8MAeaBA67+RZ10CM1m3bTAVFEDcd5AuA4a6W5YkGZ1iNXHzZz8T6TBKLeBuNriQ==", "dev": true }, "has": { @@ -799,6 +789,12 @@ "function-bind": "^1.1.1" } }, + "has-bigints": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/has-bigints/-/has-bigints-1.0.1.tgz", + "integrity": "sha512-LSBS2LjbNBTf6287JEbEzvJgftkF5qFkmCo9hDRpAzKhUOlJ+hx8dd4USs00SgsUNwc4617J9ki5YtEClM2ffA==", + "dev": true + }, "has-flag": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", @@ -806,9 +802,9 @@ "dev": true }, "has-symbols": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.1.tgz", - "integrity": "sha512-PLcsoqu++dmEIZB+6totNFKq/7Do+Z0u4oT0zKOJNl3lYK6vGwwu2hjHs+68OEZbTjiUE9bgOABXbP/GvrS0Kg==", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.2.tgz", + "integrity": "sha512-chXa79rL/UC2KlX17jo3vRGz0azaWEx5tGqZg5pO3NUyEJVB17dMruQlzCCOfUvElghKcm5194+BCRvi2Rv/Gw==", "dev": true }, "hosted-git-info": { @@ -824,9 +820,9 @@ "dev": true }, "import-fresh": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.2.1.tgz", - "integrity": "sha512-6e1q1cnWP2RXD9/keSkxHScg508CdXqXWgWBaETNhyuBFz+kUZlKboh+ISK+bU++DmbHimVBrOz/zzPe0sZ3sQ==", + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", + "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", "dev": true, "requires": { "parent-module": "^1.0.0", @@ -861,16 +857,40 @@ "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=", "dev": true }, + "is-bigint": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-bigint/-/is-bigint-1.0.2.tgz", + "integrity": "sha512-0JV5+SOCQkIdzjBK9buARcV804Ddu7A0Qet6sHi3FimE9ne6m4BGQZfRn+NZiXbBk4F4XmHfDZIipLj9pX8dSA==", + "dev": true + }, + "is-boolean-object": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/is-boolean-object/-/is-boolean-object-1.1.1.tgz", + "integrity": "sha512-bXdQWkECBUIAcCkeH1unwJLIpZYaa5VvuygSyS/c2lf719mTKZDU5UdDRlpd01UjADgmW8RfqaP+mRaVPdr/Ng==", + "dev": true, + "requires": { + "call-bind": "^1.0.2" + } + }, "is-callable": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.1.tgz", - "integrity": "sha512-wliAfSzx6V+6WfMOmus1xy0XvSgf/dlStkvTfq7F0g4bOIW0PSUbnyse3NhDwdyYS1ozfUtAAySqTws3z9Eqgg==", + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.3.tgz", + "integrity": "sha512-J1DcMe8UYTBSrKezuIUTUwjXsho29693unXM2YhJUTR2txK/eG47bvNa/wipPFmZFgr/N6f1GA66dv0mEyTIyQ==", "dev": true }, + "is-core-module": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.4.0.tgz", + "integrity": "sha512-6A2fkfq1rfeQZjxrZJGerpLCTHRNEBiSgnu0+obeJpEPZRUooHgsizvzv0ZjJwOz3iWIHdJtVWJ/tmPr3D21/A==", + "dev": true, + "requires": { + "has": "^1.0.3" + } + }, "is-date-object": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.2.tgz", - "integrity": "sha512-USlDT524woQ08aoZFzh3/Z6ch9Y/EWXEHQ/AaRN0SkKq4t2Jw2R2339tSXmwuVoY7LLlBCbOIlx2myP/L5zk0g==", + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.4.tgz", + "integrity": "sha512-/b4ZVsG7Z5XVtIxs/h9W8nvfLgSAyKYdtGWQLbqy6jA1icmgjf8WCoTKgeS4wy5tYaPePouzFMANbnj94c2Z+A==", "dev": true }, "is-extglob": { @@ -880,9 +900,9 @@ "dev": true }, "is-fullwidth-code-point": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", "dev": true }, "is-glob": { @@ -895,41 +915,42 @@ } }, "is-negative-zero": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.0.tgz", - "integrity": "sha1-lVOxIbD6wohp2p7UWeIMdUN4hGE=", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.1.tgz", + "integrity": "sha512-2z6JzQvZRa9A2Y7xC6dQQm4FSTSTNWjKIYYTt4246eMTJmIo0Q+ZyOsU66X8lxK1AbB92dFeglPLrhwpeRKO6w==", + "dev": true + }, + "is-number-object": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/is-number-object/-/is-number-object-1.0.5.tgz", + "integrity": "sha512-RU0lI/n95pMoUKu9v1BZP5MBcZuNSVJkMkAG2dJqC4z2GlkGUNeH68SuHuBKBD/XFe+LHZ+f9BKkLET60Niedw==", "dev": true }, "is-regex": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.1.tgz", - "integrity": "sha512-1+QkEcxiLlB7VEyFtyBg94e08OAsvq7FUBgApTq/w2ymCLyKJgDPsybBENVtA7XCQEgEXxKPonG+mvYRxh/LIg==", + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.3.tgz", + "integrity": "sha512-qSVXFz28HM7y+IWX6vLCsexdlvzT1PJNFSBuaQLQ5o0IEw8UDYW6/2+eCMVyIsbM8CNLX2a/QWmSpyxYEHY7CQ==", "dev": true, "requires": { - "has-symbols": "^1.0.1" + "call-bind": "^1.0.2", + "has-symbols": "^1.0.2" } }, "is-string": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/is-string/-/is-string-1.0.5.tgz", - "integrity": "sha512-buY6VNRjhQMiF1qWDouloZlQbRhDPCebwxSjxMjxgemYT46YMd2NR0/H+fBhEfWX4A/w9TBJ+ol+okqJKFE6vQ==", + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/is-string/-/is-string-1.0.6.tgz", + "integrity": "sha512-2gdzbKUuqtQ3lYNrUTQYoClPhm7oQu4UdpSZMp1/DGgkHBT8E2Z1l0yMdb6D4zNAxwDiMv8MdulKROJGNl0Q0w==", "dev": true }, "is-symbol": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.3.tgz", - "integrity": "sha512-OwijhaRSgqvhm/0ZdAcXNZt9lYdKFpcRDT5ULUuYXPoT794UNOdU+gpT6Rzo7b4V2HUl/op6GqY894AZwv9faQ==", + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.4.tgz", + "integrity": "sha512-C/CPBqKWnvdcxqIARxyOh4v1UUEOCHpgDa0WYgpKDFMszcrPcffg5uhwSgPCLD2WWxmq6isisz87tzT01tuGhg==", "dev": true, "requires": { - "has-symbols": "^1.0.1" + "has-symbols": "^1.0.2" } }, - "isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", - "dev": true - }, "isexe": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", @@ -943,9 +964,9 @@ "dev": true }, "js-yaml": { - "version": "3.14.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.0.tgz", - "integrity": "sha512-/4IbIeHcD9VMHFqDR/gQ7EdZdLimOvW2DdcxFjdyyZ9NsbS+ccrXqVWDtab/lRl5AlUqmpBx8EhPaWR+OtY17A==", + "version": "3.14.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", + "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", "dev": true, "requires": { "argparse": "^1.0.7", @@ -962,13 +983,14 @@ } }, "jsdoc": { - "version": "github:jsdoc/jsdoc#544a992824631fc652183d8b0b4b1281dc961560", - "from": "github:jsdoc/jsdoc#544a992824631fc652183d8b0b4b1281dc961560", + "version": "3.6.7", + "resolved": "https://registry.npmjs.org/jsdoc/-/jsdoc-3.6.7.tgz", + "integrity": "sha512-sxKt7h0vzCd+3Y81Ey2qinupL6DpRSZJclS04ugHDNmRUXGzqicMJ6iwayhSA0S0DwwX30c5ozyUthr1QKF6uw==", "dev": true, "requires": { "@babel/parser": "^7.9.4", "bluebird": "^3.7.2", - "catharsis": "^0.8.11", + "catharsis": "^0.9.0", "escape-string-regexp": "^2.0.0", "js2xmlparser": "^4.0.1", "klaw": "^3.0.0", @@ -979,7 +1001,7 @@ "requizzle": "^0.2.3", "strip-json-comments": "^3.1.0", "taffydb": "2.6.2", - "underscore": "~1.12.1" + "underscore": "~1.13.1" }, "dependencies": { "escape-string-regexp": { @@ -987,15 +1009,15 @@ "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz", "integrity": "sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==", "dev": true - }, - "mkdirp": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", - "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", - "dev": true } } }, + "json-parse-better-errors": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz", + "integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==", + "dev": true + }, "json-schema-traverse": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", @@ -1046,14 +1068,14 @@ } }, "load-json-file": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz", - "integrity": "sha1-eUfkIUmvgNaWy/eXvKq8/h/inKg=", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-4.0.0.tgz", + "integrity": "sha1-L19Fq5HjMhYjT9U62rZo607AmTs=", "dev": true, "requires": { "graceful-fs": "^4.1.2", - "parse-json": "^2.2.0", - "pify": "^2.0.0", + "parse-json": "^4.0.0", + "pify": "^3.0.0", "strip-bom": "^3.0.0" } }, @@ -1073,6 +1095,33 @@ "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", "dev": true }, + "lodash.clonedeep": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz", + "integrity": "sha1-4j8/nE+Pvd6HJSnBBxhXoIblzO8=", + "dev": true + }, + "lodash.merge": { + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", + "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", + "dev": true + }, + "lodash.truncate": { + "version": "4.4.2", + "resolved": "https://registry.npmjs.org/lodash.truncate/-/lodash.truncate-4.4.2.tgz", + "integrity": "sha1-WjUNoLERO4N+z//VgSy+WNbq4ZM=", + "dev": true + }, + "lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, + "requires": { + "yallist": "^4.0.0" + } + }, "markdown-it": { "version": "10.0.0", "resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-10.0.0.tgz", @@ -1093,9 +1142,9 @@ "dev": true }, "marked": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/marked/-/marked-2.0.3.tgz", - "integrity": "sha512-5otztIIcJfPc2qGTN8cVtOJEjNJZ0jwa46INMagrYfk0EvqtRuEHLsEe0LrFS0/q+ZRKT0+kXK7P2T1AN5lWRA==", + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/marked/-/marked-2.0.7.tgz", + "integrity": "sha512-BJXxkuIfJchcXOJWTT2DOL+yFWifFv2yGYOUzvXg8Qz610QKw+sHCvTMYwA+qWGhlA2uivBezChZ/pBy1tWdkQ==", "dev": true }, "mdurl": { @@ -1120,13 +1169,10 @@ "dev": true }, "mkdirp": { - "version": "0.5.5", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz", - "integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==", - "dev": true, - "requires": { - "minimist": "^1.2.5" - } + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", + "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", + "dev": true }, "ms": { "version": "2.1.2", @@ -1161,9 +1207,9 @@ } }, "object-inspect": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.8.0.tgz", - "integrity": "sha512-jLdtEOB112fORuypAyl/50VRVIBIdVQOSUUGQHzJ4xBSbit81zRarz7GThkEFZy1RceYrWYcPcBFPQwHyAc1gA==", + "version": "1.10.3", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.10.3.tgz", + "integrity": "sha512-e5mCJlSH7poANfC8z8S9s9S2IN5/4Zb3aZ33f5s8YqoazCFzNLloLU8r5VCG+G7WoqLvAAZoVMcy3tp/3X0Plw==", "dev": true }, "object-keys": { @@ -1173,80 +1219,37 @@ "dev": true }, "object.assign": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.1.tgz", - "integrity": "sha512-VT/cxmx5yaoHSOTSyrCygIDFco+RsibY2NM0a4RdEeY/4KgqezwFtK1yr3U67xYhqJSlASm2pKhLVzPj2lr4bA==", + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.2.tgz", + "integrity": "sha512-ixT2L5THXsApyiUPYKmW+2EHpXXe5Ii3M+f4e+aJFAHao5amFRW6J0OO6c/LU8Be47utCx2GL89hxGB6XSmKuQ==", "dev": true, "requires": { + "call-bind": "^1.0.0", "define-properties": "^1.1.3", - "es-abstract": "^1.18.0-next.0", "has-symbols": "^1.0.1", "object-keys": "^1.1.1" } }, "object.entries": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/object.entries/-/object.entries-1.1.2.tgz", - "integrity": "sha512-BQdB9qKmb/HyNdMNWVr7O3+z5MUIx3aiegEIJqjMBbBf0YT9RRxTJSim4mzFqtyr7PDAHigq0N9dO0m0tRakQA==", + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/object.entries/-/object.entries-1.1.4.tgz", + "integrity": "sha512-h4LWKWE+wKQGhtMjZEBud7uLGhqyLwj8fpHOarZhD2uY3C9cRtk57VQ89ke3moByLXMedqs3XCHzyb4AmA2DjA==", "dev": true, "requires": { + "call-bind": "^1.0.2", "define-properties": "^1.1.3", - "es-abstract": "^1.17.5", - "has": "^1.0.3" - }, - "dependencies": { - "es-abstract": { - "version": "1.17.6", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.17.6.tgz", - "integrity": "sha512-Fr89bON3WFyUi5EvAeI48QTWX0AyekGgLA8H+c+7fbfCkJwRWRMLd8CQedNEyJuoYYhmtEqY92pgte1FAhBlhw==", - "dev": true, - "requires": { - "es-to-primitive": "^1.2.1", - "function-bind": "^1.1.1", - "has": "^1.0.3", - "has-symbols": "^1.0.1", - "is-callable": "^1.2.0", - "is-regex": "^1.1.0", - "object-inspect": "^1.7.0", - "object-keys": "^1.1.1", - "object.assign": "^4.1.0", - "string.prototype.trimend": "^1.0.1", - "string.prototype.trimstart": "^1.0.1" - } - } + "es-abstract": "^1.18.2" } }, "object.values": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/object.values/-/object.values-1.1.1.tgz", - "integrity": "sha512-WTa54g2K8iu0kmS/us18jEmdv1a4Wi//BZ/DTVYEcH0XhLM5NYdpDHja3gt57VrZLcNAO2WGA+KpWsDBaHt6eA==", + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/object.values/-/object.values-1.1.4.tgz", + "integrity": "sha512-TnGo7j4XSnKQoK3MfvkzqKCi0nVe/D9I9IjwTNYdb/fxYHpjrluHVOgw0AF6jrRFGMPHdfuidR09tIDiIvnaSg==", "dev": true, "requires": { + "call-bind": "^1.0.2", "define-properties": "^1.1.3", - "es-abstract": "^1.17.0-next.1", - "function-bind": "^1.1.1", - "has": "^1.0.3" - }, - "dependencies": { - "es-abstract": { - "version": "1.17.6", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.17.6.tgz", - "integrity": "sha512-Fr89bON3WFyUi5EvAeI48QTWX0AyekGgLA8H+c+7fbfCkJwRWRMLd8CQedNEyJuoYYhmtEqY92pgte1FAhBlhw==", - "dev": true, - "requires": { - "es-to-primitive": "^1.2.1", - "function-bind": "^1.1.1", - "has": "^1.0.3", - "has-symbols": "^1.0.1", - "is-callable": "^1.2.0", - "is-regex": "^1.1.0", - "object-inspect": "^1.7.0", - "object-keys": "^1.1.1", - "object.assign": "^4.1.0", - "string.prototype.trimend": "^1.0.1", - "string.prototype.trimstart": "^1.0.1" - } - } + "es-abstract": "^1.18.2" } }, "once": { @@ -1306,12 +1309,13 @@ } }, "parse-json": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz", - "integrity": "sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz", + "integrity": "sha1-vjX1Qlvh9/bHRxhPmKeIy5lHfuA=", "dev": true, "requires": { - "error-ex": "^1.2.0" + "error-ex": "^1.3.1", + "json-parse-better-errors": "^1.0.1" } }, "path-exists": { @@ -1333,24 +1337,24 @@ "dev": true }, "path-parse": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz", - "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==", + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", "dev": true }, "path-type": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/path-type/-/path-type-2.0.0.tgz", - "integrity": "sha1-8BLMuEFbcJb8LaoQVMPXI4lZTHM=", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-3.0.0.tgz", + "integrity": "sha512-T2ZUsdZFHgA3u4e5PfPbjd7HDDpxPnQb5jN0SrDsjNSuVXHJqtwTnWqG0B1jZrgmJ/7lj1EmVIByWt1gxGkWvg==", "dev": true, "requires": { - "pify": "^2.0.0" + "pify": "^3.0.0" } }, "pify": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", - "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", + "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=", "dev": true }, "pkg-dir": { @@ -1362,6 +1366,15 @@ "find-up": "^2.1.0" } }, + "pkg-up": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/pkg-up/-/pkg-up-2.0.0.tgz", + "integrity": "sha1-yBmscoBZpGHKscOImivjxJoATX8=", + "dev": true, + "requires": { + "find-up": "^2.1.0" + } + }, "prelude-ls": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", @@ -1381,30 +1394,36 @@ "dev": true }, "read-pkg": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-2.0.0.tgz", - "integrity": "sha1-jvHAYjxqbbDcZxPEv6xGMysjaPg=", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-3.0.0.tgz", + "integrity": "sha1-nLxoaXj+5l0WwA4rGcI3/Pbjg4k=", "dev": true, "requires": { - "load-json-file": "^2.0.0", + "load-json-file": "^4.0.0", "normalize-package-data": "^2.3.2", - "path-type": "^2.0.0" + "path-type": "^3.0.0" } }, "read-pkg-up": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-2.0.0.tgz", - "integrity": "sha1-a3KoBImE4MQeeVEP1en6mbO1Sb4=", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-3.0.0.tgz", + "integrity": "sha1-PtSWaF26D4/hGNBpHcUfSh/5bwc=", "dev": true, "requires": { "find-up": "^2.0.0", - "read-pkg": "^2.0.0" + "read-pkg": "^3.0.0" } }, "regexpp": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.1.0.tgz", - "integrity": "sha512-ZOIzd8yVsQQA7j8GCSlPGXwg5PfmA1mrq0JP4nGhh54LaKN3xdai/vHUDu74pKwV8OxseMS65u2NImosQcSD0Q==", + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.2.0.tgz", + "integrity": "sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg==", + "dev": true + }, + "require-from-string": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", + "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", "dev": true }, "requizzle": { @@ -1417,11 +1436,12 @@ } }, "resolve": { - "version": "1.17.0", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.17.0.tgz", - "integrity": "sha512-ic+7JYiV8Vi2yzQGFWOkiZD5Z9z7O2Zhm9XMaTxdJExKasieFCr+yXZ/WmXsckHiKl12ar0y6XiXDx3m4RHn1w==", + "version": "1.20.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.20.0.tgz", + "integrity": "sha512-wENBPt4ySzg4ybFQW2TT1zMQucPK95HSh/nq2CFTZVOGut2+pQvSsgtda4d26YrYcr067wjbmzOG8byDPBX63A==", "dev": true, "requires": { + "is-core-module": "^2.2.0", "path-parse": "^1.0.6" } }, @@ -1432,19 +1452,22 @@ "dev": true }, "rimraf": { - "version": "2.6.3", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.3.tgz", - "integrity": "sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA==", + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", "dev": true, "requires": { "glob": "^7.1.3" } }, "semver": { - "version": "7.3.2", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.2.tgz", - "integrity": "sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ==", - "dev": true + "version": "7.3.5", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", + "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==", + "dev": true, + "requires": { + "lru-cache": "^6.0.0" + } }, "shebang-command": { "version": "2.0.0", @@ -1462,14 +1485,40 @@ "dev": true }, "slice-ansi": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-2.1.0.tgz", - "integrity": "sha512-Qu+VC3EwYLldKa1fCxuuvULvSJOKEgk9pi8dZeCVK7TqBfUNTH4sFkk4joj8afVSfAYgJoSOetjx9QWOJ5mYoQ==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-4.0.0.tgz", + "integrity": "sha512-qMCMfhY040cVHT43K9BFygqYbUPFZKHOg7K73mtTWJRb8pyP3fzf4Ixd5SzdEJQ6MRUg/WBnOLxghZtKKurENQ==", "dev": true, "requires": { - "ansi-styles": "^3.2.0", - "astral-regex": "^1.0.0", - "is-fullwidth-code-point": "^2.0.0" + "ansi-styles": "^4.0.0", + "astral-regex": "^2.0.0", + "is-fullwidth-code-point": "^3.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "requires": { + "color-convert": "^2.0.1" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + } } }, "spdx-correct": { @@ -1499,9 +1548,9 @@ } }, "spdx-license-ids": { - "version": "3.0.6", - "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.6.tgz", - "integrity": "sha512-+orQK83kyMva3WyPf59k1+Y525csj5JejicWut55zeTWANuN17qSiSLUXWtzHeNWORSvT7GLDJ/E/XiIWoXBTw==", + "version": "3.0.9", + "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.9.tgz", + "integrity": "sha512-Ki212dKK4ogX+xDo4CtOZBVIwhsKBEfsEEcwmJfLQzirgc2jIWdzg40Unxz/HzEUqM1WFzVlQSMF9kZZ2HboLQ==", "dev": true }, "sprintf-js": { @@ -1511,93 +1560,34 @@ "dev": true }, "string-width": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", - "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.2.tgz", + "integrity": "sha512-XBJbT3N4JhVumXE0eoLU9DCjcaF92KLNqTmFCnG1pf8duUxFGwtP6AD6nkjw9a3IdiRtL3E2w3JDiE/xi3vOeA==", "dev": true, "requires": { - "emoji-regex": "^7.0.1", - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^5.1.0" - }, - "dependencies": { - "ansi-regex": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", - "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", - "dev": true - }, - "strip-ansi": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", - "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", - "dev": true, - "requires": { - "ansi-regex": "^4.1.0" - } - } + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.0" } }, "string.prototype.trimend": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.1.tgz", - "integrity": "sha512-LRPxFUaTtpqYsTeNKaFOw3R4bxIzWOnbQ837QfBylo8jIxtcbK/A/sMV7Q+OAV/vWo+7s25pOE10KYSjaSO06g==", + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.4.tgz", + "integrity": "sha512-y9xCjw1P23Awk8EvTpcyL2NIr1j7wJ39f+k6lvRnSMz+mz9CGz9NYPelDk42kOz6+ql8xjfK8oYzy3jAP5QU5A==", "dev": true, "requires": { - "define-properties": "^1.1.3", - "es-abstract": "^1.17.5" - }, - "dependencies": { - "es-abstract": { - "version": "1.17.6", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.17.6.tgz", - "integrity": "sha512-Fr89bON3WFyUi5EvAeI48QTWX0AyekGgLA8H+c+7fbfCkJwRWRMLd8CQedNEyJuoYYhmtEqY92pgte1FAhBlhw==", - "dev": true, - "requires": { - "es-to-primitive": "^1.2.1", - "function-bind": "^1.1.1", - "has": "^1.0.3", - "has-symbols": "^1.0.1", - "is-callable": "^1.2.0", - "is-regex": "^1.1.0", - "object-inspect": "^1.7.0", - "object-keys": "^1.1.1", - "object.assign": "^4.1.0", - "string.prototype.trimend": "^1.0.1", - "string.prototype.trimstart": "^1.0.1" - } - } + "call-bind": "^1.0.2", + "define-properties": "^1.1.3" } }, "string.prototype.trimstart": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.1.tgz", - "integrity": "sha512-XxZn+QpvrBI1FOcg6dIpxUPgWCPuNXvMD72aaRaUQv1eD4e/Qy8i/hFTe0BUmD60p/QA6bh1avmuPTfNjqVWRw==", + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.4.tgz", + "integrity": "sha512-jh6e984OBfvxS50tdY2nRZnoC5/mLFKOREQfw8t5yytkoUsJRNxvI/E39qu1sD0OtWI3OC0XgKSmcWwziwYuZw==", "dev": true, "requires": { - "define-properties": "^1.1.3", - "es-abstract": "^1.17.5" - }, - "dependencies": { - "es-abstract": { - "version": "1.17.6", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.17.6.tgz", - "integrity": "sha512-Fr89bON3WFyUi5EvAeI48QTWX0AyekGgLA8H+c+7fbfCkJwRWRMLd8CQedNEyJuoYYhmtEqY92pgte1FAhBlhw==", - "dev": true, - "requires": { - "es-to-primitive": "^1.2.1", - "function-bind": "^1.1.1", - "has": "^1.0.3", - "has-symbols": "^1.0.1", - "is-callable": "^1.2.0", - "is-regex": "^1.1.0", - "object-inspect": "^1.7.0", - "object-keys": "^1.1.1", - "object.assign": "^4.1.0", - "string.prototype.trimend": "^1.0.1", - "string.prototype.trimstart": "^1.0.1" - } - } + "call-bind": "^1.0.2", + "define-properties": "^1.1.3" } }, "strip-ansi": { @@ -1631,15 +1621,37 @@ } }, "table": { - "version": "5.4.6", - "resolved": "https://registry.npmjs.org/table/-/table-5.4.6.tgz", - "integrity": "sha512-wmEc8m4fjnob4gt5riFRtTu/6+4rSe12TpAELNSqHMfF3IqnA+CH37USM6/YR3qRZv7e56kAEAtd6nKZaxe0Ug==", + "version": "6.7.1", + "resolved": "https://registry.npmjs.org/table/-/table-6.7.1.tgz", + "integrity": "sha512-ZGum47Yi6KOOFDE8m223td53ath2enHcYLgOCjGr5ngu8bdIARQk6mN/wRMv4yMRcHnCSnHbCEha4sobQx5yWg==", "dev": true, "requires": { - "ajv": "^6.10.2", - "lodash": "^4.17.14", - "slice-ansi": "^2.1.0", - "string-width": "^3.0.0" + "ajv": "^8.0.1", + "lodash.clonedeep": "^4.5.0", + "lodash.truncate": "^4.4.2", + "slice-ansi": "^4.0.0", + "string-width": "^4.2.0", + "strip-ansi": "^6.0.0" + }, + "dependencies": { + "ajv": { + "version": "8.6.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.6.0.tgz", + "integrity": "sha512-cnUG4NSBiM4YFBxgZIj/In3/6KX+rQ2l2YPRVcvAMQGWEPKuXoPIhxzwqh31jA3IPbI4qEOp/5ILI4ynioXsGQ==", + "dev": true, + "requires": { + "fast-deep-equal": "^3.1.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2", + "uri-js": "^4.2.2" + } + }, + "json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", + "dev": true + } } }, "taffydb": { @@ -1676,9 +1688,9 @@ } }, "type-fest": { - "version": "0.8.1", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz", - "integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==", + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", + "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", "dev": true }, "uc.micro": { @@ -1687,25 +1699,37 @@ "integrity": "sha512-8Y75pvTYkLJW2hWQHXxoqRgV7qb9B+9vFEtidML+7koHUFapnVJAZ6cKs+Qjz5Aw3aZWHMC6u0wJE3At+nSGwA==", "dev": true }, + "unbox-primitive": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.1.tgz", + "integrity": "sha512-tZU/3NqK3dA5gpE1KtyiJUrEB0lxnGkMFHptJ7q6ewdZ8s12QrODwNbhIJStmJkd1QDXa1NRA8aF2A1zk/Ypyw==", + "dev": true, + "requires": { + "function-bind": "^1.1.1", + "has-bigints": "^1.0.1", + "has-symbols": "^1.0.2", + "which-boxed-primitive": "^1.0.2" + } + }, "underscore": { - "version": "1.12.1", - "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.12.1.tgz", - "integrity": "sha512-hEQt0+ZLDVUMhebKxL4x1BTtDY7bavVofhZ9KZ4aI26X9SRaE+Y3m83XUL1UP2jn8ynjndwCCpEHdUG+9pP1Tw==", + "version": "1.13.1", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.13.1.tgz", + "integrity": "sha512-hzSoAVtJF+3ZtiFX0VgfFPHEDRm7Y/QPjGyNo4TVdnDTdft3tr8hEkD25a1jC+TjTuE7tkHGKkhwCgs9dgBB2g==", "dev": true }, "uri-js": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.0.tgz", - "integrity": "sha512-B0yRTzYdUCCn9n+F4+Gh4yIDtMQcaJsmYBDsTSG8g/OejKBodLQ2IHfN3bM7jUsRXndopT7OIXWdYqc1fjmV6g==", + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", "dev": true, "requires": { "punycode": "^2.1.0" } }, "v8-compile-cache": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.1.1.tgz", - "integrity": "sha512-8OQ9CL+VWyt3JStj7HX7/ciTL2V3Rl1Wf5OL+SNTm0yK1KvtReVulksyeRnCANHHuUxHlQig+JJDlUhBt1NQDQ==", + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz", + "integrity": "sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA==", "dev": true }, "validate-npm-package-license": { @@ -1727,6 +1751,19 @@ "isexe": "^2.0.0" } }, + "which-boxed-primitive": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/which-boxed-primitive/-/which-boxed-primitive-1.0.2.tgz", + "integrity": "sha512-bwZdv0AKLpplFY2KZRX6TvyuN7ojjr7lwkg6ml0roIy9YeuSr7JS372qlNW18UQYzgYK9ziGcerWqZOmEn9VNg==", + "dev": true, + "requires": { + "is-bigint": "^1.0.1", + "is-boolean-object": "^1.1.0", + "is-number-object": "^1.0.4", + "is-string": "^1.0.5", + "is-symbol": "^1.0.3" + } + }, "word-wrap": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", @@ -1739,20 +1776,17 @@ "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", "dev": true }, - "write": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/write/-/write-1.0.3.tgz", - "integrity": "sha512-/lg70HAjtkUgWPVZhZcm+T4hkL8Zbtp1nFNOn3lRrxnlv50SRBv7cR7RqR+GMsd3hUXy9hWBo4CHTbFTcOYwig==", - "dev": true, - "requires": { - "mkdirp": "^0.5.1" - } - }, "xmlcreate": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/xmlcreate/-/xmlcreate-2.0.3.tgz", "integrity": "sha512-HgS+X6zAztGa9zIK3Y3LXuJes33Lz9x+YyTxgrkIdabu2vqcGOWwdfCpf1hWLRrd553wd4QCDf6BBO6FfdsRiQ==", "dev": true + }, + "yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true } } } diff --git a/platform/javascript/package.json b/platform/javascript/package.json index 53748503f9..9dafae30c5 100644 --- a/platform/javascript/package.json +++ b/platform/javascript/package.json @@ -20,9 +20,9 @@ "author": "Godot Engine contributors", "license": "MIT", "devDependencies": { - "eslint": "^7.9.0", - "eslint-config-airbnb-base": "^14.2.0", - "eslint-plugin-import": "^2.22.0", - "jsdoc": "github:jsdoc/jsdoc#544a992824631fc652183d8b0b4b1281dc961560" + "eslint": "^7.28.0", + "eslint-config-airbnb-base": "^14.2.1", + "eslint-plugin-import": "^2.23.4", + "jsdoc": "^3.6.7" } } diff --git a/platform/linuxbsd/SCsub b/platform/linuxbsd/SCsub index 46714e9502..1751d56e71 100644 --- a/platform/linuxbsd/SCsub +++ b/platform/linuxbsd/SCsub @@ -5,21 +5,27 @@ Import("env") from platform_methods import run_in_subprocess import platform_linuxbsd_builders -common_x11 = [ +common_linuxbsd = [ "crash_handler_linuxbsd.cpp", "os_linuxbsd.cpp", "joypad_linux.cpp", - "context_gl_x11.cpp", - "detect_prime_x11.cpp", - "display_server_x11.cpp", - "vulkan_context_x11.cpp", - "key_mapping_x11.cpp", ] +if "x11" in env and env["x11"]: + common_linuxbsd += [ + "context_gl_x11.cpp", + "detect_prime_x11.cpp", + "display_server_x11.cpp", + "key_mapping_x11.cpp", + ] + +if "vulkan" in env and env["vulkan"]: + common_linuxbsd.append("vulkan_context_x11.cpp") + if "udev" in env and env["udev"]: - common_x11.append("libudev-so_wrap.c") + common_linuxbsd.append("libudev-so_wrap.c") -prog = env.add_program("#bin/godot", ["godot_linuxbsd.cpp"] + common_x11) +prog = env.add_program("#bin/godot", ["godot_linuxbsd.cpp"] + common_linuxbsd) if env["debug_symbols"] and env["separate_debug_symbols"]: env.AddPostAction(prog, run_in_subprocess(platform_linuxbsd_builders.make_debug_linuxbsd)) diff --git a/platform/linuxbsd/detect.py b/platform/linuxbsd/detect.py index ee59537ee0..1487210174 100644 --- a/platform/linuxbsd/detect.py +++ b/platform/linuxbsd/detect.py @@ -73,6 +73,7 @@ def get_opts(): BoolVariable("use_msan", "Use LLVM compiler memory sanitizer (MSAN)", False), BoolVariable("pulseaudio", "Detect and use PulseAudio", True), BoolVariable("udev", "Use udev for gamepad connection callbacks", True), + BoolVariable("x11", "Enable X11 display", True), BoolVariable("debug_symbols", "Add debugging symbols to release/release_debug builds", True), BoolVariable("separate_debug_symbols", "Create a separate file containing debugging symbols", False), BoolVariable("touch", "Enable touch events", True), @@ -362,18 +363,26 @@ def configure(env): env.ParseConfig("pkg-config zlib --cflags --libs") env.Prepend(CPPPATH=["#platform/linuxbsd"]) - env.Append(CPPDEFINES=["X11_ENABLED", "UNIX_ENABLED"]) + + if env["x11"]: + if not env["vulkan"]: + print("Error: X11 support requires vulkan=yes") + env.Exit(255) + env.Append(CPPDEFINES=["X11_ENABLED"]) + + env.Append(CPPDEFINES=["UNIX_ENABLED"]) env.Append(CPPDEFINES=[("_FILE_OFFSET_BITS", 64)]) - env.Append(CPPDEFINES=["VULKAN_ENABLED"]) - if not env["builtin_vulkan"]: - env.ParseConfig("pkg-config vulkan --cflags --libs") - if not env["builtin_glslang"]: - # No pkgconfig file for glslang so far - env.Append(LIBS=["glslang", "SPIRV"]) + if env["vulkan"]: + env.Append(CPPDEFINES=["VULKAN_ENABLED"]) + if not env["builtin_vulkan"]: + env.ParseConfig("pkg-config vulkan --cflags --libs") + if not env["builtin_glslang"]: + # No pkgconfig file for glslang so far + env.Append(LIBS=["glslang", "SPIRV"]) - # env.Append(CPPDEFINES=['OPENGL_ENABLED']) - env.Append(LIBS=["GL"]) + # env.Append(CPPDEFINES=['OPENGL_ENABLED']) + env.Append(LIBS=["GL"]) env.Append(LIBS=["pthread"]) diff --git a/platform/linuxbsd/display_server_x11.cpp b/platform/linuxbsd/display_server_x11.cpp index b50b5f3479..d2531cbe50 100644 --- a/platform/linuxbsd/display_server_x11.cpp +++ b/platform/linuxbsd/display_server_x11.cpp @@ -360,7 +360,7 @@ void DisplayServerX11::mouse_set_mode(MouseMode p_mode) { return; } - if (mouse_mode == MOUSE_MODE_CAPTURED || mouse_mode == MOUSE_MODE_CONFINED) { + if (mouse_mode == MOUSE_MODE_CAPTURED || mouse_mode == MOUSE_MODE_CONFINED || mouse_mode == MOUSE_MODE_CONFINED_HIDDEN) { XUngrabPointer(x11_display, CurrentTime); } @@ -376,7 +376,7 @@ void DisplayServerX11::mouse_set_mode(MouseMode p_mode) { } mouse_mode = p_mode; - if (mouse_mode == MOUSE_MODE_CAPTURED || mouse_mode == MOUSE_MODE_CONFINED) { + if (mouse_mode == MOUSE_MODE_CAPTURED || mouse_mode == MOUSE_MODE_CONFINED || mouse_mode == MOUSE_MODE_CONFINED_HIDDEN) { //flush pending motion events _flush_mouse_motion(); WindowData &main_window = windows[MAIN_WINDOW_ID]; @@ -450,7 +450,7 @@ Point2i DisplayServerX11::mouse_get_absolute_position() const { return Vector2i(); } -int DisplayServerX11::mouse_get_button_state() const { +MouseButton DisplayServerX11::mouse_get_button_state() const { return last_button_state; } @@ -2172,13 +2172,13 @@ void DisplayServerX11::_get_key_modifier_state(unsigned int p_x11_state, Ref<Inp state->set_meta_pressed((p_x11_state & Mod4Mask)); } -unsigned int DisplayServerX11::_get_mouse_button_state(unsigned int p_x11_button, int p_x11_type) { - unsigned int mask = 1 << (p_x11_button - 1); +MouseButton DisplayServerX11::_get_mouse_button_state(MouseButton p_x11_button, int p_x11_type) { + MouseButton mask = MouseButton(1 << (p_x11_button - 1)); if (p_x11_type == ButtonPress) { last_button_state |= mask; } else { - last_button_state &= ~mask; + last_button_state &= MouseButton(~mask); } return last_button_state; @@ -2255,7 +2255,7 @@ void DisplayServerX11::_handle_key_event(WindowID p_window, XKeyEvent *p_event, tmp.parse_utf8(utf8string, utf8bytes); for (int i = 0; i < tmp.length(); i++) { Ref<InputEventKey> k; - k.instance(); + k.instantiate(); if (physical_keycode == 0 && keycode == 0 && tmp[i] == 0) { continue; } @@ -2346,7 +2346,7 @@ void DisplayServerX11::_handle_key_event(WindowID p_window, XKeyEvent *p_event, //print_verbose("mod1: "+itos(xkeyevent->state&Mod1Mask)+" mod 5: "+itos(xkeyevent->state&Mod5Mask)); Ref<InputEventKey> k; - k.instance(); + k.instantiate(); k->set_window_id(p_window); _get_key_modifier_state(xkeyevent->state, k); @@ -2766,7 +2766,7 @@ void DisplayServerX11::process_events() { do_mouse_warp = false; // Is the current mouse mode one where it needs to be grabbed. - bool mouse_mode_grab = mouse_mode == MOUSE_MODE_CAPTURED || mouse_mode == MOUSE_MODE_CONFINED; + bool mouse_mode_grab = mouse_mode == MOUSE_MODE_CAPTURED || mouse_mode == MOUSE_MODE_CONFINED || mouse_mode == MOUSE_MODE_CONFINED_HIDDEN; xi.pressure = 0; xi.tilt = Vector2(); @@ -2904,7 +2904,7 @@ void DisplayServerX11::process_events() { bool is_begin = event_data->evtype == XI_TouchBegin; Ref<InputEventScreenTouch> st; - st.instance(); + st.instantiate(); st->set_window_id(window_id); st->set_index(index); st->set_position(pos); @@ -2938,7 +2938,7 @@ void DisplayServerX11::process_events() { if (curr_pos_elem->value() != pos) { Ref<InputEventScreenDrag> sd; - sd.instance(); + sd.instantiate(); sd->set_window_id(window_id); sd->set_index(index); sd->set_position(pos); @@ -3030,7 +3030,7 @@ void DisplayServerX11::process_events() { for (Map<WindowID, WindowData>::Element *E = windows.front(); E; E = E->next()) { if (mouse_mode == MOUSE_MODE_CONFINED) { XUndefineCursor(x11_display, E->get().x11_window); - } else if (mouse_mode == MOUSE_MODE_CAPTURED) { // or re-hide it in captured mode + } else if (mouse_mode == MOUSE_MODE_CAPTURED || mouse_mode == MOUSE_MODE_CONFINED_HIDDEN) { // Or re-hide it. XDefineCursor(x11_display, E->get().x11_window, null_cursor); } @@ -3091,7 +3091,7 @@ void DisplayServerX11::process_events() { // Release every pointer to avoid sticky points for (Map<int, Vector2>::Element *E = xi.state.front(); E; E = E->next()) { Ref<InputEventScreenTouch> st; - st.instance(); + st.instantiate(); st->set_index(E->key()); st->set_window_id(window_id); st->set_position(E->get()); @@ -3126,15 +3126,15 @@ void DisplayServerX11::process_events() { } Ref<InputEventMouseButton> mb; - mb.instance(); + mb.instantiate(); mb->set_window_id(window_id); _get_key_modifier_state(event.xbutton.state, mb); - mb->set_button_index(event.xbutton.button); - if (mb->get_button_index() == 2) { - mb->set_button_index(3); - } else if (mb->get_button_index() == 3) { - mb->set_button_index(2); + mb->set_button_index((MouseButton)event.xbutton.button); + if (mb->get_button_index() == MOUSE_BUTTON_RIGHT) { + mb->set_button_index(MOUSE_BUTTON_MIDDLE); + } else if (mb->get_button_index() == MOUSE_BUTTON_MIDDLE) { + mb->set_button_index(MOUSE_BUTTON_RIGHT); } mb->set_button_mask(_get_mouse_button_state(mb->get_button_index(), event.xbutton.type)); mb->set_position(Vector2(event.xbutton.x, event.xbutton.y)); @@ -3291,13 +3291,13 @@ void DisplayServerX11::process_events() { } Ref<InputEventMouseMotion> mm; - mm.instance(); + mm.instantiate(); mm->set_window_id(window_id); if (xi.pressure_supported) { mm->set_pressure(xi.pressure); } else { - mm->set_pressure((mouse_get_button_state() & (1 << (MOUSE_BUTTON_LEFT - 1))) ? 1.0f : 0.0f); + mm->set_pressure((mouse_get_button_state() & MOUSE_BUTTON_MASK_LEFT) ? 1.0f : 0.0f); } mm->set_tilt(xi.tilt); @@ -3855,8 +3855,6 @@ DisplayServerX11::DisplayServerX11(const String &p_rendering_driver, WindowMode img[i] = nullptr; } - last_button_state = 0; - xmbstring = nullptr; last_click_ms = 0; diff --git a/platform/linuxbsd/display_server_x11.h b/platform/linuxbsd/display_server_x11.h index 10686d8424..594a38d39e 100644 --- a/platform/linuxbsd/display_server_x11.h +++ b/platform/linuxbsd/display_server_x11.h @@ -162,7 +162,7 @@ class DisplayServerX11 : public DisplayServer { Point2i last_click_pos; uint64_t last_click_ms; int last_click_button_index; - uint32_t last_button_state; + MouseButton last_button_state = MOUSE_BUTTON_NONE; bool app_focused = false; uint64_t time_since_no_focus = 0; @@ -187,7 +187,7 @@ class DisplayServerX11 : public DisplayServer { bool _refresh_device_info(); - unsigned int _get_mouse_button_state(unsigned int p_x11_button, int p_x11_type); + MouseButton _get_mouse_button_state(MouseButton p_x11_button, int p_x11_type); void _get_key_modifier_state(unsigned int p_x11_state, Ref<InputEventWithModifiers> state); void _flush_mouse_motion(); @@ -279,7 +279,7 @@ public: virtual void mouse_warp_to_position(const Point2i &p_to); virtual Point2i mouse_get_position() const; virtual Point2i mouse_get_absolute_position() const; - virtual int mouse_get_button_state() const; + virtual MouseButton mouse_get_button_state() const; virtual void clipboard_set(const String &p_text); virtual String clipboard_get() const; diff --git a/platform/linuxbsd/export/export.cpp b/platform/linuxbsd/export/export.cpp index cb95068314..5c6be2d7d4 100644 --- a/platform/linuxbsd/export/export.cpp +++ b/platform/linuxbsd/export/export.cpp @@ -30,7 +30,7 @@ #include "export.h" -#include "core/os/file_access.h" +#include "core/io/file_access.h" #include "editor/editor_export.h" #include "platform/linuxbsd/logo.gen.h" #include "scene/resources/texture.h" @@ -39,11 +39,11 @@ static Error fixup_embedded_pck(const String &p_path, int64_t p_embedded_start, void register_linuxbsd_exporter() { Ref<EditorExportPlatformPC> platform; - platform.instance(); + platform.instantiate(); Ref<Image> img = memnew(Image(_linuxbsd_logo)); Ref<ImageTexture> logo; - logo.instance(); + logo.instantiate(); logo->create_from_image(img); platform->set_logo(logo); platform->set_name("Linux/X11"); diff --git a/platform/linuxbsd/joypad_linux.cpp b/platform/linuxbsd/joypad_linux.cpp index e8f4352dff..8b6dbc4c20 100644 --- a/platform/linuxbsd/joypad_linux.cpp +++ b/platform/linuxbsd/joypad_linux.cpp @@ -475,7 +475,7 @@ void JoypadLinux::process_joypads() { switch (ev.type) { case EV_KEY: - input->joy_button(i, joy->key_map[ev.code], ev.value); + input->joy_button(i, (JoyButton)joy->key_map[ev.code], ev.value); break; case EV_ABS: @@ -484,29 +484,29 @@ void JoypadLinux::process_joypads() { case ABS_HAT0X: if (ev.value != 0) { if (ev.value < 0) { - joy->dpad = (joy->dpad | Input::HAT_MASK_LEFT) & ~Input::HAT_MASK_RIGHT; + joy->dpad = (HatMask)((joy->dpad | HatMask::HAT_MASK_LEFT) & ~HatMask::HAT_MASK_RIGHT); } else { - joy->dpad = (joy->dpad | Input::HAT_MASK_RIGHT) & ~Input::HAT_MASK_LEFT; + joy->dpad = (HatMask)((joy->dpad | HatMask::HAT_MASK_RIGHT) & ~HatMask::HAT_MASK_LEFT); } } else { - joy->dpad &= ~(Input::HAT_MASK_LEFT | Input::HAT_MASK_RIGHT); + joy->dpad &= ~(HatMask::HAT_MASK_LEFT | HatMask::HAT_MASK_RIGHT); } - input->joy_hat(i, joy->dpad); + input->joy_hat(i, (HatMask)joy->dpad); break; case ABS_HAT0Y: if (ev.value != 0) { if (ev.value < 0) { - joy->dpad = (joy->dpad | Input::HAT_MASK_UP) & ~Input::HAT_MASK_DOWN; + joy->dpad = (HatMask)((joy->dpad | HatMask::HAT_MASK_UP) & ~HatMask::HAT_MASK_DOWN); } else { - joy->dpad = (joy->dpad | Input::HAT_MASK_DOWN) & ~Input::HAT_MASK_UP; + joy->dpad = (HatMask)((joy->dpad | HatMask::HAT_MASK_DOWN) & ~HatMask::HAT_MASK_UP); } } else { - joy->dpad &= ~(Input::HAT_MASK_UP | Input::HAT_MASK_DOWN); + joy->dpad &= ~(HatMask::HAT_MASK_UP | HatMask::HAT_MASK_DOWN); } - input->joy_hat(i, joy->dpad); + input->joy_hat(i, (HatMask)joy->dpad); break; default: @@ -526,7 +526,7 @@ void JoypadLinux::process_joypads() { for (int j = 0; j < MAX_ABS; j++) { int index = joy->abs_map[j]; if (index != -1) { - input->joy_axis(i, index, joy->curr_axis[index]); + input->joy_axis(i, (JoyAxis)index, joy->curr_axis[index]); } } if (len == 0 || (len < 0 && errno != EAGAIN)) { diff --git a/platform/linuxbsd/os_linuxbsd.cpp b/platform/linuxbsd/os_linuxbsd.cpp index 23e448fbd7..c6a2fa5be7 100644 --- a/platform/linuxbsd/os_linuxbsd.cpp +++ b/platform/linuxbsd/os_linuxbsd.cpp @@ -30,7 +30,7 @@ #include "os_linuxbsd.h" -#include "core/os/dir_access.h" +#include "core/io/dir_access.h" #include "main/main.h" #ifdef X11_ENABLED @@ -166,7 +166,7 @@ bool OS_LinuxBSD::_check_internal_feature_support(const String &p_feature) { String OS_LinuxBSD::get_config_path() const { if (has_environment("XDG_CONFIG_HOME")) { - if (get_environment("XDG_CONFIG_HOME").is_abs_path()) { + if (get_environment("XDG_CONFIG_HOME").is_absolute_path()) { return get_environment("XDG_CONFIG_HOME"); } else { WARN_PRINT_ONCE("`XDG_CONFIG_HOME` is a relative path. Ignoring its value and falling back to `$HOME/.config` or `.` per the XDG Base Directory specification."); @@ -181,7 +181,7 @@ String OS_LinuxBSD::get_config_path() const { String OS_LinuxBSD::get_data_path() const { if (has_environment("XDG_DATA_HOME")) { - if (get_environment("XDG_DATA_HOME").is_abs_path()) { + if (get_environment("XDG_DATA_HOME").is_absolute_path()) { return get_environment("XDG_DATA_HOME"); } else { WARN_PRINT_ONCE("`XDG_DATA_HOME` is a relative path. Ignoring its value and falling back to `$HOME/.local/share` or `get_config_path()` per the XDG Base Directory specification."); @@ -196,7 +196,7 @@ String OS_LinuxBSD::get_data_path() const { String OS_LinuxBSD::get_cache_path() const { if (has_environment("XDG_CACHE_HOME")) { - if (get_environment("XDG_CACHE_HOME").is_abs_path()) { + if (get_environment("XDG_CACHE_HOME").is_absolute_path()) { return get_environment("XDG_CACHE_HOME"); } else { WARN_PRINT_ONCE("`XDG_CACHE_HOME` is a relative path. Ignoring its value and falling back to `$HOME/.cache` or `get_config_path()` per the XDG Base Directory specification."); @@ -425,8 +425,8 @@ Error OS_LinuxBSD::move_to_trash(const String &p_path) { // Generates the .trashinfo file OS::Date date = OS::get_singleton()->get_date(false); OS::Time time = OS::get_singleton()->get_time(false); - String timestamp = vformat("%04d-%02d-%02dT%02d:%02d:", date.year, date.month, date.day, time.hour, time.min); - timestamp = vformat("%s%02d", timestamp, time.sec); // vformat only supports up to 6 arguments. + String timestamp = vformat("%04d-%02d-%02dT%02d:%02d:", date.year, date.month, date.day, time.hour, time.minute); + timestamp = vformat("%s%02d", timestamp, time.second); // vformat only supports up to 6 arguments. String trash_info = "[Trash Info]\nPath=" + p_path.uri_encode() + "\nDeletionDate=" + timestamp + "\n"; { Error err; diff --git a/platform/osx/dir_access_osx.h b/platform/osx/dir_access_osx.h index f61581979f..a894723e64 100644 --- a/platform/osx/dir_access_osx.h +++ b/platform/osx/dir_access_osx.h @@ -38,7 +38,7 @@ #include <sys/types.h> #include <unistd.h> -#include "core/os/dir_access.h" +#include "core/io/dir_access.h" #include "drivers/unix/dir_access_unix.h" class DirAccessOSX : public DirAccessUnix { diff --git a/platform/osx/display_server_osx.h b/platform/osx/display_server_osx.h index 9fac99810b..5f7f5f84a2 100644 --- a/platform/osx/display_server_osx.h +++ b/platform/osx/display_server_osx.h @@ -173,7 +173,7 @@ public: MouseMode mouse_mode; Point2i last_mouse_pos; - uint32_t last_button_state; + MouseButton last_button_state = MOUSE_BUTTON_NONE; bool window_focused; bool drop_events; @@ -217,7 +217,7 @@ public: virtual void mouse_warp_to_position(const Point2i &p_to) override; virtual Point2i mouse_get_position() const override; virtual Point2i mouse_get_absolute_position() const override; - virtual int mouse_get_button_state() const override; + virtual MouseButton mouse_get_button_state() const override; virtual void clipboard_set(const String &p_text) override; virtual String clipboard_get() const override; diff --git a/platform/osx/display_server_osx.mm b/platform/osx/display_server_osx.mm index f53b60891f..ec51ec78d3 100644 --- a/platform/osx/display_server_osx.mm +++ b/platform/osx/display_server_osx.mm @@ -119,7 +119,7 @@ static NSCursor *_cursorFromSelector(SEL selector, SEL fallback = nil) { if ([event type] == NSEventTypeKeyDown) { if (([event modifierFlags] & NSEventModifierFlagCommand) && [event keyCode] == 0x2f) { Ref<InputEventKey> k; - k.instance(); + k.instantiate(); _get_key_modifier_state([event modifierFlags], k); k->set_window_id(DisplayServerOSX::INVALID_WINDOW_ID); @@ -813,18 +813,18 @@ static const NSRange kEmptyRange = { NSNotFound, 0 }; DS_OSX->cursor_set_shape(p_shape); } -static void _mouseDownEvent(DisplayServer::WindowID window_id, NSEvent *event, int index, int mask, bool pressed) { +static void _mouseDownEvent(DisplayServer::WindowID window_id, NSEvent *event, MouseButton index, MouseButton mask, bool pressed) { ERR_FAIL_COND(!DS_OSX->windows.has(window_id)); DisplayServerOSX::WindowData &wd = DS_OSX->windows[window_id]; if (pressed) { DS_OSX->last_button_state |= mask; } else { - DS_OSX->last_button_state &= ~mask; + DS_OSX->last_button_state &= (MouseButton)~mask; } Ref<InputEventMouseButton> mb; - mb.instance(); + mb.instantiate(); mb->set_window_id(window_id); const Vector2 pos = _get_mouse_pos(wd, [event locationInWindow]); _get_key_modifier_state([event modifierFlags], mb); @@ -884,7 +884,7 @@ static void _mouseDownEvent(DisplayServer::WindowID window_id, NSEvent *event, i return; } - if (DS_OSX->mouse_mode == DisplayServer::MOUSE_MODE_CONFINED) { + if (DS_OSX->mouse_mode == DisplayServer::MOUSE_MODE_CONFINED || DS_OSX->mouse_mode == DisplayServer::MOUSE_MODE_CONFINED_HIDDEN) { // Discard late events if (([event timestamp]) < DS_OSX->last_warp) { return; @@ -928,7 +928,7 @@ static void _mouseDownEvent(DisplayServer::WindowID window_id, NSEvent *event, i } Ref<InputEventMouseMotion> mm; - mm.instance(); + mm.instantiate(); mm->set_window_id(window_id); mm->set_button_mask(DS_OSX->last_button_state); @@ -1016,7 +1016,7 @@ static void _mouseDownEvent(DisplayServer::WindowID window_id, NSEvent *event, i DisplayServerOSX::WindowData &wd = DS_OSX->windows[window_id]; Ref<InputEventMagnifyGesture> ev; - ev.instance(); + ev.instantiate(); ev->set_window_id(window_id); _get_key_modifier_state([event modifierFlags], ev); ev->set_position(_get_mouse_pos(wd, [event locationInWindow])); @@ -1485,14 +1485,14 @@ static int remapKey(unsigned int key, unsigned int state) { } } -inline void sendScrollEvent(DisplayServer::WindowID window_id, int button, double factor, int modifierFlags) { +inline void sendScrollEvent(DisplayServer::WindowID window_id, MouseButton button, double factor, int modifierFlags) { ERR_FAIL_COND(!DS_OSX->windows.has(window_id)); DisplayServerOSX::WindowData &wd = DS_OSX->windows[window_id]; - unsigned int mask = 1 << (button - 1); + MouseButton mask = MouseButton(1 << (button - 1)); Ref<InputEventMouseButton> sc; - sc.instance(); + sc.instantiate(); sc->set_window_id(window_id); _get_key_modifier_state(modifierFlags, sc); @@ -1501,19 +1501,19 @@ inline void sendScrollEvent(DisplayServer::WindowID window_id, int button, doubl sc->set_pressed(true); sc->set_position(wd.mouse_pos); sc->set_global_position(wd.mouse_pos); - DS_OSX->last_button_state |= mask; + DS_OSX->last_button_state |= (MouseButton)mask; sc->set_button_mask(DS_OSX->last_button_state); Input::get_singleton()->accumulate_input_event(sc); - sc.instance(); + sc.instantiate(); sc->set_window_id(window_id); sc->set_button_index(button); sc->set_factor(factor); sc->set_pressed(false); sc->set_position(wd.mouse_pos); sc->set_global_position(wd.mouse_pos); - DS_OSX->last_button_state &= ~mask; + DS_OSX->last_button_state &= (MouseButton)~mask; sc->set_button_mask(DS_OSX->last_button_state); Input::get_singleton()->accumulate_input_event(sc); @@ -1524,7 +1524,7 @@ inline void sendPanEvent(DisplayServer::WindowID window_id, double dx, double dy DisplayServerOSX::WindowData &wd = DS_OSX->windows[window_id]; Ref<InputEventPanGesture> pg; - pg.instance(); + pg.instantiate(); pg->set_window_id(window_id); _get_key_modifier_state(modifierFlags, pg); @@ -2106,7 +2106,12 @@ void DisplayServerOSX::mouse_set_mode(MouseMode p_mode) { } else if (p_mode == MOUSE_MODE_CONFINED) { CGDisplayShowCursor(kCGDirectMainDisplay); CGAssociateMouseAndMouseCursorPosition(false); - } else { + } else if (p_mode == MOUSE_MODE_CONFINED_HIDDEN) { + if (mouse_mode == MOUSE_MODE_VISIBLE || mouse_mode == MOUSE_MODE_CONFINED) { + CGDisplayHideCursor(kCGDirectMainDisplay); + } + CGAssociateMouseAndMouseCursorPosition(false); + } else { // MOUSE_MODE_VISIBLE CGDisplayShowCursor(kCGDirectMainDisplay); CGAssociateMouseAndMouseCursorPosition(true); } @@ -2143,7 +2148,7 @@ void DisplayServerOSX::mouse_warp_to_position(const Point2i &p_to) { CGEventSourceSetLocalEventsSuppressionInterval(lEventRef, 0.0); CGAssociateMouseAndMouseCursorPosition(false); CGWarpMouseCursorPosition(lMouseWarpPos); - if (mouse_mode != MOUSE_MODE_CONFINED) { + if (mouse_mode != MOUSE_MODE_CONFINED && mouse_mode != MOUSE_MODE_CONFINED_HIDDEN) { CGAssociateMouseAndMouseCursorPosition(true); } } @@ -2168,7 +2173,7 @@ Point2i DisplayServerOSX::mouse_get_absolute_position() const { return Vector2i(); } -int DisplayServerOSX::mouse_get_button_state() const { +MouseButton DisplayServerOSX::mouse_get_button_state() const { return last_button_state; } @@ -3370,7 +3375,7 @@ void DisplayServerOSX::_process_key_events() { const KeyEvent &ke = key_event_buffer[i]; if (ke.raw) { // Non IME input - no composite characters, pass events as is - k.instance(); + k.instantiate(); k->set_window_id(ke.window_id); _get_key_modifier_state(ke.osx_state, k); @@ -3384,7 +3389,7 @@ void DisplayServerOSX::_process_key_events() { } else { // IME input if ((i == 0 && ke.keycode == 0) || (i > 0 && key_event_buffer[i - 1].keycode == 0)) { - k.instance(); + k.instantiate(); k->set_window_id(ke.window_id); _get_key_modifier_state(ke.osx_state, k); @@ -3397,7 +3402,7 @@ void DisplayServerOSX::_process_key_events() { _push_input(k); } if (ke.keycode != 0) { - k.instance(); + k.instantiate(); k->set_window_id(ke.window_id); _get_key_modifier_state(ke.osx_state, k); @@ -3750,7 +3755,6 @@ DisplayServerOSX::DisplayServerOSX(const String &p_rendering_driver, WindowMode key_event_pos = 0; mouse_mode = MOUSE_MODE_VISIBLE; - last_button_state = 0; autoreleasePool = [[NSAutoreleasePool alloc] init]; diff --git a/platform/osx/export/export.cpp b/platform/osx/export/export.cpp index 6d995412ab..f68ff32012 100644 --- a/platform/osx/export/export.cpp +++ b/platform/osx/export/export.cpp @@ -31,11 +31,11 @@ #include "export.h" #include "core/config/project_settings.h" +#include "core/io/dir_access.h" +#include "core/io/file_access.h" #include "core/io/marshalls.h" #include "core/io/resource_saver.h" #include "core/io/zip_io.h" -#include "core/os/dir_access.h" -#include "core/os/file_access.h" #include "core/os/os.h" #include "core/version.h" #include "editor/editor_export.h" @@ -147,6 +147,7 @@ void EditorExportPlatformOSX::get_export_options(List<ExportOption> *r_options) r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "application/icon", PROPERTY_HINT_FILE, "*.png,*.icns"), "")); r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "application/bundle_identifier", PROPERTY_HINT_PLACEHOLDER_TEXT, "com.example.game"), "")); r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "application/signature"), "")); + r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "application/app_category", PROPERTY_HINT_ENUM, "Business,Developer-tools,Education,Entertainment,Finance,Games,Action-games,Adventure-games,Arcade-games,Board-games,Card-games,Casino-games,Dice-games,Educational-games,Family-games,Kids-games,Music-games,Puzzle-games,Racing-games,Role-playing-games,Simulation-games,Sports-games,Strategy-games,Trivia-games,Word-games,Graphics-design,Healthcare-fitness,Lifestyle,Medical,Music,News,Photography,Productivity,Reference,Social-networking,Sports,Travel,Utilities,Video,Weather"), "Games")); r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "application/short_version"), "1.0")); r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "application/version"), "1.0")); r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "application/copyright"), "")); @@ -386,6 +387,9 @@ void EditorExportPlatformOSX::_fix_plist(const Ref<EditorExportPreset> &p_preset strnew += lines[i].replace("$version", p_preset->get("application/version")) + "\n"; } else if (lines[i].find("$signature") != -1) { strnew += lines[i].replace("$signature", p_preset->get("application/signature")) + "\n"; + } else if (lines[i].find("$app_category") != -1) { + String cat = p_preset->get("application/app_category"); + strnew += lines[i].replace("$app_category", cat.to_lower()) + "\n"; } else if (lines[i].find("$copyright") != -1) { strnew += lines[i].replace("$copyright", p_preset->get("application/copyright")) + "\n"; } else if (lines[i].find("$highres") != -1) { @@ -696,7 +700,7 @@ Error EditorExportPlatformOSX::export_project(const Ref<EditorExportPreset> &p_p } } else { Ref<Image> icon; - icon.instance(); + icon.instantiate(); icon->load(iconpath); if (!icon->is_empty()) { _make_icon(icon, data); @@ -1000,9 +1004,9 @@ void EditorExportPlatformOSX::_zip_folder_recursive(zipFile &p_zip, const String zip_fileinfo zipfi; zipfi.tmz_date.tm_hour = time.hour; zipfi.tmz_date.tm_mday = date.day; - zipfi.tmz_date.tm_min = time.min; + zipfi.tmz_date.tm_min = time.minute; zipfi.tmz_date.tm_mon = date.month - 1; // Note: "tm" month range - 0..11, Godot month range - 1..12, http://www.cplusplus.com/reference/ctime/tm/ - zipfi.tmz_date.tm_sec = time.sec; + zipfi.tmz_date.tm_sec = time.second; zipfi.tmz_date.tm_year = date.year; zipfi.dosDate = 0; // 0120000: symbolic link type @@ -1045,9 +1049,9 @@ void EditorExportPlatformOSX::_zip_folder_recursive(zipFile &p_zip, const String zip_fileinfo zipfi; zipfi.tmz_date.tm_hour = time.hour; zipfi.tmz_date.tm_mday = date.day; - zipfi.tmz_date.tm_min = time.min; + zipfi.tmz_date.tm_min = time.minute; zipfi.tmz_date.tm_mon = date.month - 1; // Note: "tm" month range - 0..11, Godot month range - 1..12, http://www.cplusplus.com/reference/ctime/tm/ - zipfi.tmz_date.tm_sec = time.sec; + zipfi.tmz_date.tm_sec = time.second; zipfi.tmz_date.tm_year = date.year; zipfi.dosDate = 0; // 0100000: regular file type @@ -1147,7 +1151,7 @@ bool EditorExportPlatformOSX::can_export(const Ref<EditorExportPreset> &p_preset EditorExportPlatformOSX::EditorExportPlatformOSX() { Ref<Image> img = memnew(Image(_osx_logo)); - logo.instance(); + logo.instantiate(); logo->create_from_image(img); } @@ -1156,7 +1160,7 @@ EditorExportPlatformOSX::~EditorExportPlatformOSX() { void register_osx_exporter() { Ref<EditorExportPlatformOSX> platform; - platform.instance(); + platform.instantiate(); EditorExport::get_singleton()->add_export_platform(platform); } diff --git a/platform/osx/joypad_osx.cpp b/platform/osx/joypad_osx.cpp index b12526915f..126ebc1908 100644 --- a/platform/osx/joypad_osx.cpp +++ b/platform/osx/joypad_osx.cpp @@ -390,38 +390,38 @@ bool joypad::check_ff_features() { static int process_hat_value(int p_min, int p_max, int p_value) { int range = (p_max - p_min + 1); int value = p_value - p_min; - int hat_value = Input::HAT_MASK_CENTER; + int hat_value = HatMask::HAT_MASK_CENTER; if (range == 4) { value *= 2; } switch (value) { case 0: - hat_value = Input::HAT_MASK_UP; + hat_value = (HatMask)HatMask::HAT_MASK_UP; break; case 1: - hat_value = Input::HAT_MASK_UP | Input::HAT_MASK_RIGHT; + hat_value = (HatMask)(HatMask::HAT_MASK_UP | HatMask::HAT_MASK_RIGHT); break; case 2: - hat_value = Input::HAT_MASK_RIGHT; + hat_value = (HatMask)HatMask::HAT_MASK_RIGHT; break; case 3: - hat_value = Input::HAT_MASK_DOWN | Input::HAT_MASK_RIGHT; + hat_value = (HatMask)(HatMask::HAT_MASK_DOWN | HatMask::HAT_MASK_RIGHT); break; case 4: - hat_value = Input::HAT_MASK_DOWN; + hat_value = (HatMask)HatMask::HAT_MASK_DOWN; break; case 5: - hat_value = Input::HAT_MASK_DOWN | Input::HAT_MASK_LEFT; + hat_value = (HatMask)(HatMask::HAT_MASK_DOWN | HatMask::HAT_MASK_LEFT); break; case 6: - hat_value = Input::HAT_MASK_LEFT; + hat_value = (HatMask)HatMask::HAT_MASK_LEFT; break; case 7: - hat_value = Input::HAT_MASK_UP | Input::HAT_MASK_LEFT; + hat_value = (HatMask)(HatMask::HAT_MASK_UP | HatMask::HAT_MASK_LEFT); break; default: - hat_value = Input::HAT_MASK_CENTER; + hat_value = (HatMask)HatMask::HAT_MASK_CENTER; break; } return hat_value; @@ -458,17 +458,17 @@ void JoypadOSX::process_joypads() { for (int j = 0; j < joy.axis_elements.size(); j++) { rec_element &elem = joy.axis_elements.write[j]; int value = joy.get_hid_element_state(&elem); - input->joy_axis(joy.id, j, axis_correct(value, elem.min, elem.max)); + input->joy_axis(joy.id, (JoyAxis)j, axis_correct(value, elem.min, elem.max)); } for (int j = 0; j < joy.button_elements.size(); j++) { int value = joy.get_hid_element_state(&joy.button_elements.write[j]); - input->joy_button(joy.id, j, (value >= 1)); + input->joy_button(joy.id, (JoyButton)j, (value >= 1)); } for (int j = 0; j < joy.hat_elements.size(); j++) { rec_element &elem = joy.hat_elements.write[j]; int value = joy.get_hid_element_state(&elem); int hat_value = process_hat_value(elem.min, elem.max, value); - input->joy_hat(joy.id, hat_value); + input->joy_hat(joy.id, (HatMask)hat_value); } if (joy.ffservice) { diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm index 9e3f0350e9..b65d84d900 100644 --- a/platform/osx/os_osx.mm +++ b/platform/osx/os_osx.mm @@ -190,7 +190,7 @@ MainLoop *OS_OSX::get_main_loop() const { String OS_OSX::get_config_path() const { // The XDG Base Directory specification technically only applies on Linux/*BSD, but it doesn't hurt to support it on macOS as well. if (has_environment("XDG_CONFIG_HOME")) { - if (get_environment("XDG_CONFIG_HOME").is_abs_path()) { + if (get_environment("XDG_CONFIG_HOME").is_absolute_path()) { return get_environment("XDG_CONFIG_HOME"); } else { WARN_PRINT_ONCE("`XDG_CONFIG_HOME` is a relative path. Ignoring its value and falling back to `$HOME/Library/Application Support` or `.` per the XDG Base Directory specification."); @@ -205,7 +205,7 @@ String OS_OSX::get_config_path() const { String OS_OSX::get_data_path() const { // The XDG Base Directory specification technically only applies on Linux/*BSD, but it doesn't hurt to support it on macOS as well. if (has_environment("XDG_DATA_HOME")) { - if (get_environment("XDG_DATA_HOME").is_abs_path()) { + if (get_environment("XDG_DATA_HOME").is_absolute_path()) { return get_environment("XDG_DATA_HOME"); } else { WARN_PRINT_ONCE("`XDG_DATA_HOME` is a relative path. Ignoring its value and falling back to `get_config_path()` per the XDG Base Directory specification."); @@ -217,7 +217,7 @@ String OS_OSX::get_data_path() const { String OS_OSX::get_cache_path() const { // The XDG Base Directory specification technically only applies on Linux/*BSD, but it doesn't hurt to support it on macOS as well. if (has_environment("XDG_CACHE_HOME")) { - if (get_environment("XDG_CACHE_HOME").is_abs_path()) { + if (get_environment("XDG_CACHE_HOME").is_absolute_path()) { return get_environment("XDG_CACHE_HOME"); } else { WARN_PRINT_ONCE("`XDG_CACHE_HOME` is a relative path. Ignoring its value and falling back to `$HOME/Libary/Caches` or `get_config_path()` per the XDG Base Directory specification."); diff --git a/platform/server/SCsub b/platform/server/SCsub deleted file mode 100644 index 15b9af4d25..0000000000 --- a/platform/server/SCsub +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env python - -import sys - -Import("env") - -common_server = [ - "os_server.cpp", -] - -if sys.platform == "darwin": - common_server.append("#platform/osx/crash_handler_osx.mm") -else: - common_server.append("#platform/x11/crash_handler_x11.cpp") - -prog = env.add_program("#bin/godot_server", ["godot_server.cpp"] + common_server) diff --git a/platform/server/detect.py b/platform/server/detect.py deleted file mode 100644 index 478bcad212..0000000000 --- a/platform/server/detect.py +++ /dev/null @@ -1,296 +0,0 @@ -import os -import platform -import sys - -# This file is mostly based on platform/x11/detect.py. -# If editing this file, make sure to apply relevant changes here too. - - -def is_active(): - return True - - -def get_name(): - return "Server" - - -def get_program_suffix(): - if sys.platform == "darwin": - return "osx" - return "linuxbsd" - - -def can_build(): - if os.name != "posix": - return False - - return True - - -def get_opts(): - from SCons.Variables import BoolVariable, EnumVariable - - return [ - BoolVariable("use_llvm", "Use the LLVM compiler", False), - BoolVariable("use_static_cpp", "Link libgcc and libstdc++ statically for better portability", True), - BoolVariable("use_coverage", "Test Godot coverage", False), - BoolVariable("use_ubsan", "Use LLVM/GCC compiler undefined behavior sanitizer (UBSAN)", False), - BoolVariable("use_asan", "Use LLVM/GCC compiler address sanitizer (ASAN)", False), - BoolVariable("use_lsan", "Use LLVM/GCC compiler leak sanitizer (LSAN)", False), - BoolVariable("use_tsan", "Use LLVM/GCC compiler thread sanitizer (TSAN)", False), - BoolVariable("use_msan", "Use LLVM compiler memory sanitizer (MSAN)", False), - BoolVariable("debug_symbols", "Add debugging symbols to release/release_debug builds", True), - BoolVariable("separate_debug_symbols", "Create a separate file containing debugging symbols", False), - BoolVariable("execinfo", "Use libexecinfo on systems where glibc is not available", False), - ] - - -def get_flags(): - return [] - - -def configure(env): - - ## Build type - - if env["target"] == "release": - if env["optimize"] == "speed": # optimize for speed (default) - env.Prepend(CCFLAGS=["-O3"]) - elif env["optimize"] == "size": # optimize for size - env.Prepend(CCFLAGS=["-Os"]) - - if env["debug_symbols"]: - env.Prepend(CCFLAGS=["-g2"]) - - elif env["target"] == "release_debug": - if env["optimize"] == "speed": # optimize for speed (default) - env.Prepend(CCFLAGS=["-O2"]) - elif env["optimize"] == "size": # optimize for size - env.Prepend(CCFLAGS=["-Os"]) - env.Prepend(CPPDEFINES=["DEBUG_ENABLED"]) - - if env["debug_symbols"]: - env.Prepend(CCFLAGS=["-g2"]) - - elif env["target"] == "debug": - env.Prepend(CCFLAGS=["-g3"]) - env.Prepend(CPPDEFINES=["DEBUG_ENABLED"]) - env.Append(LINKFLAGS=["-rdynamic"]) - - ## Architecture - - is64 = sys.maxsize > 2 ** 32 - if env["bits"] == "default": - env["bits"] = "64" if is64 else "32" - - ## Compiler configuration - - if "CXX" in env and "clang" in os.path.basename(env["CXX"]): - # Convenience check to enforce the use_llvm overrides when CXX is clang(++) - env["use_llvm"] = True - - if env["use_llvm"]: - if "clang++" not in os.path.basename(env["CXX"]): - env["CC"] = "clang" - env["CXX"] = "clang++" - env.extra_suffix = ".llvm" + env.extra_suffix - env.Append(LIBS=["atomic"]) - - if env["use_coverage"]: - env.Append(CCFLAGS=["-ftest-coverage", "-fprofile-arcs"]) - env.Append(LINKFLAGS=["-ftest-coverage", "-fprofile-arcs"]) - - if env["use_ubsan"] or env["use_asan"] or env["use_lsan"] or env["use_tsan"] or env["use_msan"]: - env.extra_suffix += "s" - - if env["use_ubsan"]: - env.Append( - CCFLAGS=[ - "-fsanitize=undefined,shift,shift-exponent,integer-divide-by-zero,unreachable,vla-bound,null,return,signed-integer-overflow,bounds,float-divide-by-zero,float-cast-overflow,nonnull-attribute,returns-nonnull-attribute,bool,enum,vptr,pointer-overflow,builtin" - ] - ) - env.Append(LINKFLAGS=["-fsanitize=undefined"]) - if env["use_llvm"]: - env.Append( - CCFLAGS=[ - "-fsanitize=nullability-return,nullability-arg,function,nullability-assign,implicit-integer-sign-change" - ] - ) - else: - env.Append(CCFLAGS=["-fsanitize=bounds-strict"]) - - if env["use_asan"]: - env.Append(CCFLAGS=["-fsanitize=address,pointer-subtract,pointer-compare"]) - env.Append(LINKFLAGS=["-fsanitize=address"]) - - if env["use_lsan"]: - env.Append(CCFLAGS=["-fsanitize=leak"]) - env.Append(LINKFLAGS=["-fsanitize=leak"]) - - if env["use_tsan"]: - env.Append(CCFLAGS=["-fsanitize=thread"]) - env.Append(LINKFLAGS=["-fsanitize=thread"]) - - if env["use_msan"] and env["use_llvm"]: - env.Append(CCFLAGS=["-fsanitize=memory"]) - env.Append(CCFLAGS=["-fsanitize-memory-track-origins"]) - env.Append(CCFLAGS=["-fsanitize-recover=memory"]) - env.Append(LINKFLAGS=["-fsanitize=memory"]) - - if env["use_lto"]: - env.Append(CCFLAGS=["-flto"]) - if not env["use_llvm"] and env.GetOption("num_jobs") > 1: - env.Append(LINKFLAGS=["-flto=" + str(env.GetOption("num_jobs"))]) - else: - env.Append(LINKFLAGS=["-flto"]) - if not env["use_llvm"]: - env["RANLIB"] = "gcc-ranlib" - env["AR"] = "gcc-ar" - - env.Append(CCFLAGS=["-pipe"]) - env.Append(LINKFLAGS=["-pipe"]) - - ## Dependencies - - # FIXME: Check for existence of the libs before parsing their flags with pkg-config - - # freetype depends on libpng and zlib, so bundling one of them while keeping others - # as shared libraries leads to weird issues - if ( - env["builtin_freetype"] - or env["builtin_libpng"] - or env["builtin_zlib"] - or env["builtin_graphite"] - or env["builtin_harfbuzz"] - ): - env["builtin_freetype"] = True - env["builtin_libpng"] = True - env["builtin_zlib"] = True - env["builtin_graphite"] = True - env["builtin_harfbuzz"] = True - - if not env["builtin_freetype"]: - env.ParseConfig("pkg-config freetype2 --cflags --libs") - - if not env["builtin_graphite"]: - env.ParseConfig("pkg-config graphite2 --cflags --libs") - - if not env["builtin_icu"]: - env.ParseConfig("pkg-config icu-uc --cflags --libs") - - if not env["builtin_harfbuzz"]: - env.ParseConfig("pkg-config harfbuzz harfbuzz-icu --cflags --libs") - - if not env["builtin_libpng"]: - env.ParseConfig("pkg-config libpng16 --cflags --libs") - - if not env["builtin_bullet"]: - # We need at least version 2.89 - import subprocess - - bullet_version = subprocess.check_output(["pkg-config", "bullet", "--modversion"]).strip() - if str(bullet_version) < "2.89": - # Abort as system bullet was requested but too old - print( - "Bullet: System version {0} does not match minimal requirements ({1}). Aborting.".format( - bullet_version, "2.89" - ) - ) - sys.exit(255) - env.ParseConfig("pkg-config bullet --cflags --libs") - - if False: # not env['builtin_assimp']: - # FIXME: Add min version check - env.ParseConfig("pkg-config assimp --cflags --libs") - - if not env["builtin_enet"]: - env.ParseConfig("pkg-config libenet --cflags --libs") - - if not env["builtin_squish"]: - env.ParseConfig("pkg-config libsquish --cflags --libs") - - if not env["builtin_zstd"]: - env.ParseConfig("pkg-config libzstd --cflags --libs") - - # Sound and video libraries - # Keep the order as it triggers chained dependencies (ogg needed by others, etc.) - - if not env["builtin_libtheora"]: - env["builtin_libogg"] = False # Needed to link against system libtheora - env["builtin_libvorbis"] = False # Needed to link against system libtheora - env.ParseConfig("pkg-config theora theoradec --cflags --libs") - else: - list_of_x86 = ["x86_64", "x86", "i386", "i586"] - if any(platform.machine() in s for s in list_of_x86): - env["x86_libtheora_opt_gcc"] = True - - if not env["builtin_libvpx"]: - env.ParseConfig("pkg-config vpx --cflags --libs") - - if not env["builtin_libvorbis"]: - env["builtin_libogg"] = False # Needed to link against system libvorbis - env.ParseConfig("pkg-config vorbis vorbisfile --cflags --libs") - - if not env["builtin_opus"]: - env["builtin_libogg"] = False # Needed to link against system opus - env.ParseConfig("pkg-config opus opusfile --cflags --libs") - - if not env["builtin_libogg"]: - env.ParseConfig("pkg-config ogg --cflags --libs") - - if not env["builtin_libwebp"]: - env.ParseConfig("pkg-config libwebp --cflags --libs") - - if not env["builtin_mbedtls"]: - # mbedTLS does not provide a pkgconfig config yet. See https://github.com/ARMmbed/mbedtls/issues/228 - env.Append(LIBS=["mbedtls", "mbedcrypto", "mbedx509"]) - - if not env["builtin_wslay"]: - env.ParseConfig("pkg-config libwslay --cflags --libs") - - if not env["builtin_miniupnpc"]: - # No pkgconfig file so far, hardcode default paths. - env.Prepend(CPPPATH=["/usr/include/miniupnpc"]) - env.Append(LIBS=["miniupnpc"]) - - # On Linux wchar_t should be 32-bits - # 16-bit library shouldn't be required due to compiler optimisations - if not env["builtin_pcre2"]: - env.ParseConfig("pkg-config libpcre2-32 --cflags --libs") - - ## Flags - - # Linkflags below this line should typically stay the last ones - if not env["builtin_zlib"]: - env.ParseConfig("pkg-config zlib --cflags --libs") - - env.Prepend(CPPPATH=["#platform/server"]) - env.Append(CPPDEFINES=["SERVER_ENABLED", "UNIX_ENABLED"]) - - if platform.system() == "Darwin": - env.Append( - LINKFLAGS=[ - "-framework", - "Cocoa", - "-framework", - "Carbon", - "-lz", - "-framework", - "IOKit", - ] - ) - - env.Append(LIBS=["pthread"]) - - if platform.system() == "Linux": - env.Append(LIBS=["dl"]) - - if platform.system().find("BSD") >= 0: - env["execinfo"] = True - - if env["execinfo"]: - env.Append(LIBS=["execinfo"]) - - # Link those statically for portability - if env["use_static_cpp"]: - env.Append(LINKFLAGS=["-static-libgcc", "-static-libstdc++"]) diff --git a/platform/server/godot_server.cpp b/platform/server/godot_server.cpp deleted file mode 100644 index 1ced95fcbc..0000000000 --- a/platform/server/godot_server.cpp +++ /dev/null @@ -1,49 +0,0 @@ -/*************************************************************************/ -/* godot_server.cpp */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ - -#include "main/main.h" -#include "os_server.h" - -int main(int argc, char *argv[]) { - OS_Server os; - - // We must override main when testing is enabled - TEST_MAIN_OVERRIDE - - Error err = Main::setup(argv[0], argc - 1, &argv[1]); - if (err != OK) - return 255; - - if (Main::start()) - os.run(); // it is actually the OS that decides how to run - Main::cleanup(); - - return os.get_exit_code(); -} diff --git a/platform/server/logo.png b/platform/server/logo.png Binary files differdeleted file mode 100644 index 8666ada9ca..0000000000 --- a/platform/server/logo.png +++ /dev/null diff --git a/platform/server/os_server.cpp b/platform/server/os_server.cpp deleted file mode 100644 index 852ec7c4ef..0000000000 --- a/platform/server/os_server.cpp +++ /dev/null @@ -1,267 +0,0 @@ -/*************************************************************************/ -/* os_server.cpp */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ - -#include "os_server.h" - -#include "core/string/print_string.h" -#include "drivers/dummy/rasterizer_dummy.h" -#include "drivers/dummy/texture_loader_dummy.h" -#include "servers/rendering/rendering_server_default.h" - -#include "main/main.h" - -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> - -int OS_Server::get_video_driver_count() const { - return 1; -} - -const char *OS_Server::get_video_driver_name(int p_driver) const { - return "Dummy"; -} - -int OS_Server::get_current_video_driver() const { - return video_driver_index; -} - -void OS_Server::initialize_core() { - crash_handler.initialize(); - - OS_Unix::initialize_core(); -} - -Error OS_Server::initialize(const VideoMode &p_desired, int p_video_driver, int p_audio_driver) { - args = OS::get_singleton()->get_cmdline_args(); - current_videomode = p_desired; - main_loop = nullptr; - - RasterizerDummy::make_current(); - - video_driver_index = p_video_driver; // unused in server platform, but should still be initialized - - rendering_server = memnew(RenderingServerDefault); - rendering_server->init(); - - AudioDriverManager::initialize(p_audio_driver); - - input = memnew(InputDefault); - - _ensure_user_data_dir(); - - resource_loader_dummy.instance(); - ResourceLoader::add_resource_format_loader(resource_loader_dummy); - - return OK; -} - -void OS_Server::finalize() { - if (main_loop) - memdelete(main_loop); - main_loop = nullptr; - - rendering_server->finish(); - memdelete(rendering_server); - - memdelete(input); - - ResourceLoader::remove_resource_format_loader(resource_loader_dummy); - resource_loader_dummy.unref(); - - args.clear(); -} - -void OS_Server::set_mouse_show(bool p_show) { -} - -void OS_Server::set_mouse_grab(bool p_grab) { - grab = p_grab; -} - -bool OS_Server::is_mouse_grab_enabled() const { - return grab; -} - -int OS_Server::get_mouse_button_state() const { - return 0; -} - -Point2 OS_Server::get_mouse_position() const { - return Point2(); -} - -void OS_Server::set_window_title(const String &p_title) { -} - -void OS_Server::set_video_mode(const VideoMode &p_video_mode, int p_screen) { -} - -OS::VideoMode OS_Server::get_video_mode(int p_screen) const { - return current_videomode; -} - -Size2 OS_Server::get_window_size() const { - return Vector2(current_videomode.width, current_videomode.height); -} - -void OS_Server::get_fullscreen_mode_list(List<VideoMode> *p_list, int p_screen) const { -} - -MainLoop *OS_Server::get_main_loop() const { - return main_loop; -} - -void OS_Server::delete_main_loop() { - if (main_loop) - memdelete(main_loop); - main_loop = nullptr; -} - -void OS_Server::set_main_loop(MainLoop *p_main_loop) { - main_loop = p_main_loop; - input->set_main_loop(p_main_loop); -} - -String OS_Server::get_name() const { - return "Server"; -} - -void OS_Server::move_window_to_foreground() { -} - -bool OS_Server::_check_internal_feature_support(const String &p_feature) { - return p_feature == "pc"; -} - -void OS_Server::run() { - force_quit = false; - - if (!main_loop) - return; - - main_loop->init(); - - while (!force_quit) { - if (Main::iteration()) - break; - }; - - main_loop->finish(); -} - -String OS_Server::get_config_path() const { - if (has_environment("XDG_CONFIG_HOME")) { - return get_environment("XDG_CONFIG_HOME"); - } else if (has_environment("HOME")) { - return get_environment("HOME").plus_file(".config"); - } else { - return "."; - } -} - -String OS_Server::get_data_path() const { - if (has_environment("XDG_DATA_HOME")) { - return get_environment("XDG_DATA_HOME"); - } else if (has_environment("HOME")) { - return get_environment("HOME").plus_file(".local/share"); - } else { - return get_config_path(); - } -} - -String OS_Server::get_cache_path() const { - if (has_environment("XDG_CACHE_HOME")) { - return get_environment("XDG_CACHE_HOME"); - } else if (has_environment("HOME")) { - return get_environment("HOME").plus_file(".cache"); - } else { - return get_config_path(); - } -} - -String OS_Server::get_system_dir(SystemDir p_dir) const { - String xdgparam; - - switch (p_dir) { - case SYSTEM_DIR_DESKTOP: { - xdgparam = "DESKTOP"; - } break; - case SYSTEM_DIR_DCIM: { - xdgparam = "PICTURES"; - - } break; - case SYSTEM_DIR_DOCUMENTS: { - xdgparam = "DOCUMENTS"; - - } break; - case SYSTEM_DIR_DOWNLOADS: { - xdgparam = "DOWNLOAD"; - - } break; - case SYSTEM_DIR_MOVIES: { - xdgparam = "VIDEOS"; - - } break; - case SYSTEM_DIR_MUSIC: { - xdgparam = "MUSIC"; - - } break; - case SYSTEM_DIR_PICTURES: { - xdgparam = "PICTURES"; - - } break; - case SYSTEM_DIR_RINGTONES: { - xdgparam = "MUSIC"; - - } break; - } - - String pipe; - List<String> arg; - arg.push_back(xdgparam); - Error err = const_cast<OS_Server *>(this)->execute("xdg-user-dir", arg, true, nullptr, &pipe); - if (err != OK) - return "."; - return pipe.strip_edges(); -} - -void OS_Server::disable_crash_handler() { - crash_handler.disable(); -} - -bool OS_Server::is_disable_crash_handler() const { - return crash_handler.is_disabled(); -} - -OS_Server::OS_Server() { - //adriver here - grab = false; -}; diff --git a/platform/server/os_server.h b/platform/server/os_server.h deleted file mode 100644 index 61025fa14b..0000000000 --- a/platform/server/os_server.h +++ /dev/null @@ -1,116 +0,0 @@ -/*************************************************************************/ -/* os_server.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ - -#ifndef OS_SERVER_H -#define OS_SERVER_H - -#include "core/input/input.h" -#include "drivers/dummy/texture_loader_dummy.h" -#include "drivers/unix/os_unix.h" -#ifdef __APPLE__ -#include "platform/osx/crash_handler_osx.h" -#include "platform/osx/semaphore_osx.h" -#else -#include "platform/x11/crash_handler_linuxbsd.h" -#endif -#include "servers/audio_server.h" -#include "servers/rendering/renderer_compositor.h" -#include "servers/rendering_server.h" - -#undef CursorShape - -class OS_Server : public OS_Unix { - RenderingServer *rendering_server = nullptr; - VideoMode current_videomode; - List<String> args; - MainLoop *main_loop = nullptr; - - bool grab = false; - - virtual void delete_main_loop(); - - bool force_quit = false; - - InputDefault *input = nullptr; - - CrashHandler crash_handler; - - int video_driver_index = 0; - - Ref<ResourceFormatDummyTexture> resource_loader_dummy; - -protected: - virtual int get_video_driver_count() const; - virtual const char *get_video_driver_name(int p_driver) const; - virtual int get_current_video_driver() const; - - virtual void initialize_core(); - virtual Error initialize(const VideoMode &p_desired, int p_video_driver, int p_audio_driver); - virtual void finalize(); - - virtual void set_main_loop(MainLoop *p_main_loop); - -public: - virtual String get_name() const; - - virtual void set_mouse_show(bool p_show); - virtual void set_mouse_grab(bool p_grab); - virtual bool is_mouse_grab_enabled() const; - virtual Point2 get_mouse_position() const; - virtual int get_mouse_button_state() const; - virtual void set_window_title(const String &p_title); - - virtual MainLoop *get_main_loop() const; - - virtual void set_video_mode(const VideoMode &p_video_mode, int p_screen = 0); - virtual VideoMode get_video_mode(int p_screen = 0) const; - virtual void get_fullscreen_mode_list(List<VideoMode> *p_list, int p_screen = 0) const; - - virtual Size2 get_window_size() const; - - virtual void move_window_to_foreground(); - - void run(); - - virtual bool _check_internal_feature_support(const String &p_feature); - - virtual String get_config_path() const; - virtual String get_data_path() const; - virtual String get_cache_path() const; - - virtual String get_system_dir(SystemDir p_dir) const; - - void disable_crash_handler(); - bool is_disable_crash_handler() const; - - OS_Server(); -}; - -#endif diff --git a/platform/server/platform_config.h b/platform/server/platform_config.h deleted file mode 100644 index 32a19d811b..0000000000 --- a/platform/server/platform_config.h +++ /dev/null @@ -1,49 +0,0 @@ -/*************************************************************************/ -/* platform_config.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ - -#if defined(__linux__) || defined(__APPLE__) -#include <alloca.h> -#endif - -#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) -#include <stdlib.h> // alloca -// FreeBSD and OpenBSD use pthread_set_name_np, while other platforms, -// include NetBSD, use pthread_setname_np. NetBSD's version however requires -// a different format, we handle this directly in thread_posix. -#ifdef __NetBSD__ -#define PTHREAD_NETBSD_SET_NAME -#else -#define PTHREAD_BSD_SET_NAME -#endif -#endif - -#ifdef __APPLE__ -#define PTHREAD_RENAME_SELF -#endif diff --git a/platform/uwp/app.cpp b/platform/uwp/app.cpp index 9d6ff10483..1da17ffc5d 100644 --- a/platform/uwp/app.cpp +++ b/platform/uwp/app.cpp @@ -34,8 +34,8 @@ #include "app.h" -#include "core/os/dir_access.h" -#include "core/os/file_access.h" +#include "core/io/dir_access.h" +#include "core/io/file_access.h" #include "core/os/keyboard.h" #include "main/main.h" @@ -145,7 +145,7 @@ void App::SetWindow(CoreWindow ^ p_window) { Main::setup2(); } -static int _get_button(Windows::UI::Input::PointerPoint ^ pt) { +static MouseButton _get_button(Windows::UI::Input::PointerPoint ^ pt) { using namespace Windows::UI::Input; #if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP @@ -177,7 +177,7 @@ static int _get_button(Windows::UI::Input::PointerPoint ^ pt) { } #endif - return 0; + return MOUSE_BUTTON_NONE; }; static bool _is_touch(Windows::UI::Input::PointerPoint ^ pointerPoint) { @@ -241,10 +241,10 @@ static int _get_finger(uint32_t p_touch_id) { void App::pointer_event(Windows::UI::Core::CoreWindow ^ sender, Windows::UI::Core::PointerEventArgs ^ args, bool p_pressed, bool p_is_wheel) { Windows::UI::Input::PointerPoint ^ point = args->CurrentPoint; Windows::Foundation::Point pos = _get_pixel_position(window, point->Position, os); - int but = _get_button(point); + MouseButton but = _get_button(point); if (_is_touch(point)) { Ref<InputEventScreenTouch> screen_touch; - screen_touch.instance(); + screen_touch.instantiate(); screen_touch->set_device(0); screen_touch->set_pressed(p_pressed); screen_touch->set_position(Vector2(pos.X, pos.Y)); @@ -256,7 +256,7 @@ void App::pointer_event(Windows::UI::Core::CoreWindow ^ sender, Windows::UI::Cor os->input_event(screen_touch); } else { Ref<InputEventMouseButton> mouse_button; - mouse_button.instance(); + mouse_button.instantiate(); mouse_button->set_device(0); mouse_button->set_pressed(p_pressed); mouse_button->set_button_index(but); @@ -324,7 +324,7 @@ void App::OnPointerMoved(Windows::UI::Core::CoreWindow ^ sender, Windows::UI::Co if (_is_touch(point)) { Ref<InputEventScreenDrag> screen_drag; - screen_drag.instance(); + screen_drag.instantiate(); screen_drag->set_device(0); screen_drag->set_position(Vector2(pos.X, pos.Y)); screen_drag->set_index(_get_finger(point->PointerId)); @@ -333,11 +333,12 @@ void App::OnPointerMoved(Windows::UI::Core::CoreWindow ^ sender, Windows::UI::Co os->input_event(screen_drag); } else { // In case the mouse grabbed, MouseMoved will handle this - if (os->get_mouse_mode() == OS::MouseMode::MOUSE_MODE_CAPTURED) + if (os->get_mouse_mode() == OS::MouseMode::MOUSE_MODE_CAPTURED) { return; + } Ref<InputEventMouseMotion> mouse_motion; - mouse_motion.instance(); + mouse_motion.instantiate(); mouse_motion->set_device(0); mouse_motion->set_position(Vector2(pos.X, pos.Y)); mouse_motion->set_global_position(Vector2(pos.X, pos.Y)); @@ -351,15 +352,16 @@ void App::OnPointerMoved(Windows::UI::Core::CoreWindow ^ sender, Windows::UI::Co void App::OnMouseMoved(MouseDevice ^ mouse_device, MouseEventArgs ^ args) { // In case the mouse isn't grabbed, PointerMoved will handle this - if (os->get_mouse_mode() != OS::MouseMode::MOUSE_MODE_CAPTURED) + if (os->get_mouse_mode() != OS::MouseMode::MOUSE_MODE_CAPTURED) { return; + } Windows::Foundation::Point pos; pos.X = last_mouse_pos.X + args->MouseDelta.X; pos.Y = last_mouse_pos.Y + args->MouseDelta.Y; Ref<InputEventMouseMotion> mouse_motion; - mouse_motion.instance(); + mouse_motion.instantiate(); mouse_motion->set_device(0); mouse_motion->set_position(Vector2(pos.X, pos.Y)); mouse_motion->set_global_position(Vector2(pos.X, pos.Y)); diff --git a/platform/uwp/export/export.cpp b/platform/uwp/export/export.cpp index 351aaa5957..1075ae38ce 100644 --- a/platform/uwp/export/export.cpp +++ b/platform/uwp/export/export.cpp @@ -33,11 +33,11 @@ #include "core/config/project_settings.h" #include "core/core_bind.h" #include "core/crypto/crypto_core.h" +#include "core/io/dir_access.h" +#include "core/io/file_access.h" #include "core/io/marshalls.h" #include "core/io/zip_io.h" #include "core/object/class_db.h" -#include "core/os/dir_access.h" -#include "core/os/file_access.h" #include "core/version.h" #include "editor/editor_export.h" #include "editor/editor_node.h" @@ -1049,19 +1049,19 @@ public: // Capabilities const char **basic = uwp_capabilities; while (*basic) { - r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "capabilities/" + String(*basic).camelcase_to_underscore(false)), false)); + r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "capabilities/" + String(*basic)), false)); basic++; } const char **uap = uwp_uap_capabilities; while (*uap) { - r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "capabilities/" + String(*uap).camelcase_to_underscore(false)), false)); + r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "capabilities/" + String(*uap)), false)); uap++; } const char **device = uwp_device_capabilities; while (*device) { - r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "capabilities/" + String(*device).camelcase_to_underscore(false)), false)); + r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "capabilities/" + String(*device)), false)); device++; } } @@ -1429,7 +1429,7 @@ public: EditorExportPlatformUWP() { Ref<Image> img = memnew(Image(_uwp_logo)); - logo.instance(); + logo.instantiate(); logo->create_from_image(img); } }; @@ -1446,6 +1446,6 @@ void register_uwp_exporter() { #endif // WINDOWS_ENABLED Ref<EditorExportPlatformUWP> exporter; - exporter.instance(); + exporter.instantiate(); EditorExport::get_singleton()->add_export_platform(exporter); } diff --git a/platform/uwp/os_uwp.cpp b/platform/uwp/os_uwp.cpp index 435f829c9b..e26e204f5f 100644 --- a/platform/uwp/os_uwp.cpp +++ b/platform/uwp/os_uwp.cpp @@ -126,8 +126,6 @@ void OS_UWP::set_keep_screen_on(bool p_enabled) { } void OS_UWP::initialize_core() { - last_button_state = 0; - //RedirectIOToConsole(); FileAccess::make_default<FileAccessWindows>(FileAccess::ACCESS_RESOURCES); @@ -400,14 +398,12 @@ void OS_UWP::ManagedType::on_gyroscope_reading_changed(Gyrometer ^ sender, Gyrom void OS_UWP::set_mouse_mode(MouseMode p_mode) { if (p_mode == MouseMode::MOUSE_MODE_CAPTURED) { CoreWindow::GetForCurrentThread()->SetPointerCapture(); - } else { CoreWindow::GetForCurrentThread()->ReleasePointerCapture(); } - if (p_mode == MouseMode::MOUSE_MODE_CAPTURED || p_mode == MouseMode::MOUSE_MODE_HIDDEN) { + if (p_mode == MouseMode::MOUSE_MODE_HIDDEN || p_mode == MouseMode::MOUSE_MODE_CAPTURED || p_mode == MouseMode::MOUSE_MODE_CONFINED_HIDDEN) { CoreWindow::GetForCurrentThread()->PointerCursor = nullptr; - } else { CoreWindow::GetForCurrentThread()->PointerCursor = ref new CoreCursor(CoreCursorType::Arrow, 0); } @@ -425,7 +421,7 @@ Point2 OS_UWP::get_mouse_position() const { return Point2(old_x, old_y); } -int OS_UWP::get_mouse_button_state() const { +MouseButton OS_UWP::get_mouse_button_state() const { return last_button_state; } @@ -564,7 +560,7 @@ void OS_UWP::process_key_events() { KeyEvent &kev = key_event_buffer[i]; Ref<InputEventKey> key_event; - key_event.instance(); + key_event.instantiate(); key_event->set_alt_pressed(kev.alt); key_event->set_shift_pressed(kev.shift); key_event->set_ctrl_pressed(kev.control); diff --git a/platform/uwp/os_uwp.h b/platform/uwp/os_uwp.h index a4d3d6d52a..3a735889b0 100644 --- a/platform/uwp/os_uwp.h +++ b/platform/uwp/os_uwp.h @@ -106,7 +106,7 @@ private: bool control_mem; bool meta_mem; bool force_quit; - uint32_t last_button_state; + MouseButton last_button_state = MOUSE_BUTTON_NONE; CursorShape cursor_shape; @@ -173,7 +173,7 @@ public: MouseMode get_mouse_mode() const; virtual Point2 get_mouse_position() const; - virtual int get_mouse_button_state() const; + virtual MouseButton get_mouse_button_state() const; virtual void set_window_title(const String &p_title); virtual void set_video_mode(const VideoMode &p_video_mode, int p_screen = 0); diff --git a/platform/windows/context_gl_windows.cpp b/platform/windows/context_gl_windows.cpp index 207b0a1168..7cf9738f13 100644 --- a/platform/windows/context_gl_windows.cpp +++ b/platform/windows/context_gl_windows.cpp @@ -94,7 +94,7 @@ void ContextGL_Windows::swap_buffers() { if (vsync_via_compositor_now != vsync_via_compositor) { // The previous frame had a different operating mode than this - // frame. Set the 'vsync_via_compositor' member variable and the + // frame. Set the 'vsync_via_compositor' member variable and the // OpenGL swap interval to their proper values. set_use_vsync(true); } diff --git a/platform/windows/display_server_windows.cpp b/platform/windows/display_server_windows.cpp index 0dd02b4888..f7172598ec 100644 --- a/platform/windows/display_server_windows.cpp +++ b/platform/windows/display_server_windows.cpp @@ -84,7 +84,8 @@ void DisplayServerWindows::alert(const String &p_alert, const String &p_title) { } void DisplayServerWindows::_set_mouse_mode_impl(MouseMode p_mode) { - if (p_mode == MOUSE_MODE_CAPTURED || p_mode == MOUSE_MODE_CONFINED) { + if (p_mode == MOUSE_MODE_CAPTURED || p_mode == MOUSE_MODE_CONFINED || p_mode == MOUSE_MODE_CONFINED_HIDDEN) { + // Mouse is grabbed (captured or confined). WindowData &wd = windows[MAIN_WINDOW_ID]; RECT clipRect; @@ -100,11 +101,12 @@ void DisplayServerWindows::_set_mouse_mode_impl(MouseMode p_mode) { SetCapture(wd.hWnd); } } else { + // Mouse is free to move around (not captured or confined). ReleaseCapture(); ClipCursor(nullptr); } - if (p_mode == MOUSE_MODE_CAPTURED || p_mode == MOUSE_MODE_HIDDEN) { + if (p_mode == MOUSE_MODE_HIDDEN || p_mode == MOUSE_MODE_CAPTURED || p_mode == MOUSE_MODE_CONFINED_HIDDEN) { if (hCursor == nullptr) { hCursor = SetCursor(nullptr); } else { @@ -159,7 +161,7 @@ Point2i DisplayServerWindows::mouse_get_position() const { //return Point2(old_x, old_y); } -int DisplayServerWindows::mouse_get_button_state() const { +MouseButton DisplayServerWindows::mouse_get_button_state() const { return last_button_state; } @@ -715,7 +717,7 @@ void DisplayServerWindows::window_set_position(const Point2i &p_position, Window MoveWindow(wd.hWnd, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, TRUE); #endif // Don't let the mouse leave the window when moved - if (mouse_mode == MOUSE_MODE_CONFINED) { + if (mouse_mode == MOUSE_MODE_CONFINED || mouse_mode == MOUSE_MODE_CONFINED_HIDDEN) { RECT rect; GetClientRect(wd.hWnd, &rect); ClientToScreen(wd.hWnd, (POINT *)&rect.left); @@ -841,7 +843,7 @@ void DisplayServerWindows::window_set_size(const Size2i p_size, WindowID p_windo MoveWindow(wd.hWnd, rect.left, rect.top, w, h, TRUE); // Don't let the mouse leave the window when resizing to a smaller resolution - if (mouse_mode == MOUSE_MODE_CONFINED) { + if (mouse_mode == MOUSE_MODE_CONFINED || mouse_mode == MOUSE_MODE_CONFINED_HIDDEN) { RECT crect; GetClientRect(wd.hWnd, &crect); ClientToScreen(wd.hWnd, (POINT *)&crect.left); @@ -1119,7 +1121,7 @@ bool DisplayServerWindows::window_can_draw(WindowID p_window) const { ERR_FAIL_COND_V(!windows.has(p_window), false); const WindowData &wd = windows[p_window]; - return wd.minimized; + return !wd.minimized; } bool DisplayServerWindows::can_any_window_draw() const { @@ -1725,7 +1727,7 @@ void DisplayServerWindows::_touch_event(WindowID p_window, bool p_pressed, float } Ref<InputEventScreenTouch> event; - event.instance(); + event.instantiate(); event->set_index(idx); event->set_window_id(p_window); event->set_pressed(p_pressed); @@ -1744,7 +1746,7 @@ void DisplayServerWindows::_drag_event(WindowID p_window, float p_x, float p_y, return; Ref<InputEventScreenDrag> event; - event.instance(); + event.instantiate(); event->set_window_id(p_window); event->set_index(idx); event->set_position(Vector2(p_x, p_y)); @@ -1889,7 +1891,7 @@ LRESULT DisplayServerWindows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA // Run a timer to prevent event catching warning if the focused window is closing. windows[window_id].focus_timer_id = SetTimer(windows[window_id].hWnd, 2, USER_TIMER_MINIMUM, (TIMERPROC) nullptr); } - return 0; // Return To The Message Loop + return 0; // Return To The Message Loop } case WM_GETMINMAXINFO: { if (windows[window_id].resizable && !windows[window_id].fullscreen) { @@ -1963,7 +1965,7 @@ LRESULT DisplayServerWindows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA if (raw->header.dwType == RIM_TYPEMOUSE) { Ref<InputEventMouseMotion> mm; - mm.instance(); + mm.instantiate(); mm->set_window_id(window_id); mm->set_ctrl_pressed(control_mem); @@ -2060,7 +2062,7 @@ LRESULT DisplayServerWindows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA break; Ref<InputEventMouseMotion> mm; - mm.instance(); + mm.instantiate(); mm->set_window_id(window_id); mm->set_ctrl_pressed(GetKeyState(VK_CONTROL) < 0); mm->set_shift_pressed(GetKeyState(VK_SHIFT) < 0); @@ -2189,11 +2191,12 @@ LRESULT DisplayServerWindows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA } // Don't calculate relative mouse movement if we don't have focus in CAPTURED mode. - if (!windows[window_id].window_has_focus && mouse_mode == MOUSE_MODE_CAPTURED) + if (!windows[window_id].window_has_focus && mouse_mode == MOUSE_MODE_CAPTURED) { break; + } Ref<InputEventMouseMotion> mm; - mm.instance(); + mm.instantiate(); mm->set_window_id(window_id); if (pen_info.penMask & PEN_MASK_PRESSURE) { @@ -2294,11 +2297,12 @@ LRESULT DisplayServerWindows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA } // Don't calculate relative mouse movement if we don't have focus in CAPTURED mode. - if (!windows[window_id].window_has_focus && mouse_mode == MOUSE_MODE_CAPTURED) + if (!windows[window_id].window_has_focus && mouse_mode == MOUSE_MODE_CAPTURED) { break; + } Ref<InputEventMouseMotion> mm; - mm.instance(); + mm.instantiate(); mm->set_window_id(window_id); mm->set_ctrl_pressed((wParam & MK_CONTROL) != 0); mm->set_shift_pressed((wParam & MK_SHIFT) != 0); @@ -2381,66 +2385,69 @@ LRESULT DisplayServerWindows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA case WM_XBUTTONDOWN: case WM_XBUTTONUP: { Ref<InputEventMouseButton> mb; - mb.instance(); + mb.instantiate(); mb->set_window_id(window_id); switch (uMsg) { case WM_LBUTTONDOWN: { mb->set_pressed(true); - mb->set_button_index(1); + mb->set_button_index(MOUSE_BUTTON_LEFT); } break; case WM_LBUTTONUP: { mb->set_pressed(false); - mb->set_button_index(1); + mb->set_button_index(MOUSE_BUTTON_LEFT); } break; case WM_MBUTTONDOWN: { mb->set_pressed(true); - mb->set_button_index(3); + mb->set_button_index(MOUSE_BUTTON_MIDDLE); } break; case WM_MBUTTONUP: { mb->set_pressed(false); - mb->set_button_index(3); + mb->set_button_index(MOUSE_BUTTON_MIDDLE); } break; case WM_RBUTTONDOWN: { mb->set_pressed(true); - mb->set_button_index(2); + mb->set_button_index(MOUSE_BUTTON_RIGHT); } break; case WM_RBUTTONUP: { mb->set_pressed(false); - mb->set_button_index(2); + mb->set_button_index(MOUSE_BUTTON_RIGHT); } break; case WM_LBUTTONDBLCLK: { mb->set_pressed(true); - mb->set_button_index(1); + mb->set_button_index(MOUSE_BUTTON_LEFT); mb->set_double_click(true); } break; case WM_RBUTTONDBLCLK: { mb->set_pressed(true); - mb->set_button_index(2); + mb->set_button_index(MOUSE_BUTTON_RIGHT); mb->set_double_click(true); } break; case WM_MBUTTONDBLCLK: { mb->set_pressed(true); - mb->set_button_index(3); + mb->set_button_index(MOUSE_BUTTON_MIDDLE); mb->set_double_click(true); } break; case WM_MOUSEWHEEL: { mb->set_pressed(true); int motion = (short)HIWORD(wParam); - if (!motion) + if (!motion) { return 0; + } - if (motion > 0) + if (motion > 0) { mb->set_button_index(MOUSE_BUTTON_WHEEL_UP); - else + } else { mb->set_button_index(MOUSE_BUTTON_WHEEL_DOWN); + } } break; case WM_MOUSEHWHEEL: { mb->set_pressed(true); int motion = (short)HIWORD(wParam); - if (!motion) + if (!motion) { return 0; + } if (motion < 0) { mb->set_button_index(MOUSE_BUTTON_WHEEL_LEFT); @@ -2452,24 +2459,27 @@ LRESULT DisplayServerWindows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA } break; case WM_XBUTTONDOWN: { mb->set_pressed(true); - if (HIWORD(wParam) == XBUTTON1) + if (HIWORD(wParam) == XBUTTON1) { mb->set_button_index(MOUSE_BUTTON_XBUTTON1); - else + } else { mb->set_button_index(MOUSE_BUTTON_XBUTTON2); + } } break; case WM_XBUTTONUP: { mb->set_pressed(false); - if (HIWORD(wParam) == XBUTTON1) + if (HIWORD(wParam) == XBUTTON1) { mb->set_button_index(MOUSE_BUTTON_XBUTTON1); - else + } else { mb->set_button_index(MOUSE_BUTTON_XBUTTON2); + } } break; case WM_XBUTTONDBLCLK: { mb->set_pressed(true); - if (HIWORD(wParam) == XBUTTON1) + if (HIWORD(wParam) == XBUTTON1) { mb->set_button_index(MOUSE_BUTTON_XBUTTON1); - else + } else { mb->set_button_index(MOUSE_BUTTON_XBUTTON2); + } mb->set_double_click(true); } break; default: { @@ -2481,10 +2491,11 @@ LRESULT DisplayServerWindows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA mb->set_shift_pressed((wParam & MK_SHIFT) != 0); mb->set_alt_pressed(alt_mem); //mb->is_alt_pressed()=(wParam&MK_MENU)!=0; - if (mb->is_pressed()) - last_button_state |= (1 << (mb->get_button_index() - 1)); - else - last_button_state &= ~(1 << (mb->get_button_index() - 1)); + if (mb->is_pressed()) { + last_button_state |= MouseButton(1 << (mb->get_button_index() - 1)); + } else { + last_button_state &= (MouseButton) ~(1 << (mb->get_button_index() - 1)); + } mb->set_button_mask(last_button_state); mb->set_position(Vector2(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); @@ -2523,7 +2534,7 @@ LRESULT DisplayServerWindows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA //send release for mouse wheel Ref<InputEventMouseButton> mbd = mb->duplicate(); mbd->set_window_id(window_id); - last_button_state &= ~(1 << (mbd->get_button_index() - 1)); + last_button_state &= (MouseButton) ~(1 << (mbd->get_button_index() - 1)); mbd->set_button_mask(last_button_state); mbd->set_pressed(false); Input::get_singleton()->accumulate_input_event(mbd); @@ -2726,7 +2737,7 @@ LRESULT DisplayServerWindows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA } break; case WM_SETCURSOR: { if (LOWORD(lParam) == HTCLIENT) { - if (windows[window_id].window_has_focus && (mouse_mode == MOUSE_MODE_HIDDEN || mouse_mode == MOUSE_MODE_CAPTURED)) { + if (windows[window_id].window_has_focus && (mouse_mode == MOUSE_MODE_HIDDEN || mouse_mode == MOUSE_MODE_CAPTURED || mouse_mode == MOUSE_MODE_CONFINED_HIDDEN)) { //Hide the cursor if (hCursor == nullptr) { hCursor = SetCursor(nullptr); @@ -2832,7 +2843,7 @@ void DisplayServerWindows::_process_key_events() { prev_wc = 0; } Ref<InputEventKey> k; - k.instance(); + k.instantiate(); k->set_window_id(ke.window_id); k->set_shift_pressed(ke.shift); @@ -2859,7 +2870,7 @@ void DisplayServerWindows::_process_key_events() { case WM_KEYUP: case WM_KEYDOWN: { Ref<InputEventKey> k; - k.instance(); + k.instantiate(); k->set_window_id(ke.window_id); k->set_shift_pressed(ke.shift); diff --git a/platform/windows/display_server_windows.h b/platform/windows/display_server_windows.h index a734077e59..d71e579c67 100644 --- a/platform/windows/display_server_windows.h +++ b/platform/windows/display_server_windows.h @@ -408,7 +408,7 @@ class DisplayServerWindows : public DisplayServer { bool shift_mem = false; bool control_mem = false; bool meta_mem = false; - uint32_t last_button_state = 0; + MouseButton last_button_state = MOUSE_BUTTON_NONE; bool use_raw_input = false; bool drop_events = false; bool in_dispatch_input_event = false; @@ -449,7 +449,7 @@ public: virtual void mouse_warp_to_position(const Point2i &p_to); virtual Point2i mouse_get_position() const; - virtual int mouse_get_button_state() const; + virtual MouseButton mouse_get_button_state() const; virtual void clipboard_set(const String &p_text); virtual String clipboard_get() const; diff --git a/platform/windows/export/export.cpp b/platform/windows/export/export.cpp index 222597b3ff..03093ab6dd 100644 --- a/platform/windows/export/export.cpp +++ b/platform/windows/export/export.cpp @@ -28,7 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#include "core/os/file_access.h" +#include "core/io/file_access.h" #include "core/os/os.h" #include "editor/editor_export.h" #include "editor/editor_node.h" @@ -344,11 +344,11 @@ void register_windows_exporter() { #endif Ref<EditorExportPlatformWindows> platform; - platform.instance(); + platform.instantiate(); Ref<Image> img = memnew(Image(_windows_logo)); Ref<ImageTexture> logo; - logo.instance(); + logo.instantiate(); logo->create_from_image(img); platform->set_logo(logo); platform->set_name("Windows Desktop"); diff --git a/platform/windows/godot.natvis b/platform/windows/godot.natvis index 857c6a88f1..bb855e4ac8 100644 --- a/platform/windows/godot.natvis +++ b/platform/windows/godot.natvis @@ -40,13 +40,13 @@ <DisplayString Condition="type == Variant::TRANSFORM2D">{_data._transform2d}</DisplayString> <DisplayString Condition="type == Variant::AABB">{_data._aabb}</DisplayString> <DisplayString Condition="type == Variant::BASIS">{_data._basis}</DisplayString> - <DisplayString Condition="type == Variant::TRANSFORM">{_data._transform}</DisplayString> + <DisplayString Condition="type == Variant::TRANSFORM3D">{_data._transform}</DisplayString> <DisplayString Condition="type == Variant::STRING">{*(String *)_data._mem}</DisplayString> <DisplayString Condition="type == Variant::VECTOR2">{*(Vector2 *)_data._mem}</DisplayString> <DisplayString Condition="type == Variant::RECT2">{*(Rect2 *)_data._mem}</DisplayString> <DisplayString Condition="type == Variant::VECTOR3">{*(Vector3 *)_data._mem}</DisplayString> <DisplayString Condition="type == Variant::PLANE">{*(Plane *)_data._mem}</DisplayString> - <DisplayString Condition="type == Variant::QUAT">{*(Quat *)_data._mem}</DisplayString> + <DisplayString Condition="type == Variant::QUATERNION">{*(Quaternion *)_data._mem}</DisplayString> <DisplayString Condition="type == Variant::COLOR">{*(Color *)_data._mem}</DisplayString> <DisplayString Condition="type == Variant::NODE_PATH">{*(NodePath *)_data._mem}</DisplayString> <DisplayString Condition="type == Variant::RID">{*(::RID *)_data._mem}</DisplayString> @@ -72,13 +72,13 @@ <Item Name="[value]" Condition="type == Variant::TRANSFORM2D">_data._transform2d</Item> <Item Name="[value]" Condition="type == Variant::AABB">_data._aabb</Item> <Item Name="[value]" Condition="type == Variant::BASIS">_data._basis</Item> - <Item Name="[value]" Condition="type == Variant::TRANSFORM">_data._transform</Item> + <Item Name="[value]" Condition="type == Variant::TRANSFORM3D">_data._transform</Item> <Item Name="[value]" Condition="type == Variant::STRING">*(String *)_data._mem</Item> <Item Name="[value]" Condition="type == Variant::VECTOR2">*(Vector2 *)_data._mem</Item> <Item Name="[value]" Condition="type == Variant::RECT2">*(Rect2 *)_data._mem</Item> <Item Name="[value]" Condition="type == Variant::VECTOR3">*(Vector3 *)_data._mem</Item> <Item Name="[value]" Condition="type == Variant::PLANE">*(Plane *)_data._mem</Item> - <Item Name="[value]" Condition="type == Variant::QUAT">*(Quat *)_data._mem</Item> + <Item Name="[value]" Condition="type == Variant::QUATERNION">*(Quaternion *)_data._mem</Item> <Item Name="[value]" Condition="type == Variant::COLOR">*(Color *)_data._mem</Item> <Item Name="[value]" Condition="type == Variant::NODE_PATH">*(NodePath *)_data._mem</Item> <Item Name="[value]" Condition="type == Variant::RID">*(::RID *)_data._mem</Item> @@ -128,8 +128,8 @@ </Expand> </Type> - <Type Name="Quat"> - <DisplayString>Quat {{{x},{y},{z},{w}}}</DisplayString> + <Type Name="Quaternion"> + <DisplayString>Quaternion {{{x},{y},{z},{w}}}</DisplayString> <Expand> <Item Name="x">x</Item> <Item Name="y">y</Item> diff --git a/platform/windows/joypad_windows.cpp b/platform/windows/joypad_windows.cpp index da36dc1f2b..94da63e49d 100644 --- a/platform/windows/joypad_windows.cpp +++ b/platform/windows/joypad_windows.cpp @@ -330,7 +330,7 @@ void JoypadWindows::process_joypads() { if (joy.state.dwPacketNumber != joy.last_packet) { int button_mask = XINPUT_GAMEPAD_DPAD_UP; for (int j = 0; j <= 16; j++) { - input->joy_button(joy.id, j, joy.state.Gamepad.wButtons & button_mask); + input->joy_button(joy.id, (JoyButton)j, joy.state.Gamepad.wButtons & button_mask); button_mask = button_mask * 2; } @@ -381,12 +381,12 @@ void JoypadWindows::process_joypads() { for (int j = 0; j < 128; j++) { if (js.rgbButtons[j] & 0x80) { if (!joy->last_buttons[j]) { - input->joy_button(joy->id, j, true); + input->joy_button(joy->id, (JoyButton)j, true); joy->last_buttons[j] = true; } } else { if (joy->last_buttons[j]) { - input->joy_button(joy->id, j, false); + input->joy_button(joy->id, (JoyButton)j, false); joy->last_buttons[j] = false; } } @@ -400,7 +400,7 @@ void JoypadWindows::process_joypads() { for (int j = 0; j < joy->joy_axis.size(); j++) { for (int k = 0; k < count; k++) { if (joy->joy_axis[j] == axes[k]) { - input->joy_axis(joy->id, j, axis_correct(values[k])); + input->joy_axis(joy->id, (JoyAxis)j, axis_correct(values[k])); break; }; }; @@ -410,38 +410,38 @@ void JoypadWindows::process_joypads() { } void JoypadWindows::post_hat(int p_device, DWORD p_dpad) { - int dpad_val = 0; + HatMask dpad_val = (HatMask)0; // Should be -1 when centered, but according to docs: // "Some drivers report the centered position of the POV indicator as 65,535. Determine whether the indicator is centered as follows: // BOOL POVCentered = (LOWORD(dwPOV) == 0xFFFF);" // https://docs.microsoft.com/en-us/previous-versions/windows/desktop/ee416628(v%3Dvs.85)#remarks if (LOWORD(p_dpad) == 0xFFFF) { - dpad_val = Input::HAT_MASK_CENTER; + dpad_val = (HatMask)HatMask::HAT_MASK_CENTER; } if (p_dpad == 0) { - dpad_val = Input::HAT_MASK_UP; + dpad_val = (HatMask)HatMask::HAT_MASK_UP; } else if (p_dpad == 4500) { - dpad_val = (Input::HAT_MASK_UP | Input::HAT_MASK_RIGHT); + dpad_val = (HatMask)(HatMask::HAT_MASK_UP | HatMask::HAT_MASK_RIGHT); } else if (p_dpad == 9000) { - dpad_val = Input::HAT_MASK_RIGHT; + dpad_val = (HatMask)HatMask::HAT_MASK_RIGHT; } else if (p_dpad == 13500) { - dpad_val = (Input::HAT_MASK_RIGHT | Input::HAT_MASK_DOWN); + dpad_val = (HatMask)(HatMask::HAT_MASK_RIGHT | HatMask::HAT_MASK_DOWN); } else if (p_dpad == 18000) { - dpad_val = Input::HAT_MASK_DOWN; + dpad_val = (HatMask)HatMask::HAT_MASK_DOWN; } else if (p_dpad == 22500) { - dpad_val = (Input::HAT_MASK_DOWN | Input::HAT_MASK_LEFT); + dpad_val = (HatMask)(HatMask::HAT_MASK_DOWN | HatMask::HAT_MASK_LEFT); } else if (p_dpad == 27000) { - dpad_val = Input::HAT_MASK_LEFT; + dpad_val = (HatMask)HatMask::HAT_MASK_LEFT; } else if (p_dpad == 31500) { - dpad_val = (Input::HAT_MASK_LEFT | Input::HAT_MASK_UP); + dpad_val = (HatMask)(HatMask::HAT_MASK_LEFT | HatMask::HAT_MASK_UP); } input->joy_hat(p_device, dpad_val); }; diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp index ccf13488ab..c956fe49ae 100644 --- a/platform/windows/os_windows.cpp +++ b/platform/windows/os_windows.cpp @@ -315,8 +315,8 @@ OS::Time OS_Windows::get_time(bool utc) const { Time time; time.hour = systemtime.wHour; - time.min = systemtime.wMinute; - time.sec = systemtime.wSecond; + time.minute = systemtime.wMinute; + time.second = systemtime.wSecond; return time; } @@ -633,7 +633,7 @@ MainLoop *OS_Windows::get_main_loop() const { String OS_Windows::get_config_path() const { // The XDG Base Directory specification technically only applies on Linux/*BSD, but it doesn't hurt to support it on Windows as well. if (has_environment("XDG_CONFIG_HOME")) { - if (get_environment("XDG_CONFIG_HOME").is_abs_path()) { + if (get_environment("XDG_CONFIG_HOME").is_absolute_path()) { return get_environment("XDG_CONFIG_HOME"); } else { WARN_PRINT_ONCE("`XDG_CONFIG_HOME` is a relative path. Ignoring its value and falling back to `%APPDATA%` or `.` per the XDG Base Directory specification."); @@ -648,7 +648,7 @@ String OS_Windows::get_config_path() const { String OS_Windows::get_data_path() const { // The XDG Base Directory specification technically only applies on Linux/*BSD, but it doesn't hurt to support it on Windows as well. if (has_environment("XDG_DATA_HOME")) { - if (get_environment("XDG_DATA_HOME").is_abs_path()) { + if (get_environment("XDG_DATA_HOME").is_absolute_path()) { return get_environment("XDG_DATA_HOME"); } else { WARN_PRINT_ONCE("`XDG_DATA_HOME` is a relative path. Ignoring its value and falling back to `get_config_path()` per the XDG Base Directory specification."); @@ -660,7 +660,7 @@ String OS_Windows::get_data_path() const { String OS_Windows::get_cache_path() const { // The XDG Base Directory specification technically only applies on Linux/*BSD, but it doesn't hurt to support it on Windows as well. if (has_environment("XDG_CACHE_HOME")) { - if (get_environment("XDG_CACHE_HOME").is_abs_path()) { + if (get_environment("XDG_CACHE_HOME").is_absolute_path()) { return get_environment("XDG_CACHE_HOME"); } else { WARN_PRINT_ONCE("`XDG_CACHE_HOME` is a relative path. Ignoring its value and falling back to `%TEMP%` or `get_config_path()` per the XDG Base Directory specification."); |