summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2020-05-14 13:23:58 +0200
committerRémi Verschelde <rverschelde@gmail.com>2020-05-14 16:54:55 +0200
commit0be6d925dc3c6413bce7a3ccb49631b8e4a6e67a (patch)
treea27e497da7104dd0a64f98a04fa3067668735e91 /platform
parent710b34b70227becdc652b4ae027fe0ac47409642 (diff)
Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocks
Which means that reduz' beloved style which we all became used to will now be changed automatically to remove the first empty line. This makes us lean closer to 1TBS (the one true brace style) instead of hybridating it with some Allman-inspired spacing. There's still the case of braces around single-statement blocks that needs to be addressed (but clang-format can't help with that, but clang-tidy may if we agree about it). Part of #33027.
Diffstat (limited to 'platform')
-rw-r--r--platform/android/android_keys_utils.cpp2
-rw-r--r--platform/android/android_keys_utils.h1
-rw-r--r--platform/android/api/api.cpp3
-rw-r--r--platform/android/api/java_class_wrapper.h6
-rw-r--r--platform/android/api/jni_singleton.h19
-rw-r--r--platform/android/audio_driver_jandroid.cpp16
-rw-r--r--platform/android/audio_driver_jandroid.h1
-rw-r--r--platform/android/audio_driver_opensl.cpp19
-rw-r--r--platform/android/audio_driver_opensl.h1
-rw-r--r--platform/android/dir_access_jandroid.cpp20
-rw-r--r--platform/android/dir_access_jandroid.h1
-rw-r--r--platform/android/display_server_android.cpp6
-rw-r--r--platform/android/display_server_android.h1
-rw-r--r--platform/android/export/export.cpp82
-rw-r--r--platform/android/file_access_android.cpp16
-rw-r--r--platform/android/file_access_android.h1
-rw-r--r--platform/android/file_access_jandroid.cpp16
-rw-r--r--platform/android/file_access_jandroid.h1
-rw-r--r--platform/android/java/lib/src/org/godotengine/godot/Dictionary.java6
-rw-r--r--platform/android/java/lib/src/org/godotengine/godot/Godot.java17
-rw-r--r--platform/android/java/lib/src/org/godotengine/godot/GodotDownloaderAlarmReceiver.java1
-rw-r--r--platform/android/java/lib/src/org/godotengine/godot/GodotGLRenderView.java3
-rw-r--r--platform/android/java/lib/src/org/godotengine/godot/GodotIO.java35
-rw-r--r--platform/android/java/lib/src/org/godotengine/godot/GodotLib.java1
-rw-r--r--platform/android/java/lib/src/org/godotengine/godot/GodotRenderView.java1
-rw-r--r--platform/android/java/lib/src/org/godotengine/godot/GodotRenderer.java1
-rw-r--r--platform/android/java/lib/src/org/godotengine/godot/GodotVulkanRenderView.java1
-rw-r--r--platform/android/java/lib/src/org/godotengine/godot/input/GodotGestureHandler.java1
-rw-r--r--platform/android/java/lib/src/org/godotengine/godot/input/GodotInputHandler.java4
-rw-r--r--platform/android/java/lib/src/org/godotengine/godot/input/InputManagerCompat.java1
-rw-r--r--platform/android/java/lib/src/org/godotengine/godot/input/InputManagerV16.java1
-rw-r--r--platform/android/java/lib/src/org/godotengine/godot/plugin/GodotPlugin.java1
-rw-r--r--platform/android/java/lib/src/org/godotengine/godot/plugin/GodotPluginRegistry.java1
-rw-r--r--platform/android/java/lib/src/org/godotengine/godot/plugin/SignalInfo.java1
-rw-r--r--platform/android/java/lib/src/org/godotengine/godot/utils/Crypt.java1
-rw-r--r--platform/android/java/lib/src/org/godotengine/godot/utils/GLUtils.java1
-rw-r--r--platform/android/java/lib/src/org/godotengine/godot/utils/GodotNetUtils.java1
-rw-r--r--platform/android/java/lib/src/org/godotengine/godot/utils/PermissionsUtil.java1
-rw-r--r--platform/android/java/lib/src/org/godotengine/godot/xr/ovr/OvrConfigChooser.java1
-rw-r--r--platform/android/java/lib/src/org/godotengine/godot/xr/ovr/OvrContextFactory.java1
-rw-r--r--platform/android/java/lib/src/org/godotengine/godot/xr/ovr/OvrWindowSurfaceFactory.java1
-rw-r--r--platform/android/java/lib/src/org/godotengine/godot/xr/regular/RegularConfigChooser.java3
-rw-r--r--platform/android/java/lib/src/org/godotengine/godot/xr/regular/RegularFallbackConfigChooser.java1
-rw-r--r--platform/android/java/plugins/godotpayment/src/main/java/org/godotengine/godot/plugin/payment/ConsumeTask.java2
-rw-r--r--platform/android/java/plugins/godotpayment/src/main/java/org/godotengine/godot/plugin/payment/GodotPayment.java1
-rw-r--r--platform/android/java/plugins/godotpayment/src/main/java/org/godotengine/godot/plugin/payment/HandlePurchaseTask.java1
-rw-r--r--platform/android/java/plugins/godotpayment/src/main/java/org/godotengine/godot/plugin/payment/PaymentsCache.java1
-rw-r--r--platform/android/java/plugins/godotpayment/src/main/java/org/godotengine/godot/plugin/payment/PaymentsManager.java5
-rw-r--r--platform/android/java/plugins/godotpayment/src/main/java/org/godotengine/godot/plugin/payment/PurchaseTask.java1
-rw-r--r--platform/android/java/plugins/godotpayment/src/main/java/org/godotengine/godot/plugin/payment/ReleaseAllConsumablesTask.java4
-rw-r--r--platform/android/java/plugins/godotpayment/src/main/java/org/godotengine/godot/plugin/payment/ValidateTask.java1
-rw-r--r--platform/android/java/plugins/godotpayment/src/main/java/org/godotengine/godot/plugin/payment/utils/HttpRequester.java1
-rw-r--r--platform/android/java/plugins/godotpayment/src/main/java/org/godotengine/godot/plugin/payment/utils/RequestParams.java1
-rw-r--r--platform/android/java_class_wrapper.cpp94
-rw-r--r--platform/android/java_godot_lib_jni.cpp14
-rw-r--r--platform/android/jni_utils.cpp34
-rw-r--r--platform/android/jni_utils.h1
-rw-r--r--platform/android/net_socket_android.cpp1
-rw-r--r--platform/android/net_socket_android.h1
-rw-r--r--platform/android/os_android.cpp17
-rw-r--r--platform/android/plugin/godot_plugin_jni.cpp6
-rw-r--r--platform/android/thread_jandroid.cpp11
-rw-r--r--platform/android/thread_jandroid.h1
-rw-r--r--platform/android/vulkan/vulkan_context_android.h1
-rw-r--r--platform/haiku/os_haiku.cpp4
-rw-r--r--platform/iphone/app_delegate.mm4
-rw-r--r--platform/iphone/export/export.cpp10
-rw-r--r--platform/iphone/game_center.h1
-rw-r--r--platform/iphone/game_center.mm13
-rw-r--r--platform/iphone/gl_view.mm21
-rw-r--r--platform/iphone/godot_iphone.cpp2
-rw-r--r--platform/iphone/icloud.h1
-rw-r--r--platform/iphone/icloud.mm2
-rw-r--r--platform/iphone/in_app_store.h1
-rw-r--r--platform/iphone/in_app_store.mm14
-rw-r--r--platform/iphone/ios.h1
-rw-r--r--platform/iphone/ios.mm1
-rw-r--r--platform/iphone/os_iphone.cpp36
-rw-r--r--platform/iphone/os_iphone.h2
-rw-r--r--platform/iphone/view_controller.mm4
-rw-r--r--platform/iphone/vulkan_context_iphone.h1
-rw-r--r--platform/iphone/vulkan_context_iphone.mm1
-rw-r--r--platform/javascript/api/api.cpp6
-rw-r--r--platform/javascript/audio_driver_javascript.cpp13
-rw-r--r--platform/javascript/audio_driver_javascript.h1
-rw-r--r--platform/javascript/display_server_javascript.cpp40
-rw-r--r--platform/javascript/display_server_javascript.h1
-rw-r--r--platform/javascript/dom_keys.inc1
-rw-r--r--platform/javascript/export/export.cpp27
-rw-r--r--platform/javascript/http_client_javascript.cpp22
-rw-r--r--platform/javascript/javascript_eval.cpp2
-rw-r--r--platform/javascript/javascript_main.cpp3
-rw-r--r--platform/javascript/os_javascript.cpp27
-rw-r--r--platform/javascript/os_javascript.h1
-rw-r--r--platform/linuxbsd/context_gl_x11.cpp9
-rw-r--r--platform/linuxbsd/context_gl_x11.h1
-rw-r--r--platform/linuxbsd/crash_handler_linuxbsd.h1
-rw-r--r--platform/linuxbsd/display_server_x11.cpp121
-rw-r--r--platform/linuxbsd/export/export.cpp3
-rw-r--r--platform/linuxbsd/godot_linuxbsd.cpp1
-rw-r--r--platform/linuxbsd/joypad_linux.cpp30
-rw-r--r--platform/linuxbsd/key_mapping_x11.cpp12
-rw-r--r--platform/linuxbsd/os_linuxbsd.cpp25
-rw-r--r--platform/linuxbsd/os_linuxbsd.h1
-rw-r--r--platform/linuxbsd/vulkan_context_x11.cpp1
-rw-r--r--platform/linuxbsd/vulkan_context_x11.h1
-rw-r--r--platform/osx/context_gl_osx.h1
-rw-r--r--platform/osx/context_gl_osx.mm11
-rw-r--r--platform/osx/crash_handler_osx.h1
-rw-r--r--platform/osx/dir_access_osx.mm1
-rw-r--r--platform/osx/display_server_osx.mm5
-rw-r--r--platform/osx/export/export.cpp13
-rw-r--r--platform/osx/godot_main_osx.mm1
-rw-r--r--platform/osx/joypad_osx.cpp8
-rw-r--r--platform/osx/joypad_osx.h1
-rw-r--r--platform/osx/os_osx.mm3
-rw-r--r--platform/osx/vulkan_context_osx.h1
-rw-r--r--platform/osx/vulkan_context_osx.mm1
-rw-r--r--platform/server/godot_server.cpp1
-rw-r--r--platform/server/os_server.cpp32
-rw-r--r--platform/server/os_server.h1
-rw-r--r--platform/uwp/app.cpp25
-rw-r--r--platform/uwp/context_egl_uwp.cpp10
-rw-r--r--platform/uwp/context_egl_uwp.h1
-rw-r--r--platform/uwp/export/export.cpp42
-rw-r--r--platform/uwp/joypad_uwp.cpp13
-rw-r--r--platform/uwp/joypad_uwp.h2
-rw-r--r--platform/uwp/os_uwp.cpp75
-rw-r--r--platform/uwp/os_uwp.h2
-rw-r--r--platform/uwp/thread_uwp.cpp4
-rw-r--r--platform/uwp/thread_uwp.h1
-rw-r--r--platform/windows/context_gl_windows.cpp11
-rw-r--r--platform/windows/context_gl_windows.h1
-rw-r--r--platform/windows/crash_handler_windows.h1
-rw-r--r--platform/windows/display_server_windows.cpp145
-rw-r--r--platform/windows/display_server_windows.h1
-rw-r--r--platform/windows/export/export.cpp4
-rw-r--r--platform/windows/godot_windows.cpp1
-rw-r--r--platform/windows/joypad_windows.cpp49
-rw-r--r--platform/windows/joypad_windows.h2
-rw-r--r--platform/windows/key_mapping_windows.cpp4
-rw-r--r--platform/windows/key_mapping_windows.h1
-rw-r--r--platform/windows/os_windows.cpp46
-rw-r--r--platform/windows/os_windows.h2
-rw-r--r--platform/windows/vulkan_context_win.cpp1
-rw-r--r--platform/windows/vulkan_context_win.h1
-rw-r--r--platform/windows/windows_terminal_logger.cpp1
147 files changed, 0 insertions, 1494 deletions
diff --git a/platform/android/android_keys_utils.cpp b/platform/android/android_keys_utils.cpp
index 88874ba2c7..b5b4fb9a4b 100644
--- a/platform/android/android_keys_utils.cpp
+++ b/platform/android/android_keys_utils.cpp
@@ -32,9 +32,7 @@
unsigned int android_get_keysym(unsigned int p_code) {
for (int i = 0; _ak_to_keycode[i].keysym != KEY_UNKNOWN; i++) {
-
if (_ak_to_keycode[i].keycode == p_code) {
-
return _ak_to_keycode[i].keysym;
}
}
diff --git a/platform/android/android_keys_utils.h b/platform/android/android_keys_utils.h
index f076688ac8..fb442f4c54 100644
--- a/platform/android/android_keys_utils.h
+++ b/platform/android/android_keys_utils.h
@@ -154,7 +154,6 @@ enum {
};
struct _WinTranslatePair {
-
unsigned int keysym;
unsigned int keycode;
};
diff --git a/platform/android/api/api.cpp b/platform/android/api/api.cpp
index 4fe868d4f0..1f140f7119 100644
--- a/platform/android/api/api.cpp
+++ b/platform/android/api/api.cpp
@@ -39,7 +39,6 @@ static JavaClassWrapper *java_class_wrapper = nullptr;
#endif
void register_android_api() {
-
#if !defined(ANDROID_ENABLED)
// On Android platforms, the `java_class_wrapper` instantiation and the
// `JNISingleton` registration occurs in
@@ -54,14 +53,12 @@ void register_android_api() {
}
void unregister_android_api() {
-
#if !defined(ANDROID_ENABLED)
memdelete(java_class_wrapper);
#endif
}
void JavaClassWrapper::_bind_methods() {
-
ClassDB::bind_method(D_METHOD("wrap", "name"), &JavaClassWrapper::wrap);
}
diff --git a/platform/android/api/java_class_wrapper.h b/platform/android/api/java_class_wrapper.h
index 3dfdc75cf4..e34f2a9f69 100644
--- a/platform/android/api/java_class_wrapper.h
+++ b/platform/android/api/java_class_wrapper.h
@@ -43,7 +43,6 @@ class JavaObject;
#endif
class JavaClass : public Reference {
-
GDCLASS(JavaClass, Reference);
#ifdef ANDROID_ENABLED
@@ -68,7 +67,6 @@ class JavaClass : public Reference {
Map<StringName, Variant> constant_map;
struct MethodInfo {
-
bool _static;
Vector<uint32_t> param_types;
Vector<StringName> param_sigs;
@@ -77,12 +75,10 @@ class JavaClass : public Reference {
};
_FORCE_INLINE_ static void _convert_to_variant_type(int p_sig, Variant::Type &r_type, float &likelihood) {
-
likelihood = 1.0;
r_type = Variant::NIL;
switch (p_sig) {
-
case ARG_TYPE_VOID:
r_type = Variant::NIL;
break;
@@ -190,7 +186,6 @@ public:
};
class JavaObject : public Reference {
-
GDCLASS(JavaObject, Reference);
#ifdef ANDROID_ENABLED
@@ -210,7 +205,6 @@ public:
};
class JavaClassWrapper : public Object {
-
GDCLASS(JavaClassWrapper, Object);
#ifdef ANDROID_ENABLED
diff --git a/platform/android/api/jni_singleton.h b/platform/android/api/jni_singleton.h
index 917c3f5029..ed69f8d6e4 100644
--- a/platform/android/api/jni_singleton.h
+++ b/platform/android/api/jni_singleton.h
@@ -38,12 +38,10 @@
#endif
class JNISingleton : public Object {
-
GDCLASS(JNISingleton, Object);
#ifdef ANDROID_ENABLED
struct MethodData {
-
jmethodID method;
Variant::Type ret_type;
Vector<Variant::Type> argtypes;
@@ -63,7 +61,6 @@ public:
bool call_error = !E || E->get().argtypes.size() != p_argcount;
if (!call_error) {
for (int i = 0; i < p_argcount; i++) {
-
if (!Variant::can_convert(p_args[i]->get_type(), E->get().argtypes[i])) {
call_error = true;
break;
@@ -83,7 +80,6 @@ public:
jvalue *v = nullptr;
if (p_argcount) {
-
v = (jvalue *)alloca(sizeof(jvalue) * p_argcount);
}
@@ -95,7 +91,6 @@ public:
List<jobject> to_erase;
for (int i = 0; i < p_argcount; i++) {
-
jvalret vr = _variant_to_jvalue(env, E->get().argtypes[i], p_args[i]);
v[i] = vr.val;
if (vr.obj)
@@ -105,31 +100,24 @@ public:
Variant ret;
switch (E->get().ret_type) {
-
case Variant::NIL: {
-
env->CallVoidMethodA(instance, E->get().method, v);
} break;
case Variant::BOOL: {
-
ret = env->CallBooleanMethodA(instance, E->get().method, v) == JNI_TRUE;
} break;
case Variant::INT: {
-
ret = env->CallIntMethodA(instance, E->get().method, v);
} break;
case Variant::FLOAT: {
-
ret = env->CallFloatMethodA(instance, E->get().method, v);
} break;
case Variant::STRING: {
-
jobject o = env->CallObjectMethodA(instance, E->get().method, v);
ret = jstring_to_string((jstring)o, env);
env->DeleteLocalRef(o);
} break;
case Variant::PACKED_STRING_ARRAY: {
-
jobjectArray arr = (jobjectArray)env->CallObjectMethodA(instance, E->get().method, v);
ret = _jobject_to_variant(env, arr);
@@ -137,7 +125,6 @@ public:
env->DeleteLocalRef(arr);
} break;
case Variant::PACKED_INT32_ARRAY: {
-
jintArray arr = (jintArray)env->CallObjectMethodA(instance, E->get().method, v);
int fCount = env->GetArrayLength(arr);
@@ -150,7 +137,6 @@ public:
env->DeleteLocalRef(arr);
} break;
case Variant::PACKED_FLOAT32_ARRAY: {
-
jfloatArray arr = (jfloatArray)env->CallObjectMethodA(instance, E->get().method, v);
int fCount = env->GetArrayLength(arr);
@@ -167,14 +153,12 @@ public:
#warning This is missing 64 bits arrays, I have no idea how to do it in JNI
#endif
case Variant::DICTIONARY: {
-
jobject obj = env->CallObjectMethodA(instance, E->get().method, v);
ret = _jobject_to_variant(env, obj);
env->DeleteLocalRef(obj);
} break;
default: {
-
env->PopLocalFrame(nullptr);
ERR_FAIL_V(Variant());
} break;
@@ -197,17 +181,14 @@ public:
#ifdef ANDROID_ENABLED
jobject get_instance() const {
-
return instance;
}
void set_instance(jobject p_instance) {
-
instance = p_instance;
}
void add_method(const StringName &p_name, jmethodID p_method, const Vector<Variant::Type> &p_args, Variant::Type p_ret_type) {
-
MethodData md;
md.method = p_method;
md.argtypes = p_args;
diff --git a/platform/android/audio_driver_jandroid.cpp b/platform/android/audio_driver_jandroid.cpp
index 802d85e7be..0ace7d03a1 100644
--- a/platform/android/audio_driver_jandroid.cpp
+++ b/platform/android/audio_driver_jandroid.cpp
@@ -52,12 +52,10 @@ 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);
@@ -100,7 +98,6 @@ void AudioDriverAndroid::start() {
}
void AudioDriverAndroid::setup(jobject p_io) {
-
JNIEnv *env = ThreadAndroid::get_env();
io = p_io;
@@ -114,10 +111,8 @@ void AudioDriverAndroid::setup(jobject p_io) {
}
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;");
@@ -128,24 +123,20 @@ void AudioDriverAndroid::thread_func(JNIEnv *env) {
_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;
}
}
@@ -155,27 +146,22 @@ void AudioDriverAndroid::thread_func(JNIEnv *env) {
}
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 = ThreadAndroid::get_env();
env->CallVoidMethod(io, _quit);
@@ -189,13 +175,11 @@ void AudioDriverAndroid::finish() {
}
void AudioDriverAndroid::set_pause(bool p_pause) {
-
JNIEnv *env = ThreadAndroid::get_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
index b1cc3f9aa0..953ade9311 100644
--- a/platform/android/audio_driver_jandroid.h
+++ b/platform/android/audio_driver_jandroid.h
@@ -36,7 +36,6 @@
#include "java_godot_lib_jni.h"
class AudioDriverAndroid : public AudioDriver {
-
static Mutex mutex;
static AudioDriverAndroid *s_ad;
static jobject io;
diff --git a/platform/android/audio_driver_opensl.cpp b/platform/android/audio_driver_opensl.cpp
index e59850e016..740e9a3132 100644
--- a/platform/android/audio_driver_opensl.cpp
+++ b/platform/android/audio_driver_opensl.cpp
@@ -39,7 +39,6 @@
void AudioDriverOpenSL::_buffer_callback(
SLAndroidSimpleBufferQueueItf queueItf) {
-
bool mix = true;
if (pause) {
@@ -51,7 +50,6 @@ void AudioDriverOpenSL::_buffer_callback(
if (mix) {
audio_server_process(buffer_size, mixdown_buffer);
} else {
-
int32_t *src_buff = mixdown_buffer;
for (unsigned int i = 0; i < buffer_size * 2; i++) {
src_buff[i] = 0;
@@ -67,7 +65,6 @@ void AudioDriverOpenSL::_buffer_callback(
last_free = (last_free + 1) % BUFFER_COUNT;
for (unsigned int i = 0; i < buffer_size * 2; i++) {
-
ptr[i] = src_buff[i] >> 16;
}
@@ -77,7 +74,6 @@ void AudioDriverOpenSL::_buffer_callback(
void AudioDriverOpenSL::_buffer_callbacks(
SLAndroidSimpleBufferQueueItf queueItf,
void *pContext) {
-
AudioDriverOpenSL *ad = (AudioDriverOpenSL *)pContext;
ad->_buffer_callback(queueItf);
@@ -86,12 +82,10 @@ void AudioDriverOpenSL::_buffer_callbacks(
AudioDriverOpenSL *AudioDriverOpenSL::s_ad = nullptr;
const char *AudioDriverOpenSL::get_name() const {
-
return "Android";
}
Error AudioDriverOpenSL::init() {
-
SLresult res;
SLEngineOption EngineOption[] = {
{ (SLuint32)SL_ENGINEOPTION_THREADSAFE, (SLuint32)SL_BOOLEAN_TRUE }
@@ -106,7 +100,6 @@ Error AudioDriverOpenSL::init() {
}
void AudioDriverOpenSL::start() {
-
active = false;
SLresult res;
@@ -114,7 +107,6 @@ void AudioDriverOpenSL::start() {
buffer_size = 1024;
for (int i = 0; i < BUFFER_COUNT; i++) {
-
buffers[i] = memnew_arr(int16_t, buffer_size * 2);
memset(buffers[i], 0, buffer_size * 4);
}
@@ -204,7 +196,6 @@ void AudioDriverOpenSL::start() {
}
void AudioDriverOpenSL::_record_buffer_callback(SLAndroidSimpleBufferQueueItf queueItf) {
-
for (int i = 0; i < rec_buffer.size(); i++) {
int32_t sample = rec_buffer[i] << 16;
input_buffer_write(sample);
@@ -216,14 +207,12 @@ void AudioDriverOpenSL::_record_buffer_callback(SLAndroidSimpleBufferQueueItf qu
}
void AudioDriverOpenSL::_record_buffer_callbacks(SLAndroidSimpleBufferQueueItf queueItf, void *pContext) {
-
AudioDriverOpenSL *ad = (AudioDriverOpenSL *)pContext;
ad->_record_buffer_callback(queueItf);
}
Error AudioDriverOpenSL::capture_init_device() {
-
SLDataLocator_IODevice loc_dev = {
SL_DATALOCATOR_IODEVICE,
SL_IODEVICE_AUDIOINPUT,
@@ -291,7 +280,6 @@ Error AudioDriverOpenSL::capture_init_device() {
}
Error AudioDriverOpenSL::capture_start() {
-
if (OS::get_singleton()->request_permission("RECORD_AUDIO")) {
return capture_init_device();
}
@@ -300,7 +288,6 @@ Error AudioDriverOpenSL::capture_start() {
}
Error AudioDriverOpenSL::capture_stop() {
-
SLuint32 state;
SLresult res = (*recordItf)->GetRecordState(recordItf, &state);
ERR_FAIL_COND_V(res != SL_RESULT_SUCCESS, ERR_CANT_OPEN);
@@ -317,34 +304,28 @@ Error AudioDriverOpenSL::capture_stop() {
}
int AudioDriverOpenSL::get_mix_rate() const {
-
return 44100; // hardcoded for Android, as selected by SL_SAMPLINGRATE_44_1
}
AudioDriver::SpeakerMode AudioDriverOpenSL::get_speaker_mode() const {
-
return SPEAKER_MODE_STEREO;
}
void AudioDriverOpenSL::lock() {
-
if (active)
mutex.lock();
}
void AudioDriverOpenSL::unlock() {
-
if (active)
mutex.unlock();
}
void AudioDriverOpenSL::finish() {
-
(*sl)->Destroy(sl);
}
void AudioDriverOpenSL::set_pause(bool p_pause) {
-
pause = p_pause;
if (active) {
diff --git a/platform/android/audio_driver_opensl.h b/platform/android/audio_driver_opensl.h
index 569e2aa54b..9858a40822 100644
--- a/platform/android/audio_driver_opensl.h
+++ b/platform/android/audio_driver_opensl.h
@@ -38,7 +38,6 @@
#include <SLES/OpenSLES_Android.h>
class AudioDriverOpenSL : public AudioDriver {
-
bool active;
Mutex mutex;
diff --git a/platform/android/dir_access_jandroid.cpp b/platform/android/dir_access_jandroid.cpp
index f8571e6277..ca312b427f 100644
--- a/platform/android/dir_access_jandroid.cpp
+++ b/platform/android/dir_access_jandroid.cpp
@@ -42,12 +42,10 @@ jmethodID DirAccessJAndroid::_dir_close = nullptr;
jmethodID DirAccessJAndroid::_dir_is_dir = nullptr;
DirAccess *DirAccessJAndroid::create_fs() {
-
return memnew(DirAccessJAndroid);
}
Error DirAccessJAndroid::list_dir_begin() {
-
list_dir_end();
JNIEnv *env = ThreadAndroid::get_env();
@@ -62,7 +60,6 @@ Error DirAccessJAndroid::list_dir_begin() {
}
String DirAccessJAndroid::get_next() {
-
ERR_FAIL_COND_V(id == 0, "");
JNIEnv *env = ThreadAndroid::get_env();
@@ -76,19 +73,16 @@ String DirAccessJAndroid::get_next() {
}
bool DirAccessJAndroid::current_is_dir() const {
-
JNIEnv *env = ThreadAndroid::get_env();
return env->CallBooleanMethod(io, _dir_is_dir, id);
}
bool DirAccessJAndroid::current_is_hidden() const {
-
return current != "." && current != ".." && current.begins_with(".");
}
void DirAccessJAndroid::list_dir_end() {
-
if (id == 0)
return;
@@ -98,17 +92,14 @@ void DirAccessJAndroid::list_dir_end() {
}
int DirAccessJAndroid::get_drive_count() {
-
return 0;
}
String DirAccessJAndroid::get_drive(int p_drive) {
-
return "";
}
Error DirAccessJAndroid::change_dir(String p_dir) {
-
JNIEnv *env = ThreadAndroid::get_env();
if (p_dir == "" || p_dir == "." || (p_dir == ".." && current_dir == ""))
@@ -145,12 +136,10 @@ Error DirAccessJAndroid::change_dir(String p_dir) {
}
String DirAccessJAndroid::get_current_dir(bool p_include_drive) {
-
return "res://" + current_dir;
}
bool DirAccessJAndroid::file_exists(String p_file) {
-
String sd;
if (current_dir == "")
sd = p_file;
@@ -165,7 +154,6 @@ bool DirAccessJAndroid::file_exists(String p_file) {
}
bool DirAccessJAndroid::dir_exists(String p_dir) {
-
JNIEnv *env = ThreadAndroid::get_env();
String sd;
@@ -198,33 +186,27 @@ bool DirAccessJAndroid::dir_exists(String p_dir) {
}
Error DirAccessJAndroid::make_dir(String p_dir) {
-
ERR_FAIL_V(ERR_UNAVAILABLE);
}
Error DirAccessJAndroid::rename(String p_from, String p_to) {
-
ERR_FAIL_V(ERR_UNAVAILABLE);
}
Error DirAccessJAndroid::remove(String p_name) {
-
ERR_FAIL_V(ERR_UNAVAILABLE);
}
String DirAccessJAndroid::get_filesystem_type() const {
-
return "APK";
}
//FileType get_file_type() const;
size_t DirAccessJAndroid::get_space_left() {
-
return 0;
}
void DirAccessJAndroid::setup(jobject p_io) {
-
JNIEnv *env = ThreadAndroid::get_env();
io = p_io;
@@ -240,11 +222,9 @@ void DirAccessJAndroid::setup(jobject p_io) {
}
DirAccessJAndroid::DirAccessJAndroid() {
-
id = 0;
}
DirAccessJAndroid::~DirAccessJAndroid() {
-
list_dir_end();
}
diff --git a/platform/android/dir_access_jandroid.h b/platform/android/dir_access_jandroid.h
index 8dab3e50ce..7d0def137a 100644
--- a/platform/android/dir_access_jandroid.h
+++ b/platform/android/dir_access_jandroid.h
@@ -36,7 +36,6 @@
#include <stdio.h>
class DirAccessJAndroid : public DirAccess {
-
//AAssetDir* aad;
static jobject io;
diff --git a/platform/android/display_server_android.cpp b/platform/android/display_server_android.cpp
index 60d10b2457..48c23d3c31 100644
--- a/platform/android/display_server_android.cpp
+++ b/platform/android/display_server_android.cpp
@@ -493,7 +493,6 @@ void DisplayServerAndroid::process_touch(int p_what, int p_pointer, const Vector
if (touch.size()) {
//end all if exist
for (int i = 0; i < touch.size(); i++) {
-
Ref<InputEventScreenTouch> ev;
ev.instance();
ev->set_index(touch[i].id);
@@ -511,7 +510,6 @@ void DisplayServerAndroid::process_touch(int p_what, int p_pointer, const Vector
//send touch
for (int i = 0; i < touch.size(); i++) {
-
Ref<InputEventScreenTouch> ev;
ev.instance();
ev->set_index(touch[i].id);
@@ -525,10 +523,8 @@ void DisplayServerAndroid::process_touch(int p_what, int p_pointer, const Vector
ERR_FAIL_COND(touch.size() != p_points.size());
for (int i = 0; i < touch.size(); i++) {
-
int idx = -1;
for (int j = 0; j < p_points.size(); j++) {
-
if (touch[i].id == p_points[j].id) {
idx = j;
break;
@@ -554,7 +550,6 @@ void DisplayServerAndroid::process_touch(int p_what, int p_pointer, const Vector
if (touch.size()) {
//end all if exist
for (int i = 0; i < touch.size(); i++) {
-
Ref<InputEventScreenTouch> ev;
ev.instance();
ev->set_index(touch[i].id);
@@ -586,7 +581,6 @@ void DisplayServerAndroid::process_touch(int p_what, int p_pointer, const Vector
case 4: { // remove touch
for (int i = 0; i < touch.size(); i++) {
if (touch[i].id == p_pointer) {
-
Ref<InputEventScreenTouch> ev;
ev.instance();
ev->set_index(touch[i].id);
diff --git a/platform/android/display_server_android.h b/platform/android/display_server_android.h
index 2096ba68f1..b2909f258b 100644
--- a/platform/android/display_server_android.h
+++ b/platform/android/display_server_android.h
@@ -52,7 +52,6 @@ public:
};
struct JoypadEvent {
-
int device;
int type;
int index;
diff --git a/platform/android/export/export.cpp b/platform/android/export/export.cpp
index f346ca54d2..329798b497 100644
--- a/platform/android/export/export.cpp
+++ b/platform/android/export/export.cpp
@@ -235,14 +235,12 @@ static const LauncherIcon launcher_adaptive_icon_backgrounds[icon_densities_coun
};
class EditorExportPlatformAndroid : public EditorExportPlatform {
-
GDCLASS(EditorExportPlatformAndroid, EditorExportPlatform);
Ref<ImageTexture> logo;
Ref<ImageTexture> run_icon;
struct Device {
-
String id;
String name;
String description;
@@ -250,7 +248,6 @@ class EditorExportPlatformAndroid : public EditorExportPlatform {
};
struct APKExportData {
-
zipFile apk;
EditorProgress *ep;
};
@@ -262,14 +259,11 @@ class EditorExportPlatformAndroid : public EditorExportPlatform {
volatile bool quit_request;
static void _device_poll_thread(void *ud) {
-
EditorExportPlatformAndroid *ea = (EditorExportPlatformAndroid *)ud;
while (!ea->quit_request) {
-
String adb = EditorSettings::get_singleton()->get("export/android/adb");
if (FileAccess::exists(adb)) {
-
String devices;
List<String> args;
args.push_back("devices");
@@ -279,7 +273,6 @@ class EditorExportPlatformAndroid : public EditorExportPlatform {
Vector<String> ds = devices.split("\n");
Vector<String> ldevices;
for (int i = 1; i < ds.size(); i++) {
-
String d = ds[i];
int dpos = d.find("device");
if (dpos == -1)
@@ -293,12 +286,9 @@ class EditorExportPlatformAndroid : public EditorExportPlatform {
bool different = false;
if (ea->devices.size() != ldevices.size()) {
-
different = true;
} else {
-
for (int i = 0; i < ea->devices.size(); i++) {
-
if (ea->devices[i].id != ldevices[i]) {
different = true;
break;
@@ -307,11 +297,9 @@ class EditorExportPlatformAndroid : public EditorExportPlatform {
}
if (different) {
-
Vector<Device> ndevices;
for (int i = 0; i < ldevices.size(); i++) {
-
Device d;
d.id = ldevices[i];
for (int j = 0; j < ea->devices.size(); j++) {
@@ -340,7 +328,6 @@ class EditorExportPlatformAndroid : public EditorExportPlatform {
d.description = "Device ID: " + d.id + "\n";
d.api_level = 0;
for (int j = 0; j < props.size(); j++) {
-
// got information by `shell cat /system/build.prop` before and its format is "property=value"
// it's now changed to use `shell getporp` because of permission issue with Android 8.0 and above
// its format is "[property]: [value]" so changed it as like build.prop
@@ -407,7 +394,6 @@ class EditorExportPlatformAndroid : public EditorExportPlatform {
}
String get_project_name(const String &p_name) const {
-
String aname;
if (p_name != "") {
aname = p_name;
@@ -423,7 +409,6 @@ class EditorExportPlatformAndroid : public EditorExportPlatform {
}
String get_package_name(const String &p_package) const {
-
String pname = p_package;
String basename = ProjectSettings::get_singleton()->get("application/config/name");
basename = basename.to_lower();
@@ -449,7 +434,6 @@ class EditorExportPlatformAndroid : public EditorExportPlatform {
}
bool is_package_name_valid(const String &p_package, String *r_error = nullptr) const {
-
String pname = p_package;
if (pname.length() == 0) {
@@ -513,7 +497,6 @@ class EditorExportPlatformAndroid : public EditorExportPlatform {
}
static bool _should_compress_asset(const String &p_path, const Vector<uint8_t> &p_data) {
-
/*
* By not compressing files with little or not benefit in doing so,
* a performance gain is expected attime. Moreover, if the APK is
@@ -560,7 +543,6 @@ class EditorExportPlatformAndroid : public EditorExportPlatform {
}
static zip_fileinfo get_zip_fileinfo() {
-
OS::Time time = OS::get_singleton()->get_time();
OS::Date date = OS::get_singleton()->get_date();
@@ -649,7 +631,6 @@ class EditorExportPlatformAndroid : public EditorExportPlatform {
}
void _fix_manifest(const Ref<EditorExportPreset> &p_preset, Vector<uint8_t> &p_manifest, bool p_give_internet) {
-
// Leaving the unused types commented because looking these constants up
// again later would be annoying
// const int CHUNK_AXML_FILE = 0x00080003;
@@ -695,7 +676,6 @@ class EditorExportPlatformAndroid : public EditorExportPlatform {
const char **aperms = android_perms;
while (*aperms) {
-
bool enabled = p_preset->get("permissions/" + String(*aperms).to_lower());
if (enabled)
perms.push_back("android.permission." + String(*aperms));
@@ -717,14 +697,11 @@ class EditorExportPlatformAndroid : public EditorExportPlatform {
}
while (ofs < (uint32_t)p_manifest.size()) {
-
uint32_t chunk = decode_uint32(&p_manifest[ofs]);
uint32_t size = decode_uint32(&p_manifest[ofs + 4]);
switch (chunk) {
-
case CHUNK_STRINGS: {
-
int iofs = ofs + 8;
string_count = decode_uint32(&p_manifest[iofs]);
@@ -745,14 +722,12 @@ class EditorExportPlatformAndroid : public EditorExportPlatform {
string_table_begins = st_offset;
for (uint32_t i = 0; i < string_count; i++) {
-
uint32_t string_at = decode_uint32(&p_manifest[st_offset + i * 4]);
string_at += st_offset + string_count * 4;
ERR_FAIL_COND_MSG(string_flags & UTF8_FLAG, "Unimplemented, can't read UTF-8 string table.");
if (string_flags & UTF8_FLAG) {
-
} else {
uint32_t len = decode_uint16(&p_manifest[string_at]);
Vector<CharType> ucstring;
@@ -775,7 +750,6 @@ class EditorExportPlatformAndroid : public EditorExportPlatform {
} break;
case CHUNK_XML_START_TAG: {
-
int iofs = ofs + 8;
uint32_t name = decode_uint32(&p_manifest[iofs + 12]);
@@ -814,26 +788,20 @@ class EditorExportPlatformAndroid : public EditorExportPlatform {
}
if (tname == "activity" && attrname == "screenOrientation") {
-
encode_uint32(orientation == 0 ? 0 : 1, &p_manifest.write[iofs + 16]);
}
if (tname == "supports-screens") {
-
if (attrname == "smallScreens") {
-
encode_uint32(screen_support_small ? 0xFFFFFFFF : 0, &p_manifest.write[iofs + 16]);
} else if (attrname == "normalScreens") {
-
encode_uint32(screen_support_normal ? 0xFFFFFFFF : 0, &p_manifest.write[iofs + 16]);
} else if (attrname == "largeScreens") {
-
encode_uint32(screen_support_large ? 0xFFFFFFFF : 0, &p_manifest.write[iofs + 16]);
} else if (attrname == "xlargeScreens") {
-
encode_uint32(screen_support_xlarge ? 0xFFFFFFFF : 0, &p_manifest.write[iofs + 16]);
}
}
@@ -1038,7 +1006,6 @@ class EditorExportPlatformAndroid : public EditorExportPlatform {
}
}
if (tname == "manifest") {
-
// save manifest ending so we can restore it
Vector<uint8_t> manifest_end;
uint32_t manifest_cur_size = p_manifest.size();
@@ -1124,13 +1091,11 @@ class EditorExportPlatformAndroid : public EditorExportPlatform {
ret.resize(string_table_begins + string_table.size() * 4);
for (uint32_t i = 0; i < string_table_begins; i++) {
-
ret.write[i] = p_manifest[i];
}
ofs = 0;
for (int i = 0; i < string_table.size(); i++) {
-
encode_uint32(ofs, &ret.write[string_table_begins + i * 4]);
ofs += string_table[i].length() * 2 + 2 + 2;
}
@@ -1139,7 +1104,6 @@ class EditorExportPlatformAndroid : public EditorExportPlatform {
string_data_offset = ret.size() - ofs;
uint8_t *chars = &ret.write[string_data_offset];
for (int i = 0; i < string_table.size(); i++) {
-
String s = string_table[i];
encode_uint16(s.length(), chars);
chars += 2;
@@ -1178,7 +1142,6 @@ class EditorExportPlatformAndroid : public EditorExportPlatform {
}
static String _parse_string(const uint8_t *p_bytes, bool p_utf8) {
-
uint32_t offset = 0;
uint32_t len = 0;
@@ -1208,7 +1171,6 @@ class EditorExportPlatformAndroid : public EditorExportPlatform {
}
if (p_utf8) {
-
Vector<uint8_t> str8;
str8.resize(len + 1);
for (uint32_t i = 0; i < len; i++) {
@@ -1219,7 +1181,6 @@ class EditorExportPlatformAndroid : public EditorExportPlatform {
str.parse_utf8((const char *)str8.ptr());
return str;
} else {
-
String str;
for (uint32_t i = 0; i < len; i++) {
CharType c = decode_uint16(&p_bytes[offset + i * 2]);
@@ -1231,7 +1192,6 @@ class EditorExportPlatformAndroid : public EditorExportPlatform {
}
}
void _fix_resources(const Ref<EditorExportPreset> &p_preset, Vector<uint8_t> &p_manifest) {
-
const int UTF8_FLAG = 0x00000100;
uint32_t string_block_len = decode_uint32(&p_manifest[16]);
@@ -1244,20 +1204,17 @@ class EditorExportPlatformAndroid : public EditorExportPlatform {
String package_name = p_preset->get("package/name");
for (uint32_t i = 0; i < string_count; i++) {
-
uint32_t offset = decode_uint32(&p_manifest[string_table_begins + i * 4]);
offset += string_table_begins + string_count * 4;
String str = _parse_string(&p_manifest[offset], string_flags & UTF8_FLAG);
if (str.begins_with("godot-project-name")) {
-
if (str == "godot-project-name") {
//project name
str = get_project_name(package_name);
} else {
-
String lang = str.substr(str.find_last("-") + 1, str.length()).replace("-", "_");
String prop = "application/config/name_" + lang;
if (ProjectSettings::get_singleton()->has_setting(prop)) {
@@ -1276,13 +1233,11 @@ class EditorExportPlatformAndroid : public EditorExportPlatform {
ret.resize(string_table_begins + string_table.size() * 4);
for (uint32_t i = 0; i < string_table_begins; i++) {
-
ret.write[i] = p_manifest[i];
}
int ofs = 0;
for (int i = 0; i < string_table.size(); i++) {
-
encode_uint32(ofs, &ret.write[string_table_begins + i * 4]);
ofs += string_table[i].length() * 2 + 2 + 2;
}
@@ -1290,7 +1245,6 @@ class EditorExportPlatformAndroid : public EditorExportPlatform {
ret.resize(ret.size() + ofs);
uint8_t *chars = &ret.write[ret.size() - ofs];
for (int i = 0; i < string_table.size(); i++) {
-
String s = string_table[i];
encode_uint16(s.length(), chars);
chars += 2;
@@ -1363,7 +1317,6 @@ public:
public:
virtual void get_preset_features(const Ref<EditorExportPreset> &p_preset, List<String> *r_features) {
-
String driver = ProjectSettings::get_singleton()->get("rendering/quality/driver/driver_name");
if (driver == "GLES2") {
r_features->push_back("etc");
@@ -1380,7 +1333,6 @@ public:
}
virtual void get_export_options(List<ExportOption> *r_options) {
-
r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "graphics/32_bits_framebuffer"), true));
r_options->push_back(ExportOption(PropertyInfo(Variant::INT, "xr_features/xr_mode", PROPERTY_HINT_ENUM, "Regular,Oculus Mobile VR"), 0));
r_options->push_back(ExportOption(PropertyInfo(Variant::INT, "xr_features/degrees_of_freedom", PROPERTY_HINT_ENUM, "None,3DOF and 6DOF,6DOF"), 0));
@@ -1427,7 +1379,6 @@ public:
const char **perms = android_perms;
while (*perms) {
-
r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "permissions/" + String(*perms).to_lower()), false));
perms++;
}
@@ -1446,7 +1397,6 @@ public:
}
virtual bool poll_export() {
-
bool dc = devices_changed;
if (dc) {
// don't clear unless we're reporting true, to avoid race
@@ -1456,25 +1406,21 @@ public:
}
virtual int get_options_count() const {
-
MutexLock lock(device_lock);
return devices.size();
}
virtual String get_options_tooltip() const {
-
return TTR("Select device from the list");
}
virtual String get_option_label(int p_index) const {
-
ERR_FAIL_INDEX_V(p_index, devices.size(), "");
MutexLock lock(device_lock);
return devices[p_index].name;
}
virtual String get_option_tooltip(int p_index) const {
-
ERR_FAIL_INDEX_V(p_index, devices.size(), "");
MutexLock lock(device_lock);
String s = devices[p_index].description;
@@ -1488,7 +1434,6 @@ public:
}
virtual Error run(const Ref<EditorExportPreset> &p_preset, int p_device, int p_debug_flags) {
-
ERR_FAIL_INDEX_V(p_device, devices.size(), ERR_INVALID_PARAMETER);
String can_export_error;
@@ -1572,7 +1517,6 @@ public:
if (use_remote) {
if (use_reverse) {
-
static const char *const msg = "--- Device API >= 21; debugging over USB ---";
EditorNode::get_singleton()->get_log()->add_message(msg, EditorLog::MSG_TYPE_EDITOR);
print_line(String(msg).to_upper());
@@ -1585,7 +1529,6 @@ public:
OS::get_singleton()->execute(adb, args, true, nullptr, nullptr, &rv);
if (p_debug_flags & DEBUG_FLAG_REMOTE_DEBUG) {
-
int dbg_port = EditorSettings::get_singleton()->get("network/debug/remote_port");
args.clear();
args.push_back("-s");
@@ -1599,7 +1542,6 @@ public:
}
if (p_debug_flags & DEBUG_FLAG_DUMB_CLIENT) {
-
int fs_port = EditorSettings::get_singleton()->get("filesystem/file_server/port");
args.clear();
@@ -1613,7 +1555,6 @@ public:
print_line("Reverse result2: " + itos(rv));
}
} else {
-
static const char *const msg = "--- Device API < 21; debugging over Wi-Fi ---";
EditorNode::get_singleton()->get_log()->add_message(msg, EditorLog::MSG_TYPE_EDITOR);
print_line(String(msg).to_upper());
@@ -1653,7 +1594,6 @@ public:
}
virtual bool can_export(const Ref<EditorExportPreset> &p_preset, String &r_error, bool &r_missing_templates) const {
-
String err;
bool valid = false;
@@ -1687,7 +1627,6 @@ public:
String adb = EditorSettings::get_singleton()->get("export/android/adb");
if (!FileAccess::exists(adb)) {
-
valid = false;
err += TTR("ADB executable not configured in the Editor Settings.") + "\n";
}
@@ -1695,7 +1634,6 @@ public:
String js = EditorSettings::get_singleton()->get("export/android/jarsigner");
if (!FileAccess::exists(js)) {
-
valid = false;
err += TTR("OpenJDK jarsigner not configured in the Editor Settings.") + "\n";
}
@@ -1703,7 +1641,6 @@ public:
String dk = p_preset->get("keystore/debug");
if (!FileAccess::exists(dk)) {
-
dk = EditorSettings::get_singleton()->get("export/android/debug_keystore");
if (!FileAccess::exists(dk)) {
valid = false;
@@ -1726,7 +1663,6 @@ public:
}
if (!FileAccess::exists("res://android/build/build.gradle")) {
-
err += TTR("Android build template not installed in the project. Install it from the Project menu.") + "\n";
valid = false;
}
@@ -1735,7 +1671,6 @@ public:
bool apk_expansion = p_preset->get("apk_expansion/enable");
if (apk_expansion) {
-
String apk_expansion_pkey = p_preset->get("apk_expansion/public_key");
if (apk_expansion_pkey == "") {
@@ -1749,7 +1684,6 @@ public:
String pn_err;
if (!is_package_name_valid(get_package_name(pn), &pn_err)) {
-
valid = false;
err += TTR("Invalid package name:") + " " + pn_err + "\n";
}
@@ -1771,7 +1705,6 @@ public:
}
virtual Error export_project(const Ref<EditorExportPreset> &p_preset, bool p_debug, const String &p_path, int p_flags = 0) {
-
ExportNotifier notifier(*this, p_preset, p_debug, p_path, p_flags);
String src_apk;
@@ -1846,7 +1779,6 @@ public:
}
} else {
-
if (p_debug)
src_apk = p_preset->get("custom_template/debug");
else
@@ -1879,7 +1811,6 @@ public:
unzFile pkg = unzOpen2(src_apk.utf8().get_data(), &io);
if (!pkg) {
-
EditorNode::add_io_error("Could not find template APK to export:\n" + src_apk);
return ERR_FILE_NOT_FOUND;
}
@@ -1953,7 +1884,6 @@ public:
Vector<String> invalid_abis(enabled_abis);
while (ret == UNZ_OK) {
-
//get filename
unz_file_info info;
char fname[16384];
@@ -2059,7 +1989,6 @@ public:
gen_export_flags(cl, p_flags);
if (p_flags & DEBUG_FLAG_DUMB_CLIENT) {
-
APKExportData ed;
ed.ep = &ep;
ed.apk = unaligned_apk;
@@ -2068,7 +1997,6 @@ public:
//all files
if (apk_expansion) {
-
String apkfname = "main." + itos(version_code) + "." + get_package_name(package_name) + ".obb";
String fullpath = p_path.get_base_dir().plus_file(apkfname);
err = save_pack(p_preset, fullpath);
@@ -2087,7 +2015,6 @@ public:
cl.push_back(apk_expansion_pkey.strip_edges());
} else {
-
APKExportData ed;
ed.ep = &ep;
ed.apk = unaligned_apk;
@@ -2119,7 +2046,6 @@ public:
clf.resize(4);
encode_uint32(cl.size(), &clf.write[0]);
for (int i = 0; i < cl.size(); i++) {
-
print_line(itos(i) + " param: " + cl[i]);
CharString txt = cl[i].utf8();
int base = clf.size();
@@ -2156,7 +2082,6 @@ public:
}
if (_signed) {
-
String jarsigner = EditorSettings::get_singleton()->get("export/android/jarsigner");
if (!FileAccess::exists(jarsigner)) {
EditorNode::add_io_error("'jarsigner' could not be found.\nPlease supply a path in the Editor Settings.\nThe resulting APK is unsigned.");
@@ -2167,13 +2092,11 @@ public:
String password;
String user;
if (p_debug) {
-
keystore = p_preset->get("keystore/debug");
password = p_preset->get("keystore/debug_password");
user = p_preset->get("keystore/debug_user");
if (keystore.empty()) {
-
keystore = EditorSettings::get_singleton()->get("export/android/debug_keystore");
password = EditorSettings::get_singleton()->get("export/android/debug_keystore_pass");
user = EditorSettings::get_singleton()->get("export/android/debug_keystore_user");
@@ -2250,7 +2173,6 @@ public:
unzFile tmp_unaligned = unzOpen2(tmp_unaligned_path.utf8().get_data(), &io);
if (!tmp_unaligned) {
-
EditorNode::add_io_error("Could not unzip temporary unaligned APK.");
CLEANUP_AND_RETURN(ERR_FILE_NOT_FOUND);
}
@@ -2267,7 +2189,6 @@ public:
// following what is done in https://github.com/android/platform_build/blob/master/tools/zipalign/ZipAlign.cpp
int bias = 0;
while (ret == UNZ_OK) {
-
unz_file_info info;
memset(&info, 0, sizeof(info));
@@ -2326,7 +2247,6 @@ public:
}
virtual void get_platform_features(List<String> *r_features) {
-
r_features->push_back("mobile");
r_features->push_back("Android");
}
@@ -2335,7 +2255,6 @@ public:
}
EditorExportPlatformAndroid() {
-
Ref<Image> img = memnew(Image(_android_logo));
logo.instance();
logo->create_from_image(img);
@@ -2357,7 +2276,6 @@ public:
};
void register_android_exporter() {
-
String exe_ext;
if (OS::get_singleton()->get_name() == "Windows") {
exe_ext = "*.exe";
diff --git a/platform/android/file_access_android.cpp b/platform/android/file_access_android.cpp
index fa805ec4f3..05d5fb576d 100644
--- a/platform/android/file_access_android.cpp
+++ b/platform/android/file_access_android.cpp
@@ -39,12 +39,10 @@ AAssetManager *FileAccessAndroid::asset_manager = nullptr;
}*/
FileAccess *FileAccessAndroid::create_android() {
-
return memnew(FileAccessAndroid);
}
Error FileAccessAndroid::_open(const String &p_path, int p_mode_flags) {
-
String path = fix_path(p_path).simplify_path();
if (path.begins_with("/"))
path = path.substr(1, path.length());
@@ -64,7 +62,6 @@ Error FileAccessAndroid::_open(const String &p_path, int p_mode_flags) {
}
void FileAccessAndroid::close() {
-
if (!a)
return;
AAsset_close(a);
@@ -72,12 +69,10 @@ void FileAccessAndroid::close() {
}
bool FileAccessAndroid::is_open() const {
-
return a != nullptr;
}
void FileAccessAndroid::seek(size_t p_position) {
-
ERR_FAIL_COND(!a);
AAsset_seek(a, p_position, SEEK_SET);
pos = p_position;
@@ -90,29 +85,24 @@ void FileAccessAndroid::seek(size_t p_position) {
}
void FileAccessAndroid::seek_end(int64_t p_position) {
-
ERR_FAIL_COND(!a);
AAsset_seek(a, p_position, SEEK_END);
pos = len + p_position;
}
size_t FileAccessAndroid::get_position() const {
-
return pos;
}
size_t FileAccessAndroid::get_len() const {
-
return len;
}
bool FileAccessAndroid::eof_reached() const {
-
return eof;
}
uint8_t FileAccessAndroid::get_8() const {
-
if (pos >= len) {
eof = true;
return 0;
@@ -125,7 +115,6 @@ uint8_t FileAccessAndroid::get_8() const {
}
int FileAccessAndroid::get_buffer(uint8_t *p_dst, int p_length) const {
-
off_t r = AAsset_read(a, p_dst, p_length);
if (pos + p_length > len) {
@@ -133,7 +122,6 @@ int FileAccessAndroid::get_buffer(uint8_t *p_dst, int p_length) const {
}
if (r >= 0) {
-
pos += r;
if (pos > len) {
pos = len;
@@ -143,22 +131,18 @@ int FileAccessAndroid::get_buffer(uint8_t *p_dst, int p_length) const {
}
Error FileAccessAndroid::get_error() const {
-
return eof ? ERR_FILE_EOF : OK; //not sure what else it may happen
}
void FileAccessAndroid::flush() {
-
ERR_FAIL();
}
void FileAccessAndroid::store_8(uint8_t p_dest) {
-
ERR_FAIL();
}
bool FileAccessAndroid::file_exists(const String &p_path) {
-
String path = fix_path(p_path).simplify_path();
if (path.begins_with("/"))
path = path.substr(1, path.length());
diff --git a/platform/android/file_access_android.h b/platform/android/file_access_android.h
index 6b5ec541fd..a347c63ffb 100644
--- a/platform/android/file_access_android.h
+++ b/platform/android/file_access_android.h
@@ -38,7 +38,6 @@
//#include <android_native_app_glue.h>
class FileAccessAndroid : public FileAccess {
-
static FileAccess *create_android();
mutable AAsset *a;
mutable size_t len;
diff --git a/platform/android/file_access_jandroid.cpp b/platform/android/file_access_jandroid.cpp
index e088eca8ef..4095be00ab 100644
--- a/platform/android/file_access_jandroid.cpp
+++ b/platform/android/file_access_jandroid.cpp
@@ -44,12 +44,10 @@ jmethodID FileAccessJAndroid::_file_eof = 0;
jmethodID FileAccessJAndroid::_file_close = 0;
FileAccess *FileAccessJAndroid::create_jandroid() {
-
return memnew(FileAccessJAndroid);
}
Error FileAccessJAndroid::_open(const String &p_path, int p_mode_flags) {
-
if (is_open())
close();
@@ -75,7 +73,6 @@ Error FileAccessJAndroid::_open(const String &p_path, int p_mode_flags) {
}
void FileAccessJAndroid::close() {
-
if (!is_open())
return;
@@ -86,12 +83,10 @@ void FileAccessJAndroid::close() {
}
bool FileAccessJAndroid::is_open() const {
-
return id != 0;
}
void FileAccessJAndroid::seek(size_t p_position) {
-
JNIEnv *env = ThreadAndroid::get_env();
ERR_FAIL_COND_MSG(!is_open(), "File must be opened before use.");
@@ -99,42 +94,36 @@ void FileAccessJAndroid::seek(size_t p_position) {
}
void FileAccessJAndroid::seek_end(int64_t p_position) {
-
ERR_FAIL_COND_MSG(!is_open(), "File must be opened before use.");
seek(get_len());
}
size_t FileAccessJAndroid::get_position() const {
-
JNIEnv *env = ThreadAndroid::get_env();
ERR_FAIL_COND_V_MSG(!is_open(), 0, "File must be opened before use.");
return env->CallIntMethod(io, _file_tell, id);
}
size_t FileAccessJAndroid::get_len() const {
-
JNIEnv *env = ThreadAndroid::get_env();
ERR_FAIL_COND_V_MSG(!is_open(), 0, "File must be opened before use.");
return env->CallIntMethod(io, _file_get_size, id);
}
bool FileAccessJAndroid::eof_reached() const {
-
JNIEnv *env = ThreadAndroid::get_env();
ERR_FAIL_COND_V_MSG(!is_open(), 0, "File must be opened before use.");
return env->CallIntMethod(io, _file_eof, id);
}
uint8_t FileAccessJAndroid::get_8() const {
-
ERR_FAIL_COND_V_MSG(!is_open(), 0, "File must be opened before use.");
uint8_t byte;
get_buffer(&byte, 1);
return byte;
}
int FileAccessJAndroid::get_buffer(uint8_t *p_dst, int p_length) const {
-
ERR_FAIL_COND_V_MSG(!is_open(), 0, "File must be opened before use.");
if (p_length == 0)
return 0;
@@ -150,7 +139,6 @@ int FileAccessJAndroid::get_buffer(uint8_t *p_dst, int p_length) const {
}
Error FileAccessJAndroid::get_error() const {
-
if (eof_reached())
return ERR_FILE_EOF;
return OK;
@@ -163,7 +151,6 @@ void FileAccessJAndroid::store_8(uint8_t p_dest) {
}
bool FileAccessJAndroid::file_exists(const String &p_path) {
-
JNIEnv *env = ThreadAndroid::get_env();
String path = fix_path(p_path).simplify_path();
@@ -184,7 +171,6 @@ bool FileAccessJAndroid::file_exists(const String &p_path) {
}
void FileAccessJAndroid::setup(jobject p_io) {
-
io = p_io;
JNIEnv *env = ThreadAndroid::get_env();
@@ -201,12 +187,10 @@ void FileAccessJAndroid::setup(jobject p_io) {
}
FileAccessJAndroid::FileAccessJAndroid() {
-
id = 0;
}
FileAccessJAndroid::~FileAccessJAndroid() {
-
if (is_open())
close();
}
diff --git a/platform/android/file_access_jandroid.h b/platform/android/file_access_jandroid.h
index b361c64922..e252a4d3ac 100644
--- a/platform/android/file_access_jandroid.h
+++ b/platform/android/file_access_jandroid.h
@@ -34,7 +34,6 @@
#include "core/os/file_access.h"
#include "java_godot_lib_jni.h"
class FileAccessJAndroid : public FileAccess {
-
static jobject io;
static jclass cls;
diff --git a/platform/android/java/lib/src/org/godotengine/godot/Dictionary.java b/platform/android/java/lib/src/org/godotengine/godot/Dictionary.java
index 594cae774b..8b7a9c6c74 100644
--- a/platform/android/java/lib/src/org/godotengine/godot/Dictionary.java
+++ b/platform/android/java/lib/src/org/godotengine/godot/Dictionary.java
@@ -34,16 +34,13 @@ import java.util.HashMap;
import java.util.Set;
public class Dictionary extends HashMap<String, Object> {
-
protected String[] keys_cache;
public String[] get_keys() {
-
String[] ret = new String[size()];
int i = 0;
Set<String> keys = keySet();
for (String key : keys) {
-
ret[i] = key;
i++;
};
@@ -52,12 +49,10 @@ public class Dictionary extends HashMap<String, Object> {
};
public Object[] get_values() {
-
Object[] ret = new Object[size()];
int i = 0;
Set<String> keys = keySet();
for (String key : keys) {
-
ret[i] = get(key);
i++;
};
@@ -70,7 +65,6 @@ public class Dictionary extends HashMap<String, Object> {
};
public void set_values(Object[] vals) {
-
int i = 0;
for (String key : keys_cache) {
put(key, vals[i]);
diff --git a/platform/android/java/lib/src/org/godotengine/godot/Godot.java b/platform/android/java/lib/src/org/godotengine/godot/Godot.java
index ffe5402a54..cc9c7a9652 100644
--- a/platform/android/java/lib/src/org/godotengine/godot/Godot.java
+++ b/platform/android/java/lib/src/org/godotengine/godot/Godot.java
@@ -102,7 +102,6 @@ import java.util.List;
import java.util.Locale;
public abstract class Godot extends FragmentActivity implements SensorEventListener, IDownloaderClient {
-
private IStub mDownloaderClientStub;
private TextView mStatusText;
private TextView mProgressFraction;
@@ -251,7 +250,6 @@ public abstract class Godot extends FragmentActivity implements SensorEventListe
mRenderView.queueOnRenderThread(new Runnable() {
@Override
public void run() {
-
// Must occur after GodotLib.setup has completed.
for (GodotPlugin plugin : pluginRegistry.getAllPlugins()) {
plugin.onRegisterPluginWithGodotNative();
@@ -361,7 +359,6 @@ public abstract class Godot extends FragmentActivity implements SensorEventListe
for (int i = 0; i < argc; i++) {
r = is.read(len);
if (r < 4) {
-
return new String[0];
}
int strlen = ((int)(len[3] & 0xFF) << 24) | ((int)(len[2] & 0xFF) << 16) | ((int)(len[1] & 0xFF) << 8) | ((int)(len[0] & 0xFF));
@@ -409,9 +406,7 @@ public abstract class Godot extends FragmentActivity implements SensorEventListe
String expansion_pack_path;
private void initializeGodot() {
-
if (expansion_pack_path != null) {
-
String[] new_cmdline;
int cll = 0;
if (command_line != null) {
@@ -458,7 +453,6 @@ public abstract class Godot extends FragmentActivity implements SensorEventListe
@Override
protected void onCreate(Bundle icicle) {
-
super.onCreate(icicle);
Window window = getWindow();
window.addFlags(WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON);
@@ -475,7 +469,6 @@ public abstract class Godot extends FragmentActivity implements SensorEventListe
List<String> new_args = new LinkedList<String>();
for (int i = 0; i < command_line.length; i++) {
-
boolean has_extra = i < command_line.length - 1;
if (command_line[i].equals(XRMode.REGULAR.cmdLineArg)) {
xrMode = XRMode.REGULAR;
@@ -519,7 +512,6 @@ public abstract class Godot extends FragmentActivity implements SensorEventListe
if (new_args.isEmpty()) {
command_line = null;
} else {
-
command_line = new_args.toArray(new String[new_args.size()]);
}
if (use_apk_expansion && main_pack_md5 != null && main_pack_key != null) {
@@ -541,7 +533,6 @@ public abstract class Godot extends FragmentActivity implements SensorEventListe
boolean pack_valid = true;
if (!f.exists()) {
-
pack_valid = false;
} else if (obbIsCorrupted(expansion_pack_path, main_pack_md5)) {
@@ -553,7 +544,6 @@ public abstract class Godot extends FragmentActivity implements SensorEventListe
}
if (!pack_valid) {
-
Intent notifierIntent = new Intent(this, this.getClass());
notifierIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK |
Intent.FLAG_ACTIVITY_CLEAR_TOP);
@@ -602,7 +592,6 @@ public abstract class Godot extends FragmentActivity implements SensorEventListe
@Override
protected void onDestroy() {
-
for (GodotPlugin plugin : pluginRegistry.getAllPlugins()) {
plugin.onMainDestroy();
}
@@ -637,7 +626,6 @@ public abstract class Godot extends FragmentActivity implements SensorEventListe
}
public String getClipboard() {
-
String copiedText = "";
if (mClipboard.getPrimaryClip() != null) {
@@ -649,7 +637,6 @@ public abstract class Godot extends FragmentActivity implements SensorEventListe
}
public void setClipboard(String p_text) {
-
ClipData clip = ClipData.newPlainText("myLabel", p_text);
mClipboard.setPrimaryClip(clip);
}
@@ -809,9 +796,7 @@ public abstract class Godot extends FragmentActivity implements SensorEventListe
}
private boolean obbIsCorrupted(String f, String main_pack_md5) {
-
try {
-
InputStream fis = new FileInputStream(f);
// Create MD5 Hash
@@ -852,7 +837,6 @@ public abstract class Godot extends FragmentActivity implements SensorEventListe
}
public boolean gotTouchEvent(final MotionEvent event) {
-
final int evcount = event.getPointerCount();
if (evcount == 0)
return true;
@@ -861,7 +845,6 @@ public abstract class Godot extends FragmentActivity implements SensorEventListe
final int[] arr = new int[event.getPointerCount() * 3];
for (int i = 0; i < event.getPointerCount(); i++) {
-
arr[i * 3 + 0] = (int)event.getPointerId(i);
arr[i * 3 + 1] = (int)event.getX(i);
arr[i * 3 + 2] = (int)event.getY(i);
diff --git a/platform/android/java/lib/src/org/godotengine/godot/GodotDownloaderAlarmReceiver.java b/platform/android/java/lib/src/org/godotengine/godot/GodotDownloaderAlarmReceiver.java
index fa95e82e7a..a3dae15980 100644
--- a/platform/android/java/lib/src/org/godotengine/godot/GodotDownloaderAlarmReceiver.java
+++ b/platform/android/java/lib/src/org/godotengine/godot/GodotDownloaderAlarmReceiver.java
@@ -46,7 +46,6 @@ import com.google.android.vending.expansion.downloader.DownloaderClientMarshalle
* <receiver android:name=".GodotDownloaderAlarmReceiver"/>
*/
public class GodotDownloaderAlarmReceiver extends BroadcastReceiver {
-
@Override
public void onReceive(Context context, Intent intent) {
Log.d("GODOT", "Alarma recivida");
diff --git a/platform/android/java/lib/src/org/godotengine/godot/GodotGLRenderView.java b/platform/android/java/lib/src/org/godotengine/godot/GodotGLRenderView.java
index 5d8ac09643..14dd893faa 100644
--- a/platform/android/java/lib/src/org/godotengine/godot/GodotGLRenderView.java
+++ b/platform/android/java/lib/src/org/godotengine/godot/GodotGLRenderView.java
@@ -68,7 +68,6 @@ import android.view.SurfaceView;
* bit depths). Failure to do so would result in an EGL_BAD_MATCH error.
*/
public class GodotGLRenderView extends GLSurfaceView implements GodotRenderView {
-
private final Godot activity;
private final GodotInputHandler inputHandler;
private final GestureDetector detector;
@@ -140,11 +139,9 @@ public class GodotGLRenderView extends GLSurfaceView implements GodotRenderView
}
private void init(XRMode xrMode, boolean translucent, int depth, int stencil) {
-
setPreserveEGLContextOnPause(true);
setFocusableInTouchMode(true);
switch (xrMode) {
-
case OVR:
// Replace the default egl config chooser.
setEGLConfigChooser(new OvrConfigChooser());
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 2eb6f4e313..410b93824d 100644
--- a/platform/android/java/lib/src/org/godotengine/godot/GodotIO.java
+++ b/platform/android/java/lib/src/org/godotengine/godot/GodotIO.java
@@ -50,7 +50,6 @@ import java.util.Locale;
// Wrapper for native library
public class GodotIO {
-
AssetManager am;
Godot activity;
GodotEditText edit;
@@ -70,7 +69,6 @@ public class GodotIO {
public int last_file_id = 1;
class AssetData {
-
public boolean eof = false;
public String path;
public InputStream is;
@@ -81,7 +79,6 @@ public class GodotIO {
SparseArray<AssetData> streams;
public int file_open(String path, boolean write) {
-
//System.out.printf("file_open: Attempt to Open %s\n",path);
//Log.v("MyApp", "TRYING TO OPEN FILE: " + path);
@@ -94,7 +91,6 @@ public class GodotIO {
ad.is = am.open(path);
} catch (Exception e) {
-
//System.out.printf("Exception on file_open: %s\n",path);
return -1;
}
@@ -102,7 +98,6 @@ public class GodotIO {
try {
ad.len = ad.is.available();
} catch (Exception e) {
-
System.out.printf("Exception availabling on file_open: %s\n", path);
return -1;
}
@@ -115,7 +110,6 @@ public class GodotIO {
return last_file_id;
}
public int file_get_size(int id) {
-
if (streams.get(id) == null) {
System.out.printf("file_get_size: Invalid file id: %d\n", id);
return -1;
@@ -124,7 +118,6 @@ public class GodotIO {
return streams.get(id).len;
}
public void file_seek(int id, int bytes) {
-
if (streams.get(id) == null) {
System.out.printf("file_get_size: Invalid file id: %d\n", id);
return;
@@ -137,7 +130,6 @@ public class GodotIO {
bytes = 0;
try {
-
if (bytes > (int)ad.pos) {
int todo = bytes - (int)ad.pos;
while (todo > 0) {
@@ -145,7 +137,6 @@ public class GodotIO {
}
ad.pos = bytes;
} else if (bytes < (int)ad.pos) {
-
ad.is = am.open(ad.path);
ad.pos = bytes;
@@ -157,14 +148,12 @@ public class GodotIO {
ad.eof = false;
} catch (IOException e) {
-
System.out.printf("Exception on file_seek: %s\n", e);
return;
}
}
public int file_tell(int id) {
-
if (streams.get(id) == null) {
System.out.printf("file_read: Can't tell eof for invalid file id: %d\n", id);
return 0;
@@ -174,7 +163,6 @@ public class GodotIO {
return ad.pos;
}
public boolean file_eof(int id) {
-
if (streams.get(id) == null) {
System.out.printf("file_read: Can't check eof for invalid file id: %d\n", id);
return false;
@@ -185,7 +173,6 @@ public class GodotIO {
}
public byte[] file_read(int id, int bytes) {
-
if (streams.get(id) == null) {
System.out.printf("file_read: Can't read invalid file id: %d\n", id);
return new byte[0];
@@ -194,13 +181,11 @@ public class GodotIO {
AssetData ad = streams.get(id);
if (ad.pos + bytes > ad.len) {
-
bytes = ad.len - ad.pos;
ad.eof = true;
}
if (bytes == 0) {
-
return new byte[0];
}
@@ -209,7 +194,6 @@ public class GodotIO {
try {
r = ad.is.read(buf1);
} catch (IOException e) {
-
System.out.printf("Exception on file_read: %s\n", e);
return new byte[bytes];
}
@@ -221,19 +205,16 @@ public class GodotIO {
ad.pos += r;
if (r < bytes) {
-
byte[] buf2 = new byte[r];
for (int i = 0; i < r; i++)
buf2[i] = buf1[i];
return buf2;
} else {
-
return buf1;
}
}
public void file_close(int id) {
-
if (streams.get(id) == null) {
System.out.printf("file_close: Can't close invalid file id: %d\n", id);
return;
@@ -247,7 +228,6 @@ public class GodotIO {
/////////////////////////
class AssetDir {
-
public String[] files;
public int current;
public String path;
@@ -258,7 +238,6 @@ public class GodotIO {
SparseArray<AssetDir> dirs;
public int dir_open(String path) {
-
AssetDir ad = new AssetDir();
ad.current = 0;
ad.path = path;
@@ -271,7 +250,6 @@ public class GodotIO {
return -1;
}
} catch (IOException e) {
-
System.out.printf("Exception on dir_open: %s\n", e);
return -1;
}
@@ -310,7 +288,6 @@ public class GodotIO {
}
public String dir_next(int id) {
-
if (dirs.get(id) == null) {
System.out.printf("dir_next: invalid dir id: %d\n", id);
return "";
@@ -329,7 +306,6 @@ public class GodotIO {
}
public void dir_close(int id) {
-
if (dirs.get(id) == null) {
System.out.printf("dir_close: invalid dir id: %d\n", id);
return;
@@ -339,7 +315,6 @@ public class GodotIO {
}
GodotIO(Godot p_activity) {
-
am = p_activity.getAssets();
activity = p_activity;
//streams = new HashMap<Integer, AssetData>();
@@ -430,7 +405,6 @@ public class GodotIO {
}
public void audioPause(boolean p_pause) {
-
if (p_pause)
mAudioTrack.pause();
else
@@ -442,7 +416,6 @@ public class GodotIO {
/////////////////////////
public int openURI(String p_uri) {
-
try {
Log.v("MyApp", "TRYING TO OPEN URI: " + p_uri);
String path = p_uri;
@@ -451,7 +424,6 @@ public class GodotIO {
//absolute path to filesystem, prepend file://
path = "file://" + path;
if (p_uri.endsWith(".png") || p_uri.endsWith(".jpg") || p_uri.endsWith(".gif") || p_uri.endsWith(".webp")) {
-
type = "image/*";
}
}
@@ -467,18 +439,15 @@ public class GodotIO {
activity.startActivity(intent);
return 0;
} catch (ActivityNotFoundException e) {
-
return 1;
}
}
public String getDataDir() {
-
return activity.getFilesDir().getAbsolutePath();
}
public String getLocale() {
-
return Locale.getDefault().toString();
}
@@ -505,9 +474,7 @@ public class GodotIO {
};
public void setScreenOrientation(int p_orientation) {
-
switch (p_orientation) {
-
case SCREEN_LANDSCAPE: {
activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
} break;
@@ -550,7 +517,6 @@ public class GodotIO {
public static final int SYSTEM_DIR_RINGTONES = 7;
public String getSystemDir(int idx) {
-
String what = "";
switch (idx) {
case SYSTEM_DIR_DESKTOP: {
@@ -595,7 +561,6 @@ public class GodotIO {
public static String unique_id = "";
public String getUniqueID() {
-
return unique_id;
}
}
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 9383781150..72198ba123 100644
--- a/platform/android/java/lib/src/org/godotengine/godot/GodotLib.java
+++ b/platform/android/java/lib/src/org/godotengine/godot/GodotLib.java
@@ -41,7 +41,6 @@ import javax.microedition.khronos.opengles.GL10;
* Wrapper for native library
*/
public class GodotLib {
-
public static GodotIO io;
static {
diff --git a/platform/android/java/lib/src/org/godotengine/godot/GodotRenderView.java b/platform/android/java/lib/src/org/godotengine/godot/GodotRenderView.java
index 170c433c9c..27e63f3a66 100644
--- a/platform/android/java/lib/src/org/godotengine/godot/GodotRenderView.java
+++ b/platform/android/java/lib/src/org/godotengine/godot/GodotRenderView.java
@@ -33,7 +33,6 @@ package org.godotengine.godot;
import android.view.SurfaceView;
public interface GodotRenderView {
-
abstract public SurfaceView getView();
abstract public void initInputDevices();
diff --git a/platform/android/java/lib/src/org/godotengine/godot/GodotRenderer.java b/platform/android/java/lib/src/org/godotengine/godot/GodotRenderer.java
index 39858e5fee..99d3662317 100644
--- a/platform/android/java/lib/src/org/godotengine/godot/GodotRenderer.java
+++ b/platform/android/java/lib/src/org/godotengine/godot/GodotRenderer.java
@@ -44,7 +44,6 @@ import javax.microedition.khronos.opengles.GL10;
* Godot's renderer implementation.
*/
class GodotRenderer implements GLSurfaceView.Renderer {
-
private final GodotPluginRegistry pluginRegistry;
private boolean activityJustResumed = false;
diff --git a/platform/android/java/lib/src/org/godotengine/godot/GodotVulkanRenderView.java b/platform/android/java/lib/src/org/godotengine/godot/GodotVulkanRenderView.java
index 3a36c512a2..e9872b58ff 100644
--- a/platform/android/java/lib/src/org/godotengine/godot/GodotVulkanRenderView.java
+++ b/platform/android/java/lib/src/org/godotengine/godot/GodotVulkanRenderView.java
@@ -42,7 +42,6 @@ import android.view.MotionEvent;
import android.view.SurfaceView;
public class GodotVulkanRenderView extends VkSurfaceView implements GodotRenderView {
-
private final Godot mActivity;
private final GodotInputHandler mInputHandler;
private final GestureDetector mGestureDetector;
diff --git a/platform/android/java/lib/src/org/godotengine/godot/input/GodotGestureHandler.java b/platform/android/java/lib/src/org/godotengine/godot/input/GodotGestureHandler.java
index 0ac82dbfe4..1c9a683bbd 100644
--- a/platform/android/java/lib/src/org/godotengine/godot/input/GodotGestureHandler.java
+++ b/platform/android/java/lib/src/org/godotengine/godot/input/GodotGestureHandler.java
@@ -42,7 +42,6 @@ import android.view.MotionEvent;
* https://developer.android.com/reference/android/view/GestureDetector.SimpleOnGestureListener
*/
public class GodotGestureHandler extends GestureDetector.SimpleOnGestureListener {
-
private final GodotRenderView mRenderView;
public GodotGestureHandler(GodotRenderView godotView) {
diff --git a/platform/android/java/lib/src/org/godotengine/godot/input/GodotInputHandler.java b/platform/android/java/lib/src/org/godotengine/godot/input/GodotInputHandler.java
index cea58f27e6..9abd65cc67 100644
--- a/platform/android/java/lib/src/org/godotengine/godot/input/GodotInputHandler.java
+++ b/platform/android/java/lib/src/org/godotengine/godot/input/GodotInputHandler.java
@@ -51,7 +51,6 @@ import java.util.List;
* Handles input related events for the {@link GodotRenderView} view.
*/
public class GodotInputHandler implements InputDeviceListener {
-
private final ArrayList<Joystick> mJoysticksDevices = new ArrayList<Joystick>();
private final GodotRenderView mRenderView;
@@ -86,7 +85,6 @@ public class GodotInputHandler implements InputDeviceListener {
int source = event.getSource();
if (isKeyEvent_GameDevice(source)) {
-
final int button = getGodotButton(keyCode);
final int device_id = findJoystickDevice(event.getDeviceId());
@@ -129,7 +127,6 @@ public class GodotInputHandler implements InputDeviceListener {
//Log.e(TAG, String.format("Key down! source %d, device %d, joystick %d, %d, %d", event.getDeviceId(), source, (source & InputDevice.SOURCE_JOYSTICK), (source & InputDevice.SOURCE_DPAD), (source & InputDevice.SOURCE_GAMEPAD)));
if (isKeyEvent_GameDevice(source)) {
-
if (event.getRepeatCount() > 0) // ignore key echo
return true;
@@ -161,7 +158,6 @@ public class GodotInputHandler implements InputDeviceListener {
public boolean onGenericMotionEvent(MotionEvent event) {
if ((event.getSource() & InputDevice.SOURCE_JOYSTICK) == InputDevice.SOURCE_JOYSTICK && event.getAction() == MotionEvent.ACTION_MOVE) {
-
final int device_id = findJoystickDevice(event.getDeviceId());
// Check if the device exists
diff --git a/platform/android/java/lib/src/org/godotengine/godot/input/InputManagerCompat.java b/platform/android/java/lib/src/org/godotengine/godot/input/InputManagerCompat.java
index 4042c42e9d..62810ad3a4 100644
--- a/platform/android/java/lib/src/org/godotengine/godot/input/InputManagerCompat.java
+++ b/platform/android/java/lib/src/org/godotengine/godot/input/InputManagerCompat.java
@@ -120,7 +120,6 @@ public interface InputManagerCompat {
* Use this to construct a compatible InputManager.
*/
public static class Factory {
-
/**
* Constructs and returns a compatible InputManger
*
diff --git a/platform/android/java/lib/src/org/godotengine/godot/input/InputManagerV16.java b/platform/android/java/lib/src/org/godotengine/godot/input/InputManagerV16.java
index 3b88609cc9..61828dccae 100644
--- a/platform/android/java/lib/src/org/godotengine/godot/input/InputManagerV16.java
+++ b/platform/android/java/lib/src/org/godotengine/godot/input/InputManagerV16.java
@@ -29,7 +29,6 @@ import java.util.Map;
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
public class InputManagerV16 implements InputManagerCompat {
-
private final InputManager mInputManager;
private final Map<InputManagerCompat.InputDeviceListener, V16InputDeviceListener> mListeners;
diff --git a/platform/android/java/lib/src/org/godotengine/godot/plugin/GodotPlugin.java b/platform/android/java/lib/src/org/godotengine/godot/plugin/GodotPlugin.java
index a42bcb28ce..a8146a1332 100644
--- a/platform/android/java/lib/src/org/godotengine/godot/plugin/GodotPlugin.java
+++ b/platform/android/java/lib/src/org/godotengine/godot/plugin/GodotPlugin.java
@@ -76,7 +76,6 @@ import javax.microedition.khronos.opengles.GL10;
* 'godot/plugin/v1/[PluginName]/'
*/
public abstract class GodotPlugin {
-
private static final String TAG = GodotPlugin.class.getSimpleName();
private final Godot godot;
diff --git a/platform/android/java/lib/src/org/godotengine/godot/plugin/GodotPluginRegistry.java b/platform/android/java/lib/src/org/godotengine/godot/plugin/GodotPluginRegistry.java
index 7bc8f2c03f..bb11300861 100644
--- a/platform/android/java/lib/src/org/godotengine/godot/plugin/GodotPluginRegistry.java
+++ b/platform/android/java/lib/src/org/godotengine/godot/plugin/GodotPluginRegistry.java
@@ -51,7 +51,6 @@ import java.util.concurrent.ConcurrentHashMap;
* Registry used to load and access the registered Godot Android plugins.
*/
public final class GodotPluginRegistry {
-
private static final String TAG = GodotPluginRegistry.class.getSimpleName();
private static final String GODOT_PLUGIN_V1_NAME_PREFIX = "org.godotengine.plugin.v1.";
diff --git a/platform/android/java/lib/src/org/godotengine/godot/plugin/SignalInfo.java b/platform/android/java/lib/src/org/godotengine/godot/plugin/SignalInfo.java
index 424251169b..71523d8c27 100644
--- a/platform/android/java/lib/src/org/godotengine/godot/plugin/SignalInfo.java
+++ b/platform/android/java/lib/src/org/godotengine/godot/plugin/SignalInfo.java
@@ -39,7 +39,6 @@ import java.util.Arrays;
* Store information about a {@link GodotPlugin}'s signal.
*/
public final class SignalInfo {
-
private final String name;
private final Class<?>[] paramTypes;
private final String[] paramTypesNames;
diff --git a/platform/android/java/lib/src/org/godotengine/godot/utils/Crypt.java b/platform/android/java/lib/src/org/godotengine/godot/utils/Crypt.java
index bc0e565774..acc9c4981b 100644
--- a/platform/android/java/lib/src/org/godotengine/godot/utils/Crypt.java
+++ b/platform/android/java/lib/src/org/godotengine/godot/utils/Crypt.java
@@ -34,7 +34,6 @@ import java.security.MessageDigest;
import java.util.Random;
public class Crypt {
-
public static String md5(String input) {
try {
// Create MD5 Hash
diff --git a/platform/android/java/lib/src/org/godotengine/godot/utils/GLUtils.java b/platform/android/java/lib/src/org/godotengine/godot/utils/GLUtils.java
index 291847723c..82420eda79 100644
--- a/platform/android/java/lib/src/org/godotengine/godot/utils/GLUtils.java
+++ b/platform/android/java/lib/src/org/godotengine/godot/utils/GLUtils.java
@@ -40,7 +40,6 @@ import javax.microedition.khronos.egl.EGLDisplay;
* Contains GL utilities methods.
*/
public class GLUtils {
-
private static final String TAG = GLUtils.class.getSimpleName();
public static final boolean DEBUG = false;
diff --git a/platform/android/java/lib/src/org/godotengine/godot/utils/GodotNetUtils.java b/platform/android/java/lib/src/org/godotengine/godot/utils/GodotNetUtils.java
index bb1667afda..0832a9b965 100644
--- a/platform/android/java/lib/src/org/godotengine/godot/utils/GodotNetUtils.java
+++ b/platform/android/java/lib/src/org/godotengine/godot/utils/GodotNetUtils.java
@@ -42,7 +42,6 @@ import android.util.Log;
* to receive broadcast and multicast packets.
*/
public class GodotNetUtils {
-
/* A single, reference counted, multicast lock, or null if permission CHANGE_WIFI_MULTICAST_STATE is missing */
private WifiManager.MulticastLock multicastLock;
diff --git a/platform/android/java/lib/src/org/godotengine/godot/utils/PermissionsUtil.java b/platform/android/java/lib/src/org/godotengine/godot/utils/PermissionsUtil.java
index 4000e63fbe..c34e4c18db 100644
--- a/platform/android/java/lib/src/org/godotengine/godot/utils/PermissionsUtil.java
+++ b/platform/android/java/lib/src/org/godotengine/godot/utils/PermissionsUtil.java
@@ -48,7 +48,6 @@ import java.util.List;
* @author Cagdas Caglak <cagdascaglak@gmail.com>
*/
public final class PermissionsUtil {
-
private static final String TAG = PermissionsUtil.class.getSimpleName();
static final int REQUEST_RECORD_AUDIO_PERMISSION = 1;
diff --git a/platform/android/java/lib/src/org/godotengine/godot/xr/ovr/OvrConfigChooser.java b/platform/android/java/lib/src/org/godotengine/godot/xr/ovr/OvrConfigChooser.java
index c66d75bb2d..819bcccdf1 100644
--- a/platform/android/java/lib/src/org/godotengine/godot/xr/ovr/OvrConfigChooser.java
+++ b/platform/android/java/lib/src/org/godotengine/godot/xr/ovr/OvrConfigChooser.java
@@ -41,7 +41,6 @@ import javax.microedition.khronos.egl.EGLDisplay;
* EGL config chooser for the Oculus Mobile VR SDK.
*/
public class OvrConfigChooser implements GLSurfaceView.EGLConfigChooser {
-
private static final int[] CONFIG_ATTRIBS = {
EGL10.EGL_RED_SIZE, 8,
EGL10.EGL_GREEN_SIZE, 8,
diff --git a/platform/android/java/lib/src/org/godotengine/godot/xr/ovr/OvrContextFactory.java b/platform/android/java/lib/src/org/godotengine/godot/xr/ovr/OvrContextFactory.java
index 16d4a998f2..2d9b921466 100644
--- a/platform/android/java/lib/src/org/godotengine/godot/xr/ovr/OvrContextFactory.java
+++ b/platform/android/java/lib/src/org/godotengine/godot/xr/ovr/OvrContextFactory.java
@@ -42,7 +42,6 @@ import javax.microedition.khronos.egl.EGLDisplay;
* EGL Context factory for the Oculus mobile VR SDK.
*/
public class OvrContextFactory implements GLSurfaceView.EGLContextFactory {
-
private static final int[] CONTEXT_ATTRIBS = {
EGL14.EGL_CONTEXT_CLIENT_VERSION, 3, EGL10.EGL_NONE
};
diff --git a/platform/android/java/lib/src/org/godotengine/godot/xr/ovr/OvrWindowSurfaceFactory.java b/platform/android/java/lib/src/org/godotengine/godot/xr/ovr/OvrWindowSurfaceFactory.java
index 7ca0777f11..43c7f0f966 100644
--- a/platform/android/java/lib/src/org/godotengine/godot/xr/ovr/OvrWindowSurfaceFactory.java
+++ b/platform/android/java/lib/src/org/godotengine/godot/xr/ovr/OvrWindowSurfaceFactory.java
@@ -41,7 +41,6 @@ import javax.microedition.khronos.egl.EGLSurface;
* EGL window surface factory for the Oculus mobile VR SDK.
*/
public class OvrWindowSurfaceFactory implements GLSurfaceView.EGLWindowSurfaceFactory {
-
private final static int[] SURFACE_ATTRIBS = {
EGL10.EGL_WIDTH, 16,
EGL10.EGL_HEIGHT, 16,
diff --git a/platform/android/java/lib/src/org/godotengine/godot/xr/regular/RegularConfigChooser.java b/platform/android/java/lib/src/org/godotengine/godot/xr/regular/RegularConfigChooser.java
index 924d12f0bc..54672db282 100644
--- a/platform/android/java/lib/src/org/godotengine/godot/xr/regular/RegularConfigChooser.java
+++ b/platform/android/java/lib/src/org/godotengine/godot/xr/regular/RegularConfigChooser.java
@@ -42,7 +42,6 @@ import javax.microedition.khronos.egl.EGLDisplay;
* Used to select the egl config for pancake games.
*/
public class RegularConfigChooser implements GLSurfaceView.EGLConfigChooser {
-
private static final String TAG = RegularConfigChooser.class.getSimpleName();
private int[] mValue = new int[1];
@@ -74,7 +73,6 @@ public class RegularConfigChooser implements GLSurfaceView.EGLConfigChooser {
}
public EGLConfig chooseConfig(EGL10 egl, EGLDisplay display) {
-
/* Get the number of minimally matching EGL configurations
*/
int[] num_config = new int[1];
@@ -129,7 +127,6 @@ public class RegularConfigChooser implements GLSurfaceView.EGLConfigChooser {
private int findConfigAttrib(EGL10 egl, EGLDisplay display,
EGLConfig config, int attribute, int defaultValue) {
-
if (egl.eglGetConfigAttrib(display, config, attribute, mValue)) {
return mValue[0];
}
diff --git a/platform/android/java/lib/src/org/godotengine/godot/xr/regular/RegularFallbackConfigChooser.java b/platform/android/java/lib/src/org/godotengine/godot/xr/regular/RegularFallbackConfigChooser.java
index 64bc4ac1da..c83c47bed7 100644
--- a/platform/android/java/lib/src/org/godotengine/godot/xr/regular/RegularFallbackConfigChooser.java
+++ b/platform/android/java/lib/src/org/godotengine/godot/xr/regular/RegularFallbackConfigChooser.java
@@ -40,7 +40,6 @@ import javax.microedition.khronos.egl.EGLDisplay;
/* Fallback if 32bit View is not supported*/
public class RegularFallbackConfigChooser extends RegularConfigChooser {
-
private static final String TAG = RegularFallbackConfigChooser.class.getSimpleName();
private RegularConfigChooser fallback;
diff --git a/platform/android/java/plugins/godotpayment/src/main/java/org/godotengine/godot/plugin/payment/ConsumeTask.java b/platform/android/java/plugins/godotpayment/src/main/java/org/godotengine/godot/plugin/payment/ConsumeTask.java
index 31c72fe7f8..de009f6d16 100644
--- a/platform/android/java/plugins/godotpayment/src/main/java/org/godotengine/godot/plugin/payment/ConsumeTask.java
+++ b/platform/android/java/plugins/godotpayment/src/main/java/org/godotengine/godot/plugin/payment/ConsumeTask.java
@@ -39,7 +39,6 @@ import com.android.vending.billing.IInAppBillingService;
import java.lang.ref.WeakReference;
abstract public class ConsumeTask {
-
private Context context;
private IInAppBillingService mService;
@@ -47,7 +46,6 @@ abstract public class ConsumeTask {
private String mToken;
private static class ConsumeAsyncTask extends AsyncTask<String, String, String> {
-
private WeakReference<ConsumeTask> mTask;
ConsumeAsyncTask(ConsumeTask consume) {
diff --git a/platform/android/java/plugins/godotpayment/src/main/java/org/godotengine/godot/plugin/payment/GodotPayment.java b/platform/android/java/plugins/godotpayment/src/main/java/org/godotengine/godot/plugin/payment/GodotPayment.java
index 08ade2a18d..6f76007e1e 100644
--- a/platform/android/java/plugins/godotpayment/src/main/java/org/godotengine/godot/plugin/payment/GodotPayment.java
+++ b/platform/android/java/plugins/godotpayment/src/main/java/org/godotengine/godot/plugin/payment/GodotPayment.java
@@ -47,7 +47,6 @@ import org.json.JSONException;
import org.json.JSONObject;
public class GodotPayment extends GodotPlugin {
-
private Integer purchaseCallbackId = 0;
private String accessToken;
private String purchaseValidationUrlPrefix;
diff --git a/platform/android/java/plugins/godotpayment/src/main/java/org/godotengine/godot/plugin/payment/HandlePurchaseTask.java b/platform/android/java/plugins/godotpayment/src/main/java/org/godotengine/godot/plugin/payment/HandlePurchaseTask.java
index 70a51fcb97..00e216e8c0 100644
--- a/platform/android/java/plugins/godotpayment/src/main/java/org/godotengine/godot/plugin/payment/HandlePurchaseTask.java
+++ b/platform/android/java/plugins/godotpayment/src/main/java/org/godotengine/godot/plugin/payment/HandlePurchaseTask.java
@@ -37,7 +37,6 @@ import org.json.JSONException;
import org.json.JSONObject;
abstract public class HandlePurchaseTask {
-
private Activity context;
public HandlePurchaseTask(Activity context) {
diff --git a/platform/android/java/plugins/godotpayment/src/main/java/org/godotengine/godot/plugin/payment/PaymentsCache.java b/platform/android/java/plugins/godotpayment/src/main/java/org/godotengine/godot/plugin/payment/PaymentsCache.java
index d5919e3d9d..435f43c49d 100644
--- a/platform/android/java/plugins/godotpayment/src/main/java/org/godotengine/godot/plugin/payment/PaymentsCache.java
+++ b/platform/android/java/plugins/godotpayment/src/main/java/org/godotengine/godot/plugin/payment/PaymentsCache.java
@@ -34,7 +34,6 @@ import android.content.Context;
import android.content.SharedPreferences;
public class PaymentsCache {
-
public Context context;
public PaymentsCache(Context context) {
diff --git a/platform/android/java/plugins/godotpayment/src/main/java/org/godotengine/godot/plugin/payment/PaymentsManager.java b/platform/android/java/plugins/godotpayment/src/main/java/org/godotengine/godot/plugin/payment/PaymentsManager.java
index 0393c0b06e..9b3a338866 100644
--- a/platform/android/java/plugins/godotpayment/src/main/java/org/godotengine/godot/plugin/payment/PaymentsManager.java
+++ b/platform/android/java/plugins/godotpayment/src/main/java/org/godotengine/godot/plugin/payment/PaymentsManager.java
@@ -50,7 +50,6 @@ import org.json.JSONException;
import org.json.JSONObject;
public class PaymentsManager {
-
public static final int BILLING_RESPONSE_RESULT_OK = 0;
public static final int REQUEST_CODE_FOR_PURCHASE = 0x1001;
private static boolean auto_consume = true;
@@ -158,7 +157,6 @@ public class PaymentsManager {
Bundle bundle = mService.getPurchases(3, activity.getPackageName(), "inapp", continueToken);
if (bundle.getInt("RESPONSE_CODE") == 0) {
-
final ArrayList<String> myPurchases = bundle.getStringArrayList("INAPP_PURCHASE_DATA_LIST");
final ArrayList<String> mySignatures = bundle.getStringArrayList("INAPP_DATA_SIGNATURE_LIST");
@@ -168,7 +166,6 @@ public class PaymentsManager {
}
for (int i = 0; i < myPurchases.size(); i++) {
-
try {
String receipt = myPurchases.get(i);
JSONObject inappPurchaseData = new JSONObject(receipt);
@@ -229,11 +226,9 @@ public class PaymentsManager {
}
public void validatePurchase(String purchaseToken, final String sku) {
-
new ValidateTask(activity, godotPayment) {
@Override
protected void success() {
-
new ConsumeTask(mService, activity) {
@Override
protected void success(String ticket) {
diff --git a/platform/android/java/plugins/godotpayment/src/main/java/org/godotengine/godot/plugin/payment/PurchaseTask.java b/platform/android/java/plugins/godotpayment/src/main/java/org/godotengine/godot/plugin/payment/PurchaseTask.java
index 4894e4020f..2742bb15bf 100644
--- a/platform/android/java/plugins/godotpayment/src/main/java/org/godotengine/godot/plugin/payment/PurchaseTask.java
+++ b/platform/android/java/plugins/godotpayment/src/main/java/org/godotengine/godot/plugin/payment/PurchaseTask.java
@@ -41,7 +41,6 @@ import android.util.Log;
import com.android.vending.billing.IInAppBillingService;
abstract public class PurchaseTask {
-
private Activity context;
private IInAppBillingService mService;
diff --git a/platform/android/java/plugins/godotpayment/src/main/java/org/godotengine/godot/plugin/payment/ReleaseAllConsumablesTask.java b/platform/android/java/plugins/godotpayment/src/main/java/org/godotengine/godot/plugin/payment/ReleaseAllConsumablesTask.java
index 006688a450..1d52cf0fa5 100644
--- a/platform/android/java/plugins/godotpayment/src/main/java/org/godotengine/godot/plugin/payment/ReleaseAllConsumablesTask.java
+++ b/platform/android/java/plugins/godotpayment/src/main/java/org/godotengine/godot/plugin/payment/ReleaseAllConsumablesTask.java
@@ -44,12 +44,10 @@ import org.json.JSONException;
import org.json.JSONObject;
abstract public class ReleaseAllConsumablesTask {
-
private Context context;
private IInAppBillingService mService;
private static class ReleaseAllConsumablesAsyncTask extends AsyncTask<String, String, String> {
-
private WeakReference<ReleaseAllConsumablesTask> mTask;
private String mSku;
private String mReceipt;
@@ -94,7 +92,6 @@ abstract public class ReleaseAllConsumablesTask {
Bundle bundle = mService.getPurchases(3, context.getPackageName(), "inapp", null);
if (bundle.getInt("RESPONSE_CODE") == 0) {
-
final ArrayList<String> myPurchases = bundle.getStringArrayList("INAPP_PURCHASE_DATA_LIST");
final ArrayList<String> mySignatures = bundle.getStringArrayList("INAPP_DATA_SIGNATURE_LIST");
@@ -106,7 +103,6 @@ abstract public class ReleaseAllConsumablesTask {
//Log.d("godot", "# products to be consumed:" + myPurchases.size());
for (int i = 0; i < myPurchases.size(); i++) {
-
try {
String receipt = myPurchases.get(i);
JSONObject inappPurchaseData = new JSONObject(receipt);
diff --git a/platform/android/java/plugins/godotpayment/src/main/java/org/godotengine/godot/plugin/payment/ValidateTask.java b/platform/android/java/plugins/godotpayment/src/main/java/org/godotengine/godot/plugin/payment/ValidateTask.java
index 4ee7b5a0f8..a7156152ce 100644
--- a/platform/android/java/plugins/godotpayment/src/main/java/org/godotengine/godot/plugin/payment/ValidateTask.java
+++ b/platform/android/java/plugins/godotpayment/src/main/java/org/godotengine/godot/plugin/payment/ValidateTask.java
@@ -43,7 +43,6 @@ import org.json.JSONException;
import org.json.JSONObject;
abstract public class ValidateTask {
-
private Activity context;
private GodotPayment godotPayments;
private ProgressDialog dialog;
diff --git a/platform/android/java/plugins/godotpayment/src/main/java/org/godotengine/godot/plugin/payment/utils/HttpRequester.java b/platform/android/java/plugins/godotpayment/src/main/java/org/godotengine/godot/plugin/payment/utils/HttpRequester.java
index acd17f10f2..0afcf60f38 100644
--- a/platform/android/java/plugins/godotpayment/src/main/java/org/godotengine/godot/plugin/payment/utils/HttpRequester.java
+++ b/platform/android/java/plugins/godotpayment/src/main/java/org/godotengine/godot/plugin/payment/utils/HttpRequester.java
@@ -71,7 +71,6 @@ import org.apache.http.util.EntityUtils;
* @author Luis Linietsky <luis.linietsky@gmail.com>
*/
public class HttpRequester {
-
private Context context;
private static final int TTL = 600000; // 10 minutos
private long cttl = 0;
diff --git a/platform/android/java/plugins/godotpayment/src/main/java/org/godotengine/godot/plugin/payment/utils/RequestParams.java b/platform/android/java/plugins/godotpayment/src/main/java/org/godotengine/godot/plugin/payment/utils/RequestParams.java
index 023fd87f68..6b66c7e474 100644
--- a/platform/android/java/plugins/godotpayment/src/main/java/org/godotengine/godot/plugin/payment/utils/RequestParams.java
+++ b/platform/android/java/plugins/godotpayment/src/main/java/org/godotengine/godot/plugin/payment/utils/RequestParams.java
@@ -42,7 +42,6 @@ import org.apache.http.message.BasicNameValuePair;
* @author Luis Linietsky <luis.linietsky@gmail.com>
*/
public class RequestParams {
-
private HashMap<String, String> params;
private String url;
diff --git a/platform/android/java_class_wrapper.cpp b/platform/android/java_class_wrapper.cpp
index 6b9105b8e5..39de3cb642 100644
--- a/platform/android/java_class_wrapper.cpp
+++ b/platform/android/java_class_wrapper.cpp
@@ -33,7 +33,6 @@
#include "thread_jandroid.h"
bool JavaClass::_call_method(JavaObject *p_instance, const StringName &p_method, const Variant **p_args, int p_argcount, Callable::CallError &r_error, Variant &ret) {
-
Map<StringName, List<MethodInfo>>::Element *M = methods.find(p_method);
if (!M)
return false;
@@ -42,7 +41,6 @@ bool JavaClass::_call_method(JavaObject *p_instance, const StringName &p_method,
MethodInfo *method = nullptr;
for (List<MethodInfo>::Element *E = M->get().front(); E; E = E->next()) {
-
if (!p_instance && !E->get()._static) {
r_error.error = Callable::CallError::CALL_ERROR_INSTANCE_IS_NULL;
continue;
@@ -50,13 +48,11 @@ bool JavaClass::_call_method(JavaObject *p_instance, const StringName &p_method,
int pc = E->get().param_types.size();
if (pc > p_argcount) {
-
r_error.error = Callable::CallError::CALL_ERROR_TOO_FEW_ARGUMENTS;
r_error.argument = pc;
continue;
}
if (pc < p_argcount) {
-
r_error.error = Callable::CallError::CALL_ERROR_TOO_MANY_ARGUMENTS;
r_error.argument = pc;
continue;
@@ -65,10 +61,8 @@ bool JavaClass::_call_method(JavaObject *p_instance, const StringName &p_method,
bool valid = true;
for (int i = 0; i < pc; i++) {
-
Variant::Type arg_expected = Variant::NIL;
switch (ptypes[i]) {
-
case ARG_TYPE_VOID: {
//bug?
} break;
@@ -86,7 +80,6 @@ bool JavaClass::_call_method(JavaObject *p_instance, const StringName &p_method,
case ARG_TYPE_SHORT:
case ARG_TYPE_INT:
case ARG_TYPE_LONG: {
-
if (!p_args[i]->is_num())
arg_expected = Variant::INT;
@@ -95,32 +88,26 @@ bool JavaClass::_call_method(JavaObject *p_instance, const StringName &p_method,
case ARG_NUMBER_CLASS_BIT | ARG_TYPE_DOUBLE:
case ARG_TYPE_FLOAT:
case ARG_TYPE_DOUBLE: {
-
if (!p_args[i]->is_num())
arg_expected = Variant::FLOAT;
} break;
case ARG_TYPE_STRING: {
-
if (p_args[i]->get_type() != Variant::STRING)
arg_expected = Variant::STRING;
} break;
case ARG_TYPE_CLASS: {
-
if (p_args[i]->get_type() != Variant::OBJECT)
arg_expected = Variant::OBJECT;
else {
-
Ref<Reference> ref = *p_args[i];
if (!ref.is_null()) {
if (Object::cast_to<JavaObject>(ref.ptr())) {
-
Ref<JavaObject> jo = ref;
//could be faster
jclass c = env->FindClass(E->get().param_sigs[i].operator String().utf8().get_data());
if (!c || !env->IsInstanceOf(jo->instance, c)) {
-
arg_expected = Variant::OBJECT;
} else {
//ok
@@ -133,7 +120,6 @@ bool JavaClass::_call_method(JavaObject *p_instance, const StringName &p_method,
} break;
default: {
-
if (p_args[i]->get_type() != Variant::ARRAY)
arg_expected = Variant::ARRAY;
@@ -163,13 +149,11 @@ bool JavaClass::_call_method(JavaObject *p_instance, const StringName &p_method,
jvalue *argv = nullptr;
if (method->param_types.size()) {
-
argv = (jvalue *)alloca(sizeof(jvalue) * method->param_types.size());
}
List<jobject> to_free;
for (int i = 0; i < method->param_types.size(); i++) {
-
switch (method->param_types[i]) {
case ARG_TYPE_VOID: {
//can't happen
@@ -279,10 +263,8 @@ bool JavaClass::_call_method(JavaObject *p_instance, const StringName &p_method,
to_free.push_back(jStr);
} break;
case ARG_TYPE_CLASS: {
-
Ref<JavaObject> jo = *p_args[i];
if (jo.is_valid()) {
-
argv[i].l = jo->instance;
} else {
argv[i].l = nullptr; //I hope this works
@@ -290,7 +272,6 @@ bool JavaClass::_call_method(JavaObject *p_instance, const StringName &p_method,
} break;
case ARG_ARRAY_BIT | ARG_TYPE_BOOLEAN: {
-
Array arr = *p_args[i];
jbooleanArray a = env->NewBooleanArray(arr.size());
for (int j = 0; j < arr.size(); j++) {
@@ -302,7 +283,6 @@ bool JavaClass::_call_method(JavaObject *p_instance, const StringName &p_method,
} break;
case ARG_ARRAY_BIT | ARG_TYPE_BYTE: {
-
Array arr = *p_args[i];
jbyteArray a = env->NewByteArray(arr.size());
for (int j = 0; j < arr.size(); j++) {
@@ -314,7 +294,6 @@ bool JavaClass::_call_method(JavaObject *p_instance, const StringName &p_method,
} break;
case ARG_ARRAY_BIT | ARG_TYPE_CHAR: {
-
Array arr = *p_args[i];
jcharArray a = env->NewCharArray(arr.size());
for (int j = 0; j < arr.size(); j++) {
@@ -326,7 +305,6 @@ bool JavaClass::_call_method(JavaObject *p_instance, const StringName &p_method,
} break;
case ARG_ARRAY_BIT | ARG_TYPE_SHORT: {
-
Array arr = *p_args[i];
jshortArray a = env->NewShortArray(arr.size());
for (int j = 0; j < arr.size(); j++) {
@@ -338,7 +316,6 @@ bool JavaClass::_call_method(JavaObject *p_instance, const StringName &p_method,
} break;
case ARG_ARRAY_BIT | ARG_TYPE_INT: {
-
Array arr = *p_args[i];
jintArray a = env->NewIntArray(arr.size());
for (int j = 0; j < arr.size(); j++) {
@@ -360,7 +337,6 @@ bool JavaClass::_call_method(JavaObject *p_instance, const StringName &p_method,
} break;
case ARG_ARRAY_BIT | ARG_TYPE_FLOAT: {
-
Array arr = *p_args[i];
jfloatArray a = env->NewFloatArray(arr.size());
for (int j = 0; j < arr.size(); j++) {
@@ -372,7 +348,6 @@ bool JavaClass::_call_method(JavaObject *p_instance, const StringName &p_method,
} break;
case ARG_ARRAY_BIT | ARG_TYPE_DOUBLE: {
-
Array arr = *p_args[i];
jdoubleArray a = env->NewDoubleArray(arr.size());
for (int j = 0; j < arr.size(); j++) {
@@ -384,11 +359,9 @@ bool JavaClass::_call_method(JavaObject *p_instance, const StringName &p_method,
} break;
case ARG_ARRAY_BIT | ARG_TYPE_STRING: {
-
Array arr = *p_args[i];
jobjectArray a = env->NewObjectArray(arr.size(), env->FindClass("java/lang/String"), nullptr);
for (int j = 0; j < arr.size(); j++) {
-
String s = arr[j];
jstring jStr = env->NewStringUTF(s.utf8().get_data());
env->SetObjectArrayElement(a, j, jStr);
@@ -399,7 +372,6 @@ bool JavaClass::_call_method(JavaObject *p_instance, const StringName &p_method,
to_free.push_back(a);
} break;
case ARG_ARRAY_BIT | ARG_TYPE_CLASS: {
-
argv[i].l = nullptr;
} break;
}
@@ -409,7 +381,6 @@ bool JavaClass::_call_method(JavaObject *p_instance, const StringName &p_method,
bool success = true;
switch (method->return_type) {
-
case ARG_TYPE_VOID: {
if (method->_static) {
env->CallStaticVoidMethodA(_class, method->method, argv);
@@ -434,7 +405,6 @@ bool JavaClass::_call_method(JavaObject *p_instance, const StringName &p_method,
}
} break;
case ARG_TYPE_CHAR: {
-
if (method->_static) {
ret = env->CallStaticCharMethodA(_class, method->method, argv);
} else {
@@ -442,7 +412,6 @@ bool JavaClass::_call_method(JavaObject *p_instance, const StringName &p_method,
}
} break;
case ARG_TYPE_SHORT: {
-
if (method->_static) {
ret = env->CallStaticShortMethodA(_class, method->method, argv);
} else {
@@ -451,7 +420,6 @@ bool JavaClass::_call_method(JavaObject *p_instance, const StringName &p_method,
} break;
case ARG_TYPE_INT: {
-
if (method->_static) {
ret = env->CallStaticIntMethodA(_class, method->method, argv);
} else {
@@ -460,7 +428,6 @@ bool JavaClass::_call_method(JavaObject *p_instance, const StringName &p_method,
} break;
case ARG_TYPE_LONG: {
-
if (method->_static) {
ret = (int64_t)env->CallStaticLongMethodA(_class, method->method, argv);
} else {
@@ -469,7 +436,6 @@ bool JavaClass::_call_method(JavaObject *p_instance, const StringName &p_method,
} break;
case ARG_TYPE_FLOAT: {
-
if (method->_static) {
ret = env->CallStaticFloatMethodA(_class, method->method, argv);
} else {
@@ -478,7 +444,6 @@ bool JavaClass::_call_method(JavaObject *p_instance, const StringName &p_method,
} break;
case ARG_TYPE_DOUBLE: {
-
if (method->_static) {
ret = env->CallStaticDoubleMethodA(_class, method->method, argv);
} else {
@@ -487,7 +452,6 @@ bool JavaClass::_call_method(JavaObject *p_instance, const StringName &p_method,
} break;
default: {
-
jobject obj;
if (method->_static) {
obj = env->CallStaticObjectMethodA(_class, method->method, argv);
@@ -498,7 +462,6 @@ bool JavaClass::_call_method(JavaObject *p_instance, const StringName &p_method,
if (!obj) {
ret = Variant();
} else {
-
if (!_convert_object_to_variant(env, obj, ret, method->return_type)) {
ret = Variant();
r_error.error = Callable::CallError::CALL_ERROR_INVALID_METHOD;
@@ -518,7 +481,6 @@ bool JavaClass::_call_method(JavaObject *p_instance, const StringName &p_method,
}
Variant JavaClass::call(const StringName &p_method, const Variant **p_args, int p_argcount, Callable::CallError &r_error) {
-
Variant ret;
bool found = _call_method(nullptr, p_method, p_args, p_argcount, r_error, ret);
if (found) {
@@ -534,7 +496,6 @@ JavaClass::JavaClass() {
/////////////////////
Variant JavaObject::call(const StringName &p_method, const Variant **p_args, int p_argcount, Callable::CallError &r_error) {
-
return Variant();
}
@@ -547,14 +508,12 @@ JavaObject::~JavaObject() {
////////////////////
bool JavaClassWrapper::_get_type_sig(JNIEnv *env, jobject obj, uint32_t &sig, String &strsig) {
-
jstring name2 = (jstring)env->CallObjectMethod(obj, Class_getName);
String str_type = jstring_to_string(name2, env);
env->DeleteLocalRef(name2);
uint32_t t = 0;
if (str_type.begins_with("[")) {
-
t = JavaClass::ARG_ARRAY_BIT;
strsig = "[";
str_type = str_type.substr(1, str_type.length() - 1);
@@ -633,87 +592,71 @@ bool JavaClassWrapper::_get_type_sig(JNIEnv *env, jobject obj, uint32_t &sig, St
}
bool JavaClass::_convert_object_to_variant(JNIEnv *env, jobject obj, Variant &var, uint32_t p_sig) {
-
if (!obj) {
var = Variant(); //seems null is just null...
return true;
}
switch (p_sig) {
-
case ARG_TYPE_VOID: {
-
return Variant();
} break;
case ARG_TYPE_BOOLEAN | ARG_NUMBER_CLASS_BIT: {
-
var = env->CallBooleanMethod(obj, JavaClassWrapper::singleton->Boolean_booleanValue);
return true;
} break;
case ARG_TYPE_BYTE | ARG_NUMBER_CLASS_BIT: {
-
var = env->CallByteMethod(obj, JavaClassWrapper::singleton->Byte_byteValue);
return true;
} break;
case ARG_TYPE_CHAR | ARG_NUMBER_CLASS_BIT: {
-
var = env->CallCharMethod(obj, JavaClassWrapper::singleton->Character_characterValue);
return true;
} break;
case ARG_TYPE_SHORT | ARG_NUMBER_CLASS_BIT: {
-
var = env->CallShortMethod(obj, JavaClassWrapper::singleton->Short_shortValue);
return true;
} break;
case ARG_TYPE_INT | ARG_NUMBER_CLASS_BIT: {
-
var = env->CallIntMethod(obj, JavaClassWrapper::singleton->Integer_integerValue);
return true;
} break;
case ARG_TYPE_LONG | ARG_NUMBER_CLASS_BIT: {
-
var = (int64_t)env->CallLongMethod(obj, JavaClassWrapper::singleton->Long_longValue);
return true;
} break;
case ARG_TYPE_FLOAT | ARG_NUMBER_CLASS_BIT: {
-
var = env->CallFloatMethod(obj, JavaClassWrapper::singleton->Float_floatValue);
return true;
} break;
case ARG_TYPE_DOUBLE | ARG_NUMBER_CLASS_BIT: {
-
var = env->CallDoubleMethod(obj, JavaClassWrapper::singleton->Double_doubleValue);
return true;
} break;
case ARG_TYPE_STRING: {
-
var = jstring_to_string((jstring)obj, env);
return true;
} break;
case ARG_TYPE_CLASS: {
-
return false;
} break;
case ARG_ARRAY_BIT | ARG_TYPE_VOID: {
-
var = Array(); // ?
return true;
} break;
case ARG_ARRAY_BIT | ARG_TYPE_BOOLEAN: {
-
Array ret;
jobjectArray arr = (jobjectArray)obj;
int count = env->GetArrayLength(arr);
for (int i = 0; i < count; i++) {
-
jboolean val;
env->GetBooleanArrayRegion((jbooleanArray)arr, 0, 1, &val);
ret.push_back(val);
@@ -724,14 +667,12 @@ bool JavaClass::_convert_object_to_variant(JNIEnv *env, jobject obj, Variant &va
} break;
case ARG_ARRAY_BIT | ARG_TYPE_BYTE: {
-
Array ret;
jobjectArray arr = (jobjectArray)obj;
int count = env->GetArrayLength(arr);
for (int i = 0; i < count; i++) {
-
jbyte val;
env->GetByteArrayRegion((jbyteArray)arr, 0, 1, &val);
ret.push_back(val);
@@ -747,7 +688,6 @@ bool JavaClass::_convert_object_to_variant(JNIEnv *env, jobject obj, Variant &va
int count = env->GetArrayLength(arr);
for (int i = 0; i < count; i++) {
-
jchar val;
env->GetCharArrayRegion((jcharArray)arr, 0, 1, &val);
ret.push_back(val);
@@ -763,7 +703,6 @@ bool JavaClass::_convert_object_to_variant(JNIEnv *env, jobject obj, Variant &va
int count = env->GetArrayLength(arr);
for (int i = 0; i < count; i++) {
-
jshort val;
env->GetShortArrayRegion((jshortArray)arr, 0, 1, &val);
ret.push_back(val);
@@ -779,7 +718,6 @@ bool JavaClass::_convert_object_to_variant(JNIEnv *env, jobject obj, Variant &va
int count = env->GetArrayLength(arr);
for (int i = 0; i < count; i++) {
-
jint val;
env->GetIntArrayRegion((jintArray)arr, 0, 1, &val);
ret.push_back(val);
@@ -795,7 +733,6 @@ bool JavaClass::_convert_object_to_variant(JNIEnv *env, jobject obj, Variant &va
int count = env->GetArrayLength(arr);
for (int i = 0; i < count; i++) {
-
jlong val;
env->GetLongArrayRegion((jlongArray)arr, 0, 1, &val);
ret.push_back((int64_t)val);
@@ -811,7 +748,6 @@ bool JavaClass::_convert_object_to_variant(JNIEnv *env, jobject obj, Variant &va
int count = env->GetArrayLength(arr);
for (int i = 0; i < count; i++) {
-
jfloat val;
env->GetFloatArrayRegion((jfloatArray)arr, 0, 1, &val);
ret.push_back(val);
@@ -827,7 +763,6 @@ bool JavaClass::_convert_object_to_variant(JNIEnv *env, jobject obj, Variant &va
int count = env->GetArrayLength(arr);
for (int i = 0; i < count; i++) {
-
jdouble val;
env->GetDoubleArrayRegion((jdoubleArray)arr, 0, 1, &val);
ret.push_back(val);
@@ -837,14 +772,12 @@ bool JavaClass::_convert_object_to_variant(JNIEnv *env, jobject obj, Variant &va
return true;
} break;
case ARG_NUMBER_CLASS_BIT | ARG_ARRAY_BIT | ARG_TYPE_BOOLEAN: {
-
Array ret;
jobjectArray arr = (jobjectArray)obj;
int count = env->GetArrayLength(arr);
for (int i = 0; i < count; i++) {
-
jobject o = env->GetObjectArrayElement(arr, i);
if (!o)
ret.push_back(Variant());
@@ -860,14 +793,12 @@ bool JavaClass::_convert_object_to_variant(JNIEnv *env, jobject obj, Variant &va
} break;
case ARG_NUMBER_CLASS_BIT | ARG_ARRAY_BIT | ARG_TYPE_BYTE: {
-
Array ret;
jobjectArray arr = (jobjectArray)obj;
int count = env->GetArrayLength(arr);
for (int i = 0; i < count; i++) {
-
jobject o = env->GetObjectArrayElement(arr, i);
if (!o)
ret.push_back(Variant());
@@ -882,14 +813,12 @@ bool JavaClass::_convert_object_to_variant(JNIEnv *env, jobject obj, Variant &va
return true;
} break;
case ARG_NUMBER_CLASS_BIT | ARG_ARRAY_BIT | ARG_TYPE_CHAR: {
-
Array ret;
jobjectArray arr = (jobjectArray)obj;
int count = env->GetArrayLength(arr);
for (int i = 0; i < count; i++) {
-
jobject o = env->GetObjectArrayElement(arr, i);
if (!o)
ret.push_back(Variant());
@@ -904,14 +833,12 @@ bool JavaClass::_convert_object_to_variant(JNIEnv *env, jobject obj, Variant &va
return true;
} break;
case ARG_NUMBER_CLASS_BIT | ARG_ARRAY_BIT | ARG_TYPE_SHORT: {
-
Array ret;
jobjectArray arr = (jobjectArray)obj;
int count = env->GetArrayLength(arr);
for (int i = 0; i < count; i++) {
-
jobject o = env->GetObjectArrayElement(arr, i);
if (!o)
ret.push_back(Variant());
@@ -926,14 +853,12 @@ bool JavaClass::_convert_object_to_variant(JNIEnv *env, jobject obj, Variant &va
return true;
} break;
case ARG_NUMBER_CLASS_BIT | ARG_ARRAY_BIT | ARG_TYPE_INT: {
-
Array ret;
jobjectArray arr = (jobjectArray)obj;
int count = env->GetArrayLength(arr);
for (int i = 0; i < count; i++) {
-
jobject o = env->GetObjectArrayElement(arr, i);
if (!o)
ret.push_back(Variant());
@@ -948,14 +873,12 @@ bool JavaClass::_convert_object_to_variant(JNIEnv *env, jobject obj, Variant &va
return true;
} break;
case ARG_NUMBER_CLASS_BIT | ARG_ARRAY_BIT | ARG_TYPE_LONG: {
-
Array ret;
jobjectArray arr = (jobjectArray)obj;
int count = env->GetArrayLength(arr);
for (int i = 0; i < count; i++) {
-
jobject o = env->GetObjectArrayElement(arr, i);
if (!o)
ret.push_back(Variant());
@@ -970,14 +893,12 @@ bool JavaClass::_convert_object_to_variant(JNIEnv *env, jobject obj, Variant &va
return true;
} break;
case ARG_NUMBER_CLASS_BIT | ARG_ARRAY_BIT | ARG_TYPE_FLOAT: {
-
Array ret;
jobjectArray arr = (jobjectArray)obj;
int count = env->GetArrayLength(arr);
for (int i = 0; i < count; i++) {
-
jobject o = env->GetObjectArrayElement(arr, i);
if (!o)
ret.push_back(Variant());
@@ -998,7 +919,6 @@ bool JavaClass::_convert_object_to_variant(JNIEnv *env, jobject obj, Variant &va
int count = env->GetArrayLength(arr);
for (int i = 0; i < count; i++) {
-
jobject o = env->GetObjectArrayElement(arr, i);
if (!o)
ret.push_back(Variant());
@@ -1014,14 +934,12 @@ bool JavaClass::_convert_object_to_variant(JNIEnv *env, jobject obj, Variant &va
} break;
case ARG_ARRAY_BIT | ARG_TYPE_STRING: {
-
Array ret;
jobjectArray arr = (jobjectArray)obj;
int count = env->GetArrayLength(arr);
for (int i = 0; i < count; i++) {
-
jobject o = env->GetObjectArrayElement(arr, i);
if (!o)
ret.push_back(Variant());
@@ -1036,7 +954,6 @@ bool JavaClass::_convert_object_to_variant(JNIEnv *env, jobject obj, Variant &va
return true;
} break;
case ARG_ARRAY_BIT | ARG_TYPE_CLASS: {
-
} break;
}
@@ -1044,7 +961,6 @@ bool JavaClass::_convert_object_to_variant(JNIEnv *env, jobject obj, Variant &va
}
Ref<JavaClass> JavaClassWrapper::wrap(const String &p_class) {
-
if (class_cache.has(p_class))
return class_cache[p_class];
@@ -1066,7 +982,6 @@ Ref<JavaClass> JavaClassWrapper::wrap(const String &p_class) {
int count = env->GetArrayLength(methods);
for (int i = 0; i < count; i++) {
-
jobject obj = env->GetObjectArrayElement(methods, i);
ERR_CONTINUE(!obj);
@@ -1096,7 +1011,6 @@ Ref<JavaClass> JavaClassWrapper::wrap(const String &p_class) {
String signature = "(";
for (int j = 0; j < count2; j++) {
-
jobject obj2 = env->GetObjectArrayElement(param_types, j);
String strsig;
uint32_t sig = 0;
@@ -1138,7 +1052,6 @@ Ref<JavaClass> JavaClassWrapper::wrap(const String &p_class) {
bool discard = false;
for (List<JavaClass::MethodInfo>::Element *E = java_class->methods[str_method].front(); E; E = E->next()) {
-
float new_likeliness = 0;
float existing_likeliness = 0;
@@ -1146,7 +1059,6 @@ Ref<JavaClass> JavaClassWrapper::wrap(const String &p_class) {
continue;
bool valid = true;
for (int j = 0; j < E->get().param_types.size(); j++) {
-
Variant::Type _new;
float new_l;
Variant::Type existing;
@@ -1195,7 +1107,6 @@ Ref<JavaClass> JavaClassWrapper::wrap(const String &p_class) {
count = env->GetArrayLength(fields);
for (int i = 0; i < count; i++) {
-
jobject obj = env->GetObjectArrayElement(fields, i);
ERR_CONTINUE(!obj);
@@ -1207,17 +1118,13 @@ Ref<JavaClass> JavaClassWrapper::wrap(const String &p_class) {
jobject objc = env->CallObjectMethod(obj, Field_get, nullptr);
if (objc) {
-
uint32_t sig;
String strsig;
jclass cl = env->GetObjectClass(objc);
if (JavaClassWrapper::_get_type_sig(env, cl, sig, strsig)) {
-
if ((sig & JavaClass::ARG_TYPE_MASK) <= JavaClass::ARG_TYPE_STRING) {
-
Variant value;
if (JavaClass::_convert_object_to_variant(env, objc, value, sig)) {
-
java_class->constant_map[str_field] = value;
}
}
@@ -1239,7 +1146,6 @@ Ref<JavaClass> JavaClassWrapper::wrap(const String &p_class) {
JavaClassWrapper *JavaClassWrapper::singleton = nullptr;
JavaClassWrapper::JavaClassWrapper(jobject p_activity) {
-
singleton = this;
JNIEnv *env = ThreadAndroid::get_env();
diff --git a/platform/android/java_godot_lib_jni.cpp b/platform/android/java_godot_lib_jni.cpp
index a6730903cc..23e0d24b57 100644
--- a/platform/android/java_godot_lib_jni.cpp
+++ b/platform/android/java_godot_lib_jni.cpp
@@ -78,7 +78,6 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_setVirtualKeyboardHei
}
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_initialize(JNIEnv *env, jclass clazz, jobject activity, jobject p_asset_manager, jboolean p_use_apk_expansion) {
-
initialized = true;
JavaVM *jvm;
@@ -137,7 +136,6 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_setup(JNIEnv *env, jc
j_cmdline = (jstring *)malloc(cmdlen * sizeof(jstring));
for (int i = 0; i < cmdlen; i++) {
-
jstring string = (jstring)env->GetObjectArrayElement(p_cmdline, i);
const char *rawString = env->GetStringUTFChars(string, 0);
@@ -167,7 +165,6 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_setup(JNIEnv *env, jc
}
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_resize(JNIEnv *env, jclass clazz, jint width, jint height) {
-
if (os_android)
os_android->set_display_size(Size2i(width, height));
}
@@ -225,19 +222,16 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_step(JNIEnv *env, jcl
DisplayServerAndroid::get_singleton()->process_gyroscope(gyroscope);
if (os_android->main_loop_iterate()) {
-
godot_java->force_quit(env);
}
}
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_touch(JNIEnv *env, jclass clazz, jint ev, jint pointer, jint count, jintArray positions) {
-
if (step == 0)
return;
Vector<DisplayServerAndroid::TouchPos> points;
for (int i = 0; i < count; i++) {
-
jint p[3];
env->GetIntArrayRegion(positions, i * 3, 3, p);
DisplayServerAndroid::TouchPos tp;
@@ -357,7 +351,6 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_gyroscope(JNIEnv *env
}
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_focusin(JNIEnv *env, jclass clazz) {
-
if (step == 0)
return;
@@ -365,7 +358,6 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_focusin(JNIEnv *env,
}
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_focusout(JNIEnv *env, jclass clazz) {
-
if (step == 0)
return;
@@ -373,20 +365,17 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_focusout(JNIEnv *env,
}
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_audio(JNIEnv *env, jclass clazz) {
-
ThreadAndroid::setup_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);
return env->NewStringUTF(ProjectSettings::get_singleton()->get(js).operator String().utf8().get_data());
}
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_callobject(JNIEnv *env, jclass clazz, jint ID, jstring method, jobjectArray params) {
-
Object *obj = ObjectDB::get_instance(ObjectID((uint64_t)ID));
ERR_FAIL_COND(!obj);
@@ -399,7 +388,6 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_callobject(JNIEnv *en
Variant *vlist = (Variant *)alloca(sizeof(Variant) * count);
Variant **vptr = (Variant **)alloca(sizeof(Variant *) * count);
for (int i = 0; i < count; i++) {
-
jobject obj = env->GetObjectArrayElement(params, i);
Variant v;
if (obj)
@@ -418,7 +406,6 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_callobject(JNIEnv *en
}
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_calldeferred(JNIEnv *env, jclass clazz, jint ID, jstring method, jobjectArray params) {
-
Object *obj = ObjectDB::get_instance(ObjectID((uint64_t)ID));
ERR_FAIL_COND(!obj);
@@ -431,7 +418,6 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_calldeferred(JNIEnv *
Variant args[VARIANT_ARG_MAX];
for (int i = 0; i < MIN(count, VARIANT_ARG_MAX); i++) {
-
jobject obj = env->GetObjectArrayElement(params, i);
if (obj)
args[i] = _jobject_to_variant(env, obj);
diff --git a/platform/android/jni_utils.cpp b/platform/android/jni_utils.cpp
index ded79a668f..8e1ae53b78 100644
--- a/platform/android/jni_utils.cpp
+++ b/platform/android/jni_utils.cpp
@@ -31,13 +31,10 @@
#include "jni_utils.h"
jvalret _variant_to_jvalue(JNIEnv *env, Variant::Type p_type, const Variant *p_arg, bool force_jobject) {
-
jvalret v;
switch (p_type) {
-
case Variant::BOOL: {
-
if (force_jobject) {
jclass bclass = env->FindClass("java/lang/Boolean");
jmethodID ctor = env->GetMethodID(bclass, "<init>", "(Z)V");
@@ -52,9 +49,7 @@ jvalret _variant_to_jvalue(JNIEnv *env, Variant::Type p_type, const Variant *p_a
};
} break;
case Variant::INT: {
-
if (force_jobject) {
-
jclass bclass = env->FindClass("java/lang/Integer");
jmethodID ctor = env->GetMethodID(bclass, "<init>", "(I)V");
jvalue val;
@@ -69,9 +64,7 @@ jvalret _variant_to_jvalue(JNIEnv *env, Variant::Type p_type, const Variant *p_a
};
} break;
case Variant::FLOAT: {
-
if (force_jobject) {
-
jclass bclass = env->FindClass("java/lang/Double");
jmethodID ctor = env->GetMethodID(bclass, "<init>", "(D)V");
jvalue val;
@@ -86,19 +79,16 @@ jvalret _variant_to_jvalue(JNIEnv *env, Variant::Type p_type, const Variant *p_a
};
} break;
case Variant::STRING: {
-
String s = *p_arg;
jstring jStr = env->NewStringUTF(s.utf8().get_data());
v.val.l = jStr;
v.obj = jStr;
} break;
case Variant::PACKED_STRING_ARRAY: {
-
Vector<String> sarray = *p_arg;
jobjectArray arr = env->NewObjectArray(sarray.size(), env->FindClass("java/lang/String"), env->NewStringUTF(""));
for (int j = 0; j < sarray.size(); j++) {
-
jstring str = env->NewStringUTF(sarray[j].utf8().get_data());
env->SetObjectArrayElement(arr, j, str);
env->DeleteLocalRef(str);
@@ -109,7 +99,6 @@ jvalret _variant_to_jvalue(JNIEnv *env, Variant::Type p_type, const Variant *p_a
} break;
case Variant::DICTIONARY: {
-
Dictionary dict = *p_arg;
jclass dclass = env->FindClass("org/godotengine/godot/Dictionary");
jmethodID ctor = env->GetMethodID(dclass, "<init>", "()V");
@@ -152,7 +141,6 @@ jvalret _variant_to_jvalue(JNIEnv *env, Variant::Type p_type, const Variant *p_a
} break;
case Variant::PACKED_INT32_ARRAY: {
-
Vector<int> array = *p_arg;
jintArray arr = env->NewIntArray(array.size());
const int *r = array.ptr();
@@ -171,7 +159,6 @@ jvalret _variant_to_jvalue(JNIEnv *env, Variant::Type p_type, const Variant *p_a
} break;
case Variant::PACKED_FLOAT32_ARRAY: {
-
Vector<float> array = *p_arg;
jfloatArray arr = env->NewFloatArray(array.size());
const float *r = array.ptr();
@@ -185,7 +172,6 @@ jvalret _variant_to_jvalue(JNIEnv *env, Variant::Type p_type, const Variant *p_a
#endif
default: {
-
v.val.i = 0;
} break;
}
@@ -193,7 +179,6 @@ jvalret _variant_to_jvalue(JNIEnv *env, Variant::Type p_type, const Variant *p_a
}
String _get_class_name(JNIEnv *env, jclass cls, bool *array) {
-
jclass cclass = env->FindClass("java/lang/Class");
jmethodID getName = env->GetMethodID(cclass, "getName", "()Ljava/lang/String;");
jstring clsName = (jstring)env->CallObjectMethod(cls, getName);
@@ -210,7 +195,6 @@ String _get_class_name(JNIEnv *env, jclass cls, bool *array) {
}
Variant _jobject_to_variant(JNIEnv *env, jobject obj) {
-
if (obj == nullptr) {
return Variant();
}
@@ -220,12 +204,10 @@ Variant _jobject_to_variant(JNIEnv *env, jobject obj) {
String name = _get_class_name(env, c, &array);
if (name == "java.lang.String") {
-
return jstring_to_string((jstring)obj, env);
};
if (name == "[Ljava.lang.String;") {
-
jobjectArray arr = (jobjectArray)obj;
int stringCount = env->GetArrayLength(arr);
Vector<String> sarr;
@@ -240,14 +222,12 @@ Variant _jobject_to_variant(JNIEnv *env, jobject obj) {
};
if (name == "java.lang.Boolean") {
-
jmethodID boolValue = env->GetMethodID(c, "booleanValue", "()Z");
bool ret = env->CallBooleanMethod(obj, boolValue);
return ret;
};
if (name == "java.lang.Integer" || name == "java.lang.Long") {
-
jclass nclass = env->FindClass("java/lang/Number");
jmethodID longValue = env->GetMethodID(nclass, "longValue", "()J");
jlong ret = env->CallLongMethod(obj, longValue);
@@ -255,7 +235,6 @@ Variant _jobject_to_variant(JNIEnv *env, jobject obj) {
};
if (name == "[I") {
-
jintArray arr = (jintArray)obj;
int fCount = env->GetArrayLength(arr);
Vector<int> sarr;
@@ -267,7 +246,6 @@ Variant _jobject_to_variant(JNIEnv *env, jobject obj) {
};
if (name == "[B") {
-
jbyteArray arr = (jbyteArray)obj;
int fCount = env->GetArrayLength(arr);
Vector<uint8_t> sarr;
@@ -279,7 +257,6 @@ Variant _jobject_to_variant(JNIEnv *env, jobject obj) {
};
if (name == "java.lang.Float" || name == "java.lang.Double") {
-
jclass nclass = env->FindClass("java/lang/Number");
jmethodID doubleValue = env->GetMethodID(nclass, "doubleValue", "()D");
double ret = env->CallDoubleMethod(obj, doubleValue);
@@ -287,7 +264,6 @@ Variant _jobject_to_variant(JNIEnv *env, jobject obj) {
};
if (name == "[D") {
-
jdoubleArray arr = (jdoubleArray)obj;
int fCount = env->GetArrayLength(arr);
PackedFloat32Array sarr;
@@ -296,7 +272,6 @@ Variant _jobject_to_variant(JNIEnv *env, jobject obj) {
real_t *w = sarr.ptrw();
for (int i = 0; i < fCount; i++) {
-
double n;
env->GetDoubleArrayRegion(arr, i, 1, &n);
w[i] = n;
@@ -305,7 +280,6 @@ Variant _jobject_to_variant(JNIEnv *env, jobject obj) {
};
if (name == "[F") {
-
jfloatArray arr = (jfloatArray)obj;
int fCount = env->GetArrayLength(arr);
PackedFloat32Array sarr;
@@ -314,7 +288,6 @@ Variant _jobject_to_variant(JNIEnv *env, jobject obj) {
real_t *w = sarr.ptrw();
for (int i = 0; i < fCount; i++) {
-
float n;
env->GetFloatArrayRegion(arr, i, 1, &n);
w[i] = n;
@@ -323,7 +296,6 @@ Variant _jobject_to_variant(JNIEnv *env, jobject obj) {
};
if (name == "[Ljava.lang.Object;") {
-
jobjectArray arr = (jobjectArray)obj;
int objCount = env->GetArrayLength(arr);
Array varr;
@@ -339,7 +311,6 @@ Variant _jobject_to_variant(JNIEnv *env, jobject obj) {
};
if (name == "java.util.HashMap" || name == "org.godotengine.godot.Dictionary") {
-
Dictionary ret;
jclass oclass = c;
jmethodID get_keys = env->GetMethodID(oclass, "get_keys", "()[Ljava/lang/String;");
@@ -355,7 +326,6 @@ Variant _jobject_to_variant(JNIEnv *env, jobject obj) {
env->DeleteLocalRef(arr);
for (int i = 0; i < keys.size(); i++) {
-
ret[keys[i]] = vals[i];
};
@@ -368,7 +338,6 @@ Variant _jobject_to_variant(JNIEnv *env, jobject obj) {
}
Variant::Type get_jni_type(const String &p_type) {
-
static struct {
const char *name;
Variant::Type type;
@@ -390,7 +359,6 @@ Variant::Type get_jni_type(const String &p_type) {
int idx = 0;
while (_type_to_vtype[idx].name) {
-
if (p_type == _type_to_vtype[idx].name)
return _type_to_vtype[idx].type;
@@ -401,7 +369,6 @@ Variant::Type get_jni_type(const String &p_type) {
}
const char *get_jni_sig(const String &p_type) {
-
static struct {
const char *name;
const char *sig;
@@ -423,7 +390,6 @@ const char *get_jni_sig(const String &p_type) {
int idx = 0;
while (_type_to_vtype[idx].name) {
-
if (p_type == _type_to_vtype[idx].name)
return _type_to_vtype[idx].sig;
diff --git a/platform/android/jni_utils.h b/platform/android/jni_utils.h
index c2baa51b4a..5320715853 100644
--- a/platform/android/jni_utils.h
+++ b/platform/android/jni_utils.h
@@ -37,7 +37,6 @@
#include <jni.h>
struct jvalret {
-
jobject obj;
jvalue val;
jvalret() { obj = nullptr; }
diff --git a/platform/android/net_socket_android.cpp b/platform/android/net_socket_android.cpp
index dc0154ea01..0341ef3ec6 100644
--- a/platform/android/net_socket_android.cpp
+++ b/platform/android/net_socket_android.cpp
@@ -38,7 +38,6 @@ jmethodID NetSocketAndroid::_multicast_lock_acquire = 0;
jmethodID NetSocketAndroid::_multicast_lock_release = 0;
void NetSocketAndroid::setup(jobject p_net_utils) {
-
JNIEnv *env = ThreadAndroid::get_env();
net_utils = env->NewGlobalRef(p_net_utils);
diff --git a/platform/android/net_socket_android.h b/platform/android/net_socket_android.h
index 7d6267e8b3..955d906535 100644
--- a/platform/android/net_socket_android.h
+++ b/platform/android/net_socket_android.h
@@ -45,7 +45,6 @@
* joins/leaves a multicast group.
*/
class NetSocketAndroid : public NetSocketPosix {
-
private:
static jobject net_utils;
static jclass cls;
diff --git a/platform/android/os_android.cpp b/platform/android/os_android.cpp
index 9ae18415ba..baf6ee952a 100644
--- a/platform/android/os_android.cpp
+++ b/platform/android/os_android.cpp
@@ -57,7 +57,6 @@ public:
};
void OS_Android::initialize_core() {
-
OS_Unix::initialize_core();
if (use_apk_expansion)
@@ -121,17 +120,14 @@ GodotIOJavaWrapper *OS_Android::get_godot_io_java() {
}
bool OS_Android::request_permission(const String &p_name) {
-
return godot_java->request_permission(p_name);
}
bool OS_Android::request_permissions() {
-
return godot_java->request_permissions();
}
Vector<String> OS_Android::get_granted_permissions() const {
-
return godot_java->get_granted_permissions();
}
@@ -142,30 +138,25 @@ Error OS_Android::open_dynamic_library(const String p_path, void *&p_library_han
}
String OS_Android::get_name() const {
-
return "Android";
}
MainLoop *OS_Android::get_main_loop() const {
-
return main_loop;
}
void OS_Android::main_loop_begin() {
-
if (main_loop)
main_loop->init();
}
bool OS_Android::main_loop_iterate() {
-
if (!main_loop)
return false;
return Main::iteration();
}
void OS_Android::main_loop_end() {
-
if (main_loop)
main_loop->finish();
}
@@ -185,17 +176,14 @@ void OS_Android::main_loop_request_go_back() {
}
Error OS_Android::shell_open(String p_uri) {
-
return godot_io_java->open_uri(p_uri);
}
String OS_Android::get_resource_dir() const {
-
return "/"; //android has its own filesystem for resources inside the APK
}
String OS_Android::get_locale() const {
-
String locale = godot_io_java->get_locale();
if (locale != "") {
return locale;
@@ -205,7 +193,6 @@ String OS_Android::get_locale() const {
}
String OS_Android::get_model_name() const {
-
String model = godot_io_java->get_model();
if (model != "")
return model;
@@ -214,13 +201,11 @@ String OS_Android::get_model_name() const {
}
String OS_Android::get_user_data_dir() const {
-
if (data_dir_cache != String())
return data_dir_cache;
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);
@@ -245,7 +230,6 @@ String OS_Android::get_user_data_dir() const {
}
String OS_Android::get_unique_id() const {
-
String unique_id = godot_io_java->get_unique_id();
if (unique_id != "")
return unique_id;
@@ -254,7 +238,6 @@ String OS_Android::get_unique_id() const {
}
String OS_Android::get_system_dir(SystemDir p_dir) const {
-
return godot_io_java->get_system_dir(p_dir);
}
diff --git a/platform/android/plugin/godot_plugin_jni.cpp b/platform/android/plugin/godot_plugin_jni.cpp
index c3bfb2f2ed..557743fa73 100644
--- a/platform/android/plugin/godot_plugin_jni.cpp
+++ b/platform/android/plugin/godot_plugin_jni.cpp
@@ -42,7 +42,6 @@ static HashMap<String, JNISingleton *> jni_singletons;
extern "C" {
JNIEXPORT void JNICALL Java_org_godotengine_godot_plugin_GodotPlugin_nativeRegisterSingleton(JNIEnv *env, jobject obj, jstring name) {
-
String singname = jstring_to_string(name, env);
JNISingleton *s = (JNISingleton *)ClassDB::instance("JNISingleton");
s->set_instance(env->NewGlobalRef(obj));
@@ -53,7 +52,6 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_plugin_GodotPlugin_nativeRegis
}
JNIEXPORT void JNICALL Java_org_godotengine_godot_plugin_GodotPlugin_nativeRegisterMethod(JNIEnv *env, jobject obj, jstring sname, jstring name, jstring ret, jobjectArray args) {
-
String singname = jstring_to_string(sname, env);
ERR_FAIL_COND(!jni_singletons.has(singname));
@@ -68,7 +66,6 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_plugin_GodotPlugin_nativeRegis
int stringCount = env->GetArrayLength(args);
for (int i = 0; i < stringCount; i++) {
-
jstring string = (jstring)env->GetObjectArrayElement(args, i);
const String rawString = jstring_to_string(string, env);
types.push_back(get_jni_type(rawString));
@@ -80,7 +77,6 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_plugin_GodotPlugin_nativeRegis
jclass cls = env->GetObjectClass(s->get_instance());
jmethodID mid = env->GetMethodID(cls, mname.ascii().get_data(), cs.ascii().get_data());
if (!mid) {
-
print_line("Failed getting method ID " + mname);
}
@@ -100,7 +96,6 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_plugin_GodotPlugin_nativeRegis
int stringCount = env->GetArrayLength(j_signal_param_types);
for (int i = 0; i < stringCount; i++) {
-
jstring j_signal_param_type = (jstring)env->GetObjectArrayElement(j_signal_param_types, i);
const String signal_param_type = jstring_to_string(j_signal_param_type, env);
types.push_back(get_jni_type(signal_param_type));
@@ -122,7 +117,6 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_plugin_GodotPlugin_nativeEmitS
const Variant *args[count];
for (int i = 0; i < count; i++) {
-
jobject j_param = env->GetObjectArrayElement(j_signal_params, i);
Variant variant = _jobject_to_variant(env, j_param);
args[i] = &variant;
diff --git a/platform/android/thread_jandroid.cpp b/platform/android/thread_jandroid.cpp
index 729327f6f0..13aa313ebf 100644
--- a/platform/android/thread_jandroid.cpp
+++ b/platform/android/thread_jandroid.cpp
@@ -48,17 +48,14 @@ pthread_key_t ThreadAndroid::thread_id_key = _create_thread_id_key();
Thread::ID ThreadAndroid::next_thread_id = 0;
Thread::ID ThreadAndroid::get_id() const {
-
return id;
}
Thread *ThreadAndroid::create_thread_jandroid() {
-
return memnew(ThreadAndroid);
}
void *ThreadAndroid::thread_callback(void *userdata) {
-
ThreadAndroid *t = reinterpret_cast<ThreadAndroid *>(userdata);
setup_thread();
ScriptServer::thread_enter(); //scripts may need to attach a stack
@@ -70,7 +67,6 @@ void *ThreadAndroid::thread_callback(void *userdata) {
}
Thread *ThreadAndroid::create_func_jandroid(ThreadCreateCallback p_callback, void *p_user, const Settings &) {
-
ThreadAndroid *tr = memnew(ThreadAndroid);
tr->callback = p_callback;
tr->user = p_user;
@@ -83,7 +79,6 @@ Thread *ThreadAndroid::create_func_jandroid(ThreadCreateCallback p_callback, voi
}
Thread::ID ThreadAndroid::get_thread_id_func_jandroid() {
-
void *value = pthread_getspecific(thread_id_key);
if (value)
@@ -95,7 +90,6 @@ Thread::ID ThreadAndroid::get_thread_id_func_jandroid() {
}
void ThreadAndroid::wait_to_finish_func_jandroid(Thread *p_thread) {
-
ThreadAndroid *tp = static_cast<ThreadAndroid *>(p_thread);
ERR_FAIL_COND(!tp);
ERR_FAIL_COND(tp->pthread == 0);
@@ -105,7 +99,6 @@ void ThreadAndroid::wait_to_finish_func_jandroid(Thread *p_thread) {
}
void ThreadAndroid::_thread_destroyed(void *value) {
-
/* The thread is being destroyed, detach it from the Java VM and set the mThreadKey value to NULL as required */
JNIEnv *env = (JNIEnv *)value;
if (env != nullptr) {
@@ -118,7 +111,6 @@ pthread_key_t ThreadAndroid::jvm_key;
JavaVM *ThreadAndroid::java_vm = nullptr;
void ThreadAndroid::setup_thread() {
-
if (pthread_getspecific(jvm_key))
return; //already setup
JNIEnv *env;
@@ -127,7 +119,6 @@ void ThreadAndroid::setup_thread() {
}
void ThreadAndroid::make_default(JavaVM *p_java_vm) {
-
java_vm = p_java_vm;
create_func = create_func_jandroid;
get_thread_id_func = get_thread_id_func_jandroid;
@@ -137,7 +128,6 @@ void ThreadAndroid::make_default(JavaVM *p_java_vm) {
}
JNIEnv *ThreadAndroid::get_env() {
-
if (!pthread_getspecific(jvm_key)) {
setup_thread();
}
@@ -148,7 +138,6 @@ JNIEnv *ThreadAndroid::get_env() {
}
ThreadAndroid::ThreadAndroid() {
-
pthread = 0;
}
diff --git a/platform/android/thread_jandroid.h b/platform/android/thread_jandroid.h
index eb4725ae68..9cfcc64813 100644
--- a/platform/android/thread_jandroid.h
+++ b/platform/android/thread_jandroid.h
@@ -37,7 +37,6 @@
#include <sys/types.h>
class ThreadAndroid : public Thread {
-
static pthread_key_t thread_id_key;
static ID next_thread_id;
diff --git a/platform/android/vulkan/vulkan_context_android.h b/platform/android/vulkan/vulkan_context_android.h
index 7e698ada4f..6bd3cbee36 100644
--- a/platform/android/vulkan/vulkan_context_android.h
+++ b/platform/android/vulkan/vulkan_context_android.h
@@ -36,7 +36,6 @@
struct ANativeWindow;
class VulkanContextAndroid : public VulkanContext {
-
virtual const char *_get_platform_surface_extension() const;
public:
diff --git a/platform/haiku/os_haiku.cpp b/platform/haiku/os_haiku.cpp
index 07cb18d7cd..7a2591784f 100644
--- a/platform/haiku/os_haiku.cpp
+++ b/platform/haiku/os_haiku.cpp
@@ -324,12 +324,10 @@ String OS_Haiku::get_executable_path() const {
}
bool OS_Haiku::_check_internal_feature_support(const String &p_feature) {
-
return p_feature == "pc";
}
String OS_Haiku::get_config_path() const {
-
if (has_environment("XDG_CONFIG_HOME")) {
return get_environment("XDG_CONFIG_HOME");
} else if (has_environment("HOME")) {
@@ -340,7 +338,6 @@ String OS_Haiku::get_config_path() const {
}
String OS_Haiku::get_data_path() const {
-
if (has_environment("XDG_DATA_HOME")) {
return get_environment("XDG_DATA_HOME");
} else if (has_environment("HOME")) {
@@ -351,7 +348,6 @@ String OS_Haiku::get_data_path() const {
}
String OS_Haiku::get_cache_path() const {
-
if (has_environment("XDG_CACHE_HOME")) {
return get_environment("XDG_CACHE_HOME");
} else if (has_environment("HOME")) {
diff --git a/platform/iphone/app_delegate.mm b/platform/iphone/app_delegate.mm
index fb30441bd3..c4ef185bf1 100644
--- a/platform/iphone/app_delegate.mm
+++ b/platform/iphone/app_delegate.mm
@@ -426,7 +426,6 @@ OS::VideoMode _get_video_mode() {
static int frame_count = 0;
- (void)drawView:(UIView *)view;
{
-
switch (frame_count) {
case 0: {
OS::get_singleton()->set_video_mode(_get_video_mode());
@@ -463,7 +462,6 @@ static int frame_count = 0;
}; break;
case 1: {
-
Main::setup2();
++frame_count;
@@ -490,7 +488,6 @@ static int frame_count = 0;
ProjectSettings::get_singleton()->set("Info.plist/" + ukey, uval);
} else if ([value isKindOfClass:[NSNumber class]]) {
-
NSNumber *n = (NSNumber *)value;
double dval = [n doubleValue];
@@ -502,7 +499,6 @@ static int frame_count = 0;
}; break;
case 2: {
-
Main::start();
++frame_count;
diff --git a/platform/iphone/export/export.cpp b/platform/iphone/export/export.cpp
index 3904fd6cf9..e5e9f7764b 100644
--- a/platform/iphone/export/export.cpp
+++ b/platform/iphone/export/export.cpp
@@ -48,7 +48,6 @@
#include <sys/stat.h>
class EditorExportPlatformIOS : public EditorExportPlatform {
-
GDCLASS(EditorExportPlatformIOS, EditorExportPlatform);
int version_code;
@@ -73,7 +72,6 @@ class EditorExportPlatformIOS : public EditorExportPlatform {
String modules_buildgrp;
};
struct ExportArchitecture {
-
String name;
bool is_default = false;
@@ -105,7 +103,6 @@ class EditorExportPlatformIOS : public EditorExportPlatform {
Error _export_additional_assets(const String &p_out_dir, const Vector<SharedObject> &p_libraries, Vector<IOSExportAsset> &r_exported_assets);
bool is_package_name_valid(const String &p_package, String *r_error = nullptr) const {
-
String pname = p_package;
if (pname.length() == 0) {
@@ -148,7 +145,6 @@ public:
virtual bool can_export(const Ref<EditorExportPreset> &p_preset, String &r_error, bool &r_missing_templates) const;
virtual void get_platform_features(List<String> *r_features) {
-
r_features->push_back("mobile");
r_features->push_back("iOS");
}
@@ -161,7 +157,6 @@ public:
};
void EditorExportPlatformIOS::get_preset_features(const Ref<EditorExportPreset> &p_preset, List<String> *r_features) {
-
String driver = ProjectSettings::get_singleton()->get("rendering/quality/driver/driver_name");
if (driver == "GLES2") {
r_features->push_back("etc");
@@ -207,7 +202,6 @@ static const LoadingScreenInfo loading_screen_infos[] = {
};
void EditorExportPlatformIOS::get_export_options(List<ExportOption> *r_options) {
-
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "custom_template/debug", PROPERTY_HINT_GLOBAL_FILE, "*.zip"), ""));
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "custom_template/release", PROPERTY_HINT_GLOBAL_FILE, "*.zip"), ""));
@@ -442,7 +436,6 @@ String EditorExportPlatformIOS::_get_cpp_code() {
}
void EditorExportPlatformIOS::_blend_and_rotate(Ref<Image> &p_dst, Ref<Image> &p_src, bool p_rot) {
-
ERR_FAIL_COND(p_dst.is_null());
ERR_FAIL_COND(p_src.is_null());
@@ -1311,7 +1304,6 @@ Error EditorExportPlatformIOS::export_project(const Ref<EditorExportPreset> &p_p
}
bool EditorExportPlatformIOS::can_export(const Ref<EditorExportPreset> &p_preset, String &r_error, bool &r_missing_templates) const {
-
String err;
bool valid = false;
@@ -1376,7 +1368,6 @@ bool EditorExportPlatformIOS::can_export(const Ref<EditorExportPreset> &p_preset
}
EditorExportPlatformIOS::EditorExportPlatformIOS() {
-
Ref<Image> img = memnew(Image(_iphone_logo));
logo.instance();
logo->create_from_image(img);
@@ -1386,7 +1377,6 @@ EditorExportPlatformIOS::~EditorExportPlatformIOS() {
}
void register_iphone_exporter() {
-
Ref<EditorExportPlatformIOS> platform;
platform.instance();
diff --git a/platform/iphone/game_center.h b/platform/iphone/game_center.h
index d35cc4b87c..0d3ef5b696 100644
--- a/platform/iphone/game_center.h
+++ b/platform/iphone/game_center.h
@@ -36,7 +36,6 @@
#include "core/object.h"
class GameCenter : public Object {
-
GDCLASS(GameCenter, Object);
static GameCenter *instance;
diff --git a/platform/iphone/game_center.mm b/platform/iphone/game_center.mm
index 52f025f333..8d470da1a8 100644
--- a/platform/iphone/game_center.mm
+++ b/platform/iphone/game_center.mm
@@ -75,7 +75,6 @@ void GameCenter::return_connect_error(const char *p_error_description) {
}
void GameCenter::connect() {
-
//if this class isn't available, game center isn't implemented
if ((NSClassFromString(@"GKLocalPlayer")) == nil) {
return_connect_error("GameCenter not available");
@@ -125,7 +124,6 @@ bool GameCenter::is_authenticated() {
};
Error GameCenter::post_score(Variant p_score) {
-
Dictionary params = p_score;
ERR_FAIL_COND_V(!params.has("score") || !params.has("category"), ERR_INVALID_PARAMETER);
float score = params["score"];
@@ -156,7 +154,6 @@ Error GameCenter::post_score(Variant p_score) {
};
Error GameCenter::award_achievement(Variant p_params) {
-
Dictionary params = p_params;
ERR_FAIL_COND_V(!params.has("name") || !params.has("progress"), ERR_INVALID_PARAMETER);
String name = params["name"];
@@ -192,7 +189,6 @@ Error GameCenter::award_achievement(Variant p_params) {
};
void GameCenter::request_achievement_descriptions() {
-
[GKAchievementDescription loadAchievementDescriptionsWithCompletionHandler:^(NSArray *descriptions, NSError *error) {
Dictionary ret;
ret["type"] = "achievement_descriptions";
@@ -207,7 +203,6 @@ void GameCenter::request_achievement_descriptions() {
Array replayable;
for (int i = 0; i < [descriptions count]; i++) {
-
GKAchievementDescription *description = [descriptions objectAtIndex:i];
const char *str = [description.identifier UTF8String];
@@ -247,7 +242,6 @@ void GameCenter::request_achievement_descriptions() {
};
void GameCenter::request_achievements() {
-
[GKAchievement loadAchievementsWithCompletionHandler:^(NSArray *achievements, NSError *error) {
Dictionary ret;
ret["type"] = "achievements";
@@ -257,7 +251,6 @@ void GameCenter::request_achievements() {
PackedFloat32Array percentages;
for (int i = 0; i < [achievements count]; i++) {
-
GKAchievement *achievement = [achievements objectAtIndex:i];
const char *str = [achievement.identifier UTF8String];
names.push_back(String::utf8(str != NULL ? str : ""));
@@ -278,7 +271,6 @@ void GameCenter::request_achievements() {
};
void GameCenter::reset_achievements() {
-
[GKAchievement resetAchievementsWithCompletionHandler:^(NSError *error) {
Dictionary ret;
ret["type"] = "reset_achievements";
@@ -294,7 +286,6 @@ void GameCenter::reset_achievements() {
};
Error GameCenter::show_game_center(Variant p_params) {
-
ERR_FAIL_COND_V(!NSProtocolFromString(@"GKGameCenterControllerDelegate"), FAILED);
Dictionary params = p_params;
@@ -338,7 +329,6 @@ Error GameCenter::show_game_center(Variant p_params) {
};
Error GameCenter::request_identity_verification_signature() {
-
ERR_FAIL_COND_V(!is_authenticated(), ERR_UNAUTHORIZED);
GKLocalPlayer *player = [GKLocalPlayer localPlayer];
@@ -365,7 +355,6 @@ Error GameCenter::request_identity_verification_signature() {
};
void GameCenter::game_center_closed() {
-
Dictionary ret;
ret["type"] = "show_game_center";
ret["result"] = "ok";
@@ -373,12 +362,10 @@ void GameCenter::game_center_closed() {
}
int GameCenter::get_pending_event_count() {
-
return pending_events.size();
};
Variant GameCenter::pop_pending_event() {
-
Variant front = pending_events.front()->get();
pending_events.pop_front();
diff --git a/platform/iphone/gl_view.mm b/platform/iphone/gl_view.mm
index ede60a502d..1169ebc6b4 100644
--- a/platform/iphone/gl_view.mm
+++ b/platform/iphone/gl_view.mm
@@ -174,7 +174,6 @@ void _focus_out_video() {
};
void _unpause_video() {
-
[_instance.avPlayer play];
video_playing = true;
};
@@ -207,14 +206,12 @@ static const int max_touches = 8;
static UITouch *touches[max_touches];
static void init_touches() {
-
for (int i = 0; i < max_touches; i++) {
touches[i] = NULL;
};
};
static int get_touch_id(UITouch *p_touch) {
-
int first = -1;
for (int i = 0; i < max_touches; i++) {
if (first == -1 && touches[i] == NULL) {
@@ -234,10 +231,8 @@ static int get_touch_id(UITouch *p_touch) {
};
static int remove_touch(UITouch *p_touch) {
-
int remaining = 0;
for (int i = 0; i < max_touches; i++) {
-
if (touches[i] == NULL)
continue;
if (touches[i] == p_touch)
@@ -249,9 +244,7 @@ static int remove_touch(UITouch *p_touch) {
};
static void clear_touches() {
-
for (int i = 0; i < max_touches; i++) {
-
touches[i] = NULL;
};
};
@@ -396,7 +389,6 @@ static void clear_touches() {
active = TRUE;
printf("start animation!\n");
if (useCADisplayLink) {
-
// Approximate frame rate
// assumes device refreshes at 60 fps
int frameInterval = (int)floor(animationInterval * 60.0f);
@@ -446,7 +438,6 @@ static void clear_touches() {
// Updates the OpenGL view when the timer fires
- (void)drawView {
-
if (!active) {
printf("draw view not active!\n");
return;
@@ -489,9 +480,7 @@ static void clear_touches() {
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
NSArray *tlist = [[event allTouches] allObjects];
for (unsigned int i = 0; i < [tlist count]; i++) {
-
if ([touches containsObject:[tlist objectAtIndex:i]]) {
-
UITouch *touch = [tlist objectAtIndex:i];
if (touch.phase != UITouchPhaseBegan)
continue;
@@ -504,12 +493,9 @@ static void clear_touches() {
}
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
-
NSArray *tlist = [[event allTouches] allObjects];
for (unsigned int i = 0; i < [tlist count]; i++) {
-
if ([touches containsObject:[tlist objectAtIndex:i]]) {
-
UITouch *touch = [tlist objectAtIndex:i];
if (touch.phase != UITouchPhaseMoved)
continue;
@@ -525,9 +511,7 @@ static void clear_touches() {
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
NSArray *tlist = [[event allTouches] allObjects];
for (unsigned int i = 0; i < [tlist count]; i++) {
-
if ([touches containsObject:[tlist objectAtIndex:i]]) {
-
UITouch *touch = [tlist objectAtIndex:i];
if (touch.phase != UITouchPhaseEnded)
continue;
@@ -541,7 +525,6 @@ static void clear_touches() {
}
- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event {
-
OSIPhone::get_singleton()->touches_cancelled();
clear_touches();
};
@@ -599,7 +582,6 @@ static void clear_touches() {
NSInteger routeChangeReason = [[interuptionDict valueForKey:AVAudioSessionRouteChangeReasonKey] integerValue];
switch (routeChangeReason) {
-
case AVAudioSessionRouteChangeReasonNewDeviceAvailable: {
NSLog(@"AVAudioSessionRouteChangeReasonNewDeviceAvailable");
NSLog(@"Headphone/Line plugged in");
@@ -609,7 +591,6 @@ static void clear_touches() {
NSLog(@"AVAudioSessionRouteChangeReasonOldDeviceUnavailable");
NSLog(@"Headphone/Line was pulled. Resuming video play....");
if (_is_video_playing()) {
-
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 0.5f * NSEC_PER_SEC), dispatch_get_main_queue(), ^{
[_instance.avPlayer play]; // NOTE: change this line according your current player implementation
NSLog(@"resumed play");
@@ -685,7 +666,6 @@ static void clear_touches() {
}
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context {
-
if (object == _instance.avPlayerItem && [keyPath isEqualToString:@"status"]) {
if (_instance.avPlayerItem.status == AVPlayerStatusFailed || _instance.avPlayer.status == AVPlayerStatusFailed) {
_stop_video();
@@ -695,7 +675,6 @@ static void clear_touches() {
if (_instance.avPlayer.status == AVPlayerStatusReadyToPlay &&
_instance.avPlayerItem.status == AVPlayerItemStatusReadyToPlay &&
CMTIME_COMPARE_INLINE(video_current_time, ==, kCMTimeZero)) {
-
//NSLog(@"time: %@", video_current_time);
[_instance.avPlayer seekToTime:video_current_time];
diff --git a/platform/iphone/godot_iphone.cpp b/platform/iphone/godot_iphone.cpp
index cea0e5c7f0..b9d217c9d2 100644
--- a/platform/iphone/godot_iphone.cpp
+++ b/platform/iphone/godot_iphone.cpp
@@ -46,7 +46,6 @@ int add_cmdline(int p_argc, char **p_args);
int iphone_main(int, int, int, char **, String);
int iphone_main(int width, int height, int argc, char **argv, String data_dir) {
-
size_t len = strlen(argv[0]);
while (len--) {
@@ -86,7 +85,6 @@ int iphone_main(int width, int height, int argc, char **argv, String data_dir) {
};
void iphone_finish() {
-
printf("iphone_finish\n");
Main::cleanup();
delete os;
diff --git a/platform/iphone/icloud.h b/platform/iphone/icloud.h
index 401a6cbeb8..b11e22fec6 100644
--- a/platform/iphone/icloud.h
+++ b/platform/iphone/icloud.h
@@ -36,7 +36,6 @@
#include "core/object.h"
class ICloud : public Object {
-
GDCLASS(ICloud, Object);
static ICloud *instance;
diff --git a/platform/iphone/icloud.mm b/platform/iphone/icloud.mm
index 1b9b354727..343af744d5 100644
--- a/platform/iphone/icloud.mm
+++ b/platform/iphone/icloud.mm
@@ -58,12 +58,10 @@ void ICloud::_bind_methods() {
};
int ICloud::get_pending_event_count() {
-
return pending_events.size();
};
Variant ICloud::pop_pending_event() {
-
Variant front = pending_events.front()->get();
pending_events.pop_front();
diff --git a/platform/iphone/in_app_store.h b/platform/iphone/in_app_store.h
index 493877a5a7..44e65e77ed 100644
--- a/platform/iphone/in_app_store.h
+++ b/platform/iphone/in_app_store.h
@@ -36,7 +36,6 @@
#include "core/object.h"
class InAppStore : public Object {
-
GDCLASS(InAppStore, Object);
static InAppStore *instance;
diff --git a/platform/iphone/in_app_store.mm b/platform/iphone/in_app_store.mm
index c5a8ed2b2b..f3e8ff141b 100644
--- a/platform/iphone/in_app_store.mm
+++ b/platform/iphone/in_app_store.mm
@@ -80,7 +80,6 @@ void InAppStore::_bind_methods() {
@implementation ProductsDelegate
- (void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response {
-
NSArray *products = response.products;
Dictionary ret;
ret["type"] = "product_info";
@@ -93,7 +92,6 @@ void InAppStore::_bind_methods() {
PackedStringArray currency_codes;
for (NSUInteger i = 0; i < [products count]; i++) {
-
SKProduct *product = [products objectAtIndex:i];
const char *str = [product.localizedTitle UTF8String];
@@ -116,7 +114,6 @@ void InAppStore::_bind_methods() {
PackedStringArray invalid_ids;
for (NSString *ipid in response.invalidProductIdentifiers) {
-
invalid_ids.push_back(String::utf8([ipid UTF8String]));
};
ret["invalid_ids"] = invalid_ids;
@@ -129,7 +126,6 @@ void InAppStore::_bind_methods() {
@end
Error InAppStore::request_product_info(Variant p_params) {
-
Dictionary params = p_params;
ERR_FAIL_COND_V(!params.has("product_ids"), ERR_INVALID_PARAMETER);
@@ -155,7 +151,6 @@ Error InAppStore::request_product_info(Variant p_params) {
};
Error InAppStore::restore_purchases() {
-
printf("restoring purchases!\n");
[[SKPaymentQueue defaultQueue] restoreCompletedTransactions];
@@ -169,10 +164,8 @@ Error InAppStore::restore_purchases() {
@implementation TransObserver
- (void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions {
-
printf("transactions updated!\n");
for (SKPaymentTransaction *transaction in transactions) {
-
switch (transaction.transactionState) {
case SKPaymentTransactionStatePurchased: {
printf("status purchased!\n");
@@ -189,11 +182,9 @@ Error InAppStore::restore_purchases() {
int sdk_version = 6;
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0) {
-
NSURL *receiptFileURL = nil;
NSBundle *bundle = [NSBundle mainBundle];
if ([bundle respondsToSelector:@selector(appStoreReceiptURL)]) {
-
// Get the transaction receipt file path location in the app bundle.
receiptFileURL = [bundle appStoreReceiptURL];
@@ -263,7 +254,6 @@ Error InAppStore::restore_purchases() {
@end
Error InAppStore::purchase(Variant p_params) {
-
ERR_FAIL_COND_V(![SKPaymentQueue canMakePayments], ERR_UNAVAILABLE);
if (![SKPaymentQueue canMakePayments])
return ERR_UNAVAILABLE;
@@ -286,7 +276,6 @@ int InAppStore::get_pending_event_count() {
};
Variant InAppStore::pop_pending_event() {
-
Variant front = pending_events.front()->get();
pending_events.pop_front();
@@ -294,12 +283,10 @@ Variant InAppStore::pop_pending_event() {
};
void InAppStore::_post_event(Variant p_event) {
-
pending_events.push_back(p_event);
};
void InAppStore::_record_purchase(String product_id) {
-
String skey = "purchased/" + product_id;
NSString *key = [[[NSString alloc] initWithUTF8String:skey.utf8().get_data()] autorelease];
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:key];
@@ -307,7 +294,6 @@ void InAppStore::_record_purchase(String product_id) {
};
InAppStore *InAppStore::get_singleton() {
-
return instance;
};
diff --git a/platform/iphone/ios.h b/platform/iphone/ios.h
index 1378fdbbc5..2b29e6f268 100644
--- a/platform/iphone/ios.h
+++ b/platform/iphone/ios.h
@@ -34,7 +34,6 @@
#include "core/object.h"
class iOS : public Object {
-
GDCLASS(iOS, Object);
static void _bind_methods();
diff --git a/platform/iphone/ios.mm b/platform/iphone/ios.mm
index 697c9b8a3d..5923f558a5 100644
--- a/platform/iphone/ios.mm
+++ b/platform/iphone/ios.mm
@@ -34,7 +34,6 @@
#import <UIKit/UIKit.h>
void iOS::_bind_methods() {
-
ClassDB::bind_method(D_METHOD("get_rate_url", "app_id"), &iOS::get_rate_url);
};
diff --git a/platform/iphone/os_iphone.cpp b/platform/iphone/os_iphone.cpp
index 9254e660d8..107d142757 100644
--- a/platform/iphone/os_iphone.cpp
+++ b/platform/iphone/os_iphone.cpp
@@ -58,12 +58,10 @@
#include <dlfcn.h>
int OSIPhone::get_video_driver_count() const {
-
return 2;
};
const char *OSIPhone::get_video_driver_name(int p_driver) const {
-
switch (p_driver) {
case VIDEO_DRIVER_GLES2:
return "GLES2";
@@ -72,14 +70,12 @@ const char *OSIPhone::get_video_driver_name(int p_driver) const {
};
OSIPhone *OSIPhone::get_singleton() {
-
return (OSIPhone *)OS::get_singleton();
};
extern int gl_view_base_fb; // from gl_view.mm
void OSIPhone::set_data_dir(String p_dir) {
-
DirAccess *da = DirAccess::open(p_dir);
data_dir = da->get_current_dir();
@@ -88,17 +84,14 @@ void OSIPhone::set_data_dir(String p_dir) {
};
void OSIPhone::set_unique_id(String p_id) {
-
unique_id = p_id;
};
String OSIPhone::get_unique_id() const {
-
return unique_id;
};
void OSIPhone::initialize_core() {
-
OS_Unix::initialize_core();
set_data_dir(data_dir);
@@ -174,12 +167,10 @@ Error OSIPhone::initialize(const VideoMode &p_desired, int p_video_driver, int p
};
MainLoop *OSIPhone::get_main_loop() const {
-
return main_loop;
};
void OSIPhone::set_main_loop(MainLoop *p_main_loop) {
-
main_loop = p_main_loop;
if (main_loop) {
@@ -189,13 +180,11 @@ void OSIPhone::set_main_loop(MainLoop *p_main_loop) {
};
bool OSIPhone::iterate() {
-
if (!main_loop)
return true;
if (main_loop) {
for (int i = 0; i < event_count; i++) {
-
input->parse_input_event(event_queue[i]);
};
};
@@ -205,7 +194,6 @@ bool OSIPhone::iterate() {
};
void OSIPhone::key(uint32_t p_key, bool p_pressed) {
-
Ref<InputEventKey> ev;
ev.instance();
ev->set_echo(false);
@@ -217,7 +205,6 @@ void OSIPhone::key(uint32_t p_key, bool p_pressed) {
};
void OSIPhone::touch_press(int p_idx, int p_x, int p_y, bool p_pressed, bool p_doubleclick) {
-
if (!GLOBAL_DEF("debug/disable_touch", false)) {
Ref<InputEventScreenTouch> ev;
ev.instance();
@@ -232,9 +219,7 @@ void OSIPhone::touch_press(int p_idx, int p_x, int p_y, bool p_pressed, bool p_d
};
void OSIPhone::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->set_index(p_idx);
@@ -245,18 +230,14 @@ void OSIPhone::touch_drag(int p_idx, int p_prev_x, int p_prev_y, int p_x, int p_
};
void OSIPhone::queue_event(const Ref<InputEvent> &p_event) {
-
ERR_FAIL_INDEX(event_count, MAX_EVENTS);
event_queue[event_count++] = p_event;
};
void OSIPhone::touches_cancelled() {
-
for (int i = 0; i < MAX_MOUSE_COUNT; i++) {
-
if (touch_list.pressed[i]) {
-
// send a mouse_up outside the screen
touch_press(i, -1, -1, false, false);
};
@@ -270,7 +251,6 @@ void OSIPhone::update_gravity(float p_x, float p_y, float p_z) {
};
void OSIPhone::update_accelerometer(float p_x, float p_y, float p_z) {
-
// Found out the Z should not be negated! Pass as is!
input->set_accelerometer(Vector3(p_x / (float)ACCEL_RANGE, p_y / (float)ACCEL_RANGE, p_z / (float)ACCEL_RANGE));
@@ -333,7 +313,6 @@ void OSIPhone::joy_axis(int p_device, int p_axis, const InputDefault::JoyAxis &p
};
void OSIPhone::delete_main_loop() {
-
if (main_loop) {
main_loop->finish();
memdelete(main_loop);
@@ -343,7 +322,6 @@ void OSIPhone::delete_main_loop() {
};
void OSIPhone::finalize() {
-
delete_main_loop();
memdelete(input);
@@ -376,24 +354,20 @@ void OSIPhone::set_mouse_show(bool p_show) {}
void OSIPhone::set_mouse_grab(bool p_grab) {}
bool OSIPhone::is_mouse_grab_enabled() const {
-
return true;
};
Point2 OSIPhone::get_mouse_position() const {
-
return Point2();
};
int OSIPhone::get_mouse_button_state() const {
-
return 0;
};
void OSIPhone::set_window_title(const String &p_title) {}
void OSIPhone::alert(const String &p_alert, const String &p_title) {
-
const CharString utf8_alert = p_alert.utf8();
const CharString utf8_title = p_title.utf8();
iOS::alert(utf8_alert.get_data(), utf8_title.get_data());
@@ -431,22 +405,18 @@ Error OSIPhone::get_dynamic_library_symbol_handle(void *p_library_handle, const
}
void OSIPhone::set_video_mode(const VideoMode &p_video_mode, int p_screen) {
-
video_mode = p_video_mode;
};
OS::VideoMode OSIPhone::get_video_mode(int p_screen) const {
-
return video_mode;
};
void OSIPhone::get_fullscreen_mode_list(List<VideoMode> *p_list, int p_screen) const {
-
p_list->push_back(video_mode);
};
bool OSIPhone::can_draw() const {
-
if (native_video_is_playing())
return false;
return true;
@@ -497,17 +467,14 @@ void OSIPhone::set_keep_screen_on(bool p_enabled) {
};
String OSIPhone::get_user_data_dir() const {
-
return data_dir;
};
String OSIPhone::get_name() const {
-
return "iOS";
};
String OSIPhone::get_model_name() const {
-
String model = ios->get_model();
if (model != "")
return model;
@@ -516,7 +483,6 @@ String OSIPhone::get_model_name() const {
}
Size2 OSIPhone::get_window_size() const {
-
return Vector2(video_mode.width, video_mode.height);
}
@@ -527,7 +493,6 @@ Rect2 OSIPhone::get_window_safe_area() const {
}
bool OSIPhone::has_touchscreen_ui_hint() const {
-
return true;
}
@@ -600,7 +565,6 @@ void OSIPhone::vibrate_handheld(int p_duration_ms) {
}
bool OSIPhone::_check_internal_feature_support(const String &p_feature) {
-
return p_feature == "mobile";
}
diff --git a/platform/iphone/os_iphone.h b/platform/iphone/os_iphone.h
index eb94e1d69b..a57b8eeb5d 100644
--- a/platform/iphone/os_iphone.h
+++ b/platform/iphone/os_iphone.h
@@ -50,7 +50,6 @@
#endif
class OSIPhone : public OS_Unix {
-
private:
enum {
MAX_MOUSE_COUNT = 8,
@@ -99,7 +98,6 @@ private:
virtual void finalize();
struct MouseList {
-
bool pressed[MAX_MOUSE_COUNT];
MouseList() {
for (int i = 0; i < MAX_MOUSE_COUNT; i++)
diff --git a/platform/iphone/view_controller.mm b/platform/iphone/view_controller.mm
index 465e38e45e..279bcc1226 100644
--- a/platform/iphone/view_controller.mm
+++ b/platform/iphone/view_controller.mm
@@ -40,7 +40,6 @@ int add_path(int, char **);
int add_cmdline(int, char **);
int add_path(int p_argc, char **p_args) {
-
NSString *str = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"godot_path"];
if (!str)
return p_argc;
@@ -54,13 +53,11 @@ int add_path(int p_argc, char **p_args) {
};
int add_cmdline(int p_argc, char **p_args) {
-
NSArray *arr = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"godot_cmdline"];
if (!arr)
return p_argc;
for (int i = 0; i < [arr count]; i++) {
-
NSString *str = [arr objectAtIndex:i];
if (!str)
continue;
@@ -81,7 +78,6 @@ int add_cmdline(int p_argc, char **p_args) {
@implementation ViewController
- (void)didReceiveMemoryWarning {
-
printf("*********** did receive memory warning!\n");
};
diff --git a/platform/iphone/vulkan_context_iphone.h b/platform/iphone/vulkan_context_iphone.h
index 625e41f4b9..cadd701636 100644
--- a/platform/iphone/vulkan_context_iphone.h
+++ b/platform/iphone/vulkan_context_iphone.h
@@ -35,7 +35,6 @@
// #import <UIKit/UIKit.h>
class VulkanContextIPhone : public VulkanContext {
-
virtual const char *_get_platform_surface_extension() const;
public:
diff --git a/platform/iphone/vulkan_context_iphone.mm b/platform/iphone/vulkan_context_iphone.mm
index 701ac0d9bb..44c940dc3a 100644
--- a/platform/iphone/vulkan_context_iphone.mm
+++ b/platform/iphone/vulkan_context_iphone.mm
@@ -36,7 +36,6 @@ const char *VulkanContextIPhone::_get_platform_surface_extension() const {
}
int VulkanContextIPhone::window_create(void *p_window, int p_width, int p_height) {
-
VkIOSSurfaceCreateInfoMVK createInfo;
createInfo.sType = VK_STRUCTURE_TYPE_MACOS_SURFACE_CREATE_INFO_MVK;
createInfo.pNext = NULL;
diff --git a/platform/javascript/api/api.cpp b/platform/javascript/api/api.cpp
index 45cb82b351..9c73e5c4c4 100644
--- a/platform/javascript/api/api.cpp
+++ b/platform/javascript/api/api.cpp
@@ -35,26 +35,22 @@
static JavaScript *javascript_eval;
void register_javascript_api() {
-
ClassDB::register_virtual_class<JavaScript>();
javascript_eval = memnew(JavaScript);
Engine::get_singleton()->add_singleton(Engine::Singleton("JavaScript", javascript_eval));
}
void unregister_javascript_api() {
-
memdelete(javascript_eval);
}
JavaScript *JavaScript::singleton = nullptr;
JavaScript *JavaScript::get_singleton() {
-
return singleton;
}
JavaScript::JavaScript() {
-
ERR_FAIL_COND_MSG(singleton != nullptr, "JavaScript singleton already exist.");
singleton = this;
}
@@ -62,13 +58,11 @@ JavaScript::JavaScript() {
JavaScript::~JavaScript() {}
void JavaScript::_bind_methods() {
-
ClassDB::bind_method(D_METHOD("eval", "code", "use_global_execution_context"), &JavaScript::eval, DEFVAL(false));
}
#if !defined(JAVASCRIPT_ENABLED) || !defined(JAVASCRIPT_EVAL_ENABLED)
Variant JavaScript::eval(const String &p_code, bool p_use_global_exec_context) {
-
return Variant();
}
#endif
diff --git a/platform/javascript/audio_driver_javascript.cpp b/platform/javascript/audio_driver_javascript.cpp
index 690ce5ba47..03ca5f78d1 100644
--- a/platform/javascript/audio_driver_javascript.cpp
+++ b/platform/javascript/audio_driver_javascript.cpp
@@ -35,22 +35,18 @@
AudioDriverJavaScript *AudioDriverJavaScript::singleton = nullptr;
const char *AudioDriverJavaScript::get_name() const {
-
return "JavaScript";
}
extern "C" EMSCRIPTEN_KEEPALIVE void audio_driver_js_mix() {
-
AudioDriverJavaScript::singleton->mix_to_js();
}
extern "C" EMSCRIPTEN_KEEPALIVE void audio_driver_process_capture(float sample) {
-
AudioDriverJavaScript::singleton->process_capture(sample);
}
void AudioDriverJavaScript::mix_to_js() {
-
int channel_count = get_total_channels_by_speaker_mode(get_speaker_mode());
int sample_count = memarr_len(internal_buffer) / channel_count;
int32_t *stream_buffer = reinterpret_cast<int32_t *>(internal_buffer);
@@ -61,13 +57,11 @@ void AudioDriverJavaScript::mix_to_js() {
}
void AudioDriverJavaScript::process_capture(float sample) {
-
int32_t sample32 = int32_t(sample * 32768.f) * (1U << 16);
input_buffer_write(sample32);
}
Error AudioDriverJavaScript::init() {
-
/* clang-format off */
_driver_id = EM_ASM_INT({
return Module.IDHandler.add({
@@ -115,7 +109,6 @@ Error AudioDriverJavaScript::init() {
}
void AudioDriverJavaScript::start() {
-
/* clang-format off */
EM_ASM({
const ref = Module.IDHandler.get($0);
@@ -164,7 +157,6 @@ void AudioDriverJavaScript::resume() {
}
int AudioDriverJavaScript::get_mix_rate() const {
-
/* clang-format off */
return EM_ASM_INT({
const ref = Module.IDHandler.get($0);
@@ -174,7 +166,6 @@ int AudioDriverJavaScript::get_mix_rate() const {
}
AudioDriver::SpeakerMode AudioDriverJavaScript::get_speaker_mode() const {
-
/* clang-format off */
return get_speaker_mode_by_total_channels(EM_ASM_INT({
const ref = Module.IDHandler.get($0);
@@ -191,7 +182,6 @@ void AudioDriverJavaScript::unlock() {
}
void AudioDriverJavaScript::finish_async() {
-
// Close the context, add the operation to the async_finish list in module.
int id = _driver_id;
_driver_id = 0;
@@ -230,7 +220,6 @@ void AudioDriverJavaScript::finish() {
}
Error AudioDriverJavaScript::capture_start() {
-
input_buffer_init(buffer_length);
/* clang-format off */
@@ -260,7 +249,6 @@ Error AudioDriverJavaScript::capture_start() {
}
Error AudioDriverJavaScript::capture_stop() {
-
/* clang-format off */
EM_ASM({
var ref = Module.IDHandler.get($0);
@@ -286,7 +274,6 @@ Error AudioDriverJavaScript::capture_stop() {
}
AudioDriverJavaScript::AudioDriverJavaScript() {
-
_driver_id = 0;
internal_buffer = nullptr;
buffer_length = 0;
diff --git a/platform/javascript/audio_driver_javascript.h b/platform/javascript/audio_driver_javascript.h
index 4a44f4683f..7d5237998a 100644
--- a/platform/javascript/audio_driver_javascript.h
+++ b/platform/javascript/audio_driver_javascript.h
@@ -34,7 +34,6 @@
#include "servers/audio_server.h"
class AudioDriverJavaScript : public AudioDriver {
-
float *internal_buffer;
int _driver_id;
diff --git a/platform/javascript/display_server_javascript.cpp b/platform/javascript/display_server_javascript.cpp
index 53b22bbe7c..758e48ce81 100644
--- a/platform/javascript/display_server_javascript.cpp
+++ b/platform/javascript/display_server_javascript.cpp
@@ -56,7 +56,6 @@ extern "C" EMSCRIPTEN_KEEPALIVE void _set_canvas_id(uint8_t *p_data, int p_data_
}
static void focus_canvas() {
-
/* clang-format off */
EM_ASM(
Module['canvas'].focus();
@@ -65,7 +64,6 @@ static void focus_canvas() {
}
static bool is_canvas_focused() {
-
/* clang-format off */
return EM_ASM_INT_V(
return document.activeElement == Module['canvas'];
@@ -96,7 +94,6 @@ static Point2 compute_position_in_canvas(int x, int y) {
static bool cursor_inside_canvas = true;
EM_BOOL DisplayServerJavaScript::fullscreen_change_callback(int p_event_type, const EmscriptenFullscreenChangeEvent *p_event, void *p_user_data) {
-
DisplayServerJavaScript *display = get_singleton();
// Empty ID is canvas.
String target_id = String::utf8(p_event->id);
@@ -135,7 +132,6 @@ extern "C" EMSCRIPTEN_KEEPALIVE void _drop_files_callback(char *p_filev[], int p
template <typename T>
static void dom2godot_mod(T *emscripten_event_ptr, Ref<InputEventWithModifiers> godot_event) {
-
godot_event->set_shift(emscripten_event_ptr->shiftKey);
godot_event->set_alt(emscripten_event_ptr->altKey);
godot_event->set_control(emscripten_event_ptr->ctrlKey);
@@ -143,7 +139,6 @@ static void dom2godot_mod(T *emscripten_event_ptr, Ref<InputEventWithModifiers>
}
static Ref<InputEventKey> setup_key_event(const EmscriptenKeyboardEvent *emscripten_event) {
-
Ref<InputEventKey> ev;
ev.instance();
ev->set_echo(emscripten_event->repeat);
@@ -165,7 +160,6 @@ static Ref<InputEventKey> setup_key_event(const EmscriptenKeyboardEvent *emscrip
}
EM_BOOL DisplayServerJavaScript::keydown_callback(int p_event_type, const EmscriptenKeyboardEvent *p_event, void *p_user_data) {
-
DisplayServerJavaScript *display = get_singleton();
Ref<InputEventKey> ev = setup_key_event(p_event);
ev->set_pressed(true);
@@ -180,7 +174,6 @@ EM_BOOL DisplayServerJavaScript::keydown_callback(int p_event_type, const Emscri
}
EM_BOOL DisplayServerJavaScript::keypress_callback(int p_event_type, const EmscriptenKeyboardEvent *p_event, void *p_user_data) {
-
DisplayServerJavaScript *display = get_singleton();
display->deferred_key_event->set_unicode(p_event->charCode);
Input::get_singleton()->parse_input_event(display->deferred_key_event);
@@ -188,7 +181,6 @@ EM_BOOL DisplayServerJavaScript::keypress_callback(int p_event_type, const Emscr
}
EM_BOOL DisplayServerJavaScript::keyup_callback(int p_event_type, const EmscriptenKeyboardEvent *p_event, void *p_user_data) {
-
Ref<InputEventKey> ev = setup_key_event(p_event);
ev->set_pressed(false);
Input::get_singleton()->parse_input_event(ev);
@@ -198,7 +190,6 @@ EM_BOOL DisplayServerJavaScript::keyup_callback(int p_event_type, const Emscript
// Mouse
EM_BOOL DisplayServerJavaScript::mouse_button_callback(int p_event_type, const EmscriptenMouseEvent *p_event, void *p_user_data) {
-
DisplayServerJavaScript *display = get_singleton();
Ref<InputEventMouseButton> ev;
@@ -229,13 +220,10 @@ EM_BOOL DisplayServerJavaScript::mouse_button_callback(int p_event_type, const E
}
if (ev->is_pressed()) {
-
double diff = emscripten_get_now() - display->last_click_ms;
if (ev->get_button_index() == display->last_click_button_index) {
-
if (diff < 400 && Point2(display->last_click_pos).distance_to(ev->get_position()) < 5) {
-
display->last_click_ms = 0;
display->last_click_pos = Point2(-100, -100);
display->last_click_button_index = -1;
@@ -275,7 +263,6 @@ EM_BOOL DisplayServerJavaScript::mouse_button_callback(int p_event_type, const E
}
EM_BOOL DisplayServerJavaScript::mousemove_callback(int p_event_type, const EmscriptenMouseEvent *p_event, void *p_user_data) {
-
Input *input = Input::get_singleton();
int input_mask = input->get_mouse_button_mask();
Point2 pos = compute_position_in_canvas(p_event->clientX, p_event->clientY);
@@ -303,7 +290,6 @@ EM_BOOL DisplayServerJavaScript::mousemove_callback(int p_event_type, const Emsc
// Cursor
static const char *godot2dom_cursor(DisplayServer::CursorShape p_shape) {
-
switch (p_shape) {
case DisplayServer::CURSOR_ARROW:
return "auto";
@@ -345,7 +331,6 @@ static const char *godot2dom_cursor(DisplayServer::CursorShape p_shape) {
}
static void set_css_cursor(const char *p_cursor) {
-
/* clang-format off */
EM_ASM_({
Module['canvas'].style.cursor = UTF8ToString($0);
@@ -354,7 +339,6 @@ static void set_css_cursor(const char *p_cursor) {
}
static bool is_css_cursor_hidden() {
-
/* clang-format off */
return EM_ASM_INT({
return Module['canvas'].style.cursor === 'none';
@@ -363,7 +347,6 @@ static bool is_css_cursor_hidden() {
}
void DisplayServerJavaScript::cursor_set_shape(CursorShape p_shape) {
-
ERR_FAIL_INDEX(p_shape, CURSOR_MAX);
if (mouse_get_mode() == MOUSE_MODE_VISIBLE) {
@@ -383,9 +366,7 @@ DisplayServer::CursorShape DisplayServerJavaScript::cursor_get_shape() const {
}
void DisplayServerJavaScript::cursor_set_custom_image(const RES &p_cursor, CursorShape p_shape, const Vector2 &p_hotspot) {
-
if (p_cursor.is_valid()) {
-
Map<CursorShape, Vector<Variant>>::Element *cursor_c = cursors_cache.find(p_shape);
if (cursor_c) {
@@ -513,25 +494,21 @@ 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())
return;
if (p_mode == MOUSE_MODE_VISIBLE) {
-
// set_css_cursor must be called before set_cursor_shape to make the cursor visible
set_css_cursor(godot2dom_cursor(cursor_shape));
cursor_set_shape(cursor_shape);
emscripten_exit_pointerlock();
} else if (p_mode == MOUSE_MODE_HIDDEN) {
-
set_css_cursor("none");
emscripten_exit_pointerlock();
} else if (p_mode == MOUSE_MODE_CAPTURED) {
-
EMSCRIPTEN_RESULT result = emscripten_request_pointerlock("canvas", false);
ERR_FAIL_COND_MSG(result == EMSCRIPTEN_RESULT_FAILED_NOT_DEFERRED, "MOUSE_MODE_CAPTURED can only be entered from within an appropriate input callback.");
ERR_FAIL_COND_MSG(result != EMSCRIPTEN_RESULT_SUCCESS, "MOUSE_MODE_CAPTURED can only be entered from within an appropriate input callback.");
@@ -542,7 +519,6 @@ void DisplayServerJavaScript::mouse_set_mode(MouseMode p_mode) {
}
DisplayServer::MouseMode DisplayServerJavaScript::mouse_get_mode() const {
-
if (is_css_cursor_hidden())
return MOUSE_MODE_HIDDEN;
@@ -554,7 +530,6 @@ DisplayServer::MouseMode DisplayServerJavaScript::mouse_get_mode() const {
// Wheel
EM_BOOL DisplayServerJavaScript::wheel_callback(int p_event_type, const EmscriptenWheelEvent *p_event, void *p_user_data) {
-
ERR_FAIL_COND_V(p_event_type != EMSCRIPTEN_EVENT_WHEEL, false);
if (!is_canvas_focused()) {
if (cursor_inside_canvas) {
@@ -604,13 +579,11 @@ EM_BOOL DisplayServerJavaScript::wheel_callback(int p_event_type, const Emscript
// Touch
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();
int lowest_id_index = -1;
for (int i = 0; i < p_event->numTouches; ++i) {
-
const EmscriptenTouchPoint &touch = p_event->touches[i];
if (lowest_id_index == -1 || touch.identifier < p_event->touches[lowest_id_index].identifier)
lowest_id_index = i;
@@ -628,13 +601,11 @@ 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();
int lowest_id_index = -1;
for (int i = 0; i < p_event->numTouches; ++i) {
-
const EmscriptenTouchPoint &touch = p_event->touches[i];
if (lowest_id_index == -1 || touch.identifier < p_event->touches[lowest_id_index].identifier)
lowest_id_index = i;
@@ -658,10 +629,8 @@ bool DisplayServerJavaScript::screen_is_touchscreen(int p_screen) const {
// Gamepad
EM_BOOL DisplayServerJavaScript::gamepad_change_callback(int p_event_type, const EmscriptenGamepadEvent *p_event, void *p_user_data) {
-
Input *input = Input::get_singleton();
if (p_event_type == EMSCRIPTEN_EVENT_GAMEPADCONNECTED) {
-
String guid = "";
if (String::utf8(p_event->mapping) == "standard")
guid = "Default HTML5 Gamepad";
@@ -673,7 +642,6 @@ EM_BOOL DisplayServerJavaScript::gamepad_change_callback(int p_event_type, const
}
void DisplayServerJavaScript::process_joypads() {
-
int joypad_count = emscripten_get_num_gamepads();
Input *input = Input::get_singleton();
for (int joypad = 0; joypad < joypad_count; joypad++) {
@@ -683,16 +651,13 @@ void DisplayServerJavaScript::process_joypads() {
ERR_CONTINUE(query_result != EMSCRIPTEN_RESULT_SUCCESS &&
query_result != EMSCRIPTEN_RESULT_NO_DATA);
if (query_result == EMSCRIPTEN_RESULT_SUCCESS && state.connected) {
-
int button_count = MIN(state.numButtons, 18);
int axis_count = MIN(state.numAxes, 8);
for (int button = 0; button < button_count; button++) {
-
float value = state.analogButton[button];
input->joy_button(joypad, button, value);
}
for (int axis = 0; axis < axis_count; axis++) {
-
Input::JoyAxis joy_axis;
joy_axis.min = -1;
joy_axis.value = state.axis[axis];
@@ -760,7 +725,6 @@ String DisplayServerJavaScript::clipboard_get() const {
}
extern "C" EMSCRIPTEN_KEEPALIVE void send_window_event(int p_notification) {
-
if (p_notification == DisplayServer::WINDOW_EVENT_MOUSE_ENTER || p_notification == DisplayServer::WINDOW_EVENT_MOUSE_EXIT) {
cursor_inside_canvas = p_notification == DisplayServer::WINDOW_EVENT_MOUSE_ENTER;
}
@@ -778,7 +742,6 @@ extern "C" EMSCRIPTEN_KEEPALIVE void send_window_event(int p_notification) {
}
void DisplayServerJavaScript::alert(const String &p_alert, const String &p_title) {
-
/* clang-format off */
EM_ASM_({
window.alert(UTF8ToString($0));
@@ -787,7 +750,6 @@ void DisplayServerJavaScript::alert(const String &p_alert, const String &p_title
}
void DisplayServerJavaScript::set_icon(const Ref<Image> &p_icon) {
-
ERR_FAIL_COND(p_icon.is_null());
Ref<Image> icon = p_icon;
if (icon->is_compressed()) {
@@ -857,7 +819,6 @@ DisplayServer *DisplayServerJavaScript::create_func(const String &p_rendering_dr
}
DisplayServerJavaScript::DisplayServerJavaScript(const String &p_rendering_driver, WindowMode p_mode, uint32_t p_flags, const Vector2i &p_resolution, Error &r_error) {
-
/* clang-format off */
EM_ASM({
const canvas = Module['canvas'];
@@ -1042,7 +1003,6 @@ Point2i DisplayServerJavaScript::screen_get_position(int p_screen) const {
}
Size2i DisplayServerJavaScript::screen_get_size(int p_screen) const {
-
EmscriptenFullscreenChangeEvent ev;
EMSCRIPTEN_RESULT result = emscripten_get_fullscreen_status(&ev);
ERR_FAIL_COND_V(result != EMSCRIPTEN_RESULT_SUCCESS, Size2i());
diff --git a/platform/javascript/display_server_javascript.h b/platform/javascript/display_server_javascript.h
index 73a7b017e6..9860ecdf98 100644
--- a/platform/javascript/display_server_javascript.h
+++ b/platform/javascript/display_server_javascript.h
@@ -37,7 +37,6 @@
#include <emscripten/html5.h>
class DisplayServerJavaScript : public DisplayServer {
-
//int video_driver_index;
Vector2 windowed_size;
diff --git a/platform/javascript/dom_keys.inc b/platform/javascript/dom_keys.inc
index 42d394fd4f..882e943471 100644
--- a/platform/javascript/dom_keys.inc
+++ b/platform/javascript/dom_keys.inc
@@ -219,7 +219,6 @@
#define DOM_VK_WIN_OEM_CLEAR 0xFE
int dom2godot_keycode(int dom_keycode) {
-
if (DOM_VK_0 <= dom_keycode && dom_keycode <= DOM_VK_Z) {
// ASCII intersection
return dom_keycode;
diff --git a/platform/javascript/export/export.cpp b/platform/javascript/export/export.cpp
index fbc298a399..b5172651d0 100644
--- a/platform/javascript/export/export.cpp
+++ b/platform/javascript/export/export.cpp
@@ -41,7 +41,6 @@
#define EXPORT_TEMPLATE_WEBASSEMBLY_DEBUG "webassembly_debug.zip"
class EditorHTTPServer : public Reference {
-
private:
Ref<TCP_Server> server;
Ref<StreamPeerTCP> connection;
@@ -165,7 +164,6 @@ public:
return;
while (true) {
-
char *r = (char *)req_buf;
int l = req_pos - 1;
if (l > 3 && r[l] == '\n' && r[l - 1] == '\r' && r[l - 2] == '\n' && r[l - 3] == '\r') {
@@ -191,7 +189,6 @@ public:
};
class EditorExportPlatformJavaScript : public EditorExportPlatform {
-
GDCLASS(EditorExportPlatformJavaScript, EditorExportPlatform);
Ref<ImageTexture> logo;
@@ -231,7 +228,6 @@ public:
virtual Ref<Texture2D> get_run_icon() const;
virtual void get_platform_features(List<String> *r_features) {
-
r_features->push_back("web");
r_features->push_back(get_os_name());
}
@@ -246,7 +242,6 @@ public:
};
void EditorExportPlatformJavaScript::_fix_html(Vector<uint8_t> &p_html, const Ref<EditorExportPreset> &p_preset, const String &p_name, bool p_debug, int p_flags) {
-
String str_template = String::utf8(reinterpret_cast<const char *>(p_html.ptr()), p_html.size());
String str_export;
Vector<String> lines = str_template.split("\n");
@@ -256,7 +251,6 @@ void EditorExportPlatformJavaScript::_fix_html(Vector<uint8_t> &p_html, const Re
flags_json = JSON::print(flags);
for (int i = 0; i < lines.size(); i++) {
-
String current_line = lines[i];
current_line = current_line.replace("$GODOT_BASENAME", p_name);
current_line = current_line.replace("$GODOT_PROJECT_NAME", ProjectSettings::get_singleton()->get_setting("application/config/name"));
@@ -274,7 +268,6 @@ void EditorExportPlatformJavaScript::_fix_html(Vector<uint8_t> &p_html, const Re
}
void EditorExportPlatformJavaScript::get_preset_features(const Ref<EditorExportPreset> &p_preset, List<String> *r_features) {
-
if (p_preset->get("vram_texture_compression/for_desktop")) {
r_features->push_back("s3tc");
}
@@ -291,7 +284,6 @@ void EditorExportPlatformJavaScript::get_preset_features(const Ref<EditorExportP
}
void EditorExportPlatformJavaScript::get_export_options(List<ExportOption> *r_options) {
-
r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "vram_texture_compression/for_desktop"), true)); // S3TC
r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "vram_texture_compression/for_mobile"), false)); // ETC or ETC2, depending on renderer
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "html/custom_html_shell", PROPERTY_HINT_FILE, "*.html"), ""));
@@ -301,22 +293,18 @@ void EditorExportPlatformJavaScript::get_export_options(List<ExportOption> *r_op
}
String EditorExportPlatformJavaScript::get_name() const {
-
return "HTML5";
}
String EditorExportPlatformJavaScript::get_os_name() const {
-
return "HTML5";
}
Ref<Texture2D> EditorExportPlatformJavaScript::get_logo() const {
-
return logo;
}
bool EditorExportPlatformJavaScript::can_export(const Ref<EditorExportPreset> &p_preset, String &r_error, bool &r_missing_templates) const {
-
String err;
bool valid = false;
@@ -358,7 +346,6 @@ bool EditorExportPlatformJavaScript::can_export(const Ref<EditorExportPreset> &p
}
List<String> EditorExportPlatformJavaScript::get_binary_extensions(const Ref<EditorExportPreset> &p_preset) const {
-
List<String> list;
list.push_back("html");
return list;
@@ -376,7 +363,6 @@ Error EditorExportPlatformJavaScript::export_project(const Ref<EditorExportPrese
template_path = template_path.strip_edges();
if (template_path == String()) {
-
if (p_debug)
template_path = find_export_template(EXPORT_TEMPLATE_WEBASSEMBLY_DEBUG);
else
@@ -404,7 +390,6 @@ Error EditorExportPlatformJavaScript::export_project(const Ref<EditorExportPrese
unzFile pkg = unzOpen2(template_path.utf8().get_data(), &io);
if (!pkg) {
-
EditorNode::get_singleton()->show_warning(TTR("Could not open template for export:") + "\n" + template_path);
return ERR_FILE_NOT_FOUND;
}
@@ -434,7 +419,6 @@ Error EditorExportPlatformJavaScript::export_project(const Ref<EditorExportPrese
//write
if (file == "godot.html") {
-
if (!custom_html.empty()) {
continue;
}
@@ -442,14 +426,11 @@ Error EditorExportPlatformJavaScript::export_project(const Ref<EditorExportPrese
file = p_path.get_file();
} else if (file == "godot.js") {
-
file = p_path.get_file().get_basename() + ".js";
} else if (file == "godot.worker.js") {
-
file = p_path.get_file().get_basename() + ".worker.js";
} else if (file == "godot.wasm") {
-
file = p_path.get_file().get_basename() + ".wasm";
}
@@ -467,7 +448,6 @@ Error EditorExportPlatformJavaScript::export_project(const Ref<EditorExportPrese
unzClose(pkg);
if (!custom_html.empty()) {
-
FileAccess *f = FileAccess::open(custom_html, FileAccess::READ);
if (!f) {
EditorNode::get_singleton()->show_warning(TTR("Could not read custom HTML shell:") + "\n" + custom_html);
@@ -531,11 +511,9 @@ Error EditorExportPlatformJavaScript::export_project(const Ref<EditorExportPrese
}
bool EditorExportPlatformJavaScript::poll_export() {
-
Ref<EditorExportPreset> preset;
for (int i = 0; i < EditorExport::get_singleton()->get_export_preset_count(); i++) {
-
Ref<EditorExportPreset> ep = EditorExport::get_singleton()->get_export_preset(i);
if (ep->is_runnable() && ep->get_platform() == this) {
preset = ep;
@@ -561,12 +539,10 @@ Ref<ImageTexture> EditorExportPlatformJavaScript::get_option_icon(int p_index) c
}
int EditorExportPlatformJavaScript::get_options_count() const {
-
return menu_options;
}
Error EditorExportPlatformJavaScript::run(const Ref<EditorExportPreset> &p_preset, int p_option, int p_debug_flags) {
-
if (p_option == 1) {
MutexLock lock(server_lock);
server->stop();
@@ -614,7 +590,6 @@ Error EditorExportPlatformJavaScript::run(const Ref<EditorExportPreset> &p_prese
}
Ref<Texture2D> EditorExportPlatformJavaScript::get_run_icon() const {
-
return run_icon;
}
@@ -630,7 +605,6 @@ void EditorExportPlatformJavaScript::_server_thread_poll(void *data) {
}
EditorExportPlatformJavaScript::EditorExportPlatformJavaScript() {
-
server.instance();
server_quit = false;
server_thread = Thread::create(_server_thread_poll, this);
@@ -660,7 +634,6 @@ EditorExportPlatformJavaScript::~EditorExportPlatformJavaScript() {
}
void register_javascript_exporter() {
-
EDITOR_DEF("export/web/http_host", "localhost");
EDITOR_DEF("export/web/http_port", 8060);
EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::INT, "export/web/http_port", PROPERTY_HINT_RANGE, "1,65535,1"));
diff --git a/platform/javascript/http_client_javascript.cpp b/platform/javascript/http_client_javascript.cpp
index 19ce7ef219..cb0e48b8a9 100644
--- a/platform/javascript/http_client_javascript.cpp
+++ b/platform/javascript/http_client_javascript.cpp
@@ -33,7 +33,6 @@
#include "http_request.h"
Error HTTPClient::connect_to_host(const String &p_host, int p_port, bool p_ssl, bool p_verify_host) {
-
close();
if (p_ssl && !p_verify_host) {
WARN_PRINT("Disabling HTTPClient's host verification is not supported for the HTML5 platform, host will be verified");
@@ -68,17 +67,14 @@ Error HTTPClient::connect_to_host(const String &p_host, int p_port, bool p_ssl,
}
void HTTPClient::set_connection(const Ref<StreamPeer> &p_connection) {
-
ERR_FAIL_MSG("Accessing an HTTPClient's StreamPeer is not supported for the HTML5 platform.");
}
Ref<StreamPeer> HTTPClient::get_connection() const {
-
ERR_FAIL_V_MSG(REF(), "Accessing an HTTPClient's StreamPeer is not supported for the HTML5 platform.");
}
Error HTTPClient::prepare_request(Method p_method, const String &p_url, const Vector<String> &p_headers) {
-
ERR_FAIL_INDEX_V(p_method, METHOD_MAX, ERR_INVALID_PARAMETER);
ERR_FAIL_COND_V_MSG(p_method == METHOD_TRACE || p_method == METHOD_CONNECT, ERR_UNAVAILABLE, "HTTP methods TRACE and CONNECT are not supported for the HTML5 platform.");
ERR_FAIL_COND_V(status != STATUS_CONNECTED, ERR_INVALID_PARAMETER);
@@ -105,7 +101,6 @@ Error HTTPClient::prepare_request(Method p_method, const String &p_url, const Ve
}
Error HTTPClient::request_raw(Method p_method, const String &p_url, const Vector<String> &p_headers, const Vector<uint8_t> &p_body) {
-
Error err = prepare_request(p_method, p_url, p_headers);
if (err != OK)
return err;
@@ -114,7 +109,6 @@ Error HTTPClient::request_raw(Method p_method, const String &p_url, const Vector
}
Error HTTPClient::request(Method p_method, const String &p_url, const Vector<String> &p_headers, const String &p_body) {
-
Error err = prepare_request(p_method, p_url, p_headers);
if (err != OK)
return err;
@@ -123,7 +117,6 @@ Error HTTPClient::request(Method p_method, const String &p_url, const Vector<Str
}
void HTTPClient::close() {
-
host = "";
port = -1;
use_tls = false;
@@ -135,28 +128,23 @@ void HTTPClient::close() {
}
HTTPClient::Status HTTPClient::get_status() const {
-
return status;
}
bool HTTPClient::has_response() const {
-
return !polled_response_header.empty();
}
bool HTTPClient::is_response_chunked() const {
-
// TODO evaluate using moz-chunked-arraybuffer, fetch & ReadableStream
return false;
}
int HTTPClient::get_response_code() const {
-
return polled_response_code;
}
Error HTTPClient::get_response_headers(List<String> *r_response) {
-
if (polled_response_header.empty())
return ERR_INVALID_PARAMETER;
@@ -169,12 +157,10 @@ Error HTTPClient::get_response_headers(List<String> *r_response) {
}
int HTTPClient::get_response_body_length() const {
-
return polled_response.size();
}
PackedByteArray HTTPClient::read_response_body_chunk() {
-
ERR_FAIL_COND_V(status != STATUS_BODY, PackedByteArray());
int to_read = MIN(read_limit, polled_response.size() - response_read_offset);
@@ -193,17 +179,14 @@ PackedByteArray HTTPClient::read_response_body_chunk() {
}
void HTTPClient::set_blocking_mode(bool p_enable) {
-
ERR_FAIL_COND_MSG(p_enable, "HTTPClient blocking mode is not supported for the HTML5 platform.");
}
bool HTTPClient::is_blocking_mode_enabled() const {
-
return false;
}
void HTTPClient::set_read_chunk_size(int p_size) {
-
read_limit = p_size;
}
@@ -212,9 +195,7 @@ int HTTPClient::get_read_chunk_size() const {
}
Error HTTPClient::poll() {
-
switch (status) {
-
case STATUS_DISCONNECTED:
return ERR_UNCONFIGURED;
@@ -234,7 +215,6 @@ Error HTTPClient::poll() {
return ERR_CONNECTION_ERROR;
case STATUS_REQUESTING: {
-
#ifdef DEBUG_ENABLED
if (!has_polled) {
has_polled = true;
@@ -280,11 +260,9 @@ Error HTTPClient::poll() {
}
HTTPClient::HTTPClient() {
-
xhr_id = godot_xhr_new();
}
HTTPClient::~HTTPClient() {
-
godot_xhr_free(xhr_id);
}
diff --git a/platform/javascript/javascript_eval.cpp b/platform/javascript/javascript_eval.cpp
index db8050b90e..3a72b10dd4 100644
--- a/platform/javascript/javascript_eval.cpp
+++ b/platform/javascript/javascript_eval.cpp
@@ -34,14 +34,12 @@
#include "emscripten.h"
extern "C" EMSCRIPTEN_KEEPALIVE uint8_t *resize_PackedByteArray_and_open_write(PackedByteArray *p_arr, VectorWriteProxy<uint8_t> *r_write, int p_len) {
-
p_arr->resize(p_len);
*r_write = p_arr->write;
return p_arr->ptrw();
}
Variant JavaScript::eval(const String &p_code, bool p_use_global_exec_context) {
-
union {
bool b;
double d;
diff --git a/platform/javascript/javascript_main.cpp b/platform/javascript/javascript_main.cpp
index 854383aeee..740a72fafa 100644
--- a/platform/javascript/javascript_main.cpp
+++ b/platform/javascript/javascript_main.cpp
@@ -46,7 +46,6 @@ void exit_callback() {
}
void main_loop_callback() {
-
if (os->main_loop_iterate()) {
emscripten_cancel_main_loop(); // Cancel current loop and wait for finalize_async.
EM_ASM({
@@ -69,7 +68,6 @@ extern "C" EMSCRIPTEN_KEEPALIVE void cleanup_after_sync() {
}
extern "C" EMSCRIPTEN_KEEPALIVE void main_after_fs_sync(char *p_idbfs_err) {
-
String idbfs_err = String::utf8(p_idbfs_err);
if (!idbfs_err.empty()) {
print_line("IndexedDB not available: " + idbfs_err);
@@ -85,7 +83,6 @@ extern "C" EMSCRIPTEN_KEEPALIVE void main_after_fs_sync(char *p_idbfs_err) {
}
int main(int argc, char *argv[]) {
-
os = new OS_JavaScript();
Main::setup(argv[0], argc - 1, &argv[1], false);
emscripten_set_main_loop(main_loop_callback, -1, false);
diff --git a/platform/javascript/os_javascript.cpp b/platform/javascript/os_javascript.cpp
index 1ec23973d6..ad4b5a5afa 100644
--- a/platform/javascript/os_javascript.cpp
+++ b/platform/javascript/os_javascript.cpp
@@ -47,7 +47,6 @@
#include <stdlib.h>
bool OS_JavaScript::has_touchscreen_ui_hint() const {
-
/* clang-format off */
return EM_ASM_INT_V(
return 'ontouchstart' in window;
@@ -58,18 +57,15 @@ bool OS_JavaScript::has_touchscreen_ui_hint() const {
// Audio
int OS_JavaScript::get_audio_driver_count() const {
-
return 1;
}
const char *OS_JavaScript::get_audio_driver_name(int p_driver) const {
-
return "JavaScript";
}
// Lifecycle
void OS_JavaScript::initialize() {
-
OS_Unix::initialize_core();
FileAccess::make_default<FileAccessBufferedFA<FileAccessUnix>>(FileAccess::ACCESS_RESOURCES);
DisplayServerJavaScript::register_javascript_driver();
@@ -93,22 +89,18 @@ void OS_JavaScript::resume_audio() {
}
void OS_JavaScript::set_main_loop(MainLoop *p_main_loop) {
-
main_loop = p_main_loop;
}
MainLoop *OS_JavaScript::get_main_loop() const {
-
return main_loop;
}
void OS_JavaScript::main_loop_callback() {
-
get_singleton()->main_loop_iterate();
}
bool OS_JavaScript::main_loop_iterate() {
-
if (is_userfs_persistent() && sync_wait_time >= 0) {
int64_t current_time = get_ticks_msec();
int64_t elapsed_time = current_time - last_sync_check_time;
@@ -133,7 +125,6 @@ bool OS_JavaScript::main_loop_iterate() {
}
void OS_JavaScript::delete_main_loop() {
-
if (main_loop) {
memdelete(main_loop);
}
@@ -146,14 +137,12 @@ void OS_JavaScript::finalize_async() {
}
void OS_JavaScript::finalize() {
-
delete_main_loop();
}
// Miscellaneous
Error OS_JavaScript::execute(const String &p_path, const List<String> &p_arguments, bool p_blocking, ProcessID *r_child_id, String *r_pipe, int *r_exitcode, bool read_stderr, Mutex *p_pipe_mutex) {
-
Array args;
for (const List<String>::Element *E = p_arguments.front(); E; E = E->next()) {
args.push_back(E->get());
@@ -175,17 +164,14 @@ Error OS_JavaScript::execute(const String &p_path, const List<String> &p_argumen
}
Error OS_JavaScript::kill(const ProcessID &p_pid) {
-
ERR_FAIL_V_MSG(ERR_UNAVAILABLE, "OS::kill() is not available on the HTML5 platform.");
}
int OS_JavaScript::get_process_id() const {
-
ERR_FAIL_V_MSG(0, "OS::get_process_id() is not available on the HTML5 platform.");
}
bool OS_JavaScript::_check_internal_feature_support(const String &p_feature) {
-
if (p_feature == "HTML5" || p_feature == "web")
return true;
@@ -198,12 +184,10 @@ bool OS_JavaScript::_check_internal_feature_support(const String &p_feature) {
}
String OS_JavaScript::get_executable_path() const {
-
return OS::get_executable_path();
}
Error OS_JavaScript::shell_open(String p_uri) {
-
// Open URI in a new tab, browser will deal with it by protocol.
/* clang-format off */
EM_ASM_({
@@ -214,37 +198,30 @@ Error OS_JavaScript::shell_open(String p_uri) {
}
String OS_JavaScript::get_name() const {
-
return "HTML5";
}
bool OS_JavaScript::can_draw() const {
-
return true; // Always?
}
String OS_JavaScript::get_user_data_dir() const {
-
return "/userfs";
};
String OS_JavaScript::get_cache_path() const {
-
return "/home/web_user/.cache";
}
String OS_JavaScript::get_config_path() const {
-
return "/home/web_user/.config";
}
String OS_JavaScript::get_data_path() const {
-
return "/home/web_user/.local/share";
}
void OS_JavaScript::file_access_close_callback(const String &p_file, int p_flags) {
-
OS_JavaScript *os = get_singleton();
if (os->is_userfs_persistent() && p_file.begins_with("/userfs") && p_flags & FileAccess::WRITE) {
os->last_sync_check_time = OS::get_singleton()->get_ticks_msec();
@@ -254,17 +231,14 @@ void OS_JavaScript::file_access_close_callback(const String &p_file, int p_flags
}
void OS_JavaScript::set_idb_available(bool p_idb_available) {
-
idb_available = p_idb_available;
}
bool OS_JavaScript::is_userfs_persistent() const {
-
return idb_available;
}
OS_JavaScript *OS_JavaScript::get_singleton() {
-
return static_cast<OS_JavaScript *>(OS::get_singleton());
}
@@ -272,7 +246,6 @@ void OS_JavaScript::initialize_joypads() {
}
OS_JavaScript::OS_JavaScript() {
-
AudioDriverManager::add_driver(&audio_driver_javascript);
Vector<Logger *> loggers;
diff --git a/platform/javascript/os_javascript.h b/platform/javascript/os_javascript.h
index 0a81a4a5b3..f0f18b44f8 100644
--- a/platform/javascript/os_javascript.h
+++ b/platform/javascript/os_javascript.h
@@ -39,7 +39,6 @@
#include <emscripten/html5.h>
class OS_JavaScript : public OS_Unix {
-
MainLoop *main_loop = nullptr;
AudioDriverJavaScript audio_driver_javascript;
diff --git a/platform/linuxbsd/context_gl_x11.cpp b/platform/linuxbsd/context_gl_x11.cpp
index 308d68521a..c9b95b41a3 100644
--- a/platform/linuxbsd/context_gl_x11.cpp
+++ b/platform/linuxbsd/context_gl_x11.cpp
@@ -46,22 +46,18 @@
typedef GLXContext (*GLXCREATECONTEXTATTRIBSARBPROC)(Display *, GLXFBConfig, GLXContext, Bool, const int *);
struct ContextGL_X11_Private {
-
::GLXContext glx_context;
};
void ContextGL_X11::release_current() {
-
glXMakeCurrent(x11_display, None, nullptr);
}
void ContextGL_X11::make_current() {
-
glXMakeCurrent(x11_display, x11_window, p->glx_context);
}
void ContextGL_X11::swap_buffers() {
-
glXSwapBuffers(x11_display, x11_window);
}
@@ -85,7 +81,6 @@ static void set_class_hint(Display *p_display, Window p_window) {
}
Error ContextGL_X11::initialize() {
-
//const char *extensions = glXQueryExtensionsString(x11_display, DefaultScreen(x11_display));
GLXCREATECONTEXTATTRIBSARBPROC glXCreateContextAttribsARB = (GLXCREATECONTEXTATTRIBSARBPROC)glXGetProcAddress((const GLubyte *)"glXCreateContextAttribsARB");
@@ -167,7 +162,6 @@ Error ContextGL_X11::initialize() {
switch (context_type) {
case GLES_2_0_COMPATIBLE: {
-
p->glx_context = glXCreateNewContext(x11_display, fbconfig, GLX_RGBA_TYPE, 0, true);
ERR_FAIL_COND_V(!p->glx_context, ERR_UNCONFIGURED);
} break;
@@ -192,7 +186,6 @@ Error ContextGL_X11::initialize() {
}
int ContextGL_X11::get_window_width() {
-
XWindowAttributes xwa;
XGetWindowAttributes(x11_display, x11_window, &xwa);
@@ -235,13 +228,11 @@ void ContextGL_X11::set_use_vsync(bool p_use) {
use_vsync = p_use;
}
bool ContextGL_X11::is_using_vsync() const {
-
return use_vsync;
}
ContextGL_X11::ContextGL_X11(::Display *p_x11_display, ::Window &p_x11_window, const OS::VideoMode &p_default_video_mode, ContextType p_context_type) :
x11_window(p_x11_window) {
-
default_video_mode = p_default_video_mode;
x11_display = p_x11_display;
diff --git a/platform/linuxbsd/context_gl_x11.h b/platform/linuxbsd/context_gl_x11.h
index 2c0643c95a..7aed280c98 100644
--- a/platform/linuxbsd/context_gl_x11.h
+++ b/platform/linuxbsd/context_gl_x11.h
@@ -42,7 +42,6 @@
struct ContextGL_X11_Private;
class ContextGL_X11 {
-
public:
enum ContextType {
GLES_2_0_COMPATIBLE,
diff --git a/platform/linuxbsd/crash_handler_linuxbsd.h b/platform/linuxbsd/crash_handler_linuxbsd.h
index 94b4649690..9bb03579bc 100644
--- a/platform/linuxbsd/crash_handler_linuxbsd.h
+++ b/platform/linuxbsd/crash_handler_linuxbsd.h
@@ -32,7 +32,6 @@
#define CRASH_HANDLER_X11_H
class CrashHandler {
-
bool disabled;
public:
diff --git a/platform/linuxbsd/display_server_x11.cpp b/platform/linuxbsd/display_server_x11.cpp
index f016892453..e2f0a53f0f 100644
--- a/platform/linuxbsd/display_server_x11.cpp
+++ b/platform/linuxbsd/display_server_x11.cpp
@@ -204,7 +204,6 @@ void DisplayServerX11::_update_real_mouse_position(const WindowData &wd) {
if (xquerypointer_result) {
if (win_x > 0 && win_y > 0 && win_x <= wd.size.width && win_y <= wd.size.height) {
-
last_mouse_pos.x = win_x;
last_mouse_pos.y = win_y;
last_mouse_pos_valid = true;
@@ -354,7 +353,6 @@ void DisplayServerX11::_flush_mouse_motion() {
}
void DisplayServerX11::mouse_set_mode(MouseMode p_mode) {
-
_THREAD_SAFE_METHOD_
if (p_mode == mouse_mode)
@@ -367,7 +365,6 @@ void DisplayServerX11::mouse_set_mode(MouseMode p_mode) {
bool showCursor = (p_mode == MOUSE_MODE_VISIBLE || p_mode == MOUSE_MODE_CONFINED);
for (Map<WindowID, WindowData>::Element *E = windows.front(); E; E = E->next()) {
-
if (showCursor) {
XDefineCursor(x11_display, E->get().x11_window, cursors[current_cursor]); // show cursor
} else {
@@ -377,7 +374,6 @@ void DisplayServerX11::mouse_set_mode(MouseMode p_mode) {
mouse_mode = p_mode;
if (mouse_mode == MOUSE_MODE_CAPTURED || mouse_mode == MOUSE_MODE_CONFINED) {
-
//flush pending motion events
_flush_mouse_motion();
WindowData &main_window = windows[MAIN_WINDOW_ID];
@@ -409,14 +405,11 @@ DisplayServerX11::MouseMode DisplayServerX11::mouse_get_mode() const {
}
void DisplayServerX11::mouse_warp_to_position(const Point2i &p_to) {
-
_THREAD_SAFE_METHOD_
if (mouse_mode == MOUSE_MODE_CAPTURED) {
-
last_mouse_pos = p_to;
} else {
-
/*XWindowAttributes xwa;
XGetWindowAttributes(x11_display, x11_window, &xwa);
printf("%d %d\n", xwa.x, xwa.y); needed? */
@@ -451,7 +444,6 @@ int DisplayServerX11::mouse_get_button_state() const {
}
void DisplayServerX11::clipboard_set(const String &p_text) {
-
_THREAD_SAFE_METHOD_
internal_clipboard = p_text;
@@ -460,7 +452,6 @@ void DisplayServerX11::clipboard_set(const String &p_text) {
}
static String _clipboard_get_impl(Atom p_source, Window x11_window, ::Display *x11_display, String p_internal_clipboard, Atom target) {
-
String ret;
Atom type;
@@ -471,7 +462,6 @@ static String _clipboard_get_impl(Atom p_source, Window x11_window, ::Display *x
Window Sown = XGetSelectionOwner(x11_display, p_source);
if (Sown == x11_window) {
-
return p_internal_clipboard;
};
@@ -531,7 +521,6 @@ static String _clipboard_get(Atom p_source, Window x11_window, ::Display *x11_di
}
String DisplayServerX11::clipboard_get() const {
-
_THREAD_SAFE_METHOD_
String ret;
@@ -545,7 +534,6 @@ String DisplayServerX11::clipboard_get() const {
}
int DisplayServerX11::get_screen_count() const {
-
_THREAD_SAFE_METHOD_
// Using Xinerama Extension
@@ -560,7 +548,6 @@ int DisplayServerX11::get_screen_count() const {
return count;
}
Point2i DisplayServerX11::screen_get_position(int p_screen) const {
-
_THREAD_SAFE_METHOD_
if (p_screen == SCREEN_OF_MAIN_WINDOW) {
@@ -615,7 +602,6 @@ Rect2i DisplayServerX11::screen_get_usable_rect(int p_screen) const {
}
int DisplayServerX11::screen_get_dpi(int p_screen) const {
-
_THREAD_SAFE_METHOD_
if (p_screen == SCREEN_OF_MAIN_WINDOW) {
@@ -659,7 +645,6 @@ int DisplayServerX11::screen_get_dpi(int p_screen) const {
return 96;
}
bool DisplayServerX11::screen_is_touchscreen(int p_screen) const {
-
_THREAD_SAFE_METHOD_
#ifndef _MSC_VER
@@ -680,7 +665,6 @@ Vector<DisplayServer::WindowID> DisplayServerX11::get_window_list() const {
}
DisplayServer::WindowID DisplayServerX11::create_sub_window(WindowMode p_mode, uint32_t p_flags, const Rect2i &p_rect) {
-
_THREAD_SAFE_METHOD_
WindowID id = _create_window(p_mode, p_flags, p_rect);
@@ -694,7 +678,6 @@ DisplayServer::WindowID DisplayServerX11::create_sub_window(WindowMode p_mode, u
}
void DisplayServerX11::delete_sub_window(WindowID p_id) {
-
_THREAD_SAFE_METHOD_
ERR_FAIL_COND(!windows.has(p_id));
@@ -725,7 +708,6 @@ void DisplayServerX11::delete_sub_window(WindowID p_id) {
}
void DisplayServerX11::window_attach_instance_id(ObjectID p_instance, WindowID p_window) {
-
ERR_FAIL_COND(!windows.has(p_window));
WindowData &wd = windows[p_window];
@@ -733,19 +715,16 @@ void DisplayServerX11::window_attach_instance_id(ObjectID p_instance, WindowID p
}
ObjectID DisplayServerX11::window_get_attached_instance_id(WindowID p_window) const {
-
ERR_FAIL_COND_V(!windows.has(p_window), ObjectID());
const WindowData &wd = windows[p_window];
return wd.instance_id;
}
DisplayServerX11::WindowID DisplayServerX11::get_window_at_screen_position(const Point2i &p_position) const {
-
return INVALID_WINDOW_ID;
}
void DisplayServerX11::window_set_title(const String &p_title, WindowID p_window) {
-
_THREAD_SAFE_METHOD_
ERR_FAIL_COND(!windows.has(p_window));
@@ -759,7 +738,6 @@ void DisplayServerX11::window_set_title(const String &p_title, WindowID p_window
}
void DisplayServerX11::window_set_rect_changed_callback(const Callable &p_callable, WindowID p_window) {
-
_THREAD_SAFE_METHOD_
ERR_FAIL_COND(!windows.has(p_window));
@@ -768,7 +746,6 @@ void DisplayServerX11::window_set_rect_changed_callback(const Callable &p_callab
}
void DisplayServerX11::window_set_window_event_callback(const Callable &p_callable, WindowID p_window) {
-
_THREAD_SAFE_METHOD_
ERR_FAIL_COND(!windows.has(p_window));
@@ -777,7 +754,6 @@ void DisplayServerX11::window_set_window_event_callback(const Callable &p_callab
}
void DisplayServerX11::window_set_input_event_callback(const Callable &p_callable, WindowID p_window) {
-
_THREAD_SAFE_METHOD_
ERR_FAIL_COND(!windows.has(p_window));
@@ -785,7 +761,6 @@ void DisplayServerX11::window_set_input_event_callback(const Callable &p_callabl
wd.input_event_callback = p_callable;
}
void DisplayServerX11::window_set_input_text_callback(const Callable &p_callable, WindowID p_window) {
-
_THREAD_SAFE_METHOD_
ERR_FAIL_COND(!windows.has(p_window));
@@ -794,7 +769,6 @@ void DisplayServerX11::window_set_input_text_callback(const Callable &p_callable
}
void DisplayServerX11::window_set_drop_files_callback(const Callable &p_callable, WindowID p_window) {
-
_THREAD_SAFE_METHOD_
ERR_FAIL_COND(!windows.has(p_window));
@@ -803,7 +777,6 @@ void DisplayServerX11::window_set_drop_files_callback(const Callable &p_callable
}
int DisplayServerX11::window_get_current_screen(WindowID p_window) const {
-
_THREAD_SAFE_METHOD_
ERR_FAIL_COND_V(!windows.has(p_window), -1);
@@ -823,7 +796,6 @@ int DisplayServerX11::window_get_current_screen(WindowID p_window) const {
return 0;
}
void DisplayServerX11::window_set_current_screen(int p_screen, WindowID p_window) {
-
_THREAD_SAFE_METHOD_
ERR_FAIL_COND(!windows.has(p_window));
@@ -847,7 +819,6 @@ void DisplayServerX11::window_set_current_screen(int p_screen, WindowID p_window
}
void DisplayServerX11::window_set_transient(WindowID p_window, WindowID p_parent) {
-
_THREAD_SAFE_METHOD_
ERR_FAIL_COND(p_window == p_parent);
@@ -883,7 +854,6 @@ void DisplayServerX11::window_set_transient(WindowID p_window, WindowID p_parent
}
Point2i DisplayServerX11::window_get_position(WindowID p_window) const {
-
_THREAD_SAFE_METHOD_
ERR_FAIL_COND_V(!windows.has(p_window), Point2i());
@@ -893,7 +863,6 @@ Point2i DisplayServerX11::window_get_position(WindowID p_window) const {
}
void DisplayServerX11::window_set_position(const Point2i &p_position, WindowID p_window) {
-
_THREAD_SAFE_METHOD_
ERR_FAIL_COND(!windows.has(p_window));
@@ -926,7 +895,6 @@ void DisplayServerX11::window_set_position(const Point2i &p_position, WindowID p
}
void DisplayServerX11::window_set_max_size(const Size2i p_size, WindowID p_window) {
-
_THREAD_SAFE_METHOD_
ERR_FAIL_COND(!windows.has(p_window));
@@ -959,7 +927,6 @@ void DisplayServerX11::window_set_max_size(const Size2i p_size, WindowID p_windo
}
}
Size2i DisplayServerX11::window_get_max_size(WindowID p_window) const {
-
_THREAD_SAFE_METHOD_
ERR_FAIL_COND_V(!windows.has(p_window), Size2i());
@@ -969,7 +936,6 @@ Size2i DisplayServerX11::window_get_max_size(WindowID p_window) const {
}
void DisplayServerX11::window_set_min_size(const Size2i p_size, WindowID p_window) {
-
_THREAD_SAFE_METHOD_
ERR_FAIL_COND(!windows.has(p_window));
@@ -1002,7 +968,6 @@ void DisplayServerX11::window_set_min_size(const Size2i p_size, WindowID p_windo
}
}
Size2i DisplayServerX11::window_get_min_size(WindowID p_window) const {
-
_THREAD_SAFE_METHOD_
ERR_FAIL_COND_V(!windows.has(p_window), Size2i());
@@ -1012,7 +977,6 @@ Size2i DisplayServerX11::window_get_min_size(WindowID p_window) const {
}
void DisplayServerX11::window_set_size(const Size2i p_size, WindowID p_window) {
-
_THREAD_SAFE_METHOD_
ERR_FAIL_COND(!windows.has(p_window));
@@ -1074,7 +1038,6 @@ void DisplayServerX11::window_set_size(const Size2i p_size, WindowID p_window) {
}
}
Size2i DisplayServerX11::window_get_size(WindowID p_window) const {
-
_THREAD_SAFE_METHOD_
ERR_FAIL_COND_V(!windows.has(p_window), Size2i());
@@ -1082,7 +1045,6 @@ Size2i DisplayServerX11::window_get_size(WindowID p_window) const {
return wd.size;
}
Size2i DisplayServerX11::window_get_real_size(WindowID p_window) const {
-
_THREAD_SAFE_METHOD_
ERR_FAIL_COND_V(!windows.has(p_window), Size2i());
@@ -1113,7 +1075,6 @@ Size2i DisplayServerX11::window_get_real_size(WindowID p_window) const {
}
bool DisplayServerX11::window_is_maximize_allowed(WindowID p_window) const {
-
_THREAD_SAFE_METHOD_
ERR_FAIL_COND_V(!windows.has(p_window), false);
@@ -1163,7 +1124,6 @@ bool DisplayServerX11::window_is_maximize_allowed(WindowID p_window) const {
}
void DisplayServerX11::_set_wm_maximized(WindowID p_window, bool p_enabled) {
-
ERR_FAIL_COND(!windows.has(p_window));
WindowData &wd = windows[p_window];
@@ -1195,7 +1155,6 @@ void DisplayServerX11::_set_wm_maximized(WindowID p_window, bool p_enabled) {
}
void DisplayServerX11::_set_wm_fullscreen(WindowID p_window, bool p_enabled) {
-
ERR_FAIL_COND(!windows.has(p_window));
WindowData &wd = windows[p_window];
@@ -1280,7 +1239,6 @@ void DisplayServerX11::_set_wm_fullscreen(WindowID p_window, bool p_enabled) {
}
void DisplayServerX11::window_set_mode(WindowMode p_mode, WindowID p_window) {
-
_THREAD_SAFE_METHOD_
ERR_FAIL_COND(!windows.has(p_window));
@@ -1341,7 +1299,6 @@ void DisplayServerX11::window_set_mode(WindowMode p_mode, WindowID p_window) {
} break;
case WINDOW_MODE_MAXIMIZED: {
-
_set_wm_maximized(p_window, false);
} break;
}
@@ -1386,7 +1343,6 @@ void DisplayServerX11::window_set_mode(WindowMode p_mode, WindowID p_window) {
wd.fullscreen = true;
} break;
case WINDOW_MODE_MAXIMIZED: {
-
_set_wm_maximized(p_window, true);
} break;
@@ -1394,7 +1350,6 @@ void DisplayServerX11::window_set_mode(WindowMode p_mode, WindowID p_window) {
}
DisplayServer::WindowMode DisplayServerX11::window_get_mode(WindowID p_window) const {
-
_THREAD_SAFE_METHOD_
ERR_FAIL_COND_V(!windows.has(p_window), WINDOW_MODE_WINDOWED);
@@ -1493,7 +1448,6 @@ DisplayServer::WindowMode DisplayServerX11::window_get_mode(WindowID p_window) c
}
void DisplayServerX11::window_set_flag(WindowFlags p_flag, bool p_enabled, WindowID p_window) {
-
_THREAD_SAFE_METHOD_
ERR_FAIL_COND(!windows.has(p_window));
@@ -1534,7 +1488,6 @@ void DisplayServerX11::window_set_flag(WindowFlags p_flag, bool p_enabled, Windo
} break;
case WINDOW_FLAG_BORDERLESS: {
-
Hints hints;
Atom property;
hints.flags = 2;
@@ -1548,7 +1501,6 @@ void DisplayServerX11::window_set_flag(WindowFlags p_flag, bool p_enabled, Windo
wd.borderless = p_enabled;
} break;
case WINDOW_FLAG_ALWAYS_ON_TOP: {
-
ERR_FAIL_COND_MSG(wd.transient_parent != INVALID_WINDOW_ID, "Can't make a window transient if the 'on top' flag is active.");
if (p_enabled && wd.fullscreen) {
_set_wm_maximized(p_window, true);
@@ -1582,7 +1534,6 @@ void DisplayServerX11::window_set_flag(WindowFlags p_flag, bool p_enabled, Windo
}
}
bool DisplayServerX11::window_get_flag(WindowFlags p_flag, WindowID p_window) const {
-
_THREAD_SAFE_METHOD_
ERR_FAIL_COND_V(!windows.has(p_window), false);
@@ -1590,15 +1541,12 @@ bool DisplayServerX11::window_get_flag(WindowFlags p_flag, WindowID p_window) co
switch (p_flag) {
case WINDOW_FLAG_RESIZE_DISABLED: {
-
return wd.resize_disabled;
} break;
case WINDOW_FLAG_BORDERLESS: {
-
bool borderless = wd.borderless;
Atom prop = XInternAtom(x11_display, "_MOTIF_WM_HINTS", True);
if (prop != None) {
-
Atom type;
int format;
unsigned long len;
@@ -1616,7 +1564,6 @@ bool DisplayServerX11::window_get_flag(WindowFlags p_flag, WindowID p_window) co
return borderless;
} break;
case WINDOW_FLAG_ALWAYS_ON_TOP: {
-
return wd.on_top;
} break;
case WINDOW_FLAG_TRANSPARENT: {
@@ -1630,7 +1577,6 @@ bool DisplayServerX11::window_get_flag(WindowFlags p_flag, WindowID p_window) co
}
void DisplayServerX11::window_request_attention(WindowID p_window) {
-
_THREAD_SAFE_METHOD_
ERR_FAIL_COND(!windows.has(p_window));
@@ -1657,7 +1603,6 @@ void DisplayServerX11::window_request_attention(WindowID p_window) {
}
void DisplayServerX11::window_move_to_foreground(WindowID p_window) {
-
_THREAD_SAFE_METHOD_
ERR_FAIL_COND(!windows.has(p_window));
@@ -1679,12 +1624,10 @@ void DisplayServerX11::window_move_to_foreground(WindowID p_window) {
}
bool DisplayServerX11::window_can_draw(WindowID p_window) const {
-
//this seems to be all that is provided by X11
return window_get_mode(p_window) != WINDOW_MODE_MINIMIZED;
}
bool DisplayServerX11::can_any_window_draw() const {
-
_THREAD_SAFE_METHOD_
for (Map<WindowID, WindowData>::Element *E = windows.front(); E; E = E->next()) {
@@ -1697,7 +1640,6 @@ bool DisplayServerX11::can_any_window_draw() const {
}
void DisplayServerX11::window_set_ime_active(const bool p_active, WindowID p_window) {
-
_THREAD_SAFE_METHOD_
ERR_FAIL_COND(!windows.has(p_window));
@@ -1716,7 +1658,6 @@ void DisplayServerX11::window_set_ime_active(const bool p_active, WindowID p_win
}
}
void DisplayServerX11::window_set_ime_position(const Point2i &p_pos, WindowID p_window) {
-
_THREAD_SAFE_METHOD_
ERR_FAIL_COND(!windows.has(p_window));
@@ -1736,7 +1677,6 @@ void DisplayServerX11::window_set_ime_position(const Point2i &p_pos, WindowID p_
}
void DisplayServerX11::cursor_set_shape(CursorShape p_shape) {
-
_THREAD_SAFE_METHOD_
ERR_FAIL_INDEX(p_shape, CURSOR_MAX);
@@ -1763,11 +1703,9 @@ DisplayServerX11::CursorShape DisplayServerX11::cursor_get_shape() const {
return current_cursor;
}
void DisplayServerX11::cursor_set_custom_image(const RES &p_cursor, CursorShape p_shape, const Vector2 &p_hotspot) {
-
_THREAD_SAFE_METHOD_
if (p_cursor.is_valid()) {
-
Map<CursorShape, Vector<Variant>>::Element *cursor_c = cursors_cache.find(p_shape);
if (cursor_c) {
@@ -1906,7 +1844,6 @@ DisplayServerX11::LatinKeyboardVariant DisplayServerX11::get_latin_keyboard_vari
}
DisplayServerX11::Property DisplayServerX11::_read_property(Display *p_display, Window p_window, Atom p_property) {
-
Atom actual_type;
int actual_format;
unsigned long nitems;
@@ -1935,11 +1872,9 @@ DisplayServerX11::Property DisplayServerX11::_read_property(Display *p_display,
}
static Atom pick_target_from_list(Display *p_display, Atom *p_list, int p_count) {
-
static const char *target_type = "text/uri-list";
for (int i = 0; i < p_count; i++) {
-
Atom atom = p_list[i];
if (atom != None && String(XGetAtomName(p_display, atom)) == target_type)
@@ -1949,7 +1884,6 @@ static Atom pick_target_from_list(Display *p_display, Atom *p_list, int p_count)
}
static Atom pick_target_from_atoms(Display *p_disp, Atom p_t1, Atom p_t2, Atom p_t3) {
-
static const char *target_type = "text/uri-list";
if (p_t1 != None && String(XGetAtomName(p_disp, p_t1)) == target_type)
return p_t1;
@@ -1964,7 +1898,6 @@ static Atom pick_target_from_atoms(Display *p_disp, Atom p_t1, Atom p_t2, Atom p
}
void DisplayServerX11::_get_key_modifier_state(unsigned int p_x11_state, Ref<InputEventWithModifiers> state) {
-
state->set_shift((p_x11_state & ShiftMask));
state->set_control((p_x11_state & ControlMask));
state->set_alt((p_x11_state & Mod1Mask /*|| p_x11_state&Mod5Mask*/)); //altgr should not count as alt
@@ -1972,7 +1905,6 @@ void DisplayServerX11::_get_key_modifier_state(unsigned int p_x11_state, Ref<Inp
}
unsigned int DisplayServerX11::_get_mouse_button_state(unsigned int p_x11_button, int p_x11_type) {
-
unsigned int mask = 1 << (p_x11_button - 1);
if (p_x11_type == ButtonPress) {
@@ -1985,7 +1917,6 @@ unsigned int DisplayServerX11::_get_mouse_button_state(unsigned int p_x11_button
}
void DisplayServerX11::_handle_key_event(WindowID p_window, XKeyEvent *p_event, bool p_echo) {
-
WindowData wd = windows[p_window];
// X11 functions don't know what const is
XKeyEvent *xkeyevent = p_event;
@@ -2029,7 +1960,6 @@ void DisplayServerX11::_handle_key_event(WindowID p_window, XKeyEvent *p_event,
}
if (xkeyevent->type == KeyPress && wd.xic) {
-
Status status;
#ifdef X_HAVE_UTF8_STRING
int utf8len = 8;
@@ -2093,7 +2023,6 @@ void DisplayServerX11::_handle_key_event(WindowID p_window, XKeyEvent *p_event,
memfree(utf8string);
#else
do {
-
int mnbytes = XmbLookupString(xic, xkeyevent, xmbstring, xmblen - 1, &keysym_unicode, &status);
xmbstring[mnbytes] = '\0';
@@ -2161,7 +2090,6 @@ void DisplayServerX11::_handle_key_event(WindowID p_window, XKeyEvent *p_event,
// difference in time is below a threshold.
if (xkeyevent->type != KeyPress) {
-
p_echo = false;
// make sure there are events pending,
@@ -2240,7 +2168,6 @@ void DisplayServerX11::_handle_key_event(WindowID p_window, XKeyEvent *p_event,
void DisplayServerX11::_xim_destroy_callback(::XIM im, ::XPointer client_data,
::XPointer call_data) {
-
WARN_PRINT("Input method stopped");
DisplayServerX11 *ds = reinterpret_cast<DisplayServerX11 *>(client_data);
ds->xim = nullptr;
@@ -2251,7 +2178,6 @@ void DisplayServerX11::_xim_destroy_callback(::XIM im, ::XPointer client_data,
}
void DisplayServerX11::_window_changed(XEvent *event) {
-
WindowID window_id = MAIN_WINDOW_ID;
// Assign the event to the relevant window
@@ -2316,7 +2242,6 @@ void DisplayServerX11::_dispatch_input_events(const Ref<InputEvent> &p_event) {
}
void DisplayServerX11::_dispatch_input_event(const Ref<InputEvent> &p_event) {
-
Variant ev = p_event;
Variant *evp = &ev;
Variant ret;
@@ -2353,7 +2278,6 @@ void DisplayServerX11::_send_window_event(const WindowData &wd, WindowEvent p_ev
}
}
void DisplayServerX11::process_events() {
-
_THREAD_SAFE_METHOD_
do_mouse_warp = false;
@@ -2384,9 +2308,7 @@ void DisplayServerX11::process_events() {
}
if (XGetEventData(x11_display, &event.xcookie)) {
-
if (event.xcookie.type == GenericEvent && event.xcookie.extension == xi.opcode) {
-
XIDeviceEvent *event_data = (XIDeviceEvent *)event.xcookie.data;
int index = event_data->detail;
Vector2 pos = Vector2(event_data->event_x, event_data->event_y);
@@ -2493,7 +2415,6 @@ void DisplayServerX11::process_events() {
//XIAllowTouchEvents(x11_display, event_data->deviceid, event_data->detail, x11_window, XIAcceptTouch);
case XI_TouchEnd: {
-
bool is_begin = event_data->evtype == XI_TouchBegin;
Ref<InputEventScreenTouch> st;
@@ -2522,14 +2443,12 @@ void DisplayServerX11::process_events() {
} break;
case XI_TouchUpdate: {
-
Map<int, Vector2>::Element *curr_pos_elem = xi.state.find(index);
if (!curr_pos_elem) { // Defensive
break;
}
if (curr_pos_elem->value() != pos) {
-
Ref<InputEventScreenDrag> sd;
sd.instance();
sd->set_window_id(window_id);
@@ -2581,7 +2500,6 @@ void DisplayServerX11::process_events() {
// Show and update the cursor if confined and the window regained focus.
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
@@ -2612,7 +2530,6 @@ void DisplayServerX11::process_events() {
if (mouse_mode_grab) {
for (Map<WindowID, WindowData>::Element *E = windows.front(); E; E = E->next()) {
-
//dear X11, I try, I really try, but you never work, you do whathever you want.
if (mouse_mode == MOUSE_MODE_CAPTURED) {
// Show the cursor if we're in captured mode so it doesn't look weird.
@@ -2629,7 +2546,6 @@ 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->set_index(E->key());
@@ -2649,7 +2565,6 @@ void DisplayServerX11::process_events() {
break;
case ButtonPress:
case ButtonRelease: {
-
/* exit in case of a mouse button press */
last_timestamp = event.xbutton.time;
if (mouse_mode == MOUSE_MODE_CAPTURED) {
@@ -2674,13 +2589,10 @@ void DisplayServerX11::process_events() {
mb->set_pressed((event.type == ButtonPress));
if (event.type == ButtonPress) {
-
uint64_t diff = OS::get_singleton()->get_ticks_usec() / 1000 - last_click_ms;
if (mb->get_button_index() == last_click_button_index) {
-
if (diff < 400 && Vector2(last_click_pos).distance_to(Vector2(event.xbutton.x, event.xbutton.y)) < 5) {
-
last_click_ms = 0;
last_click_pos = Point2i(-100, -100);
last_click_button_index = -1;
@@ -2701,7 +2613,6 @@ void DisplayServerX11::process_events() {
} break;
case MotionNotify: {
-
// The X11 API requires filtering one-by-one through the motion
// notify events, in order to figure out which event is the one
// generated by warping the mouse pointer.
@@ -2757,7 +2668,6 @@ void DisplayServerX11::process_events() {
}
if (!last_mouse_pos_valid) {
-
last_mouse_pos = pos;
last_mouse_pos_valid = true;
}
@@ -2820,7 +2730,6 @@ void DisplayServerX11::process_events() {
} break;
case KeyPress:
case KeyRelease: {
-
last_timestamp = event.xkey.time;
// key event is a little complex, so
@@ -2828,7 +2737,6 @@ void DisplayServerX11::process_events() {
_handle_key_event(window_id, (XKeyEvent *)&event);
} break;
case SelectionRequest: {
-
XSelectionRequestEvent *req;
XEvent e, respond;
e = event;
@@ -2851,7 +2759,6 @@ void DisplayServerX11::process_events() {
clip.length());
respond.xselection.property = req->property;
} else if (req->target == XInternAtom(x11_display, "TARGETS", 0)) {
-
Atom data[7];
data[0] = XInternAtom(x11_display, "TARGETS", 0);
data[1] = XInternAtom(x11_display, "UTF8_STRING", 0);
@@ -2892,7 +2799,6 @@ void DisplayServerX11::process_events() {
case SelectionNotify:
if (event.xselection.target == requested) {
-
Property p = _read_property(x11_display, windows[window_id].x11_window, XInternAtom(x11_display, "PRIMARY", 0));
Vector<String> files = String((char *)p.data).split("\n", false);
@@ -2931,7 +2837,6 @@ void DisplayServerX11::process_events() {
}
else if ((unsigned int)event.xclient.message_type == (unsigned int)xdnd_enter) {
-
//File(s) have been dragged over the window, check for supported target (text/uri-list)
xdnd_version = (event.xclient.data.l[1] >> 24);
Window source = event.xclient.data.l[0];
@@ -2942,7 +2847,6 @@ void DisplayServerX11::process_events() {
} else
requested = pick_target_from_atoms(x11_display, event.xclient.data.l[2], event.xclient.data.l[3], event.xclient.data.l[4]);
} else if ((unsigned int)event.xclient.message_type == (unsigned int)xdnd_position) {
-
//xdnd position event, reply with an XDND status message
//just depending on type of data for now
XClientMessageEvent m;
@@ -2961,7 +2865,6 @@ void DisplayServerX11::process_events() {
XSendEvent(x11_display, event.xclient.data.l[0], False, NoEventMask, (XEvent *)&m);
XFlush(x11_display);
} else if ((unsigned int)event.xclient.message_type == (unsigned int)xdnd_drop) {
-
if (requested != None) {
xdnd_source_window = event.xclient.data.l[0];
if (xdnd_version >= 1)
@@ -2992,7 +2895,6 @@ void DisplayServerX11::process_events() {
XFlush(x11_display);
if (do_mouse_warp) {
-
XWarpPointer(x11_display, None, windows[MAIN_WINDOW_ID].x11_window,
0, 0, 0, 0, (int)windows[MAIN_WINDOW_ID].size.width / 2, (int)windows[MAIN_WINDOW_ID].size.height / 2);
@@ -3024,7 +2926,6 @@ void DisplayServerX11::_update_context(WindowData &wd) {
XClassHint *classHint = XAllocClassHint();
if (classHint) {
-
CharString name_str;
switch (context) {
case CONTEXT_EDITOR:
@@ -3058,7 +2959,6 @@ void DisplayServerX11::_update_context(WindowData &wd) {
}
}
void DisplayServerX11::set_context(Context p_context) {
-
_THREAD_SAFE_METHOD_
context = p_context;
@@ -3167,12 +3067,10 @@ Vector<String> DisplayServerX11::get_rendering_drivers_func() {
}
DisplayServer *DisplayServerX11::create_func(const String &p_rendering_driver, WindowMode p_mode, uint32_t p_flags, const Vector2i &p_resolution, Error &r_error) {
-
return memnew(DisplayServerX11(p_rendering_driver, p_mode, p_flags, p_resolution, r_error));
}
DisplayServerX11::WindowID DisplayServerX11::_create_window(WindowMode p_mode, uint32_t p_flags, const Rect2i &p_rect) {
-
//Create window
long visualMask = VisualScreenMask;
@@ -3254,7 +3152,6 @@ DisplayServerX11::WindowID DisplayServerX11::_create_window(WindowMode p_mode, u
XChangeProperty(x11_display, wd.x11_window, xdnd_aware, XA_ATOM, 32, PropModeReplace, (unsigned char *)&xdnd_version, 1);
if (xim && xim_style) {
-
wd.xic = XCreateIC(xim, XNInputStyle, xim_style, XNClientWindow, wd.x11_window, XNFocusWindow, wd.x11_window, (char *)nullptr);
if (XGetICValues(wd.xic, XNFilterEvents, &im_event_mask, nullptr) != nullptr) {
WARN_PRINT("XGetICValues couldn't obtain XNFilterEvents value");
@@ -3267,7 +3164,6 @@ DisplayServerX11::WindowID DisplayServerX11::_create_window(WindowMode p_mode, u
WARN_PRINT("XCreateIC couldn't create wd.xic");
}
} else {
-
wd.xic = nullptr;
WARN_PRINT("XCreateIC couldn't create wd.xic");
}
@@ -3279,9 +3175,7 @@ DisplayServerX11::WindowID DisplayServerX11::_create_window(WindowMode p_mode, u
windows[id] = wd;
{
-
if (p_flags & WINDOW_FLAG_RESIZE_DISABLED_BIT) {
-
XSizeHints *xsh;
xsh = XAllocSizeHints();
@@ -3345,7 +3239,6 @@ DisplayServerX11::WindowID DisplayServerX11::_create_window(WindowMode p_mode, u
}
if (id != MAIN_WINDOW_ID) {
-
XSizeHints my_hints = XSizeHints();
my_hints.flags = PPosition | PSize; /* I want to specify position and size */
@@ -3395,14 +3288,12 @@ DisplayServerX11::WindowID DisplayServerX11::_create_window(WindowMode p_mode, u
//set cursor
if (cursors[current_cursor] != None) {
-
XDefineCursor(x11_display, wd.x11_window, cursors[current_cursor]);
}
return id;
}
DisplayServerX11::DisplayServerX11(const String &p_rendering_driver, WindowMode p_mode, uint32_t p_flags, const Vector2i &p_resolution, Error &r_error) {
-
Input::get_singleton()->set_event_dispatch_function(_dispatch_input_events);
r_error = OK;
@@ -3411,7 +3302,6 @@ DisplayServerX11::DisplayServerX11(const String &p_rendering_driver, WindowMode
mouse_mode = MOUSE_MODE_VISIBLE;
for (int i = 0; i < CURSOR_MAX; i++) {
-
cursors[i] = None;
img[i] = nullptr;
}
@@ -3446,7 +3336,6 @@ DisplayServerX11::DisplayServerX11(const String &p_rendering_driver, WindowMode
// Try to support IME if detectable auto-repeat is supported
if (xkb_dar == True) {
-
#ifdef X_HAVE_UTF8_STRING
// Xutf8LookupString will be used later instead of XmbLookupString before
// the multibyte sequences can be converted to unicode string.
@@ -3523,10 +3412,8 @@ DisplayServerX11::DisplayServerX11(const String &p_rendering_driver, WindowMode
if (xim_styles) {
xim_style = 0L;
for (int i = 0; i < xim_styles->count_styles; i++) {
-
if (xim_styles->supported_styles[i] ==
(XIMPreeditNothing | XIMStatusNothing)) {
-
xim_style = xim_styles->supported_styles[i];
break;
}
@@ -3561,7 +3448,6 @@ DisplayServerX11::DisplayServerX11(const String &p_rendering_driver, WindowMode
#if defined(VULKAN_ENABLED)
if (rendering_driver == "vulkan") {
-
context_vulkan = memnew(VulkanContextX11);
if (context_vulkan->initialize() != OK) {
memdelete(context_vulkan);
@@ -3583,7 +3469,6 @@ DisplayServerX11::DisplayServerX11(const String &p_rendering_driver, WindowMode
getenv("PRIMUS_libGL") ||
getenv("PRIMUS_LOAD_GLOBAL") ||
getenv("BUMBLEBEE_SOCKET")) {
-
print_verbose("Optirun/primusrun detected. Skipping GPU detection");
use_prime = 0;
}
@@ -3595,7 +3480,6 @@ DisplayServerX11::DisplayServerX11(const String &p_rendering_driver, WindowMode
for (int i = 0; i < libraries.size(); ++i) {
if (FileAccess::exists(libraries[i] + "/libGL.so.1") ||
FileAccess::exists(libraries[i] + "/libGL.so")) {
-
print_verbose("Custom libGL override detected. Skipping GPU detection");
use_prime = 0;
}
@@ -3649,7 +3533,6 @@ DisplayServerX11::DisplayServerX11(const String &p_rendering_driver, WindowMode
//create RenderingDevice if used
#if defined(VULKAN_ENABLED)
if (rendering_driver == "vulkan") {
-
//temporary
rendering_device_vulkan = memnew(RenderingDeviceVulkan);
rendering_device_vulkan->initialize(context_vulkan);
@@ -3695,7 +3578,6 @@ DisplayServerX11::DisplayServerX11(const String &p_rendering_driver, WindowMode
}
for (int i = 0; i < CURSOR_MAX; i++) {
-
static const char *cursor_file[] = {
"left_ptr",
"xterm",
@@ -3831,7 +3713,6 @@ DisplayServerX11::DisplayServerX11(const String &p_rendering_driver, WindowMode
r_error = OK;
}
DisplayServerX11::~DisplayServerX11() {
-
//destroy all windows
for (Map<WindowID, WindowData>::Element *E = windows.front(); E; E = E->next()) {
#ifdef VULKAN_ENABLED
@@ -3850,7 +3731,6 @@ DisplayServerX11::~DisplayServerX11() {
//destroy drivers
#if defined(VULKAN_ENABLED)
if (rendering_driver == "vulkan") {
-
if (rendering_device_vulkan) {
rendering_device_vulkan->finalize();
memdelete(rendering_device_vulkan);
@@ -3881,7 +3761,6 @@ DisplayServerX11::~DisplayServerX11() {
}
void DisplayServerX11::register_x11_driver() {
-
register_create_function("x11", create_func, get_rendering_drivers_func);
}
diff --git a/platform/linuxbsd/export/export.cpp b/platform/linuxbsd/export/export.cpp
index 53e3ce8f85..86ea95c563 100644
--- a/platform/linuxbsd/export/export.cpp
+++ b/platform/linuxbsd/export/export.cpp
@@ -38,7 +38,6 @@
static Error fixup_embedded_pck(const String &p_path, int64_t p_embedded_start, int64_t p_embedded_size);
void register_linuxbsd_exporter() {
-
Ref<EditorExportPlatformPC> platform;
platform.instance();
@@ -62,7 +61,6 @@ void register_linuxbsd_exporter() {
}
static Error fixup_embedded_pck(const String &p_path, int64_t p_embedded_start, int64_t p_embedded_size) {
-
// Patch the header of the "pck" section in the ELF file so that it corresponds to the embedded data
FileAccess *f = FileAccess::open(p_path, FileAccess::READ_WRITE);
@@ -139,7 +137,6 @@ static Error fixup_embedded_pck(const String &p_path, int64_t p_embedded_start,
bool found = false;
for (int i = 0; i < num_sections; ++i) {
-
int64_t section_header_pos = section_table_pos + i * section_header_size;
f->seek(section_header_pos);
diff --git a/platform/linuxbsd/godot_linuxbsd.cpp b/platform/linuxbsd/godot_linuxbsd.cpp
index 710ba3ca40..6a0c2a4a5d 100644
--- a/platform/linuxbsd/godot_linuxbsd.cpp
+++ b/platform/linuxbsd/godot_linuxbsd.cpp
@@ -37,7 +37,6 @@
#include "os_linuxbsd.h"
int main(int argc, char *argv[]) {
-
OS_LinuxBSD os;
setlocale(LC_CTYPE, "");
diff --git a/platform/linuxbsd/joypad_linux.cpp b/platform/linuxbsd/joypad_linux.cpp
index f57f74907f..e74371ca52 100644
--- a/platform/linuxbsd/joypad_linux.cpp
+++ b/platform/linuxbsd/joypad_linux.cpp
@@ -59,7 +59,6 @@ JoypadLinux::Joypad::Joypad() {
}
JoypadLinux::Joypad::~Joypad() {
-
for (int i = 0; i < MAX_ABS; i++) {
if (abs_info[i]) {
memdelete(abs_info[i]);
@@ -94,7 +93,6 @@ JoypadLinux::~JoypadLinux() {
}
void JoypadLinux::joy_thread_func(void *p_user) {
-
if (p_user) {
JoypadLinux *joy = (JoypadLinux *)p_user;
joy->run_joypad_thread();
@@ -115,7 +113,6 @@ void JoypadLinux::run_joypad_thread() {
#ifdef UDEV_ENABLED
void JoypadLinux::enumerate_joypads(udev *p_udev) {
-
udev_enumerate *enumerate;
udev_list_entry *devices, *dev_list_entry;
udev_device *dev;
@@ -126,13 +123,11 @@ void JoypadLinux::enumerate_joypads(udev *p_udev) {
udev_enumerate_scan_devices(enumerate);
devices = udev_enumerate_get_list_entry(enumerate);
udev_list_entry_foreach(dev_list_entry, devices) {
-
const char *path = udev_list_entry_get_name(dev_list_entry);
dev = udev_device_new_from_syspath(p_udev, path);
const char *devnode = udev_device_get_devnode(dev);
if (devnode) {
-
String devnode_str = devnode;
if (devnode_str.find(ignore_str) == -1) {
MutexLock lock(joy_mutex);
@@ -145,7 +140,6 @@ void JoypadLinux::enumerate_joypads(udev *p_udev) {
}
void JoypadLinux::monitor_joypads(udev *p_udev) {
-
udev_device *dev = nullptr;
udev_monitor *mon = udev_monitor_new_from_netlink(p_udev, "udev");
udev_monitor_filter_add_match_subsystem_devtype(mon, "input", nullptr);
@@ -153,7 +147,6 @@ void JoypadLinux::monitor_joypads(udev *p_udev) {
int fd = udev_monitor_get_fd(mon);
while (!exit_udev) {
-
fd_set fds;
struct timeval tv;
int ret;
@@ -172,15 +165,12 @@ void JoypadLinux::monitor_joypads(udev *p_udev) {
dev = udev_monitor_receive_device(mon);
if (dev && udev_device_get_devnode(dev) != 0) {
-
MutexLock lock(joy_mutex);
String action = udev_device_get_action(dev);
const char *devnode = udev_device_get_devnode(dev);
if (devnode) {
-
String devnode_str = devnode;
if (devnode_str.find(ignore_str) == -1) {
-
if (action == "add")
open_joypad(devnode);
else if (String(action) == "remove")
@@ -198,7 +188,6 @@ void JoypadLinux::monitor_joypads(udev *p_udev) {
#endif
void JoypadLinux::monitor_joypads() {
-
while (!exit_udev) {
{
MutexLock lock(joy_mutex);
@@ -216,9 +205,7 @@ void JoypadLinux::monitor_joypads() {
}
int JoypadLinux::get_joy_from_path(String p_path) const {
-
for (int i = 0; i < JOYPADS_MAX; i++) {
-
if (joypads[i].devpath == p_path) {
return i;
}
@@ -229,7 +216,6 @@ int JoypadLinux::get_joy_from_path(String p_path) const {
void JoypadLinux::close_joypad(int p_id) {
if (p_id == -1) {
for (int i = 0; i < JOYPADS_MAX; i++) {
-
close_joypad(i);
};
return;
@@ -239,7 +225,6 @@ void JoypadLinux::close_joypad(int p_id) {
Joypad &joy = joypads[p_id];
if (joy.fd != -1) {
-
close(joy.fd);
joy.fd = -1;
attached_devices.remove(attached_devices.find(joy.devpath));
@@ -248,7 +233,6 @@ void JoypadLinux::close_joypad(int p_id) {
}
static String _hex_str(uint8_t p_byte) {
-
static const char *dict = "0123456789abcdef";
char ret[3];
ret[2] = 0;
@@ -260,7 +244,6 @@ static String _hex_str(uint8_t p_byte) {
}
void JoypadLinux::setup_joypad_properties(int p_id) {
-
Joypad *joy = &joypads[p_id];
unsigned long keybit[NBITS(KEY_MAX)] = { 0 };
@@ -274,16 +257,12 @@ void JoypadLinux::setup_joypad_properties(int p_id) {
return;
}
for (int i = BTN_JOYSTICK; i < KEY_MAX; ++i) {
-
if (test_bit(i, keybit)) {
-
joy->key_map[i] = num_buttons++;
}
}
for (int i = BTN_MISC; i < BTN_JOYSTICK; ++i) {
-
if (test_bit(i, keybit)) {
-
joy->key_map[i] = num_buttons++;
}
}
@@ -294,7 +273,6 @@ void JoypadLinux::setup_joypad_properties(int p_id) {
continue;
}
if (test_bit(i, absbit)) {
-
joy->abs_map[i] = num_axes++;
joy->abs_info[i] = memnew(input_absinfo);
if (ioctl(joy->fd, EVIOCGABS(i), joy->abs_info[i]) < 0) {
@@ -315,11 +293,9 @@ void JoypadLinux::setup_joypad_properties(int p_id) {
}
void JoypadLinux::open_joypad(const char *p_path) {
-
int joy_num = input->get_unused_joy_id();
int fd = open(p_path, O_RDWR | O_NONBLOCK);
if (fd != -1 && joy_num != -1) {
-
unsigned long evbit[NBITS(EV_MAX)] = { 0 };
unsigned long keybit[NBITS(KEY_MAX)] = { 0 };
unsigned long absbit[NBITS(ABS_MAX)] = { 0 };
@@ -369,7 +345,6 @@ void JoypadLinux::open_joypad(const char *p_path) {
setup_joypad_properties(joy_num);
sprintf(uid, "%04x%04x", BSWAP16(inpid.bustype), 0);
if (inpid.vendor && inpid.product && inpid.version) {
-
uint16_t vendor = BSWAP16(inpid.vendor);
uint16_t product = BSWAP16(inpid.product);
uint16_t version = BSWAP16(inpid.version);
@@ -380,7 +355,6 @@ void JoypadLinux::open_joypad(const char *p_path) {
String uidname = uid;
int uidlen = MIN(name.length(), 11);
for (int i = 0; i < uidlen; i++) {
-
uidname = uidname + _hex_str(name[i]);
}
uidname += "00";
@@ -437,7 +411,6 @@ void JoypadLinux::joypad_vibration_stop(int p_id, uint64_t p_timestamp) {
}
Input::JoyAxis JoypadLinux::axis_correct(const input_absinfo *p_abs, int p_value) const {
-
int min = p_abs->minimum;
int max = p_abs->maximum;
Input::JoyAxis jx;
@@ -457,12 +430,10 @@ Input::JoyAxis JoypadLinux::axis_correct(const input_absinfo *p_abs, int p_value
}
void JoypadLinux::process_joypads() {
-
if (joy_mutex.try_lock() != OK) {
return;
}
for (int i = 0; i < JOYPADS_MAX; i++) {
-
if (joypads[i].fd == -1)
continue;
@@ -474,7 +445,6 @@ void JoypadLinux::process_joypads() {
while ((len = read(joy->fd, events, (sizeof events))) > 0) {
len /= sizeof(events[0]);
for (int j = 0; j < len; j++) {
-
input_event &ev = events[j];
// ev may be tainted and out of MAX_KEY range, which will cause
diff --git a/platform/linuxbsd/key_mapping_x11.cpp b/platform/linuxbsd/key_mapping_x11.cpp
index 78bd2b71a0..daf7326024 100644
--- a/platform/linuxbsd/key_mapping_x11.cpp
+++ b/platform/linuxbsd/key_mapping_x11.cpp
@@ -33,7 +33,6 @@
/***** SCAN CODE CONVERSION ******/
struct _XTranslatePair {
-
KeySym keysym;
unsigned int keycode;
};
@@ -181,7 +180,6 @@ static _XTranslatePair _xkeysym_to_keycode[] = {
};
struct _TranslatePair {
-
unsigned int keysym;
unsigned int keycode;
};
@@ -301,10 +299,8 @@ static _TranslatePair _scancode_to_keycode[] = {
};
unsigned int KeyMappingX11::get_scancode(unsigned int p_code) {
-
unsigned int keycode = KEY_UNKNOWN;
for (int i = 0; _scancode_to_keycode[i].keysym != KEY_UNKNOWN; i++) {
-
if (_scancode_to_keycode[i].keycode == p_code) {
keycode = _scancode_to_keycode[i].keysym;
break;
@@ -315,7 +311,6 @@ unsigned int KeyMappingX11::get_scancode(unsigned int p_code) {
}
unsigned int KeyMappingX11::get_keycode(KeySym p_keysym) {
-
// kinda bruteforce.. could optimize.
if (p_keysym < 0x100) // Latin 1, maps 1-1
@@ -323,7 +318,6 @@ unsigned int KeyMappingX11::get_keycode(KeySym p_keysym) {
// look for special key
for (int idx = 0; _xkeysym_to_keycode[idx].keysym != 0; idx++) {
-
if (_xkeysym_to_keycode[idx].keysym == p_keysym)
return _xkeysym_to_keycode[idx].keycode;
}
@@ -332,7 +326,6 @@ unsigned int KeyMappingX11::get_keycode(KeySym p_keysym) {
}
KeySym KeyMappingX11::get_keysym(unsigned int p_code) {
-
// kinda bruteforce.. could optimize.
if (p_code < 0x100) // Latin 1, maps 1-1
@@ -340,7 +333,6 @@ KeySym KeyMappingX11::get_keysym(unsigned int p_code) {
// look for special key
for (int idx = 0; _xkeysym_to_keycode[idx].keysym != 0; idx++) {
-
if (_xkeysym_to_keycode[idx].keycode == p_code)
return _xkeysym_to_keycode[idx].keysym;
}
@@ -353,7 +345,6 @@ KeySym KeyMappingX11::get_keysym(unsigned int p_code) {
// Tables taken from FOX toolkit
struct _XTranslateUnicodePair {
-
KeySym keysym;
unsigned int unicode;
};
@@ -1125,7 +1116,6 @@ static _XTranslateUnicodePair _xkeysym_to_unicode[_KEYSYM_MAX] = {
};
unsigned int KeyMappingX11::get_unicode_from_keysym(KeySym p_keysym) {
-
/* Latin-1 */
if (p_keysym >= 0x20 && p_keysym <= 0x7e)
return p_keysym;
@@ -1155,7 +1145,6 @@ unsigned int KeyMappingX11::get_unicode_from_keysym(KeySym p_keysym) {
}
struct _XTranslateUnicodePairReverse {
-
unsigned int unicode;
KeySym keysym;
};
@@ -1919,7 +1908,6 @@ static _XTranslateUnicodePairReverse _unicode_to_xkeysym[_UNICODE_MAX] = {
};
KeySym KeyMappingX11::get_keysym_from_unicode(unsigned int p_unicode) {
-
/* Latin 1 */
if (p_unicode >= 0x20 && p_unicode <= 0x7e)
diff --git a/platform/linuxbsd/os_linuxbsd.cpp b/platform/linuxbsd/os_linuxbsd.cpp
index 7b76f7394b..7c7a27add0 100644
--- a/platform/linuxbsd/os_linuxbsd.cpp
+++ b/platform/linuxbsd/os_linuxbsd.cpp
@@ -55,21 +55,18 @@
#endif
void OS_LinuxBSD::initialize() {
-
crash_handler.initialize();
OS_Unix::initialize_core();
}
void OS_LinuxBSD::initialize_joypads() {
-
#ifdef JOYDEV_ENABLED
joypad = memnew(JoypadLinux(Input::get_singleton()));
#endif
}
String OS_LinuxBSD::get_unique_id() const {
-
static String machine_id;
if (machine_id.empty()) {
if (FileAccess *f = FileAccess::open("/etc/machine-id", FileAccess::READ)) {
@@ -84,7 +81,6 @@ String OS_LinuxBSD::get_unique_id() const {
}
void OS_LinuxBSD::finalize() {
-
if (main_loop)
memdelete(main_loop);
main_loop = nullptr;
@@ -99,24 +95,20 @@ void OS_LinuxBSD::finalize() {
}
MainLoop *OS_LinuxBSD::get_main_loop() const {
-
return main_loop;
}
void OS_LinuxBSD::delete_main_loop() {
-
if (main_loop)
memdelete(main_loop);
main_loop = nullptr;
}
void OS_LinuxBSD::set_main_loop(MainLoop *p_main_loop) {
-
main_loop = p_main_loop;
}
String OS_LinuxBSD::get_name() const {
-
#ifdef __linux__
return "Linux";
#elif defined(__FreeBSD__)
@@ -129,7 +121,6 @@ String OS_LinuxBSD::get_name() const {
}
Error OS_LinuxBSD::shell_open(String p_uri) {
-
Error ok;
List<String> args;
args.push_back(p_uri);
@@ -144,12 +135,10 @@ Error OS_LinuxBSD::shell_open(String p_uri) {
}
bool OS_LinuxBSD::_check_internal_feature_support(const String &p_feature) {
-
return p_feature == "pc";
}
String OS_LinuxBSD::get_config_path() const {
-
if (has_environment("XDG_CONFIG_HOME")) {
return get_environment("XDG_CONFIG_HOME");
} else if (has_environment("HOME")) {
@@ -160,7 +149,6 @@ String OS_LinuxBSD::get_config_path() const {
}
String OS_LinuxBSD::get_data_path() const {
-
if (has_environment("XDG_DATA_HOME")) {
return get_environment("XDG_DATA_HOME");
} else if (has_environment("HOME")) {
@@ -171,7 +159,6 @@ String OS_LinuxBSD::get_data_path() const {
}
String OS_LinuxBSD::get_cache_path() const {
-
if (has_environment("XDG_CACHE_HOME")) {
return get_environment("XDG_CACHE_HOME");
} else if (has_environment("HOME")) {
@@ -182,46 +169,37 @@ String OS_LinuxBSD::get_cache_path() const {
}
String OS_LinuxBSD::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;
@@ -237,7 +215,6 @@ String OS_LinuxBSD::get_system_dir(SystemDir p_dir) const {
}
void OS_LinuxBSD::run() {
-
force_quit = false;
if (!main_loop)
@@ -251,7 +228,6 @@ void OS_LinuxBSD::run() {
//uint64_t frame=0;
while (!force_quit) {
-
DisplayServer::get_singleton()->process_events(); // get rid of pending events
#ifdef JOYDEV_ENABLED
joypad->process_joypads();
@@ -363,7 +339,6 @@ Error OS_LinuxBSD::move_to_trash(const String &p_path) {
}
OS_LinuxBSD::OS_LinuxBSD() {
-
main_loop = nullptr;
force_quit = false;
diff --git a/platform/linuxbsd/os_linuxbsd.h b/platform/linuxbsd/os_linuxbsd.h
index 391f29e8a3..4295721c68 100644
--- a/platform/linuxbsd/os_linuxbsd.h
+++ b/platform/linuxbsd/os_linuxbsd.h
@@ -43,7 +43,6 @@
#include "servers/rendering_server.h"
class OS_LinuxBSD : public OS_Unix {
-
virtual void delete_main_loop();
bool force_quit;
diff --git a/platform/linuxbsd/vulkan_context_x11.cpp b/platform/linuxbsd/vulkan_context_x11.cpp
index 1798a7026e..2eaa9f9446 100644
--- a/platform/linuxbsd/vulkan_context_x11.cpp
+++ b/platform/linuxbsd/vulkan_context_x11.cpp
@@ -36,7 +36,6 @@ const char *VulkanContextX11::_get_platform_surface_extension() const {
}
Error VulkanContextX11::window_create(DisplayServer::WindowID p_window_id, ::Window p_window, Display *p_display, int p_width, int p_height) {
-
VkXlibSurfaceCreateInfoKHR createInfo;
createInfo.sType = VK_STRUCTURE_TYPE_XLIB_SURFACE_CREATE_INFO_KHR;
createInfo.pNext = nullptr;
diff --git a/platform/linuxbsd/vulkan_context_x11.h b/platform/linuxbsd/vulkan_context_x11.h
index 6e144ab2d9..af3d923cfe 100644
--- a/platform/linuxbsd/vulkan_context_x11.h
+++ b/platform/linuxbsd/vulkan_context_x11.h
@@ -35,7 +35,6 @@
#include <X11/Xlib.h>
class VulkanContextX11 : public VulkanContext {
-
virtual const char *_get_platform_surface_extension() const;
public:
diff --git a/platform/osx/context_gl_osx.h b/platform/osx/context_gl_osx.h
index 7e436c5e36..cce00fb35f 100644
--- a/platform/osx/context_gl_osx.h
+++ b/platform/osx/context_gl_osx.h
@@ -41,7 +41,6 @@
#include <CoreVideo/CoreVideo.h>
class ContextGL_OSX {
-
bool opengl_3_context;
bool use_vsync;
diff --git a/platform/osx/context_gl_osx.mm b/platform/osx/context_gl_osx.mm
index 91d1332d24..2319e9eb1f 100644
--- a/platform/osx/context_gl_osx.mm
+++ b/platform/osx/context_gl_osx.mm
@@ -33,42 +33,34 @@
#if defined(OPENGL_ENABLED) || defined(GLES_ENABLED)
void ContextGL_OSX::release_current() {
-
[NSOpenGLContext clearCurrentContext];
}
void ContextGL_OSX::make_current() {
-
[context makeCurrentContext];
}
void ContextGL_OSX::update() {
-
[context update];
}
void ContextGL_OSX::set_opacity(GLint p_opacity) {
-
[context setValues:&p_opacity forParameter:NSOpenGLCPSurfaceOpacity];
}
int ContextGL_OSX::get_window_width() {
-
return OS::get_singleton()->get_video_mode().width;
}
int ContextGL_OSX::get_window_height() {
-
return OS::get_singleton()->get_video_mode().height;
}
void ContextGL_OSX::swap_buffers() {
-
[context flushBuffer];
}
void ContextGL_OSX::set_use_vsync(bool p_use) {
-
CGLContextObj ctx = CGLGetCurrentContext();
if (ctx) {
GLint swapInterval = p_use ? 1 : 0;
@@ -78,12 +70,10 @@ void ContextGL_OSX::set_use_vsync(bool p_use) {
}
bool ContextGL_OSX::is_using_vsync() const {
-
return use_vsync;
}
Error ContextGL_OSX::initialize() {
-
framework = CFBundleGetBundleWithIdentifier(CFSTR("com.apple.opengl"));
ERR_FAIL_COND_V(!framework, ERR_CANT_CREATE);
@@ -161,7 +151,6 @@ Error ContextGL_OSX::initialize() {
}
ContextGL_OSX::ContextGL_OSX(id p_view, bool p_opengl_3_context) {
-
opengl_3_context = p_opengl_3_context;
window_view = p_view;
use_vsync = false;
diff --git a/platform/osx/crash_handler_osx.h b/platform/osx/crash_handler_osx.h
index abd9812596..9970f6045a 100644
--- a/platform/osx/crash_handler_osx.h
+++ b/platform/osx/crash_handler_osx.h
@@ -32,7 +32,6 @@
#define CRASH_HANDLER_OSX_H
class CrashHandler {
-
bool disabled;
public:
diff --git a/platform/osx/dir_access_osx.mm b/platform/osx/dir_access_osx.mm
index 66ea380903..7791ba5407 100644
--- a/platform/osx/dir_access_osx.mm
+++ b/platform/osx/dir_access_osx.mm
@@ -38,7 +38,6 @@
#include <Foundation/Foundation.h>
String DirAccessOSX::fix_unicode_name(const char *p_name) const {
-
String fname;
NSString *nsstr = [[NSString stringWithUTF8String:p_name] precomposedStringWithCanonicalMapping];
diff --git a/platform/osx/display_server_osx.mm b/platform/osx/display_server_osx.mm
index 71e4584dac..46ddc23d8a 100644
--- a/platform/osx/display_server_osx.mm
+++ b/platform/osx/display_server_osx.mm
@@ -921,7 +921,6 @@ static void _mouseDownEvent(DisplayServer::WindowID window_id, NSEvent *event, i
}
static bool isNumpadKey(unsigned int key) {
-
static const unsigned int table[] = {
0x41, /* kVK_ANSI_KeypadDecimal */
0x43, /* kVK_ANSI_KeypadMultiply */
@@ -954,7 +953,6 @@ static bool isNumpadKey(unsigned int key) {
// Translates a OS X keycode to a Godot keycode
//
static int translateKey(unsigned int key) {
-
// Keyboard symbol translation table
static const unsigned int table[128] = {
/* 00 */ KEY_A,
@@ -3011,7 +3009,6 @@ DisplayServerOSX::LatinKeyboardVariant DisplayServerOSX::get_latin_keyboard_vari
static LatinKeyboardVariant layout = LATIN_KEYBOARD_QWERTY;
if (keyboard_layout_dirty) {
-
layout = LATIN_KEYBOARD_QWERTY;
CGKeyCode keys[] = { kVK_ANSI_Q, kVK_ANSI_W, kVK_ANSI_E, kVK_ANSI_R, kVK_ANSI_T, kVK_ANSI_Y };
@@ -3553,7 +3550,6 @@ DisplayServerOSX::DisplayServerOSX(const String &p_rendering_driver, WindowMode
#endif
#if defined(VULKAN_ENABLED)
if (rendering_driver == "vulkan") {
-
context_vulkan = memnew(VulkanContextOSX);
if (context_vulkan->initialize() != OK) {
memdelete(context_vulkan);
@@ -3613,7 +3609,6 @@ DisplayServerOSX::~DisplayServerOSX() {
//destroy drivers
#if defined(VULKAN_ENABLED)
if (rendering_driver == "vulkan") {
-
if (rendering_device_vulkan) {
rendering_device_vulkan->finalize();
memdelete(rendering_device_vulkan);
diff --git a/platform/osx/export/export.cpp b/platform/osx/export/export.cpp
index c2df9c7082..24c80dccf5 100644
--- a/platform/osx/export/export.cpp
+++ b/platform/osx/export/export.cpp
@@ -46,7 +46,6 @@
#include <sys/stat.h>
class EditorExportPlatformOSX : public EditorExportPlatform {
-
GDCLASS(EditorExportPlatformOSX, EditorExportPlatform);
int version_code;
@@ -89,7 +88,6 @@ public:
virtual bool can_export(const Ref<EditorExportPreset> &p_preset, String &r_error, bool &r_missing_templates) const;
virtual void get_platform_features(List<String> *r_features) {
-
r_features->push_back("pc");
r_features->push_back("s3tc");
r_features->push_back("OSX");
@@ -117,7 +115,6 @@ void EditorExportPlatformOSX::get_preset_features(const Ref<EditorExportPreset>
}
void EditorExportPlatformOSX::get_export_options(List<ExportOption> *r_options) {
-
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "custom_template/debug", PROPERTY_HINT_GLOBAL_FILE, "*.zip"), ""));
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "custom_template/release", PROPERTY_HINT_GLOBAL_FILE, "*.zip"), ""));
@@ -148,7 +145,6 @@ void EditorExportPlatformOSX::get_export_options(List<ExportOption> *r_options)
}
void _rgba8_to_packbits_encode(int p_ch, int p_size, Vector<uint8_t> &p_source, Vector<uint8_t> &p_dest) {
-
int src_len = p_size * p_size;
Vector<uint8_t> result;
@@ -163,7 +159,6 @@ void _rgba8_to_packbits_encode(int p_ch, int p_size, Vector<uint8_t> &p_source,
uint8_t cur = p_source.ptr()[i * 4 + p_ch];
if (i < src_len - 2) {
-
if ((p_source.ptr()[(i + 1) * 4 + p_ch] == cur) && (p_source.ptr()[(i + 2) * 4 + p_ch] == cur)) {
if (buf_size > 0) {
result.write[res_size++] = (uint8_t)(buf_size - 1);
@@ -215,7 +210,6 @@ void _rgba8_to_packbits_encode(int p_ch, int p_size, Vector<uint8_t> &p_source,
}
void EditorExportPlatformOSX::_make_icon(const Ref<Image> &p_icon, Vector<uint8_t> &p_data) {
-
Ref<ImageTexture> it = memnew(ImageTexture);
Vector<uint8_t> data;
@@ -320,7 +314,6 @@ void EditorExportPlatformOSX::_make_icon(const Ref<Image> &p_icon, Vector<uint8_
}
void EditorExportPlatformOSX::_fix_plist(const Ref<EditorExportPreset> &p_preset, Vector<uint8_t> &plist, const String &p_binary) {
-
String str;
String strnew;
str.parse_utf8((const char *)plist.ptr(), plist.size());
@@ -485,7 +478,6 @@ Error EditorExportPlatformOSX::export_project(const Ref<EditorExportPreset> &p_p
unzFile src_pkg_zip = unzOpen2(src_pkg_name.utf8().get_data(), &io);
if (!src_pkg_zip) {
-
EditorNode::add_io_error("Could not find template app to export:\n" + src_pkg_name);
return ERR_FILE_NOT_FOUND;
}
@@ -614,7 +606,6 @@ Error EditorExportPlatformOSX::export_project(const Ref<EditorExportPreset> &p_p
}
if (data.size() > 0) {
-
if (file.find("/data.mono.osx.64.release_debug/") != -1) {
if (!p_debug) {
ret = unzGoToNextFile(src_pkg_zip);
@@ -769,7 +760,6 @@ Error EditorExportPlatformOSX::export_project(const Ref<EditorExportPreset> &p_p
uint8_t buf[BSIZE];
while (true) {
-
int r = pf->get_buffer(buf, BSIZE);
if (r <= 0)
break;
@@ -818,7 +808,6 @@ Error EditorExportPlatformOSX::export_project(const Ref<EditorExportPreset> &p_p
}
bool EditorExportPlatformOSX::can_export(const Ref<EditorExportPreset> &p_preset, String &r_error, bool &r_missing_templates) const {
-
String err;
bool valid = false;
@@ -849,7 +838,6 @@ bool EditorExportPlatformOSX::can_export(const Ref<EditorExportPreset> &p_preset
}
EditorExportPlatformOSX::EditorExportPlatformOSX() {
-
Ref<Image> img = memnew(Image(_osx_logo));
logo.instance();
logo->create_from_image(img);
@@ -859,7 +847,6 @@ EditorExportPlatformOSX::~EditorExportPlatformOSX() {
}
void register_osx_exporter() {
-
Ref<EditorExportPlatformOSX> platform;
platform.instance();
diff --git a/platform/osx/godot_main_osx.mm b/platform/osx/godot_main_osx.mm
index eacd2b5cc6..93d0d6168c 100644
--- a/platform/osx/godot_main_osx.mm
+++ b/platform/osx/godot_main_osx.mm
@@ -36,7 +36,6 @@
#include <unistd.h>
int main(int argc, char **argv) {
-
#if defined(VULKAN_ENABLED)
//MoltenVK - enable full component swizzling support
setenv("MVK_CONFIG_FULL_IMAGE_VIEW_SWIZZLE", "1", 1);
diff --git a/platform/osx/joypad_osx.cpp b/platform/osx/joypad_osx.cpp
index 0f50ba63c6..52cceae3fd 100644
--- a/platform/osx/joypad_osx.cpp
+++ b/platform/osx/joypad_osx.cpp
@@ -240,7 +240,6 @@ static bool is_joypad(IOHIDDeviceRef p_device_ref) {
}
void JoypadOSX::_device_added(IOReturn p_res, IOHIDDeviceRef p_device) {
-
if (p_res != kIOReturnSuccess || have_device(p_device)) {
return;
}
@@ -264,7 +263,6 @@ void JoypadOSX::_device_added(IOReturn p_res, IOHIDDeviceRef p_device) {
}
void JoypadOSX::_device_removed(IOReturn p_res, IOHIDDeviceRef p_device) {
-
int device = get_joy_ref(p_device);
ERR_FAIL_COND(device == -1);
@@ -274,7 +272,6 @@ void JoypadOSX::_device_removed(IOReturn p_res, IOHIDDeviceRef p_device) {
}
static String _hex_str(uint8_t p_byte) {
-
static const char *dict = "0123456789abcdef";
char ret[3];
ret[2] = 0;
@@ -286,7 +283,6 @@ static String _hex_str(uint8_t p_byte) {
}
bool JoypadOSX::configure_joypad(IOHIDDeviceRef p_device_ref, joypad *p_joy) {
-
p_joy->device_ref = p_device_ref;
/* get device name */
String name;
@@ -346,7 +342,6 @@ bool JoypadOSX::configure_joypad(IOHIDDeviceRef p_device_ref, joypad *p_joy) {
} \
}
bool joypad::config_force_feedback(io_service_t p_service) {
-
HRESULT ret = FFCreateDevice(p_service, &ff_device);
ERR_FAIL_COND_V(ret != FF_OK, false);
@@ -368,7 +363,6 @@ bool joypad::config_force_feedback(io_service_t p_service) {
#define TEST_FF(ff) (features.supportedEffects & (ff))
bool joypad::check_ff_features() {
-
FFCAPABILITIES features;
HRESULT ret = FFDeviceGetForceFeedbackCapabilities(ff_device, &features);
if (ret == FF_OK && (features.supportedEffects & FFCAP_ET_CONSTANTFORCE)) {
@@ -559,7 +553,6 @@ static CFDictionaryRef create_match_dictionary(const UInt32 page, const UInt32 u
}
void JoypadOSX::config_hid_manager(CFArrayRef p_matching_array) const {
-
CFRunLoopRef runloop = CFRunLoopGetCurrent();
IOReturn ret = IOHIDManagerOpen(hid_manager, kIOHIDOptionsTypeNone);
ERR_FAIL_COND(ret != kIOReturnSuccess);
@@ -603,7 +596,6 @@ JoypadOSX::JoypadOSX(Input *in) {
}
JoypadOSX::~JoypadOSX() {
-
for (int i = 0; i < device_list.size(); i++) {
device_list.write[i].free();
}
diff --git a/platform/osx/joypad_osx.h b/platform/osx/joypad_osx.h
index fc176b0990..dc238e68e4 100644
--- a/platform/osx/joypad_osx.h
+++ b/platform/osx/joypad_osx.h
@@ -88,7 +88,6 @@ struct joypad {
};
class JoypadOSX {
-
enum {
JOYPADS_MAX = 16,
};
diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm
index f132ed9514..dba96ccfcd 100644
--- a/platform/osx/os_osx.mm
+++ b/platform/osx/os_osx.mm
@@ -139,7 +139,6 @@ void OS_OSX::initialize() {
}
void OS_OSX::finalize() {
-
#ifdef COREMIDI_ENABLED
midi_driver.close();
#endif
@@ -261,10 +260,8 @@ String OS_OSX::get_system_dir(SystemDir p_dir) const {
String ret;
if (found) {
-
NSArray *paths = NSSearchPathForDirectoriesInDomains(id, NSUserDomainMask, YES);
if (paths && [paths count] >= 1) {
-
char *utfs = strdup([[paths firstObject] UTF8String]);
ret.parse_utf8(utfs);
free(utfs);
diff --git a/platform/osx/vulkan_context_osx.h b/platform/osx/vulkan_context_osx.h
index 09a5494ae8..e996f176a9 100644
--- a/platform/osx/vulkan_context_osx.h
+++ b/platform/osx/vulkan_context_osx.h
@@ -35,7 +35,6 @@
#include <AppKit/AppKit.h>
class VulkanContextOSX : public VulkanContext {
-
virtual const char *_get_platform_surface_extension() const;
public:
diff --git a/platform/osx/vulkan_context_osx.mm b/platform/osx/vulkan_context_osx.mm
index 320401cdcb..ec8745ff01 100644
--- a/platform/osx/vulkan_context_osx.mm
+++ b/platform/osx/vulkan_context_osx.mm
@@ -36,7 +36,6 @@ const char *VulkanContextOSX::_get_platform_surface_extension() const {
}
Error VulkanContextOSX::window_create(DisplayServer::WindowID p_window_id, id p_window, int p_width, int p_height) {
-
VkMacOSSurfaceCreateInfoMVK createInfo;
createInfo.sType = VK_STRUCTURE_TYPE_MACOS_SURFACE_CREATE_INFO_MVK;
createInfo.pNext = NULL;
diff --git a/platform/server/godot_server.cpp b/platform/server/godot_server.cpp
index df49bfaebf..32bd943ac3 100644
--- a/platform/server/godot_server.cpp
+++ b/platform/server/godot_server.cpp
@@ -32,7 +32,6 @@
#include "os_server.h"
int main(int argc, char *argv[]) {
-
OS_Server os;
Error err = Main::setup(argv[0], argc - 1, &argv[1]);
diff --git a/platform/server/os_server.cpp b/platform/server/os_server.cpp
index 0fda0663a2..bcf0deeba9 100644
--- a/platform/server/os_server.cpp
+++ b/platform/server/os_server.cpp
@@ -42,11 +42,9 @@
#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";
}
@@ -55,7 +53,6 @@ int OS_Server::get_audio_driver_count() const {
}
const char *OS_Server::get_audio_driver_name(int p_driver) const {
-
return "Dummy";
}
@@ -64,14 +61,12 @@ int OS_Server::get_current_video_driver() const {
}
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;
@@ -96,7 +91,6 @@ Error OS_Server::initialize(const VideoMode &p_desired, int p_video_driver, int
}
void OS_Server::finalize() {
-
if (main_loop)
memdelete(main_loop);
main_loop = nullptr;
@@ -116,22 +110,18 @@ 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();
}
@@ -142,12 +132,10 @@ 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);
}
@@ -155,30 +143,25 @@ void OS_Server::get_fullscreen_mode_list(List<VideoMode> *p_list, int p_screen)
}
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);
}
bool OS_Server::can_draw() const {
-
return false; //can never draw
};
String OS_Server::get_name() const {
-
return "Server";
}
@@ -190,7 +173,6 @@ bool OS_Server::_check_internal_feature_support(const String &p_feature) {
}
void OS_Server::run() {
-
force_quit = false;
if (!main_loop)
@@ -199,7 +181,6 @@ void OS_Server::run() {
main_loop->init();
while (!force_quit) {
-
if (Main::iteration())
break;
};
@@ -208,7 +189,6 @@ void OS_Server::run() {
}
String OS_Server::get_config_path() const {
-
if (has_environment("XDG_CONFIG_HOME")) {
return get_environment("XDG_CONFIG_HOME");
} else if (has_environment("HOME")) {
@@ -219,7 +199,6 @@ String OS_Server::get_config_path() const {
}
String OS_Server::get_data_path() const {
-
if (has_environment("XDG_DATA_HOME")) {
return get_environment("XDG_DATA_HOME");
} else if (has_environment("HOME")) {
@@ -230,7 +209,6 @@ String OS_Server::get_data_path() const {
}
String OS_Server::get_cache_path() const {
-
if (has_environment("XDG_CACHE_HOME")) {
return get_environment("XDG_CACHE_HOME");
} else if (has_environment("HOME")) {
@@ -241,46 +219,37 @@ String OS_Server::get_cache_path() const {
}
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;
@@ -304,7 +273,6 @@ bool OS_Server::is_disable_crash_handler() const {
}
OS_Server::OS_Server() {
-
//adriver here
grab = false;
};
diff --git a/platform/server/os_server.h b/platform/server/os_server.h
index b273e8d4e4..06ea483fd4 100644
--- a/platform/server/os_server.h
+++ b/platform/server/os_server.h
@@ -47,7 +47,6 @@
#undef CursorShape
class OS_Server : public OS_Unix {
-
RenderingServer *rendering_server;
VideoMode current_videomode;
List<String> args;
diff --git a/platform/uwp/app.cpp b/platform/uwp/app.cpp
index 988f958739..c99ce5ee16 100644
--- a/platform/uwp/app.cpp
+++ b/platform/uwp/app.cpp
@@ -146,7 +146,6 @@ void App::SetWindow(CoreWindow ^ p_window) {
}
static int _get_button(Windows::UI::Input::PointerPoint ^ pt) {
-
using namespace Windows::UI::Input;
#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP
@@ -197,7 +196,6 @@ static bool _is_touch(Windows::UI::Input::PointerPoint ^ pointerPoint) {
}
static Windows::Foundation::Point _get_pixel_position(CoreWindow ^ window, Windows::Foundation::Point rawPosition, OS *os) {
-
Windows::Foundation::Point outputPosition;
// Compute coordinates normalized from 0..1.
@@ -237,17 +235,14 @@ static Windows::Foundation::Point _get_pixel_position(CoreWindow ^ window, Windo
};
static int _get_finger(uint32_t p_touch_id) {
-
return p_touch_id % 31; // for now
};
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);
if (_is_touch(point)) {
-
Ref<InputEventScreenTouch> screen_touch;
screen_touch.instance();
screen_touch->set_device(0);
@@ -260,7 +255,6 @@ 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->set_device(0);
@@ -291,22 +285,18 @@ void App::pointer_event(Windows::UI::Core::CoreWindow ^ sender, Windows::UI::Cor
};
void App::OnPointerPressed(Windows::UI::Core::CoreWindow ^ sender, Windows::UI::Core::PointerEventArgs ^ args) {
-
pointer_event(sender, args, true);
};
void App::OnPointerReleased(Windows::UI::Core::CoreWindow ^ sender, Windows::UI::Core::PointerEventArgs ^ args) {
-
pointer_event(sender, args, false);
};
void App::OnPointerWheelChanged(Windows::UI::Core::CoreWindow ^ sender, Windows::UI::Core::PointerEventArgs ^ args) {
-
pointer_event(sender, args, true, true);
}
void App::OnMouseModeChanged(Windows::System::Threading::Core::SignalNotifier ^ signalNotifier, bool timedOut) {
-
OS::MouseMode mode = os->get_mouse_mode();
SignalNotifier ^ notifier = mouseChangedNotifier;
@@ -315,12 +305,10 @@ void App::OnMouseModeChanged(Windows::System::Threading::Core::SignalNotifier ^
ref new DispatchedHandler(
[mode, notifier, this]() {
if (mode == OS::MOUSE_MODE_CAPTURED) {
-
this->MouseMovedToken = MouseDevice::GetForCurrentView()->MouseMoved +=
ref new TypedEventHandler<MouseDevice ^, MouseEventArgs ^>(this, &App::OnMouseMoved);
} else {
-
MouseDevice::GetForCurrentView()->MouseMoved -= MouseMovedToken;
}
@@ -331,12 +319,10 @@ void App::OnMouseModeChanged(Windows::System::Threading::Core::SignalNotifier ^
}
void App::OnPointerMoved(Windows::UI::Core::CoreWindow ^ sender, Windows::UI::Core::PointerEventArgs ^ args) {
-
Windows::UI::Input::PointerPoint ^ point = args->CurrentPoint;
Windows::Foundation::Point pos = _get_pixel_position(window, point->Position, os);
if (_is_touch(point)) {
-
Ref<InputEventScreenDrag> screen_drag;
screen_drag.instance();
screen_drag->set_device(0);
@@ -346,7 +332,6 @@ 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)
return;
@@ -365,7 +350,6 @@ 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)
return;
@@ -387,7 +371,6 @@ void App::OnMouseMoved(MouseDevice ^ mouse_device, MouseEventArgs ^ args) {
}
void App::key_event(Windows::UI::Core::CoreWindow ^ sender, bool p_pressed, Windows::UI::Core::KeyEventArgs ^ key_args, Windows::UI::Core::CharacterReceivedEventArgs ^ char_args) {
-
OS_UWP::KeyEvent ke;
ke.control = sender->GetAsyncKeyState(VirtualKey::Control) == CoreVirtualKeyStates::Down;
@@ -397,7 +380,6 @@ void App::key_event(Windows::UI::Core::CoreWindow ^ sender, bool p_pressed, Wind
ke.pressed = p_pressed;
if (key_args != nullptr) {
-
ke.type = OS_UWP::KeyEvent::MessageType::KEY_EVENT_MESSAGE;
ke.unicode = 0;
ke.keycode = KeyMappingWindows::get_keysym((unsigned int)key_args->VirtualKey);
@@ -405,7 +387,6 @@ void App::key_event(Windows::UI::Core::CoreWindow ^ sender, bool p_pressed, Wind
ke.echo = (!p_pressed && !key_args->KeyStatus.IsKeyReleased) || (p_pressed && key_args->KeyStatus.WasKeyDown);
} else {
-
ke.type = OS_UWP::KeyEvent::MessageType::CHAR_EVENT_MESSAGE;
ke.unicode = char_args->KeyCode;
ke.keycode = 0;
@@ -496,14 +477,12 @@ void App::UpdateWindowSize(Size size) {
}
char **App::get_command_line(unsigned int *out_argc) {
-
static char *fail_cl[] = { "--path", "game", nullptr };
*out_argc = 2;
FILE *f = _wfopen(L"__cl__.cl", L"rb");
if (f == nullptr) {
-
wprintf(L"Couldn't open command line file.\n");
return fail_cl;
}
@@ -525,7 +504,6 @@ char **App::get_command_line(unsigned int *out_argc) {
int argc = READ_LE_4(len);
for (int i = 0; i < argc; i++) {
-
r = fread(len, sizeof(uint8_t), 4, f);
if (r < 4) {
@@ -547,7 +525,6 @@ char **App::get_command_line(unsigned int *out_argc) {
arg[strlen] = '\0';
if (r == strlen) {
-
int warg_size = MultiByteToWideChar(CP_UTF8, 0, arg, -1, nullptr, 0);
wchar_t *warg = new wchar_t[warg_size];
@@ -556,7 +533,6 @@ char **App::get_command_line(unsigned int *out_argc) {
cl.Append(ref new Platform::String(warg, warg_size));
} else {
-
delete[] arg;
fclose(f);
wprintf(L"Error reading command.\n");
@@ -572,7 +548,6 @@ char **App::get_command_line(unsigned int *out_argc) {
char **ret = new char *[cl.Size + 1];
for (int i = 0; i < cl.Size; i++) {
-
int arg_size = WideCharToMultiByte(CP_UTF8, 0, cl.GetAt(i)->Data(), -1, nullptr, 0, nullptr, nullptr);
char *arg = new char[arg_size];
diff --git a/platform/uwp/context_egl_uwp.cpp b/platform/uwp/context_egl_uwp.cpp
index bc8ca2e36c..2da6c5897a 100644
--- a/platform/uwp/context_egl_uwp.cpp
+++ b/platform/uwp/context_egl_uwp.cpp
@@ -35,27 +35,22 @@
using Platform::Exception;
void ContextEGL_UWP::release_current() {
-
eglMakeCurrent(mEglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, mEglContext);
};
void ContextEGL_UWP::make_current() {
-
eglMakeCurrent(mEglDisplay, mEglSurface, mEglSurface, mEglContext);
};
int ContextEGL_UWP::get_window_width() {
-
return width;
};
int ContextEGL_UWP::get_window_height() {
-
return height;
};
void ContextEGL_UWP::reset() {
-
cleanup();
window = CoreWindow::GetForCurrentThread();
@@ -63,7 +58,6 @@ void ContextEGL_UWP::reset() {
};
void ContextEGL_UWP::swap_buffers() {
-
if (eglSwapBuffers(mEglDisplay, mEglSurface) != EGL_TRUE) {
cleanup();
@@ -75,7 +69,6 @@ void ContextEGL_UWP::swap_buffers() {
};
Error ContextEGL_UWP::initialize() {
-
EGLint configAttribList[] = {
EGL_RED_SIZE, 8,
EGL_GREEN_SIZE, 8,
@@ -115,7 +108,6 @@ Error ContextEGL_UWP::initialize() {
}
try {
-
const EGLint displayAttributes[] = {
/*EGL_PLATFORM_ANGLE_TYPE_ANGLE, EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE,
EGL_PLATFORM_ANGLE_MAX_VERSION_MAJOR_ANGLE, 9,
@@ -191,7 +183,6 @@ Error ContextEGL_UWP::initialize() {
};
void ContextEGL_UWP::cleanup() {
-
if (mEglDisplay != EGL_NO_DISPLAY && mEglSurface != EGL_NO_SURFACE) {
eglDestroySurface(mEglDisplay, mEglSurface);
mEglSurface = EGL_NO_SURFACE;
@@ -216,6 +207,5 @@ ContextEGL_UWP::ContextEGL_UWP(CoreWindow ^ p_window, Driver p_driver) :
window(p_window) {}
ContextEGL_UWP::~ContextEGL_UWP() {
-
cleanup();
};
diff --git a/platform/uwp/context_egl_uwp.h b/platform/uwp/context_egl_uwp.h
index fa61cf50c6..6f333b8e6a 100644
--- a/platform/uwp/context_egl_uwp.h
+++ b/platform/uwp/context_egl_uwp.h
@@ -41,7 +41,6 @@
using namespace Windows::UI::Core;
class ContextEGL_UWP {
-
public:
enum Driver {
GLES_2_0,
diff --git a/platform/uwp/export/export.cpp b/platform/uwp/export/export.cpp
index 50136ccb66..3d099b44ef 100644
--- a/platform/uwp/export/export.cpp
+++ b/platform/uwp/export/export.cpp
@@ -83,7 +83,6 @@ static const char *uwp_device_capabilities[] = {
};
class AppxPackager {
-
enum {
FILE_HEADER_MAGIC = 0x04034b50,
DATA_DESCRIPTOR_MAGIC = 0x08074b50,
@@ -107,13 +106,11 @@ class AppxPackager {
};
struct BlockHash {
-
String base64_hash;
size_t compressed_size;
};
struct FileMeta {
-
String name;
int lfh_size = 0;
bool compressed = false;
@@ -189,7 +186,6 @@ public:
///////////////////////////////////////////////////////////////////////////
String AppxPackager::hash_block(const uint8_t *p_block_data, size_t p_block_len) {
-
unsigned char hash[32];
char base64[45];
@@ -202,21 +198,18 @@ String AppxPackager::hash_block(const uint8_t *p_block_data, size_t p_block_len)
}
void AppxPackager::make_block_map(const String &p_path) {
-
FileAccess *tmp_file = FileAccess::open(p_path, FileAccess::WRITE);
tmp_file->store_string("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>");
tmp_file->store_string("<BlockMap xmlns=\"http://schemas.microsoft.com/appx/2010/blockmap\" HashMethod=\"http://www.w3.org/2001/04/xmlenc#sha256\">");
for (int i = 0; i < file_metadata.size(); i++) {
-
FileMeta file = file_metadata[i];
tmp_file->store_string(
"<File Name=\"" + file.name.replace("/", "\\") + "\" Size=\"" + itos(file.uncompressed_size) + "\" LfhSize=\"" + itos(file.lfh_size) + "\">");
for (int j = 0; j < file.hashes.size(); j++) {
-
tmp_file->store_string("<Block Hash=\"" + file.hashes[j].base64_hash + "\" ");
if (file.compressed)
tmp_file->store_string("Size=\"" + itos(file.hashes[j].compressed_size) + "\" ");
@@ -233,7 +226,6 @@ void AppxPackager::make_block_map(const String &p_path) {
}
String AppxPackager::content_type(String p_extension) {
-
if (p_extension == "png")
return "image/png";
else if (p_extension == "jpg")
@@ -247,7 +239,6 @@ String AppxPackager::content_type(String p_extension) {
}
void AppxPackager::make_content_types(const String &p_path) {
-
FileAccess *tmp_file = FileAccess::open(p_path, FileAccess::WRITE);
tmp_file->store_string("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
@@ -256,7 +247,6 @@ void AppxPackager::make_content_types(const String &p_path) {
Map<String, String> types;
for (int i = 0; i < file_metadata.size(); i++) {
-
String ext = file_metadata[i].name.get_extension();
if (types.has(ext))
@@ -283,7 +273,6 @@ void AppxPackager::make_content_types(const String &p_path) {
}
Vector<uint8_t> AppxPackager::make_file_header(FileMeta p_file_meta) {
-
Vector<uint8_t> buf;
buf.resize(BASE_FILE_HEADER_SIZE + p_file_meta.name.length());
@@ -326,7 +315,6 @@ Vector<uint8_t> AppxPackager::make_file_header(FileMeta p_file_meta) {
}
void AppxPackager::store_central_dir_header(const FileMeta &p_file, bool p_do_hash) {
-
Vector<uint8_t> &buf = central_dir_data;
int offs = buf.size();
buf.resize(buf.size() + BASE_CENTRAL_DIR_SIZE + p_file.name.length());
@@ -378,7 +366,6 @@ void AppxPackager::store_central_dir_header(const FileMeta &p_file, bool p_do_ha
}
Vector<uint8_t> AppxPackager::make_end_of_central_record() {
-
Vector<uint8_t> buf;
buf.resize(ZIP64_END_OF_CENTRAL_DIR_SIZE + 12 + END_OF_CENTRAL_DIR_SIZE); // Size plus magic
@@ -448,14 +435,12 @@ Vector<uint8_t> AppxPackager::make_end_of_central_record() {
}
void AppxPackager::init(FileAccess *p_fa) {
-
package = p_fa;
central_dir_offset = 0;
end_of_central_dir_offset = 0;
}
Error AppxPackager::add_file(String p_file_name, const uint8_t *p_buffer, size_t p_len, int p_file_no, int p_total_files, bool p_compress) {
-
if (p_file_no >= 1 && p_total_files >= 1) {
if (EditorNode::progress_task_step(progress_task, "File: " + p_file_name, (p_file_no * 100) / p_total_files)) {
return ERR_SKIP;
@@ -479,7 +464,6 @@ Error AppxPackager::add_file(String p_file_name, const uint8_t *p_buffer, size_t
Vector<uint8_t> strm_out;
if (p_compress) {
-
strm.zalloc = zipio_alloc;
strm.zfree = zipio_free;
strm.opaque = &strm_f;
@@ -492,7 +476,6 @@ Error AppxPackager::add_file(String p_file_name, const uint8_t *p_buffer, size_t
int step = 0;
while (p_len - step > 0) {
-
size_t block_size = (p_len - step) > BLOCK_SIZE ? (size_t)BLOCK_SIZE : (p_len - step);
for (uint64_t i = 0; i < block_size; i++) {
@@ -503,7 +486,6 @@ Error AppxPackager::add_file(String p_file_name, const uint8_t *p_buffer, size_t
bh.base64_hash = hash_block(strm_in.ptr(), block_size);
if (p_compress) {
-
strm.avail_in = block_size;
strm.avail_out = strm_out.size();
strm.next_in = (uint8_t *)strm_in.ptr();
@@ -536,7 +518,6 @@ Error AppxPackager::add_file(String p_file_name, const uint8_t *p_buffer, size_t
}
if (p_compress) {
-
strm.avail_in = 0;
strm.avail_out = strm_out.size();
strm.next_in = (uint8_t *)strm_in.ptr();
@@ -556,7 +537,6 @@ Error AppxPackager::add_file(String p_file_name, const uint8_t *p_buffer, size_t
meta.compressed_size = strm.total_out;
} else {
-
meta.compressed_size = p_len;
}
@@ -579,7 +559,6 @@ Error AppxPackager::add_file(String p_file_name, const uint8_t *p_buffer, size_t
}
void AppxPackager::finish() {
-
// Create and add block map file
EditorNode::progress_task_step("export", "Creating block map...", 4);
@@ -646,7 +625,6 @@ AppxPackager::~AppxPackager() {}
////////////////////////////////////////////////////////////////////
class EditorExportPlatformUWP : public EditorExportPlatform {
-
GDCLASS(EditorExportPlatformUWP, EditorExportPlatform);
Ref<ImageTexture> logo;
@@ -658,7 +636,6 @@ class EditorExportPlatformUWP : public EditorExportPlatform {
};
bool _valid_resource_name(const String &p_name) const {
-
if (p_name.empty())
return false;
if (p_name.ends_with("."))
@@ -681,7 +658,6 @@ class EditorExportPlatformUWP : public EditorExportPlatform {
}
bool _valid_guid(const String &p_guid) const {
-
Vector<String> parts = p_guid.split("-");
if (parts.size() != 5)
@@ -698,7 +674,6 @@ class EditorExportPlatformUWP : public EditorExportPlatform {
}
bool _valid_bgcolor(const String &p_color) const {
-
if (p_color.empty())
return true;
if (p_color.begins_with("#") && p_color.is_valid_html_color())
@@ -745,7 +720,6 @@ class EditorExportPlatformUWP : public EditorExportPlatform {
}
bool _valid_image(const StreamTexture2D *p_image, int p_width, int p_height) const {
-
if (!p_image) {
return false;
}
@@ -757,7 +731,6 @@ class EditorExportPlatformUWP : public EditorExportPlatform {
bool valid_h = false;
for (int i = 0; i < 1; i++) {
-
int w = ceil(p_width * scales[i]);
int h = ceil(p_height * scales[i]);
@@ -771,7 +744,6 @@ class EditorExportPlatformUWP : public EditorExportPlatform {
}
Vector<uint8_t> _fix_manifest(const Ref<EditorExportPreset> &p_preset, const Vector<uint8_t> &p_template, bool p_give_internet) const {
-
String result = String::utf8((const char *)p_template.ptr(), p_template.size());
result = result.replace("$godot_version$", VERSION_FULL_NAME);
@@ -879,7 +851,6 @@ class EditorExportPlatformUWP : public EditorExportPlatform {
}
Vector<uint8_t> _get_image_data(const Ref<EditorExportPreset> &p_preset, const String &p_path) {
-
Vector<uint8_t> data;
StreamTexture2D *image = nullptr;
@@ -909,7 +880,6 @@ class EditorExportPlatformUWP : public EditorExportPlatform {
Error err = image->get_data()->save_png(tmp_path);
if (err != OK) {
-
String err_string = "Couldn't save temp logo file.";
EditorNode::add_io_error(err_string);
@@ -919,7 +889,6 @@ class EditorExportPlatformUWP : public EditorExportPlatform {
FileAccess *f = FileAccess::open(tmp_path, FileAccess::READ, &err);
if (err != OK) {
-
String err_string = "Couldn't open temp logo file.";
// Cleanup generated file.
DirAccess::remove_file_or_error(tmp_path);
@@ -938,7 +907,6 @@ class EditorExportPlatformUWP : public EditorExportPlatform {
}
static bool _should_compress_asset(const String &p_path, const Vector<uint8_t> &p_data) {
-
/* TODO: This was copied verbatim from Android export. It should be
* refactored to the parent class and also be used for .zip export.
*/
@@ -989,7 +957,6 @@ class EditorExportPlatformUWP : public EditorExportPlatform {
}
static Error save_appx_file(void *p_userdata, const String &p_path, const Vector<uint8_t> &p_data, int p_file, int p_total) {
-
AppxPackager *packager = (AppxPackager *)p_userdata;
String dst_path = p_path.replace_first("res://", "game/");
@@ -1096,7 +1063,6 @@ public:
}
virtual bool can_export(const Ref<EditorExportPreset> &p_preset, String &r_error, bool &r_missing_templates) const {
-
String err;
bool valid = false;
@@ -1207,7 +1173,6 @@ public:
}
virtual Error export_project(const Ref<EditorExportPreset> &p_preset, bool p_debug, const String &p_path, int p_flags = 0) {
-
String src_appx;
EditorProgress ep("export", "Exporting for Windows Universal", 7, true);
@@ -1267,7 +1232,6 @@ public:
unzFile pkg = unzOpen2(src_appx.utf8().get_data(), &io);
if (!pkg) {
-
EditorNode::add_io_error("Could not find template appx to export:\n" + src_appx);
return ERR_FILE_NOT_FOUND;
}
@@ -1285,7 +1249,6 @@ public:
int template_file_no = 1;
while (ret == UNZ_OK) {
-
// get file name
unz_file_info info;
char fname[16834];
@@ -1303,7 +1266,6 @@ public:
bool do_read = true;
if (path.begins_with("Assets/")) {
-
path = path.replace(".scale-100", "");
data = _get_image_data(p_preset, path);
@@ -1320,7 +1282,6 @@ public:
}
if (path == "AppxManifest.xml") {
-
data = _fix_manifest(p_preset, data, p_flags & (DEBUG_FLAG_DUMB_CLIENT | DEBUG_FLAG_REMOTE_DEBUG));
}
@@ -1363,7 +1324,6 @@ public:
encode_uint32(cl.size(), clf.ptrw());
for (int i = 0; i < cl.size(); i++) {
-
CharString txt = cl[i].utf8();
int base = clf.size();
clf.resize(base + 4 + txt.length());
@@ -1452,7 +1412,6 @@ public:
}
virtual void get_platform_features(List<String> *r_features) {
-
r_features->push_back("pc");
r_features->push_back("UWP");
}
@@ -1468,7 +1427,6 @@ public:
};
void register_uwp_exporter() {
-
#ifdef WINDOWS_ENABLED
EDITOR_DEF("export/uwp/signtool", "");
EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::STRING, "export/uwp/signtool", PROPERTY_HINT_GLOBAL_FILE, "*.exe"));
diff --git a/platform/uwp/joypad_uwp.cpp b/platform/uwp/joypad_uwp.cpp
index 066787e9d6..4fdfde9673 100644
--- a/platform/uwp/joypad_uwp.cpp
+++ b/platform/uwp/joypad_uwp.cpp
@@ -35,7 +35,6 @@ using namespace Windows::Gaming::Input;
using namespace Windows::Foundation;
void JoypadUWP::register_events() {
-
Gamepad::GamepadAdded +=
ref new EventHandler<Gamepad ^>(this, &JoypadUWP::OnGamepadAdded);
Gamepad::GamepadRemoved +=
@@ -43,23 +42,18 @@ void JoypadUWP::register_events() {
}
void JoypadUWP::process_controllers() {
-
for (int i = 0; i < MAX_CONTROLLERS; i++) {
-
ControllerDevice &joy = controllers[i];
if (!joy.connected)
break;
switch (joy.type) {
-
case ControllerType::GAMEPAD_CONTROLLER: {
-
GamepadReading reading = ((Gamepad ^) joy.controller_reference)->GetCurrentReading();
int button_mask = (int)GamepadButtons::Menu;
for (int j = 0; j < 14; j++) {
-
input->joy_button(joy.id, j, (int)reading.Buttons & button_mask);
button_mask *= 2;
}
@@ -93,24 +87,20 @@ void JoypadUWP::process_controllers() {
}
JoypadUWP::JoypadUWP() {
-
for (int i = 0; i < MAX_CONTROLLERS; i++)
controllers[i].id = i;
}
JoypadUWP::JoypadUWP(InputDefault *p_input) {
-
input = p_input;
JoypadUWP();
}
void JoypadUWP::OnGamepadAdded(Platform::Object ^ sender, Windows::Gaming::Input::Gamepad ^ value) {
-
short idx = -1;
for (int i = 0; i < MAX_CONTROLLERS; i++) {
-
if (!controllers[i].connected) {
idx = i;
break;
@@ -128,11 +118,9 @@ void JoypadUWP::OnGamepadAdded(Platform::Object ^ sender, Windows::Gaming::Input
}
void JoypadUWP::OnGamepadRemoved(Platform::Object ^ sender, Windows::Gaming::Input::Gamepad ^ value) {
-
short idx = -1;
for (int i = 0; i < MAX_CONTROLLERS; i++) {
-
if (controllers[i].controller_reference == value) {
idx = i;
break;
@@ -147,7 +135,6 @@ void JoypadUWP::OnGamepadRemoved(Platform::Object ^ sender, Windows::Gaming::Inp
}
InputDefault::JoyAxis JoypadUWP::axis_correct(double p_val, bool p_negate, bool p_trigger) const {
-
InputDefault::JoyAxis jx;
jx.min = p_trigger ? 0 : -1;
diff --git a/platform/uwp/joypad_uwp.h b/platform/uwp/joypad_uwp.h
index 69431052e5..13f246a438 100644
--- a/platform/uwp/joypad_uwp.h
+++ b/platform/uwp/joypad_uwp.h
@@ -34,7 +34,6 @@
#include "core/input/input.h"
ref class JoypadUWP sealed {
-
/** clang-format breaks this, it does not understand this token. */
/* clang-format off */
internal:
@@ -57,7 +56,6 @@ private:
};
struct ControllerDevice {
-
Windows::Gaming::Input::IGameController ^ controller_reference;
int id;
diff --git a/platform/uwp/os_uwp.cpp b/platform/uwp/os_uwp.cpp
index 1c83ebfdf7..2104cacb6e 100644
--- a/platform/uwp/os_uwp.cpp
+++ b/platform/uwp/os_uwp.cpp
@@ -82,7 +82,6 @@ int OS_UWP::get_current_video_driver() const {
}
void OS_UWP::set_window_size(const Size2 p_size) {
-
Windows::Foundation::Size new_size;
new_size.Width = p_size.width;
new_size.Height = p_size.height;
@@ -90,14 +89,12 @@ void OS_UWP::set_window_size(const Size2 p_size) {
ApplicationView ^ view = ApplicationView::GetForCurrentView();
if (view->TryResizeView(new_size)) {
-
video_mode.width = p_size.width;
video_mode.height = p_size.height;
}
}
void OS_UWP::set_window_fullscreen(bool p_enabled) {
-
ApplicationView ^ view = ApplicationView::GetForCurrentView();
video_mode.fullscreen = view->IsFullScreenMode;
@@ -106,23 +103,19 @@ void OS_UWP::set_window_fullscreen(bool p_enabled) {
return;
if (p_enabled) {
-
video_mode.fullscreen = view->TryEnterFullScreenMode();
} else {
-
view->ExitFullScreenMode();
video_mode.fullscreen = false;
}
}
bool OS_UWP::is_window_fullscreen() const {
-
return ApplicationView::GetForCurrentView()->IsFullScreenMode;
}
void OS_UWP::set_keep_screen_on(bool p_enabled) {
-
if (is_keep_screen_on() == p_enabled)
return;
@@ -135,7 +128,6 @@ void OS_UWP::set_keep_screen_on(bool p_enabled) {
}
void OS_UWP::initialize_core() {
-
last_button_state = 0;
//RedirectIOToConsole();
@@ -166,7 +158,6 @@ void OS_UWP::initialize_core() {
}
bool OS_UWP::can_draw() const {
-
return !minimized;
};
@@ -175,12 +166,10 @@ void OS_UWP::set_window(Windows::UI::Core::CoreWindow ^ p_window) {
}
void OS_UWP::screen_size_changed() {
-
gl_context->reset();
};
Error OS_UWP::initialize(const VideoMode &p_desired, int p_video_driver, int p_audio_driver) {
-
main_loop = nullptr;
outside = true;
@@ -231,11 +220,9 @@ Error OS_UWP::initialize(const VideoMode &p_desired, int p_video_driver, int p_a
if (p_desired.fullscreen != view->IsFullScreenMode) {
if (p_desired.fullscreen) {
-
vm.fullscreen = view->TryEnterFullScreenMode();
} else {
-
view->ExitFullScreenMode();
vm.fullscreen = false;
}
@@ -248,7 +235,6 @@ Error OS_UWP::initialize(const VideoMode &p_desired, int p_video_driver, int p_a
view->PreferredLaunchViewSize = desired;
if (view->TryResizeView(desired)) {
-
vm.width = view->VisibleBounds.Width;
vm.height = view->VisibleBounds.Height;
}
@@ -309,7 +295,6 @@ Error OS_UWP::initialize(const VideoMode &p_desired, int p_video_driver, int p_a
}
void OS_UWP::set_clipboard(const String &p_text) {
-
DataPackage ^ clip = ref new DataPackage();
clip->RequestedOperation = DataPackageOperation::Copy;
clip->SetText(ref new Platform::String((const wchar_t *)p_text.c_str()));
@@ -318,7 +303,6 @@ void OS_UWP::set_clipboard(const String &p_text) {
};
String OS_UWP::get_clipboard() const {
-
if (managed_object->clipboard != nullptr)
return managed_object->clipboard->Data();
else
@@ -326,25 +310,21 @@ String OS_UWP::get_clipboard() const {
};
void OS_UWP::input_event(const Ref<InputEvent> &p_event) {
-
input->parse_input_event(p_event);
};
void OS_UWP::delete_main_loop() {
-
if (main_loop)
memdelete(main_loop);
main_loop = nullptr;
}
void OS_UWP::set_main_loop(MainLoop *p_main_loop) {
-
input->set_main_loop(p_main_loop);
main_loop = p_main_loop;
}
void OS_UWP::finalize() {
-
if (main_loop)
memdelete(main_loop);
@@ -363,12 +343,10 @@ void OS_UWP::finalize() {
}
void OS_UWP::finalize_core() {
-
NetSocketPosix::cleanup();
}
void OS_UWP::alert(const String &p_alert, const String &p_title) {
-
Platform::String ^ alert = ref new Platform::String(p_alert.c_str());
Platform::String ^ title = ref new Platform::String(p_title.c_str());
@@ -384,21 +362,17 @@ void OS_UWP::alert(const String &p_alert, const String &p_title) {
}
void OS_UWP::ManagedType::alert_close(IUICommand ^ command) {
-
alert_close_handle = false;
}
void OS_UWP::ManagedType::on_clipboard_changed(Platform::Object ^ sender, Platform::Object ^ ev) {
-
update_clipboard();
}
void OS_UWP::ManagedType::update_clipboard() {
-
DataPackageView ^ data = Clipboard::GetContent();
if (data->Contains(StandardDataFormats::Text)) {
-
create_task(data->GetTextAsync()).then([this](Platform::String ^ clipboard_content) {
this->clipboard = clipboard_content;
});
@@ -406,7 +380,6 @@ void OS_UWP::ManagedType::update_clipboard() {
}
void OS_UWP::ManagedType::on_accelerometer_reading_changed(Accelerometer ^ sender, AccelerometerReadingChangedEventArgs ^ args) {
-
AccelerometerReading ^ reading = args->Reading;
os->input->set_accelerometer(Vector3(
@@ -416,7 +389,6 @@ void OS_UWP::ManagedType::on_accelerometer_reading_changed(Accelerometer ^ sende
}
void OS_UWP::ManagedType::on_magnetometer_reading_changed(Magnetometer ^ sender, MagnetometerReadingChangedEventArgs ^ args) {
-
MagnetometerReading ^ reading = args->Reading;
os->input->set_magnetometer(Vector3(
@@ -426,7 +398,6 @@ void OS_UWP::ManagedType::on_magnetometer_reading_changed(Magnetometer ^ sender,
}
void OS_UWP::ManagedType::on_gyroscope_reading_changed(Gyrometer ^ sender, GyrometerReadingChangedEventArgs ^ args) {
-
GyrometerReading ^ reading = args->Reading;
os->input->set_magnetometer(Vector3(
@@ -436,22 +407,17 @@ 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) {
-
CoreWindow::GetForCurrentThread()->PointerCursor = nullptr;
} else {
-
CoreWindow::GetForCurrentThread()->PointerCursor = ref new CoreCursor(CoreCursorType::Arrow, 0);
}
@@ -461,17 +427,14 @@ void OS_UWP::set_mouse_mode(MouseMode p_mode) {
}
OS_UWP::MouseMode OS_UWP::get_mouse_mode() const {
-
return mouse_mode;
}
Point2 OS_UWP::get_mouse_position() const {
-
return Point2(old_x, old_y);
}
int OS_UWP::get_mouse_button_state() const {
-
return last_button_state;
}
@@ -479,23 +442,19 @@ void OS_UWP::set_window_title(const String &p_title) {
}
void OS_UWP::set_video_mode(const VideoMode &p_video_mode, int p_screen) {
-
video_mode = p_video_mode;
}
OS::VideoMode OS_UWP::get_video_mode(int p_screen) const {
-
return video_mode;
}
void OS_UWP::get_fullscreen_mode_list(List<VideoMode> *p_list, int p_screen) const {
}
String OS_UWP::get_name() const {
-
return "UWP";
}
OS::Date OS_UWP::get_date(bool utc) const {
-
SYSTEMTIME systemtime;
if (utc)
GetSystemTime(&systemtime);
@@ -511,7 +470,6 @@ OS::Date OS_UWP::get_date(bool utc) const {
return date;
}
OS::Time OS_UWP::get_time(bool utc) const {
-
SYSTEMTIME systemtime;
if (utc)
GetSystemTime(&systemtime);
@@ -545,7 +503,6 @@ OS::TimeZoneInfo OS_UWP::get_time_zone_info() const {
}
uint64_t OS_UWP::get_unix_time() const {
-
FILETIME ft;
SYSTEMTIME st;
GetSystemTime(&st);
@@ -567,14 +524,12 @@ uint64_t OS_UWP::get_unix_time() const {
};
void OS_UWP::delay_usec(uint32_t p_usec) const {
-
int msec = p_usec < 1000 ? 1 : p_usec / 1000;
// no Sleep()
WaitForSingleObjectEx(GetCurrentThread(), msec, false);
}
uint64_t OS_UWP::get_ticks_usec() const {
-
uint64_t ticks;
uint64_t time;
// This is the number of clock ticks since start
@@ -588,15 +543,12 @@ uint64_t OS_UWP::get_ticks_usec() const {
}
void OS_UWP::process_events() {
-
joypad->process_controllers();
process_key_events();
}
void OS_UWP::process_key_events() {
-
for (int i = 0; i < key_event_pos; i++) {
-
KeyEvent &kev = key_event_buffer[i];
Ref<InputEventKey> key_event;
@@ -619,7 +571,6 @@ void OS_UWP::queue_key_event(KeyEvent &p_event) {
// This merges Char events with the previous Key event, so
// the unicode can be retrieved without sending duplicate events.
if (p_event.type == KeyEvent::MessageType::CHAR_EVENT_MESSAGE && key_event_pos > 0) {
-
KeyEvent &old = key_event_buffer[key_event_pos - 1];
ERR_FAIL_COND(old.type != KeyEvent::MessageType::KEY_EVENT_MESSAGE);
@@ -633,7 +584,6 @@ void OS_UWP::queue_key_event(KeyEvent &p_event) {
}
void OS_UWP::set_cursor_shape(CursorShape p_shape) {
-
ERR_FAIL_INDEX(p_shape, CURSOR_MAX);
if (cursor_shape == p_shape)
@@ -665,7 +615,6 @@ void OS_UWP::set_cursor_shape(CursorShape p_shape) {
}
OS::CursorShape OS_UWP::get_cursor_shape() const {
-
return cursor_shape;
}
@@ -674,22 +623,18 @@ void OS_UWP::set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_shape, c
}
Error OS_UWP::execute(const String &p_path, const List<String> &p_arguments, bool p_blocking, ProcessID *r_child_id, String *r_pipe, int *r_exitcode, bool read_stderr, Mutex *p_pipe_mutex) {
-
return FAILED;
};
Error OS_UWP::kill(const ProcessID &p_pid) {
-
return FAILED;
};
Error OS_UWP::set_cwd(const String &p_cwd) {
-
return FAILED;
}
String OS_UWP::get_executable_path() const {
-
return "";
}
@@ -697,22 +642,18 @@ void OS_UWP::set_icon(const Ref<Image> &p_icon) {
}
bool OS_UWP::has_environment(const String &p_var) const {
-
return false;
};
String OS_UWP::get_environment(const String &p_var) const {
-
return "";
};
bool OS_UWP::set_environment(const String &p_var, const String &p_value) const {
-
return false;
}
String OS_UWP::get_stdin_string(bool p_block) {
-
return String();
}
@@ -720,12 +661,10 @@ void OS_UWP::move_window_to_foreground() {
}
Error OS_UWP::shell_open(String p_uri) {
-
return FAILED;
}
String OS_UWP::get_locale() const {
-
#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP // this should work on phone 8.1, but it doesn't
return "en";
#else
@@ -735,45 +674,37 @@ String OS_UWP::get_locale() const {
}
void OS_UWP::release_rendering_thread() {
-
gl_context->release_current();
}
void OS_UWP::make_rendering_thread() {
-
gl_context->make_current();
}
void OS_UWP::swap_buffers() {
-
gl_context->swap_buffers();
}
bool OS_UWP::has_touchscreen_ui_hint() const {
-
TouchCapabilities ^ tc = ref new TouchCapabilities();
return tc->TouchPresent != 0 || UIViewSettings::GetForCurrentView()->UserInteractionMode == UserInteractionMode::Touch;
}
bool OS_UWP::has_virtual_keyboard() const {
-
return UIViewSettings::GetForCurrentView()->UserInteractionMode == UserInteractionMode::Touch;
}
void OS_UWP::show_virtual_keyboard(const String &p_existing_text, const Rect2 &p_screen_rect, int p_max_input_length) {
-
InputPane ^ pane = InputPane::GetForCurrentView();
pane->TryShow();
}
void OS_UWP::hide_virtual_keyboard() {
-
InputPane ^ pane = InputPane::GetForCurrentView();
pane->TryHide();
}
static String format_error_message(DWORD id) {
-
LPWSTR messageBuffer = nullptr;
size_t size = FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
nullptr, id, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPWSTR)&messageBuffer, 0, nullptr);
@@ -786,7 +717,6 @@ static String format_error_message(DWORD id) {
}
Error OS_UWP::open_dynamic_library(const String p_path, void *&p_library_handle, bool p_also_set_library_path) {
-
String full_path = "game/" + p_path;
p_library_handle = (void *)LoadPackagedLibrary(full_path.c_str(), 0);
ERR_FAIL_COND_V_MSG(!p_library_handle, ERR_CANT_OPEN, "Can't open dynamic library: " + full_path + ", error: " + format_error_message(GetLastError()) + ".");
@@ -813,7 +743,6 @@ Error OS_UWP::get_dynamic_library_symbol_handle(void *p_library_handle, const St
}
void OS_UWP::run() {
-
if (!main_loop)
return;
@@ -825,7 +754,6 @@ void OS_UWP::run() {
uint64_t frame = 0;
while (!force_quit) {
-
CoreWindow::GetForCurrentThread()->Dispatcher->ProcessEvents(CoreProcessEventsOption::ProcessAllIfPresent);
if (managed_object->alert_close_handle)
continue;
@@ -838,12 +766,10 @@ void OS_UWP::run() {
}
MainLoop *OS_UWP::get_main_loop() const {
-
return main_loop;
}
String OS_UWP::get_user_data_dir() const {
-
Windows::Storage::StorageFolder ^ data_folder = Windows::Storage::ApplicationData::Current->LocalFolder;
return String(data_folder->Path->Data()).replace("\\", "/");
@@ -854,7 +780,6 @@ bool OS_UWP::_check_internal_feature_support(const String &p_feature) {
}
OS_UWP::OS_UWP() {
-
key_event_pos = 0;
force_quit = false;
alt_mem = false;
diff --git a/platform/uwp/os_uwp.h b/platform/uwp/os_uwp.h
index 2233f6a413..1cab38cabe 100644
--- a/platform/uwp/os_uwp.h
+++ b/platform/uwp/os_uwp.h
@@ -48,10 +48,8 @@
#include <windows.h>
class OS_UWP : public OS {
-
public:
struct KeyEvent {
-
enum MessageType {
KEY_EVENT_MESSAGE,
CHAR_EVENT_MESSAGE
diff --git a/platform/uwp/thread_uwp.cpp b/platform/uwp/thread_uwp.cpp
index 9dc20a74e8..35a366a173 100644
--- a/platform/uwp/thread_uwp.cpp
+++ b/platform/uwp/thread_uwp.cpp
@@ -33,7 +33,6 @@
#include "core/os/memory.h"
Thread *ThreadUWP::create_func_uwp(ThreadCreateCallback p_callback, void *p_user, const Settings &) {
-
ThreadUWP *thread = memnew(ThreadUWP);
std::thread new_thread(p_callback, p_user);
@@ -43,18 +42,15 @@ Thread *ThreadUWP::create_func_uwp(ThreadCreateCallback p_callback, void *p_user
};
Thread::ID ThreadUWP::get_thread_id_func_uwp() {
-
return std::hash<std::thread::id>()(std::this_thread::get_id());
};
void ThreadUWP::wait_to_finish_func_uwp(Thread *p_thread) {
-
ThreadUWP *tp = static_cast<ThreadUWP *>(p_thread);
tp->thread.join();
};
Thread::ID ThreadUWP::get_id() const {
-
return std::hash<std::thread::id>()(thread.get_id());
};
diff --git a/platform/uwp/thread_uwp.h b/platform/uwp/thread_uwp.h
index a2d367ae2f..1f1d85a66a 100644
--- a/platform/uwp/thread_uwp.h
+++ b/platform/uwp/thread_uwp.h
@@ -38,7 +38,6 @@
#include <thread>
class ThreadUWP : public Thread {
-
std::thread thread;
static Thread *create_func_uwp(ThreadCreateCallback p_callback, void *, const Settings &);
diff --git a/platform/windows/context_gl_windows.cpp b/platform/windows/context_gl_windows.cpp
index 5a36b5546d..1c32639a38 100644
--- a/platform/windows/context_gl_windows.cpp
+++ b/platform/windows/context_gl_windows.cpp
@@ -51,27 +51,22 @@
typedef HGLRC(APIENTRY *PFNWGLCREATECONTEXTATTRIBSARBPROC)(HDC, HGLRC, const int *);
void ContextGL_Windows::release_current() {
-
wglMakeCurrent(hDC, nullptr);
}
void ContextGL_Windows::make_current() {
-
wglMakeCurrent(hDC, hRC);
}
int ContextGL_Windows::get_window_width() {
-
return OS::get_singleton()->get_video_mode().width;
}
int ContextGL_Windows::get_window_height() {
-
return OS::get_singleton()->get_video_mode().height;
}
bool ContextGL_Windows::should_vsync_via_compositor() {
-
if (OS::get_singleton()->is_window_fullscreen() || !OS::get_singleton()->is_vsync_via_compositor_enabled()) {
return false;
}
@@ -88,7 +83,6 @@ bool ContextGL_Windows::should_vsync_via_compositor() {
}
void ContextGL_Windows::swap_buffers() {
-
SwapBuffers(hDC);
if (use_vsync) {
@@ -108,7 +102,6 @@ void ContextGL_Windows::swap_buffers() {
}
void ContextGL_Windows::set_use_vsync(bool p_use) {
-
vsync_via_compositor = p_use && should_vsync_via_compositor();
if (wglSwapIntervalEXT) {
@@ -120,14 +113,12 @@ void ContextGL_Windows::set_use_vsync(bool p_use) {
}
bool ContextGL_Windows::is_using_vsync() const {
-
return use_vsync;
}
#define _WGL_CONTEXT_DEBUG_BIT_ARB 0x0001
Error ContextGL_Windows::initialize() {
-
static PIXELFORMATDESCRIPTOR pfd = {
sizeof(PIXELFORMATDESCRIPTOR), // Size Of This Pixel Format Descriptor
1,
@@ -175,7 +166,6 @@ Error ContextGL_Windows::initialize() {
wglMakeCurrent(hDC, hRC);
if (opengl_3_context) {
-
int attribs[] = {
WGL_CONTEXT_MAJOR_VERSION_ARB, 3, //we want a 3.3 context
WGL_CONTEXT_MINOR_VERSION_ARB, 3,
@@ -217,7 +207,6 @@ Error ContextGL_Windows::initialize() {
}
ContextGL_Windows::ContextGL_Windows(HWND hwnd, bool p_opengl_3_context) {
-
opengl_3_context = p_opengl_3_context;
hWnd = hwnd;
use_vsync = false;
diff --git a/platform/windows/context_gl_windows.h b/platform/windows/context_gl_windows.h
index 280c5a1e3c..046e3437ea 100644
--- a/platform/windows/context_gl_windows.h
+++ b/platform/windows/context_gl_windows.h
@@ -44,7 +44,6 @@ typedef bool(APIENTRY *PFNWGLSWAPINTERVALEXTPROC)(int interval);
typedef int(APIENTRY *PFNWGLGETSWAPINTERVALEXTPROC)(void);
class ContextGL_Windows {
-
HDC hDC;
HGLRC hRC;
unsigned int pixel_format;
diff --git a/platform/windows/crash_handler_windows.h b/platform/windows/crash_handler_windows.h
index adc548073c..66a4cac296 100644
--- a/platform/windows/crash_handler_windows.h
+++ b/platform/windows/crash_handler_windows.h
@@ -41,7 +41,6 @@ extern DWORD CrashHandlerException(EXCEPTION_POINTERS *ep);
#endif
class CrashHandler {
-
bool disabled;
public:
diff --git a/platform/windows/display_server_windows.cpp b/platform/windows/display_server_windows.cpp
index e794efb4fb..2637702fab 100644
--- a/platform/windows/display_server_windows.cpp
+++ b/platform/windows/display_server_windows.cpp
@@ -38,7 +38,6 @@
#ifdef DEBUG_ENABLED
static String format_error_message(DWORD id) {
-
LPWSTR messageBuffer = nullptr;
size_t size = FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
nullptr, id, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPWSTR)&messageBuffer, 0, nullptr);
@@ -83,7 +82,6 @@ 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) {
WindowData &wd = windows[MAIN_WINDOW_ID];
@@ -93,7 +91,6 @@ void DisplayServerWindows::_set_mouse_mode_impl(MouseMode p_mode) {
ClientToScreen(wd.hWnd, (POINT *)&clipRect.right);
ClipCursor(&clipRect);
if (p_mode == MOUSE_MODE_CAPTURED) {
-
center = window_get_size() / 2;
POINT pos = { (int)center.x, (int)center.y };
ClientToScreen(wd.hWnd, &pos);
@@ -114,7 +111,6 @@ void DisplayServerWindows::_set_mouse_mode_impl(MouseMode p_mode) {
}
}
void DisplayServerWindows::mouse_set_mode(MouseMode p_mode) {
-
_THREAD_SAFE_METHOD_
if (mouse_mode == p_mode)
@@ -129,7 +125,6 @@ DisplayServer::MouseMode DisplayServerWindows::mouse_get_mode() const {
}
void DisplayServerWindows::mouse_warp_to_position(const Point2i &p_to) {
-
_THREAD_SAFE_METHOD_
if (!windows.has(last_focused_window)) {
@@ -137,11 +132,9 @@ void DisplayServerWindows::mouse_warp_to_position(const Point2i &p_to) {
}
if (mouse_mode == MOUSE_MODE_CAPTURED) {
-
old_x = p_to.x;
old_y = p_to.y;
} else {
-
POINT p;
p.x = p_to.x;
p.y = p_to.y;
@@ -161,7 +154,6 @@ int DisplayServerWindows::mouse_get_button_state() const {
}
void DisplayServerWindows::clipboard_set(const String &p_text) {
-
_THREAD_SAFE_METHOD_
if (!windows.has(last_focused_window)) {
@@ -201,7 +193,6 @@ void DisplayServerWindows::clipboard_set(const String &p_text) {
CloseClipboard();
}
String DisplayServerWindows::clipboard_get() const {
-
_THREAD_SAFE_METHOD_
if (!windows.has(last_focused_window)) {
@@ -214,26 +205,20 @@ String DisplayServerWindows::clipboard_get() const {
};
if (IsClipboardFormatAvailable(CF_UNICODETEXT)) {
-
HGLOBAL mem = GetClipboardData(CF_UNICODETEXT);
if (mem != nullptr) {
-
LPWSTR ptr = (LPWSTR)GlobalLock(mem);
if (ptr != nullptr) {
-
ret = String((CharType *)ptr);
GlobalUnlock(mem);
};
};
} else if (IsClipboardFormatAvailable(CF_TEXT)) {
-
HGLOBAL mem = GetClipboardData(CF_UNICODETEXT);
if (mem != nullptr) {
-
LPTSTR ptr = (LPTSTR)GlobalLock(mem);
if (ptr != nullptr) {
-
ret.parse_utf8((const char *)ptr);
GlobalUnlock(mem);
};
@@ -252,7 +237,6 @@ typedef struct {
} EnumScreenData;
static BOOL CALLBACK _MonitorEnumProcScreen(HMONITOR hMonitor, HDC hdcMonitor, LPRECT lprcMonitor, LPARAM dwData) {
-
EnumScreenData *data = (EnumScreenData *)dwData;
if (data->monitor == hMonitor) {
data->screen = data->count;
@@ -263,7 +247,6 @@ static BOOL CALLBACK _MonitorEnumProcScreen(HMONITOR hMonitor, HDC hdcMonitor, L
}
static BOOL CALLBACK _MonitorEnumProcCount(HMONITOR hMonitor, HDC hdcMonitor, LPRECT lprcMonitor, LPARAM dwData) {
-
int *data = (int *)dwData;
(*data)++;
return TRUE;
@@ -284,7 +267,6 @@ typedef struct {
} EnumPosData;
static BOOL CALLBACK _MonitorEnumProcPos(HMONITOR hMonitor, HDC hdcMonitor, LPRECT lprcMonitor, LPARAM dwData) {
-
EnumPosData *data = (EnumPosData *)dwData;
if (data->count == data->screen) {
data->pos.x = lprcMonitor->left;
@@ -295,7 +277,6 @@ static BOOL CALLBACK _MonitorEnumProcPos(HMONITOR hMonitor, HDC hdcMonitor, LPRE
return TRUE;
}
Point2i DisplayServerWindows::screen_get_position(int p_screen) const {
-
_THREAD_SAFE_METHOD_
EnumPosData data = { 0, p_screen == SCREEN_OF_MAIN_WINDOW ? window_get_current_screen() : p_screen, Point2() };
@@ -316,7 +297,6 @@ typedef struct {
} EnumRectData;
static BOOL CALLBACK _MonitorEnumProcSize(HMONITOR hMonitor, HDC hdcMonitor, LPRECT lprcMonitor, LPARAM dwData) {
-
EnumSizeData *data = (EnumSizeData *)dwData;
if (data->count == data->screen) {
data->size.x = lprcMonitor->right - lprcMonitor->left;
@@ -328,7 +308,6 @@ static BOOL CALLBACK _MonitorEnumProcSize(HMONITOR hMonitor, HDC hdcMonitor, LPR
}
Size2i DisplayServerWindows::screen_get_size(int p_screen) const {
-
_THREAD_SAFE_METHOD_
EnumSizeData data = { 0, p_screen == SCREEN_OF_MAIN_WINDOW ? window_get_current_screen() : p_screen, Size2() };
@@ -337,7 +316,6 @@ Size2i DisplayServerWindows::screen_get_size(int p_screen) const {
}
static BOOL CALLBACK _MonitorEnumProcUsableSize(HMONITOR hMonitor, HDC hdcMonitor, LPRECT lprcMonitor, LPARAM dwData) {
-
EnumRectData *data = (EnumRectData *)dwData;
if (data->count == data->screen) {
MONITORINFO minfo;
@@ -356,7 +334,6 @@ static BOOL CALLBACK _MonitorEnumProcUsableSize(HMONITOR hMonitor, HDC hdcMonito
}
Rect2i DisplayServerWindows::screen_get_usable_rect(int p_screen) const {
-
_THREAD_SAFE_METHOD_
EnumRectData data = { 0, p_screen == SCREEN_OF_MAIN_WINDOW ? window_get_current_screen() : p_screen, Rect2i() };
@@ -378,7 +355,6 @@ enum _MonitorDpiType {
};
static int QueryDpiForMonitor(HMONITOR hmon, _MonitorDpiType dpiType = MDT_Default) {
-
int dpiX = 96, dpiY = 96;
static HMODULE Shcore = nullptr;
@@ -401,7 +377,6 @@ static int QueryDpiForMonitor(HMONITOR hmon, _MonitorDpiType dpiType = MDT_Defau
if (hmon && (Shcore != (HMODULE)INVALID_HANDLE_VALUE)) {
hr = getDPIForMonitor(hmon, dpiType /*MDT_Effective_DPI*/, &x, &y);
if (SUCCEEDED(hr) && (x > 0) && (y > 0)) {
-
dpiX = (int)x;
dpiY = (int)y;
}
@@ -425,7 +400,6 @@ static int QueryDpiForMonitor(HMONITOR hmon, _MonitorDpiType dpiType = MDT_Defau
}
static BOOL CALLBACK _MonitorEnumProcDpi(HMONITOR hMonitor, HDC hdcMonitor, LPRECT lprcMonitor, LPARAM dwData) {
-
EnumDpiData *data = (EnumDpiData *)dwData;
if (data->count == data->screen) {
data->dpi = QueryDpiForMonitor(hMonitor);
@@ -462,7 +436,6 @@ bool DisplayServerWindows::screen_is_kept_on() const {
}
Vector<DisplayServer::WindowID> DisplayServerWindows::get_window_list() const {
-
_THREAD_SAFE_METHOD_
Vector<DisplayServer::WindowID> ret;
@@ -473,7 +446,6 @@ Vector<DisplayServer::WindowID> DisplayServerWindows::get_window_list() const {
}
DisplayServer::WindowID DisplayServerWindows::get_window_at_screen_position(const Point2i &p_position) const {
-
POINT p;
p.x = p_position.x;
p.y = p_position.y;
@@ -488,7 +460,6 @@ DisplayServer::WindowID DisplayServerWindows::get_window_at_screen_position(cons
}
DisplayServer::WindowID DisplayServerWindows::create_sub_window(WindowMode p_mode, uint32_t p_flags, const Rect2i &p_rect) {
-
_THREAD_SAFE_METHOD_
WindowID window_id = _create_window(p_mode, p_flags, p_rect);
@@ -519,7 +490,6 @@ DisplayServer::WindowID DisplayServerWindows::create_sub_window(WindowMode p_mod
return window_id;
}
void DisplayServerWindows::delete_sub_window(WindowID p_window) {
-
_THREAD_SAFE_METHOD_
ERR_FAIL_COND(!windows.has(p_window));
@@ -550,7 +520,6 @@ void DisplayServerWindows::delete_sub_window(WindowID p_window) {
}
void DisplayServerWindows::window_attach_instance_id(ObjectID p_instance, WindowID p_window) {
-
_THREAD_SAFE_METHOD_
ERR_FAIL_COND(!windows.has(p_window));
@@ -558,7 +527,6 @@ void DisplayServerWindows::window_attach_instance_id(ObjectID p_instance, Window
}
ObjectID DisplayServerWindows::window_get_attached_instance_id(WindowID p_window) const {
-
_THREAD_SAFE_METHOD_
ERR_FAIL_COND_V(!windows.has(p_window), ObjectID());
@@ -566,7 +534,6 @@ ObjectID DisplayServerWindows::window_get_attached_instance_id(WindowID p_window
}
void DisplayServerWindows::window_set_rect_changed_callback(const Callable &p_callable, WindowID p_window) {
-
_THREAD_SAFE_METHOD_
ERR_FAIL_COND(!windows.has(p_window));
@@ -574,21 +541,18 @@ void DisplayServerWindows::window_set_rect_changed_callback(const Callable &p_ca
}
void DisplayServerWindows::window_set_window_event_callback(const Callable &p_callable, WindowID p_window) {
-
_THREAD_SAFE_METHOD_
ERR_FAIL_COND(!windows.has(p_window));
windows[p_window].event_callback = p_callable;
}
void DisplayServerWindows::window_set_input_event_callback(const Callable &p_callable, WindowID p_window) {
-
_THREAD_SAFE_METHOD_
ERR_FAIL_COND(!windows.has(p_window));
windows[p_window].input_event_callback = p_callable;
}
void DisplayServerWindows::window_set_input_text_callback(const Callable &p_callable, WindowID p_window) {
-
_THREAD_SAFE_METHOD_
ERR_FAIL_COND(!windows.has(p_window));
@@ -596,7 +560,6 @@ void DisplayServerWindows::window_set_input_text_callback(const Callable &p_call
}
void DisplayServerWindows::window_set_drop_files_callback(const Callable &p_callable, WindowID p_window) {
-
_THREAD_SAFE_METHOD_
ERR_FAIL_COND(!windows.has(p_window));
@@ -604,7 +567,6 @@ void DisplayServerWindows::window_set_drop_files_callback(const Callable &p_call
}
void DisplayServerWindows::window_set_title(const String &p_title, WindowID p_window) {
-
_THREAD_SAFE_METHOD_
ERR_FAIL_COND(!windows.has(p_window));
@@ -612,7 +574,6 @@ void DisplayServerWindows::window_set_title(const String &p_title, WindowID p_wi
}
int DisplayServerWindows::window_get_current_screen(WindowID p_window) const {
-
_THREAD_SAFE_METHOD_
ERR_FAIL_COND_V(!windows.has(p_window), -1);
@@ -622,7 +583,6 @@ int DisplayServerWindows::window_get_current_screen(WindowID p_window) const {
return data.screen;
}
void DisplayServerWindows::window_set_current_screen(int p_screen, WindowID p_window) {
-
_THREAD_SAFE_METHOD_
ERR_FAIL_COND(!windows.has(p_window));
@@ -633,7 +593,6 @@ void DisplayServerWindows::window_set_current_screen(int p_screen, WindowID p_wi
}
Point2i DisplayServerWindows::window_get_position(WindowID p_window) const {
-
_THREAD_SAFE_METHOD_
ERR_FAIL_COND_V(!windows.has(p_window), Point2i());
@@ -659,7 +618,6 @@ Point2i DisplayServerWindows::window_get_position(WindowID p_window) const {
#endif
}
void DisplayServerWindows::_update_real_mouse_position(WindowID p_window) {
-
POINT mouse_pos;
if (GetCursorPos(&mouse_pos) && ScreenToClient(windows[p_window].hWnd, &mouse_pos)) {
if (mouse_pos.x > 0 && mouse_pos.y > 0 && mouse_pos.x <= windows[p_window].width && mouse_pos.y <= windows[p_window].height) {
@@ -671,7 +629,6 @@ void DisplayServerWindows::_update_real_mouse_position(WindowID p_window) {
}
}
void DisplayServerWindows::window_set_position(const Point2i &p_position, WindowID p_window) {
-
_THREAD_SAFE_METHOD_
ERR_FAIL_COND(!windows.has(p_window));
@@ -712,7 +669,6 @@ void DisplayServerWindows::window_set_position(const Point2i &p_position, Window
}
void DisplayServerWindows::window_set_transient(WindowID p_window, WindowID p_parent) {
-
_THREAD_SAFE_METHOD_
ERR_FAIL_COND(p_window == p_parent);
@@ -749,7 +705,6 @@ void DisplayServerWindows::window_set_transient(WindowID p_window, WindowID p_pa
}
void DisplayServerWindows::window_set_max_size(const Size2i p_size, WindowID p_window) {
-
_THREAD_SAFE_METHOD_
ERR_FAIL_COND(!windows.has(p_window));
@@ -762,7 +717,6 @@ void DisplayServerWindows::window_set_max_size(const Size2i p_size, WindowID p_w
wd.max_size = p_size;
}
Size2i DisplayServerWindows::window_get_max_size(WindowID p_window) const {
-
_THREAD_SAFE_METHOD_
ERR_FAIL_COND_V(!windows.has(p_window), Size2i());
@@ -771,7 +725,6 @@ Size2i DisplayServerWindows::window_get_max_size(WindowID p_window) const {
}
void DisplayServerWindows::window_set_min_size(const Size2i p_size, WindowID p_window) {
-
_THREAD_SAFE_METHOD_
ERR_FAIL_COND(!windows.has(p_window));
@@ -784,7 +737,6 @@ void DisplayServerWindows::window_set_min_size(const Size2i p_size, WindowID p_w
wd.min_size = p_size;
}
Size2i DisplayServerWindows::window_get_min_size(WindowID p_window) const {
-
_THREAD_SAFE_METHOD_
ERR_FAIL_COND_V(!windows.has(p_window), Size2i());
@@ -793,7 +745,6 @@ Size2i DisplayServerWindows::window_get_min_size(WindowID p_window) const {
}
void DisplayServerWindows::window_set_size(const Size2i p_size, WindowID p_window) {
-
_THREAD_SAFE_METHOD_
ERR_FAIL_COND(!windows.has(p_window));
@@ -838,7 +789,6 @@ void DisplayServerWindows::window_set_size(const Size2i p_size, WindowID p_windo
}
}
Size2i DisplayServerWindows::window_get_size(WindowID p_window) const {
-
_THREAD_SAFE_METHOD_
ERR_FAIL_COND_V(!windows.has(p_window), Size2i());
@@ -855,7 +805,6 @@ Size2i DisplayServerWindows::window_get_size(WindowID p_window) const {
return Size2();
}
Size2i DisplayServerWindows::window_get_real_size(WindowID p_window) const {
-
_THREAD_SAFE_METHOD_
ERR_FAIL_COND_V(!windows.has(p_window), Size2i());
@@ -869,7 +818,6 @@ Size2i DisplayServerWindows::window_get_real_size(WindowID p_window) const {
}
void DisplayServerWindows::_get_window_style(bool p_main_window, bool p_fullscreen, bool p_borderless, bool p_resizable, bool p_maximized, bool p_no_activate_focus, DWORD &r_style, DWORD &r_style_ex) {
-
r_style = 0;
r_style_ex = WS_EX_WINDOWEDGE;
if (p_main_window) {
@@ -882,7 +830,6 @@ void DisplayServerWindows::_get_window_style(bool p_main_window, bool p_fullscre
// r_style_ex |= WS_EX_TOOLWINDOW;
//}
} else {
-
if (p_resizable) {
if (p_maximized) {
r_style = WS_OVERLAPPEDWINDOW | WS_MAXIMIZE;
@@ -901,7 +848,6 @@ void DisplayServerWindows::_get_window_style(bool p_main_window, bool p_fullscre
}
void DisplayServerWindows::_update_window_style(WindowID p_window, bool p_repaint, bool p_maximized) {
-
_THREAD_SAFE_METHOD_
ERR_FAIL_COND(!windows.has(p_window));
@@ -925,14 +871,12 @@ void DisplayServerWindows::_update_window_style(WindowID p_window, bool p_repain
}
void DisplayServerWindows::window_set_mode(WindowMode p_mode, WindowID p_window) {
-
_THREAD_SAFE_METHOD_
ERR_FAIL_COND(!windows.has(p_window));
WindowData &wd = windows[p_window];
if (wd.fullscreen && p_mode != WINDOW_MODE_FULLSCREEN) {
-
RECT rect;
wd.fullscreen = false;
@@ -954,21 +898,18 @@ void DisplayServerWindows::window_set_mode(WindowMode p_mode, WindowID p_window)
}
if (p_mode == WINDOW_MODE_MAXIMIZED) {
-
ShowWindow(wd.hWnd, SW_MAXIMIZE);
wd.maximized = true;
wd.minimized = false;
}
if (p_mode == WINDOW_MODE_WINDOWED) {
-
ShowWindow(wd.hWnd, SW_RESTORE);
wd.maximized = false;
wd.minimized = false;
}
if (p_mode == WINDOW_MODE_MINIMIZED) {
-
ShowWindow(wd.hWnd, SW_MINIMIZE);
wd.maximized = false;
wd.minimized = true;
@@ -998,7 +939,6 @@ void DisplayServerWindows::window_set_mode(WindowMode p_mode, WindowID p_window)
}
}
DisplayServer::WindowMode DisplayServerWindows::window_get_mode(WindowID p_window) const {
-
_THREAD_SAFE_METHOD_
ERR_FAIL_COND_V(!windows.has(p_window), WINDOW_MODE_WINDOWED);
@@ -1016,7 +956,6 @@ DisplayServer::WindowMode DisplayServerWindows::window_get_mode(WindowID p_windo
}
bool DisplayServerWindows::window_is_maximize_allowed(WindowID p_window) const {
-
_THREAD_SAFE_METHOD_
ERR_FAIL_COND_V(!windows.has(p_window), false);
@@ -1027,34 +966,28 @@ bool DisplayServerWindows::window_is_maximize_allowed(WindowID p_window) const {
}
void DisplayServerWindows::window_set_flag(WindowFlags p_flag, bool p_enabled, WindowID p_window) {
-
_THREAD_SAFE_METHOD_
ERR_FAIL_COND(!windows.has(p_window));
WindowData &wd = windows[p_window];
switch (p_flag) {
case WINDOW_FLAG_RESIZE_DISABLED: {
-
wd.resizable = !p_enabled;
_update_window_style(p_window);
} break;
case WINDOW_FLAG_BORDERLESS: {
-
wd.borderless = p_enabled;
_update_window_style(p_window);
} break;
case WINDOW_FLAG_ALWAYS_ON_TOP: {
-
ERR_FAIL_COND_MSG(wd.transient_parent != INVALID_WINDOW_ID && p_enabled, "Transient windows can't become on top");
wd.always_on_top = p_enabled;
_update_window_style(p_window);
} break;
case WINDOW_FLAG_TRANSPARENT: {
-
// FIXME: Implement.
} break;
case WINDOW_FLAG_NO_FOCUS: {
-
wd.no_focus = p_enabled;
_update_window_style(p_window);
} break;
@@ -1064,30 +997,24 @@ void DisplayServerWindows::window_set_flag(WindowFlags p_flag, bool p_enabled, W
}
bool DisplayServerWindows::window_get_flag(WindowFlags p_flag, WindowID p_window) const {
-
_THREAD_SAFE_METHOD_
ERR_FAIL_COND_V(!windows.has(p_window), false);
const WindowData &wd = windows[p_window];
switch (p_flag) {
case WINDOW_FLAG_RESIZE_DISABLED: {
-
return !wd.resizable;
} break;
case WINDOW_FLAG_BORDERLESS: {
-
return wd.borderless;
} break;
case WINDOW_FLAG_ALWAYS_ON_TOP: {
-
return wd.always_on_top;
} break;
case WINDOW_FLAG_TRANSPARENT: {
-
// FIXME: Implement.
} break;
case WINDOW_FLAG_NO_FOCUS: {
-
return wd.no_focus;
} break;
case WINDOW_FLAG_MAX:
@@ -1098,7 +1025,6 @@ bool DisplayServerWindows::window_get_flag(WindowFlags p_flag, WindowID p_window
}
void DisplayServerWindows::window_request_attention(WindowID p_window) {
-
_THREAD_SAFE_METHOD_
ERR_FAIL_COND(!windows.has(p_window));
@@ -1113,7 +1039,6 @@ void DisplayServerWindows::window_request_attention(WindowID p_window) {
FlashWindowEx(&info);
}
void DisplayServerWindows::window_move_to_foreground(WindowID p_window) {
-
_THREAD_SAFE_METHOD_
ERR_FAIL_COND(!windows.has(p_window));
@@ -1123,7 +1048,6 @@ void DisplayServerWindows::window_move_to_foreground(WindowID p_window) {
}
bool DisplayServerWindows::window_can_draw(WindowID p_window) const {
-
_THREAD_SAFE_METHOD_
ERR_FAIL_COND_V(!windows.has(p_window), false);
@@ -1132,7 +1056,6 @@ bool DisplayServerWindows::window_can_draw(WindowID p_window) const {
}
bool DisplayServerWindows::can_any_window_draw() const {
-
_THREAD_SAFE_METHOD_
for (Map<WindowID, WindowData>::Element *E = windows.front(); E; E = E->next()) {
@@ -1145,7 +1068,6 @@ bool DisplayServerWindows::can_any_window_draw() const {
}
void DisplayServerWindows::window_set_ime_active(const bool p_active, WindowID p_window) {
-
_THREAD_SAFE_METHOD_
ERR_FAIL_COND(!windows.has(p_window));
@@ -1160,7 +1082,6 @@ void DisplayServerWindows::window_set_ime_active(const bool p_active, WindowID p
}
}
void DisplayServerWindows::window_set_ime_position(const Point2i &p_pos, WindowID p_window) {
-
_THREAD_SAFE_METHOD_
ERR_FAIL_COND(!windows.has(p_window));
@@ -1181,7 +1102,6 @@ void DisplayServerWindows::window_set_ime_position(const Point2i &p_pos, WindowI
}
void DisplayServerWindows::console_set_visible(bool p_enabled) {
-
_THREAD_SAFE_METHOD_
if (console_visible == p_enabled)
@@ -1194,7 +1114,6 @@ bool DisplayServerWindows::is_console_visible() const {
}
void DisplayServerWindows::cursor_set_shape(CursorShape p_shape) {
-
_THREAD_SAFE_METHOD_
ERR_FAIL_INDEX(p_shape, CURSOR_MAX);
@@ -1240,7 +1159,6 @@ DisplayServer::CursorShape DisplayServerWindows::cursor_get_shape() const {
}
void DisplayServerWindows::GetMaskBitmaps(HBITMAP hSourceBitmap, COLORREF clrTransparent, OUT HBITMAP &hAndMaskBitmap, OUT HBITMAP &hXorMaskBitmap) {
-
// Get the system display DC
HDC hDC = GetDC(nullptr);
@@ -1290,11 +1208,9 @@ void DisplayServerWindows::GetMaskBitmaps(HBITMAP hSourceBitmap, COLORREF clrTra
}
void DisplayServerWindows::cursor_set_custom_image(const RES &p_cursor, CursorShape p_shape, const Vector2 &p_hotspot) {
-
_THREAD_SAFE_METHOD_
if (p_cursor.is_valid()) {
-
Map<CursorShape, Vector<Variant>>::Element *cursor_c = cursors_cache.find(p_shape);
if (cursor_c) {
@@ -1433,7 +1349,6 @@ void DisplayServerWindows::enable_for_stealing_focus(OS::ProcessID pid) {
}
DisplayServer::LatinKeyboardVariant DisplayServerWindows::get_latin_keyboard_variant() const {
-
_THREAD_SAFE_METHOD_
unsigned long azerty[] = {
@@ -1500,7 +1415,6 @@ DisplayServer::LatinKeyboardVariant DisplayServerWindows::get_latin_keyboard_var
}
void DisplayServerWindows::process_events() {
-
_THREAD_SAFE_METHOD_
MSG msg;
@@ -1510,7 +1424,6 @@ void DisplayServerWindows::process_events() {
}
while (PeekMessageW(&msg, nullptr, 0, 0, PM_REMOVE)) {
-
TranslateMessage(&msg);
DispatchMessageW(&msg);
}
@@ -1522,7 +1435,6 @@ void DisplayServerWindows::process_events() {
}
void DisplayServerWindows::force_process_and_drop_events() {
-
_THREAD_SAFE_METHOD_
drop_events = true;
@@ -1538,7 +1450,6 @@ void DisplayServerWindows::swap_buffers() {
}
void DisplayServerWindows::set_native_icon(const String &p_filename) {
-
_THREAD_SAFE_METHOD_
FileAccess *f = FileAccess::open(p_filename, FileAccess::READ);
@@ -1632,7 +1543,6 @@ void DisplayServerWindows::set_native_icon(const String &p_filename) {
memdelete(icon_dir);
}
void DisplayServerWindows::set_icon(const Ref<Image> &p_icon) {
-
_THREAD_SAFE_METHOD_
ERR_FAIL_COND(!p_icon.is_valid());
@@ -1664,9 +1574,7 @@ void DisplayServerWindows::set_icon(const Ref<Image> &p_icon) {
const uint8_t *r = icon->get_data().ptr();
for (int i = 0; i < h; i++) {
-
for (int j = 0; j < w; j++) {
-
const uint8_t *rpx = &r[((h - i - 1) * w + j) * 4];
uint8_t *wpx = &wr[(i * w + j) * 4];
wpx[0] = rpx[2];
@@ -1703,7 +1611,6 @@ void DisplayServerWindows::set_context(Context p_context) {
#define IsTouchEvent(dw) (IsPenEvent(dw) && ((dw)&0x80))
void DisplayServerWindows::_touch_event(WindowID p_window, bool p_pressed, float p_x, float p_y, int idx) {
-
// Defensive
if (touch_state.has(idx) == p_pressed)
return;
@@ -1725,7 +1632,6 @@ void DisplayServerWindows::_touch_event(WindowID p_window, bool p_pressed, float
}
void DisplayServerWindows::_drag_event(WindowID p_window, float p_x, float p_y, int idx) {
-
Map<int, Vector2>::Element *curr = touch_state.find(idx);
// Defensive
if (!curr)
@@ -1747,7 +1653,6 @@ void DisplayServerWindows::_drag_event(WindowID p_window, float p_x, float p_y,
}
void DisplayServerWindows::_send_window_event(const WindowData &wd, WindowEvent p_event) {
-
if (!wd.event_callback.is_null()) {
Variant event = int(p_event);
Variant *eventp = &event;
@@ -1762,7 +1667,6 @@ void DisplayServerWindows::_dispatch_input_events(const Ref<InputEvent> &p_event
}
void DisplayServerWindows::_dispatch_input_event(const Ref<InputEvent> &p_event) {
-
Variant ev = p_event;
Variant *evp = &ev;
Variant ret;
@@ -1790,11 +1694,8 @@ void DisplayServerWindows::_dispatch_input_event(const Ref<InputEvent> &p_event)
}
LRESULT DisplayServerWindows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) {
-
if (drop_events) {
-
if (user_proc) {
-
return CallWindowProcW(user_proc, hWnd, uMsg, wParam, lParam);
} else {
return DefWindowProcW(hWnd, uMsg, wParam, lParam);
@@ -1813,7 +1714,6 @@ LRESULT DisplayServerWindows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
switch (uMsg) // Check For Windows Messages
{
case WM_SETFOCUS: {
-
windows[window_id].window_has_focus = true;
last_focused_window = window_id;
@@ -1842,7 +1742,6 @@ LRESULT DisplayServerWindows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
windows[window_id].minimized = HIWORD(wParam) != 0;
if (LOWORD(wParam) == WA_ACTIVE || LOWORD(wParam) == WA_CLICKACTIVE) {
-
_send_window_event(windows[window_id], WINDOW_EVENT_FOCUS_IN);
windows[window_id].window_focused = true;
alt_mem = false;
@@ -1899,13 +1798,11 @@ LRESULT DisplayServerWindows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
case WM_CLOSE: // Did We Receive A Close Message?
{
-
_send_window_event(windows[window_id], WINDOW_EVENT_CLOSE_REQUEST);
return 0; // Jump Back
}
case WM_MOUSELEAVE: {
-
old_invalid = true;
outside = true;
@@ -1959,7 +1856,6 @@ LRESULT DisplayServerWindows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
mm->set_relative(Vector2(raw->data.mouse.lLastX, raw->data.mouse.lLastY));
} else if (raw->data.mouse.usFlags == MOUSE_MOVE_ABSOLUTE) {
-
int nScreenWidth = GetSystemMetrics(SM_CXVIRTUALSCREEN);
int nScreenHeight = GetSystemMetrics(SM_CYVIRTUALSCREEN);
int nScreenLeft = GetSystemMetrics(SM_XVIRTUALSCREEN);
@@ -2008,7 +1904,6 @@ LRESULT DisplayServerWindows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
if (!OS::get_singleton()->is_wintab_disabled() && wintab_available && windows[window_id].wtctx) {
PACKET packet;
if (wintab_WTPacket(windows[window_id].wtctx, wParam, &packet)) {
-
float pressure = float(packet.pkNormalPressure - windows[window_id].min_pressure) / float(windows[window_id].max_pressure - windows[window_id].min_pressure);
windows[window_id].last_pressure = pressure;
windows[window_id].last_pressure_update = 0;
@@ -2166,7 +2061,6 @@ LRESULT DisplayServerWindows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
mm->set_global_position(Vector2(coords.x, coords.y));
if (mouse_mode == MOUSE_MODE_CAPTURED) {
-
Point2i c(windows[window_id].width / 2, windows[window_id].height / 2);
old_x = c.x;
old_y = c.y;
@@ -2187,7 +2081,6 @@ LRESULT DisplayServerWindows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
mm->set_speed(Input::get_singleton()->get_last_mouse_speed());
if (old_invalid) {
-
old_x = mm->get_position().x;
old_y = mm->get_position().y;
old_invalid = false;
@@ -2269,7 +2162,6 @@ LRESULT DisplayServerWindows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
mm->set_global_position(Vector2(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)));
if (mouse_mode == MOUSE_MODE_CAPTURED) {
-
Point2i c(windows[window_id].width / 2, windows[window_id].height / 2);
old_x = c.x;
old_y = c.y;
@@ -2290,7 +2182,6 @@ LRESULT DisplayServerWindows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
mm->set_speed(Input::get_singleton()->get_last_mouse_speed());
if (old_invalid) {
-
old_x = mm->get_position().x;
old_y = mm->get_position().y;
old_invalid = false;
@@ -2325,7 +2216,6 @@ LRESULT DisplayServerWindows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
case WM_XBUTTONDBLCLK:
case WM_XBUTTONDOWN:
case WM_XBUTTONUP: {
-
Ref<InputEventMouseButton> mb;
mb.instance();
mb->set_window_id(window_id);
@@ -2371,7 +2261,6 @@ LRESULT DisplayServerWindows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
mb->set_doubleclick(true);
} break;
case WM_MOUSEWHEEL: {
-
mb->set_pressed(true);
int motion = (short)HIWORD(wParam);
if (!motion)
@@ -2384,7 +2273,6 @@ LRESULT DisplayServerWindows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
} break;
case WM_MOUSEHWHEEL: {
-
mb->set_pressed(true);
int motion = (short)HIWORD(wParam);
if (!motion)
@@ -2399,7 +2287,6 @@ LRESULT DisplayServerWindows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
}
} break;
case WM_XBUTTONDOWN: {
-
mb->set_pressed(true);
if (HIWORD(wParam) == XBUTTON1)
mb->set_button_index(BUTTON_XBUTTON1);
@@ -2407,7 +2294,6 @@ LRESULT DisplayServerWindows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
mb->set_button_index(BUTTON_XBUTTON2);
} break;
case WM_XBUTTONUP: {
-
mb->set_pressed(false);
if (HIWORD(wParam) == XBUTTON1)
mb->set_button_index(BUTTON_XBUTTON1);
@@ -2415,7 +2301,6 @@ LRESULT DisplayServerWindows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
mb->set_button_index(BUTTON_XBUTTON2);
} break;
case WM_XBUTTONDBLCLK: {
-
mb->set_pressed(true);
if (HIWORD(wParam) == XBUTTON1)
mb->set_button_index(BUTTON_XBUTTON1);
@@ -2441,17 +2326,14 @@ LRESULT DisplayServerWindows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
mb->set_position(Vector2(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)));
if (mouse_mode == MOUSE_MODE_CAPTURED && !use_raw_input) {
-
mb->set_position(Vector2(old_x, old_y));
}
if (uMsg != WM_MOUSEWHEEL && uMsg != WM_MOUSEHWHEEL) {
if (mb->is_pressed()) {
-
if (++pressrc > 0 && mouse_mode != MOUSE_MODE_CAPTURED)
SetCapture(hWnd);
} else {
-
if (--pressrc <= 0) {
if (mouse_mode != MOUSE_MODE_CAPTURED) {
ReleaseCapture();
@@ -2492,7 +2374,6 @@ LRESULT DisplayServerWindows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
windows[window_id].last_pos = Point2(x, y);
if (!windows[window_id].rect_changed_callback.is_null()) {
-
Variant size = Rect2i(windows[window_id].last_pos.x, windows[window_id].last_pos.y, windows[window_id].width, windows[window_id].height);
Variant *sizep = &size;
Variant ret;
@@ -2524,7 +2405,6 @@ LRESULT DisplayServerWindows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
}
if (!windows[window_id].rect_changed_callback.is_null()) {
-
Variant size = Rect2i(windows[window_id].last_pos.x, windows[window_id].last_pos.y, windows[window_id].width, windows[window_id].height);
Variant *sizep = &size;
Variant ret;
@@ -2588,7 +2468,6 @@ LRESULT DisplayServerWindows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
case WM_SYSKEYUP:
case WM_KEYUP:
case WM_KEYDOWN: {
-
if (wParam == VK_SHIFT)
shift_mem = uMsg == WM_KEYDOWN;
if (wParam == VK_CONTROL)
@@ -2612,7 +2491,6 @@ LRESULT DisplayServerWindows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
[[fallthrough]];
}
case WM_CHAR: {
-
ERR_BREAK(key_event_pos >= KEY_EVENT_BUFFER_SIZE);
// Make sure we don't include modifiers for the modifier key itself.
@@ -2635,12 +2513,10 @@ LRESULT DisplayServerWindows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
} break;
case WM_INPUTLANGCHANGEREQUEST: {
-
// FIXME: Do something?
} break;
case WM_TOUCH: {
-
BOOL bHandled = FALSE;
UINT cInputs = LOWORD(wParam);
PTOUCHINPUT pInputs = memnew_arr(TOUCHINPUT, cInputs);
@@ -2655,10 +2531,8 @@ LRESULT DisplayServerWindows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
ScreenToClient(hWnd, &touch_pos);
//do something with each touch input entry
if (ti.dwFlags & TOUCHEVENTF_MOVE) {
-
_drag_event(window_id, touch_pos.x, touch_pos.y, ti.dwID);
} else if (ti.dwFlags & (TOUCHEVENTF_UP | TOUCHEVENTF_DOWN)) {
-
_touch_event(window_id, ti.dwFlags & TOUCHEVENTF_DOWN, touch_pos.x, touch_pos.y, ti.dwID);
};
}
@@ -2678,7 +2552,6 @@ LRESULT DisplayServerWindows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
} break;
case WM_DEVICECHANGE: {
-
joypad->probe_joypads();
} break;
case WM_SETCURSOR: {
@@ -2701,7 +2574,6 @@ LRESULT DisplayServerWindows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
} break;
case WM_DROPFILES: {
-
HDROP hDropInfo = (HDROP)wParam;
const int buffsize = 4096;
wchar_t buf[buffsize];
@@ -2711,7 +2583,6 @@ LRESULT DisplayServerWindows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
Vector<String> files;
for (int i = 0; i < fcount; i++) {
-
DragQueryFileW(hDropInfo, i, buf, buffsize);
String file = buf;
files.push_back(file);
@@ -2728,9 +2599,7 @@ LRESULT DisplayServerWindows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
} break;
default: {
-
if (user_proc) {
-
return CallWindowProcW(user_proc, hWnd, uMsg, wParam, lParam);
};
};
@@ -2740,7 +2609,6 @@ LRESULT DisplayServerWindows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
}
LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) {
-
DisplayServerWindows *ds_win = static_cast<DisplayServerWindows *>(DisplayServer::get_singleton());
if (ds_win)
return ds_win->WndProc(hWnd, uMsg, wParam, lParam);
@@ -2749,12 +2617,9 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) {
}
void DisplayServerWindows::_process_key_events() {
-
for (int i = 0; i < key_event_pos; i++) {
-
KeyEvent &ke = key_event_buffer[i];
switch (ke.uMsg) {
-
case WM_CHAR: {
if ((i == 0 && ke.uMsg == WM_CHAR) || (i > 0 && key_event_buffer[i - 1].uMsg == WM_CHAR)) {
Ref<InputEventKey> k;
@@ -2784,7 +2649,6 @@ void DisplayServerWindows::_process_key_events() {
} break;
case WM_KEYUP:
case WM_KEYDOWN: {
-
Ref<InputEventKey> k;
k.instance();
@@ -2828,7 +2692,6 @@ void DisplayServerWindows::_process_key_events() {
}
DisplayServer::WindowID DisplayServerWindows::_create_window(WindowMode p_mode, uint32_t p_flags, const Rect2i &p_rect) {
-
DWORD dwExStyle;
DWORD dwStyle;
@@ -2953,7 +2816,6 @@ typedef enum _SHC_PROCESS_DPI_AWARENESS {
} SHC_PROCESS_DPI_AWARENESS;
DisplayServerWindows::DisplayServerWindows(const String &p_rendering_driver, WindowMode p_mode, uint32_t p_flags, const Vector2i &p_resolution, Error &r_error) {
-
//Note: Wacom WinTab driver API for pen input, for devices incompatible with Windows Ink.
HMODULE wintab_lib = LoadLibraryW(L"wintab32.dll");
if (wintab_lib) {
@@ -3042,7 +2904,6 @@ DisplayServerWindows::DisplayServerWindows(const String &p_rendering_driver, Win
#if defined(VULKAN_ENABLED)
if (rendering_driver == "vulkan") {
-
context_vulkan = memnew(VulkanContextWindows);
if (context_vulkan->initialize() != OK) {
memdelete(context_vulkan);
@@ -3054,7 +2915,6 @@ DisplayServerWindows::DisplayServerWindows(const String &p_rendering_driver, Win
#endif
#if defined(OPENGL_ENABLED)
if (rendering_driver_index == VIDEO_DRIVER_GLES2) {
-
context_gles2 = memnew(ContextGL_Windows(hWnd, false));
if (context_gles2->initialize() != OK) {
@@ -3093,7 +2953,6 @@ DisplayServerWindows::DisplayServerWindows(const String &p_rendering_driver, Win
#if defined(VULKAN_ENABLED)
if (rendering_driver == "vulkan") {
-
rendering_device_vulkan = memnew(RenderingDeviceVulkan);
rendering_device_vulkan->initialize(context_vulkan);
@@ -3144,17 +3003,14 @@ Vector<String> DisplayServerWindows::get_rendering_drivers_func() {
}
DisplayServer *DisplayServerWindows::create_func(const String &p_rendering_driver, WindowMode p_mode, uint32_t p_flags, const Vector2i &p_resolution, Error &r_error) {
-
return memnew(DisplayServerWindows(p_rendering_driver, p_mode, p_flags, p_resolution, r_error));
}
void DisplayServerWindows::register_windows_driver() {
-
register_create_function("windows", create_func, get_rendering_drivers_func);
}
DisplayServerWindows::~DisplayServerWindows() {
-
delete joypad;
touch_state.clear();
@@ -3162,7 +3018,6 @@ DisplayServerWindows::~DisplayServerWindows() {
#if defined(VULKAN_ENABLED)
if (rendering_driver == "vulkan") {
-
if (rendering_device_vulkan) {
rendering_device_vulkan->finalize();
memdelete(rendering_device_vulkan);
diff --git a/platform/windows/display_server_windows.h b/platform/windows/display_server_windows.h
index 4f5bdbac5b..ea08b1899f 100644
--- a/platform/windows/display_server_windows.h
+++ b/platform/windows/display_server_windows.h
@@ -275,7 +275,6 @@ class DisplayServerWindows : public DisplayServer {
};
struct KeyEvent {
-
WindowID window_id;
bool alt, shift, control, meta;
UINT uMsg;
diff --git a/platform/windows/export/export.cpp b/platform/windows/export/export.cpp
index d63067587c..c2436e8b64 100644
--- a/platform/windows/export/export.cpp
+++ b/platform/windows/export/export.cpp
@@ -38,7 +38,6 @@
static Error fixup_embedded_pck(const String &p_path, int64_t p_embedded_start, int64_t p_embedded_size);
class EditorExportPlatformWindows : public EditorExportPlatformPC {
-
void _rcedit_add_data(const Ref<EditorExportPreset> &p_preset, const String &p_path);
Error _code_sign(const Ref<EditorExportPreset> &p_preset, const String &p_path);
@@ -331,7 +330,6 @@ Error EditorExportPlatformWindows::_code_sign(const Ref<EditorExportPreset> &p_p
}
void register_windows_exporter() {
-
EDITOR_DEF("export/windows/rcedit", "");
EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::STRING, "export/windows/rcedit", PROPERTY_HINT_GLOBAL_FILE, "*.exe"));
#ifdef WINDOWS_ENABLED
@@ -366,7 +364,6 @@ void register_windows_exporter() {
}
static Error fixup_embedded_pck(const String &p_path, int64_t p_embedded_start, int64_t p_embedded_size) {
-
// Patch the header of the "pck" section in the PE file so that it corresponds to the embedded data
FileAccess *f = FileAccess::open(p_path, FileAccess::READ_WRITE);
@@ -408,7 +405,6 @@ static Error fixup_embedded_pck(const String &p_path, int64_t p_embedded_start,
bool found = false;
for (int i = 0; i < num_sections; ++i) {
-
int64_t section_header_pos = section_table_pos + i * 40;
f->seek(section_header_pos);
diff --git a/platform/windows/godot_windows.cpp b/platform/windows/godot_windows.cpp
index 2aa928c2a7..910059a9fc 100644
--- a/platform/windows/godot_windows.cpp
+++ b/platform/windows/godot_windows.cpp
@@ -136,7 +136,6 @@ char *wc_to_utf8(const wchar_t *wc) {
}
int widechar_main(int argc, wchar_t **argv) {
-
OS_Windows os(nullptr);
setlocale(LC_CTYPE, "");
diff --git a/platform/windows/joypad_windows.cpp b/platform/windows/joypad_windows.cpp
index 821d4eb685..38a4065ef9 100644
--- a/platform/windows/joypad_windows.cpp
+++ b/platform/windows/joypad_windows.cpp
@@ -53,7 +53,6 @@ JoypadWindows::JoypadWindows() {
}
JoypadWindows::JoypadWindows(HWND *hwnd) {
-
input = Input::get_singleton();
hWnd = hwnd;
joypad_count = 0;
@@ -76,18 +75,14 @@ JoypadWindows::JoypadWindows(HWND *hwnd) {
}
JoypadWindows::~JoypadWindows() {
-
close_joypad();
dinput->Release();
unload_xinput();
}
bool JoypadWindows::have_device(const GUID &p_guid) {
-
for (int i = 0; i < JOYPADS_MAX; i++) {
-
if (d_joypads[i].guid == p_guid) {
-
d_joypads[i].confirmed = true;
return true;
}
@@ -97,7 +92,6 @@ bool JoypadWindows::have_device(const GUID &p_guid) {
// adapted from SDL2, works a lot better than the MSDN version
bool JoypadWindows::is_xinput_device(const GUID *p_guid) {
-
static GUID IID_ValveStreamingGamepad = { MAKELONG(0x28DE, 0x11FF), 0x0000, 0x0000, { 0x00, 0x00, 0x50, 0x49, 0x44, 0x56, 0x49, 0x44 } };
static GUID IID_X360WiredGamepad = { MAKELONG(0x045E, 0x02A1), 0x0000, 0x0000, { 0x00, 0x00, 0x50, 0x49, 0x44, 0x56, 0x49, 0x44 } };
static GUID IID_X360WirelessGamepad = { MAKELONG(0x045E, 0x028E), 0x0000, 0x0000, { 0x00, 0x00, 0x50, 0x49, 0x44, 0x56, 0x49, 0x44 } };
@@ -120,7 +114,6 @@ bool JoypadWindows::is_xinput_device(const GUID *p_guid) {
return false;
}
for (unsigned int i = 0; i < dev_list_count; i++) {
-
RID_DEVICE_INFO rdi;
char dev_name[128];
UINT rdiSize = sizeof(rdi);
@@ -132,7 +125,6 @@ bool JoypadWindows::is_xinput_device(const GUID *p_guid) {
(MAKELONG(rdi.hid.dwVendorId, rdi.hid.dwProductId) == (LONG)p_guid->Data1) &&
(GetRawInputDeviceInfoA(dev_list[i].hDevice, RIDI_DEVICENAME, &dev_name, &nameSize) != (UINT)-1) &&
(strstr(dev_name, "IG_") != nullptr)) {
-
free(dev_list);
return true;
}
@@ -142,7 +134,6 @@ bool JoypadWindows::is_xinput_device(const GUID *p_guid) {
}
bool JoypadWindows::setup_dinput_joypad(const DIDEVICEINSTANCE *instance) {
-
HRESULT hr;
int num = input->get_unused_joy_id();
@@ -189,9 +180,7 @@ bool JoypadWindows::setup_dinput_joypad(const DIDEVICEINSTANCE *instance) {
}
void JoypadWindows::setup_joypad_object(const DIDEVICEOBJECTINSTANCE *ob, int p_joy_id) {
-
if (ob->dwType & DIDFT_AXIS) {
-
HRESULT res;
DIPROPRANGE prop_range;
DIPROPDWORD dilong;
@@ -240,7 +229,6 @@ void JoypadWindows::setup_joypad_object(const DIDEVICEOBJECTINSTANCE *ob, int p_
}
BOOL CALLBACK JoypadWindows::enumCallback(const DIDEVICEINSTANCE *p_instance, void *p_context) {
-
JoypadWindows *self = (JoypadWindows *)p_context;
if (self->is_xinput_device(&p_instance->guidProduct)) {
return DIENUM_CONTINUE;
@@ -250,7 +238,6 @@ BOOL CALLBACK JoypadWindows::enumCallback(const DIDEVICEINSTANCE *p_instance, vo
}
BOOL CALLBACK JoypadWindows::objectsCallback(const DIDEVICEOBJECTINSTANCE *instance, void *context) {
-
JoypadWindows *self = (JoypadWindows *)context;
self->setup_joypad_object(instance, self->id_to_change);
@@ -258,11 +245,8 @@ BOOL CALLBACK JoypadWindows::objectsCallback(const DIDEVICEOBJECTINSTANCE *insta
}
void JoypadWindows::close_joypad(int id) {
-
if (id == -1) {
-
for (int i = 0; i < JOYPADS_MAX; i++) {
-
close_joypad(i);
}
return;
@@ -281,18 +265,14 @@ void JoypadWindows::close_joypad(int id) {
}
void JoypadWindows::probe_joypads() {
-
DWORD dwResult;
for (DWORD i = 0; i < XUSER_MAX_COUNT; i++) {
-
ZeroMemory(&x_joypads[i].state, sizeof(XINPUT_STATE));
dwResult = xinput_get_state(i, &x_joypads[i].state);
if (dwResult == ERROR_SUCCESS) {
-
int id = input->get_unused_joy_id();
if (id != -1 && !x_joypads[i].attached) {
-
x_joypads[i].attached = true;
x_joypads[i].id = id;
x_joypads[i].ff_timestamp = 0;
@@ -302,7 +282,6 @@ void JoypadWindows::probe_joypads() {
input->joy_connection_changed(id, true, "XInput Gamepad", "__XINPUT_DEVICE__");
}
} else if (x_joypads[i].attached) {
-
x_joypads[i].attached = false;
attached_joypads[x_joypads[i].id] = false;
input->joy_connection_changed(x_joypads[i].id, false, "");
@@ -310,27 +289,22 @@ void JoypadWindows::probe_joypads() {
}
for (int i = 0; i < joypad_count; i++) {
-
d_joypads[i].confirmed = false;
}
dinput->EnumDevices(DI8DEVCLASS_GAMECTRL, enumCallback, this, DIEDFL_ATTACHEDONLY);
for (int i = 0; i < joypad_count; i++) {
-
if (!d_joypads[i].confirmed) {
-
close_joypad(i);
}
}
}
void JoypadWindows::process_joypads() {
-
HRESULT hr;
for (int i = 0; i < XUSER_MAX_COUNT; i++) {
-
xinput_gamepad &joy = x_joypads[i];
if (!joy.attached) {
continue;
@@ -339,10 +313,8 @@ void JoypadWindows::process_joypads() {
xinput_get_state(i, &joy.state);
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);
button_mask = button_mask * 2;
}
@@ -372,7 +344,6 @@ void JoypadWindows::process_joypads() {
}
for (int i = 0; i < JOYPADS_MAX; i++) {
-
dinput_gamepad *joy = &d_joypads[i];
if (!joy->attached)
@@ -393,18 +364,13 @@ void JoypadWindows::process_joypads() {
post_hat(joy->id, js.rgdwPOV[0]);
for (int j = 0; j < 128; j++) {
-
if (js.rgbButtons[j] & 0x80) {
-
if (!joy->last_buttons[j]) {
-
input->joy_button(joy->id, j, true);
joy->last_buttons[j] = true;
}
} else {
-
if (joy->last_buttons[j]) {
-
input->joy_button(joy->id, j, false);
joy->last_buttons[j] = false;
}
@@ -417,7 +383,6 @@ void JoypadWindows::process_joypads() {
int values[] = { js.lX, js.lY, js.lZ, js.lRx, js.lRy, js.lRz };
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]));
@@ -430,7 +395,6 @@ void JoypadWindows::process_joypads() {
}
void JoypadWindows::post_hat(int p_device, DWORD p_dpad) {
-
int dpad_val = 0;
// Should be -1 when centered, but according to docs:
@@ -441,42 +405,33 @@ void JoypadWindows::post_hat(int p_device, DWORD p_dpad) {
dpad_val = Input::HAT_MASK_CENTER;
}
if (p_dpad == 0) {
-
dpad_val = Input::HAT_MASK_UP;
} else if (p_dpad == 4500) {
-
dpad_val = (Input::HAT_MASK_UP | Input::HAT_MASK_RIGHT);
} else if (p_dpad == 9000) {
-
dpad_val = Input::HAT_MASK_RIGHT;
} else if (p_dpad == 13500) {
-
dpad_val = (Input::HAT_MASK_RIGHT | Input::HAT_MASK_DOWN);
} else if (p_dpad == 18000) {
-
dpad_val = Input::HAT_MASK_DOWN;
} else if (p_dpad == 22500) {
-
dpad_val = (Input::HAT_MASK_DOWN | Input::HAT_MASK_LEFT);
} else if (p_dpad == 27000) {
-
dpad_val = Input::HAT_MASK_LEFT;
} else if (p_dpad == 31500) {
-
dpad_val = (Input::HAT_MASK_LEFT | Input::HAT_MASK_UP);
}
input->joy_hat(p_device, dpad_val);
};
Input::JoyAxis JoypadWindows::axis_correct(int p_val, bool p_xinput, bool p_trigger, bool p_negate) const {
-
Input::JoyAxis jx;
if (Math::abs(p_val) < MIN_JOY_AXIS) {
jx.min = p_trigger ? 0 : -1;
@@ -484,7 +439,6 @@ Input::JoyAxis JoypadWindows::axis_correct(int p_val, bool p_xinput, bool p_trig
return jx;
}
if (p_xinput) {
-
if (p_trigger) {
jx.min = 0;
jx.value = (float)p_val / MAX_TRIGGER;
@@ -534,7 +488,6 @@ void JoypadWindows::joypad_vibration_stop_xinput(int p_device, uint64_t p_timest
}
void JoypadWindows::load_xinput() {
-
xinput_get_state = &_xinput_get_state;
xinput_set_state = &_xinput_set_state;
xinput_dll = LoadLibrary("XInput1_4.dll");
@@ -561,9 +514,7 @@ void JoypadWindows::load_xinput() {
}
void JoypadWindows::unload_xinput() {
-
if (xinput_dll) {
-
FreeLibrary((HMODULE)xinput_dll);
}
}
diff --git a/platform/windows/joypad_windows.h b/platform/windows/joypad_windows.h
index fefdcf1673..6c06b3f6f0 100644
--- a/platform/windows/joypad_windows.h
+++ b/platform/windows/joypad_windows.h
@@ -70,7 +70,6 @@ private:
};
struct dinput_gamepad {
-
int id;
bool attached;
bool confirmed;
@@ -93,7 +92,6 @@ private:
};
struct xinput_gamepad {
-
int id;
bool attached;
bool vibrating;
diff --git a/platform/windows/key_mapping_windows.cpp b/platform/windows/key_mapping_windows.cpp
index 92a2585745..1fe7551445 100644
--- a/platform/windows/key_mapping_windows.cpp
+++ b/platform/windows/key_mapping_windows.cpp
@@ -33,7 +33,6 @@
#include <stdio.h>
struct _WinTranslatePair {
-
unsigned int keysym;
unsigned int keycode;
};
@@ -337,9 +336,7 @@ static _WinTranslatePair _scancode_to_keycode[] = {
};
unsigned int KeyMappingWindows::get_keysym(unsigned int p_code) {
-
for (int i = 0; _vk_to_keycode[i].keysym != KEY_UNKNOWN; i++) {
-
if (_vk_to_keycode[i].keycode == p_code) {
//printf("outcode: %x\n",_vk_to_keycode[i].keysym);
@@ -353,7 +350,6 @@ unsigned int KeyMappingWindows::get_keysym(unsigned int p_code) {
unsigned int KeyMappingWindows::get_scansym(unsigned int p_code, bool p_extended) {
unsigned int keycode = KEY_UNKNOWN;
for (int i = 0; _scancode_to_keycode[i].keysym != KEY_UNKNOWN; i++) {
-
if (_scancode_to_keycode[i].keycode == p_code) {
keycode = _scancode_to_keycode[i].keysym;
break;
diff --git a/platform/windows/key_mapping_windows.h b/platform/windows/key_mapping_windows.h
index 028ca9fd5d..4d0c12c16e 100644
--- a/platform/windows/key_mapping_windows.h
+++ b/platform/windows/key_mapping_windows.h
@@ -38,7 +38,6 @@
#include <winuser.h>
class KeyMappingWindows {
-
KeyMappingWindows() {}
public:
diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp
index 0a67a591b7..76e23820aa 100644
--- a/platform/windows/os_windows.cpp
+++ b/platform/windows/os_windows.cpp
@@ -80,7 +80,6 @@ __declspec(dllexport) int AmdPowerXpressRequestHighPerformance = 1;
#ifdef DEBUG_ENABLED
static String format_error_message(DWORD id) {
-
LPWSTR messageBuffer = nullptr;
size_t size = FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
nullptr, id, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPWSTR)&messageBuffer, 0, nullptr);
@@ -94,7 +93,6 @@ static String format_error_message(DWORD id) {
#endif // DEBUG_ENABLED
void RedirectIOToConsole() {
-
int hConHandle;
intptr_t lStdHandle;
@@ -175,12 +173,10 @@ BOOL WINAPI HandlerRoutine(_In_ DWORD dwCtrlType) {
}
void OS_Windows::initialize_debugging() {
-
SetConsoleCtrlHandler(HandlerRoutine, TRUE);
}
void OS_Windows::initialize() {
-
crash_handler.initialize();
//RedirectIOToConsole();
@@ -217,19 +213,16 @@ void OS_Windows::initialize() {
}
void OS_Windows::delete_main_loop() {
-
if (main_loop)
memdelete(main_loop);
main_loop = nullptr;
}
void OS_Windows::set_main_loop(MainLoop *p_main_loop) {
-
main_loop = p_main_loop;
}
void OS_Windows::finalize() {
-
#ifdef WINMIDI_ENABLED
driver_midi.close();
#endif
@@ -241,7 +234,6 @@ void OS_Windows::finalize() {
}
void OS_Windows::finalize_core() {
-
timeEndPeriod(1);
memdelete(process_map);
@@ -249,7 +241,6 @@ void OS_Windows::finalize_core() {
}
Error OS_Windows::open_dynamic_library(const String p_path, void *&p_library_handle, bool p_also_set_library_path) {
-
String path = p_path;
if (!FileAccess::exists(path)) {
@@ -300,12 +291,10 @@ Error OS_Windows::get_dynamic_library_symbol_handle(void *p_library_handle, cons
}
String OS_Windows::get_name() const {
-
return "Windows";
}
OS::Date OS_Windows::get_date(bool utc) const {
-
SYSTEMTIME systemtime;
if (utc)
GetSystemTime(&systemtime);
@@ -321,7 +310,6 @@ OS::Date OS_Windows::get_date(bool utc) const {
return date;
}
OS::Time OS_Windows::get_time(bool utc) const {
-
SYSTEMTIME systemtime;
if (utc)
GetSystemTime(&systemtime);
@@ -355,7 +343,6 @@ OS::TimeZoneInfo OS_Windows::get_time_zone_info() const {
}
uint64_t OS_Windows::get_unix_time() const {
-
FILETIME ft;
SYSTEMTIME st;
GetSystemTime(&st);
@@ -387,12 +374,10 @@ uint64_t OS_Windows::get_unix_time() const {
};
uint64_t OS_Windows::get_system_time_secs() const {
-
return get_system_time_msecs() / 1000;
}
uint64_t OS_Windows::get_system_time_msecs() const {
-
const uint64_t WINDOWS_TICK = 10000;
const uint64_t MSEC_TO_UNIX_EPOCH = 11644473600000LL;
@@ -409,14 +394,12 @@ uint64_t OS_Windows::get_system_time_msecs() const {
}
void OS_Windows::delay_usec(uint32_t p_usec) const {
-
if (p_usec < 1000)
Sleep(1);
else
Sleep(p_usec / 1000);
}
uint64_t OS_Windows::get_ticks_usec() const {
-
uint64_t ticks;
uint64_t time;
// This is the number of clock ticks since start
@@ -431,14 +414,11 @@ uint64_t OS_Windows::get_ticks_usec() const {
}
Error OS_Windows::execute(const String &p_path, const List<String> &p_arguments, bool p_blocking, ProcessID *r_child_id, String *r_pipe, int *r_exitcode, bool read_stderr, Mutex *p_pipe_mutex) {
-
if (p_blocking && r_pipe) {
-
String argss;
argss = "\"\"" + p_path + "\"";
for (const List<String>::Element *E = p_arguments.front(); E; E = E->next()) {
-
argss += " \"" + E->get() + "\"";
}
@@ -454,7 +434,6 @@ Error OS_Windows::execute(const String &p_path, const List<String> &p_arguments,
char buf[65535];
while (fgets(buf, 65535, f)) {
-
if (p_pipe_mutex) {
p_pipe_mutex->lock();
}
@@ -474,7 +453,6 @@ Error OS_Windows::execute(const String &p_path, const List<String> &p_arguments,
String cmdline = "\"" + p_path + "\"";
const List<String>::Element *I = p_arguments.front();
while (I) {
-
cmdline += " \"" + I->get() + "\"";
I = I->next();
@@ -494,7 +472,6 @@ Error OS_Windows::execute(const String &p_path, const List<String> &p_arguments,
ERR_FAIL_COND_V(ret == 0, ERR_CANT_FORK);
if (p_blocking) {
-
DWORD ret2 = WaitForSingleObject(pi.pi.hProcess, INFINITE);
if (r_exitcode)
*r_exitcode = ret2;
@@ -502,7 +479,6 @@ Error OS_Windows::execute(const String &p_path, const List<String> &p_arguments,
CloseHandle(pi.pi.hProcess);
CloseHandle(pi.pi.hThread);
} else {
-
ProcessID pid = pi.pi.dwProcessId;
if (r_child_id) {
*r_child_id = pid;
@@ -513,7 +489,6 @@ Error OS_Windows::execute(const String &p_path, const List<String> &p_arguments,
};
Error OS_Windows::kill(const ProcessID &p_pid) {
-
ERR_FAIL_COND_V(!process_map->has(p_pid), FAILED);
const PROCESS_INFORMATION pi = (*process_map)[p_pid].pi;
@@ -532,7 +507,6 @@ int OS_Windows::get_process_id() const {
}
Error OS_Windows::set_cwd(const String &p_cwd) {
-
if (_wchdir(p_cwd.c_str()) != 0)
return ERR_CANT_OPEN;
@@ -540,7 +514,6 @@ Error OS_Windows::set_cwd(const String &p_cwd) {
}
String OS_Windows::get_executable_path() const {
-
wchar_t bufname[4096];
GetModuleFileNameW(nullptr, bufname, 4096);
String s = bufname;
@@ -548,7 +521,6 @@ String OS_Windows::get_executable_path() const {
}
bool OS_Windows::has_environment(const String &p_var) const {
-
#ifdef MINGW_ENABLED
return _wgetenv(p_var.c_str()) != nullptr;
#else
@@ -562,7 +534,6 @@ bool OS_Windows::has_environment(const String &p_var) const {
};
String OS_Windows::get_environment(const String &p_var) const {
-
wchar_t wval[0x7Fff]; // MSDN says 32767 char is the maximum
int wlen = GetEnvironmentVariableW(p_var.c_str(), wval, 0x7Fff);
if (wlen > 0) {
@@ -572,12 +543,10 @@ String OS_Windows::get_environment(const String &p_var) const {
}
bool OS_Windows::set_environment(const String &p_var, const String &p_value) const {
-
return (bool)SetEnvironmentVariableW(p_var.c_str(), p_value.c_str());
}
String OS_Windows::get_stdin_string(bool p_block) {
-
if (p_block) {
char buff[1024];
return fgets(buff, 1024, stdin);
@@ -587,13 +556,11 @@ String OS_Windows::get_stdin_string(bool p_block) {
}
Error OS_Windows::shell_open(String p_uri) {
-
ShellExecuteW(nullptr, nullptr, p_uri.c_str(), nullptr, nullptr, SW_SHOWNORMAL);
return OK;
}
String OS_Windows::get_locale() const {
-
const _WinLocale *wl = &_win_locales[0];
LANGID langid = GetUserDefaultUILanguage();
@@ -602,7 +569,6 @@ String OS_Windows::get_locale() const {
int sublang = langid & ~((1 << 9) - 1);
while (wl->locale) {
-
if (wl->main_lang == lang && wl->sublang == SUBLANG_NEUTRAL)
neutral = wl->locale;
@@ -649,14 +615,12 @@ int OS_Windows::get_processor_count() const {
}
void OS_Windows::run() {
-
if (!main_loop)
return;
main_loop->init();
while (!force_quit) {
-
DisplayServer::get_singleton()->process_events(); // get rid of pending events
if (Main::iteration())
break;
@@ -666,12 +630,10 @@ void OS_Windows::run() {
}
MainLoop *OS_Windows::get_main_loop() const {
-
return main_loop;
}
String OS_Windows::get_config_path() const {
-
if (has_environment("XDG_CONFIG_HOME")) { // unlikely, but after all why not?
return get_environment("XDG_CONFIG_HOME");
} else if (has_environment("APPDATA")) {
@@ -682,7 +644,6 @@ String OS_Windows::get_config_path() const {
}
String OS_Windows::get_data_path() const {
-
if (has_environment("XDG_DATA_HOME")) {
return get_environment("XDG_DATA_HOME");
} else {
@@ -691,7 +652,6 @@ String OS_Windows::get_data_path() const {
}
String OS_Windows::get_cache_path() const {
-
if (has_environment("XDG_CACHE_HOME")) {
return get_environment("XDG_CACHE_HOME");
} else if (has_environment("TEMP")) {
@@ -703,12 +663,10 @@ String OS_Windows::get_cache_path() const {
// Get properly capitalized engine name for system paths
String OS_Windows::get_godot_dir_name() const {
-
return String(VERSION_SHORT_NAME).capitalize();
}
String OS_Windows::get_system_dir(SystemDir p_dir) const {
-
KNOWNFOLDERID id;
switch (p_dir) {
@@ -747,7 +705,6 @@ String OS_Windows::get_system_dir(SystemDir p_dir) const {
}
String OS_Windows::get_user_data_dir() const {
-
String appname = get_safe_dir_name(ProjectSettings::get_singleton()->get("application/config/name"));
if (appname != "") {
bool use_custom_dir = ProjectSettings::get_singleton()->get("application/config/use_custom_user_dir");
@@ -766,14 +723,12 @@ String OS_Windows::get_user_data_dir() const {
}
String OS_Windows::get_unique_id() const {
-
HW_PROFILE_INFO HwProfInfo;
ERR_FAIL_COND_V(!GetCurrentHwProfile(&HwProfInfo), "");
return String(HwProfInfo.szHwProfileGuid);
}
bool OS_Windows::_check_internal_feature_support(const String &p_feature) {
-
return p_feature == "pc";
}
@@ -812,7 +767,6 @@ Error OS_Windows::move_to_trash(const String &p_path) {
}
OS_Windows::OS_Windows(HINSTANCE _hInstance) {
-
force_quit = false;
hInstance = _hInstance;
diff --git a/platform/windows/os_windows.h b/platform/windows/os_windows.h
index 7226109e57..480a9faa87 100644
--- a/platform/windows/os_windows.h
+++ b/platform/windows/os_windows.h
@@ -63,7 +63,6 @@
class JoypadWindows;
class OS_Windows : public OS {
-
#ifdef STDOUT_FILE
FILE *stdo;
#endif
@@ -101,7 +100,6 @@ protected:
virtual String get_stdin_string(bool p_block);
struct ProcessInfo {
-
STARTUPINFO si;
PROCESS_INFORMATION pi;
};
diff --git a/platform/windows/vulkan_context_win.cpp b/platform/windows/vulkan_context_win.cpp
index 98aa21411f..2c63281c49 100644
--- a/platform/windows/vulkan_context_win.cpp
+++ b/platform/windows/vulkan_context_win.cpp
@@ -36,7 +36,6 @@ const char *VulkanContextWindows::_get_platform_surface_extension() const {
}
int VulkanContextWindows::window_create(DisplayServer::WindowID p_window_id, HWND p_window, HINSTANCE p_instance, int p_width, int p_height) {
-
VkWin32SurfaceCreateInfoKHR createInfo;
createInfo.sType = VK_STRUCTURE_TYPE_WIN32_SURFACE_CREATE_INFO_KHR;
createInfo.pNext = nullptr;
diff --git a/platform/windows/vulkan_context_win.h b/platform/windows/vulkan_context_win.h
index c9fea9369b..6e80db0286 100644
--- a/platform/windows/vulkan_context_win.h
+++ b/platform/windows/vulkan_context_win.h
@@ -35,7 +35,6 @@
#include <windows.h>
class VulkanContextWindows : public VulkanContext {
-
virtual const char *_get_platform_surface_extension() const;
public:
diff --git a/platform/windows/windows_terminal_logger.cpp b/platform/windows/windows_terminal_logger.cpp
index 3fb2adfd2c..0938b65b04 100644
--- a/platform/windows/windows_terminal_logger.cpp
+++ b/platform/windows/windows_terminal_logger.cpp
@@ -81,7 +81,6 @@ void WindowsTerminalLogger::log_error(const char *p_function, const char *p_file
StdLogger::log_error(p_function, p_file, p_line, p_code, p_rationale, p_type);
#ifndef UWP_ENABLED
} else {
-
CONSOLE_SCREEN_BUFFER_INFO sbi; //original
GetConsoleScreenBufferInfo(hCon, &sbi);