summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
Diffstat (limited to 'platform')
-rw-r--r--platform/android/SCsub11
-rw-r--r--platform/android/audio_driver_jandroid.cpp5
-rw-r--r--platform/android/audio_driver_jandroid.h4
-rw-r--r--platform/android/audio_driver_opensl.cpp127
-rw-r--r--platform/android/audio_driver_opensl.h2
-rw-r--r--platform/android/detect.py24
-rw-r--r--platform/android/dir_access_android.cpp2
-rw-r--r--platform/android/dir_access_android.h2
-rw-r--r--platform/android/dir_access_jandroid.cpp2
-rw-r--r--platform/android/dir_access_jandroid.h4
-rw-r--r--platform/android/export/export.cpp2004
-rw-r--r--platform/android/export/export.h2
-rw-r--r--platform/android/file_access_android.cpp2
-rw-r--r--platform/android/file_access_android.h2
-rw-r--r--platform/android/file_access_jandroid.cpp2
-rw-r--r--platform/android/file_access_jandroid.h4
-rw-r--r--platform/android/globals/global_defaults.cpp2
-rw-r--r--platform/android/globals/global_defaults.h2
-rw-r--r--platform/android/godot_android.cpp59
-rw-r--r--platform/android/java/src/org/godotengine/godot/Dictionary.java2
-rw-r--r--platform/android/java/src/org/godotengine/godot/Godot.java14
-rw-r--r--platform/android/java/src/org/godotengine/godot/GodotDownloaderAlarmReceiver.java2
-rw-r--r--platform/android/java/src/org/godotengine/godot/GodotDownloaderService.java2
-rw-r--r--platform/android/java/src/org/godotengine/godot/GodotIO.java2
-rw-r--r--platform/android/java/src/org/godotengine/godot/GodotLib.java4
-rw-r--r--platform/android/java/src/org/godotengine/godot/GodotPaymentV3.java2
-rw-r--r--platform/android/java/src/org/godotengine/godot/GodotView.java4
-rw-r--r--platform/android/java/src/org/godotengine/godot/input/GodotEditText.java2
-rw-r--r--platform/android/java/src/org/godotengine/godot/input/GodotTextInputWrapper.java2
-rw-r--r--platform/android/java/src/org/godotengine/godot/payments/ConsumeTask.java2
-rw-r--r--platform/android/java/src/org/godotengine/godot/payments/GenericConsumeTask.java2
-rw-r--r--platform/android/java/src/org/godotengine/godot/payments/HandlePurchaseTask.java2
-rw-r--r--platform/android/java/src/org/godotengine/godot/payments/PaymentsCache.java2
-rw-r--r--platform/android/java/src/org/godotengine/godot/payments/PaymentsManager.java2
-rw-r--r--platform/android/java/src/org/godotengine/godot/payments/PurchaseTask.java2
-rw-r--r--platform/android/java/src/org/godotengine/godot/payments/ReleaseAllConsumablesTask.java2
-rw-r--r--platform/android/java/src/org/godotengine/godot/payments/ValidateTask.java2
-rw-r--r--platform/android/java/src/org/godotengine/godot/utils/Crypt.java2
-rw-r--r--platform/android/java/src/org/godotengine/godot/utils/CustomSSLSocketFactory.java2
-rw-r--r--platform/android/java/src/org/godotengine/godot/utils/HttpRequester.java2
-rw-r--r--platform/android/java/src/org/godotengine/godot/utils/RequestParams.java2
-rw-r--r--platform/android/java_class_wrapper.cpp4
-rw-r--r--platform/android/java_class_wrapper.h2
-rw-r--r--platform/android/java_glue.cpp14
-rw-r--r--platform/android/java_glue.h8
-rw-r--r--platform/android/os_android.cpp40
-rw-r--r--platform/android/os_android.h7
-rw-r--r--platform/android/platform_config.h2
-rw-r--r--platform/android/power_android.cpp2
-rw-r--r--platform/android/power_android.h2
-rw-r--r--platform/android/thread_jandroid.cpp17
-rw-r--r--platform/android/thread_jandroid.h5
-rw-r--r--platform/haiku/audio_driver_media_kit.cpp4
-rw-r--r--platform/haiku/audio_driver_media_kit.h2
-rw-r--r--platform/haiku/context_gl_haiku.cpp2
-rw-r--r--platform/haiku/context_gl_haiku.h2
-rw-r--r--platform/haiku/godot_haiku.cpp2
-rw-r--r--platform/haiku/haiku_application.cpp2
-rw-r--r--platform/haiku/haiku_application.h2
-rw-r--r--platform/haiku/haiku_direct_window.cpp2
-rw-r--r--platform/haiku/haiku_direct_window.h2
-rw-r--r--platform/haiku/haiku_gl_view.cpp2
-rw-r--r--platform/haiku/haiku_gl_view.h2
-rw-r--r--platform/haiku/key_mapping_haiku.cpp2
-rw-r--r--platform/haiku/key_mapping_haiku.h2
-rw-r--r--platform/haiku/os_haiku.cpp11
-rw-r--r--platform/haiku/os_haiku.h6
-rw-r--r--platform/haiku/platform_config.h2
-rw-r--r--platform/haiku/power_haiku.cpp2
-rw-r--r--platform/haiku/power_haiku.h2
-rw-r--r--platform/iphone/app_delegate.h2
-rw-r--r--platform/iphone/app_delegate.mm2
-rw-r--r--platform/iphone/audio_driver_iphone.cpp8
-rw-r--r--platform/iphone/audio_driver_iphone.h2
-rw-r--r--platform/iphone/detect.py8
-rw-r--r--platform/iphone/export/export.cpp2
-rw-r--r--platform/iphone/export/export.h2
-rw-r--r--platform/iphone/game_center.h2
-rw-r--r--platform/iphone/game_center.mm2
-rw-r--r--platform/iphone/gl_view.h2
-rw-r--r--platform/iphone/gl_view.mm2
-rw-r--r--platform/iphone/globals/global_defaults.cpp2
-rw-r--r--platform/iphone/globals/global_defaults.h2
-rw-r--r--platform/iphone/godot_iphone.cpp2
-rw-r--r--platform/iphone/icloud.h2
-rw-r--r--platform/iphone/icloud.mm2
-rw-r--r--platform/iphone/in_app_store.h2
-rw-r--r--platform/iphone/in_app_store.mm2
-rw-r--r--platform/iphone/ios.h2
-rw-r--r--platform/iphone/ios.mm2
-rw-r--r--platform/iphone/main.m2
-rw-r--r--platform/iphone/os_iphone.cpp2
-rw-r--r--platform/iphone/os_iphone.h6
-rw-r--r--platform/iphone/platform_config.h2
-rw-r--r--platform/iphone/platform_refcount.h2
-rw-r--r--platform/iphone/power_iphone.cpp2
-rw-r--r--platform/iphone/power_iphone.h2
-rw-r--r--platform/iphone/sem_iphone.cpp2
-rw-r--r--platform/iphone/sem_iphone.h2
-rw-r--r--platform/iphone/view_controller.h2
-rw-r--r--platform/iphone/view_controller.mm4
-rw-r--r--platform/javascript/audio_driver_javascript.cpp2
-rw-r--r--platform/javascript/audio_driver_javascript.h2
-rw-r--r--platform/javascript/audio_server_javascript.cpp4
-rw-r--r--platform/javascript/audio_server_javascript.h4
-rw-r--r--platform/javascript/detect.py2
-rw-r--r--platform/javascript/dom_keys.h2
-rw-r--r--platform/javascript/export/export.cpp2
-rw-r--r--platform/javascript/export/export.h2
-rw-r--r--platform/javascript/javascript_eval.cpp2
-rw-r--r--platform/javascript/javascript_eval.h2
-rw-r--r--platform/javascript/javascript_main.cpp2
-rw-r--r--platform/javascript/os_javascript.cpp4
-rw-r--r--platform/javascript/os_javascript.h4
-rw-r--r--platform/javascript/platform_config.h2
-rw-r--r--platform/javascript/power_javascript.cpp2
-rw-r--r--platform/javascript/power_javascript.h2
-rw-r--r--platform/osx/audio_driver_osx.cpp104
-rw-r--r--platform/osx/audio_driver_osx.h6
-rw-r--r--platform/osx/detect.py10
-rw-r--r--platform/osx/dir_access_osx.h2
-rw-r--r--platform/osx/dir_access_osx.mm2
-rw-r--r--platform/osx/export/export.cpp2
-rw-r--r--platform/osx/export/export.h2
-rw-r--r--platform/osx/godot_main_osx.mm2
-rw-r--r--platform/osx/joypad_osx.cpp12
-rw-r--r--platform/osx/joypad_osx.h2
-rw-r--r--platform/osx/os_osx.h10
-rw-r--r--platform/osx/os_osx.mm72
-rw-r--r--platform/osx/platform_config.h2
-rw-r--r--platform/osx/power_osx.cpp2
-rw-r--r--platform/osx/power_osx.h2
-rw-r--r--platform/osx/sem_osx.cpp2
-rw-r--r--platform/osx/sem_osx.h2
-rw-r--r--platform/server/godot_server.cpp2
-rw-r--r--platform/server/os_server.cpp2
-rw-r--r--platform/server/os_server.h2
-rw-r--r--platform/server/platform_config.h2
-rw-r--r--platform/uwp/app.cpp4
-rw-r--r--platform/uwp/app.h2
-rw-r--r--platform/uwp/detect.py4
-rw-r--r--platform/uwp/export/export.cpp36
-rw-r--r--platform/uwp/export/export.h2
-rw-r--r--platform/uwp/gl_context_egl.cpp2
-rw-r--r--platform/uwp/gl_context_egl.h2
-rw-r--r--platform/uwp/joypad_uwp.cpp8
-rw-r--r--platform/uwp/joypad_uwp.h2
-rw-r--r--platform/uwp/os_uwp.cpp2
-rw-r--r--platform/uwp/os_uwp.h2
-rw-r--r--platform/uwp/platform_config.h2
-rw-r--r--platform/uwp/power_uwp.cpp2
-rw-r--r--platform/uwp/power_uwp.h2
-rw-r--r--platform/uwp/thread_uwp.cpp2
-rw-r--r--platform/uwp/thread_uwp.h2
-rw-r--r--platform/windows/context_gl_win.cpp2
-rw-r--r--platform/windows/context_gl_win.h2
-rw-r--r--platform/windows/ctxgl_procaddr.cpp2
-rw-r--r--platform/windows/ctxgl_procaddr.h2
-rw-r--r--platform/windows/detect.py65
-rw-r--r--platform/windows/export/export.cpp2
-rw-r--r--platform/windows/export/export.h2
-rw-r--r--platform/windows/godot_win.cpp9
-rw-r--r--platform/windows/joypad.cpp10
-rw-r--r--platform/windows/joypad.h2
-rw-r--r--platform/windows/key_mapping_win.cpp2
-rw-r--r--platform/windows/key_mapping_win.h2
-rw-r--r--platform/windows/lang_table.h2
-rw-r--r--platform/windows/os_windows.cpp150
-rw-r--r--platform/windows/os_windows.h22
-rw-r--r--platform/windows/packet_peer_udp_winsock.cpp4
-rw-r--r--platform/windows/packet_peer_udp_winsock.h4
-rw-r--r--platform/windows/platform_config.h2
-rw-r--r--platform/windows/power_windows.cpp2
-rw-r--r--platform/windows/power_windows.h2
-rw-r--r--platform/windows/stream_peer_winsock.cpp2
-rw-r--r--platform/windows/stream_peer_winsock.h2
-rw-r--r--platform/windows/tcp_server_winsock.cpp4
-rw-r--r--platform/windows/tcp_server_winsock.h4
-rw-r--r--platform/x11/context_gl_x11.cpp20
-rw-r--r--platform/x11/context_gl_x11.h2
-rw-r--r--platform/x11/detect.py9
-rw-r--r--platform/x11/export/export.cpp22
-rw-r--r--platform/x11/export/export.h2
-rw-r--r--platform/x11/godot_x11.cpp6
-rw-r--r--platform/x11/joypad_linux.cpp2
-rw-r--r--platform/x11/joypad_linux.h12
-rw-r--r--platform/x11/key_mapping_x11.cpp2
-rw-r--r--platform/x11/key_mapping_x11.h2
-rw-r--r--platform/x11/os_x11.cpp60
-rw-r--r--platform/x11/os_x11.h8
-rw-r--r--platform/x11/platform_config.h2
-rw-r--r--platform/x11/power_x11.cpp15
-rw-r--r--platform/x11/power_x11.h2
193 files changed, 724 insertions, 2660 deletions
diff --git a/platform/android/SCsub b/platform/android/SCsub
index b124a1a5a8..87e7ee4747 100644
--- a/platform/android/SCsub
+++ b/platform/android/SCsub
@@ -1,6 +1,7 @@
#!/usr/bin/env python
import shutil
+from compat import open_utf8
Import('env')
@@ -40,8 +41,8 @@ prog = None
abspath = env.Dir(".").abspath
-gradle_basein = open(abspath + "/build.gradle.template", "rb")
-gradle_baseout = open(abspath + "/java/build.gradle", "wb")
+gradle_basein = open_utf8(abspath + "/build.gradle.template", "r")
+gradle_baseout = open_utf8(abspath + "/java/build.gradle", "w")
gradle_text = gradle_basein.read()
@@ -124,8 +125,8 @@ gradle_baseout.write(gradle_text)
gradle_baseout.close()
-pp_basein = open(abspath + "/AndroidManifest.xml.template", "rb")
-pp_baseout = open(abspath + "/java/AndroidManifest.xml", "wb")
+pp_basein = open_utf8(abspath + "/AndroidManifest.xml.template", "r")
+pp_baseout = open_utf8(abspath + "/java/AndroidManifest.xml", "w")
manifest = pp_basein.read()
manifest = manifest.replace("$$ADD_APPLICATION_CHUNKS$$", env.android_manifest_chunk)
manifest = manifest.replace("$$ADD_PERMISSION_CHUNKS$$", env.android_permission_chunk)
@@ -146,7 +147,7 @@ elif env['android_arch'] == 'arm64v8':
elif env['android_arch'] == 'x86':
lib_arch_dir = 'x86'
else:
- print 'WARN: Architecture not suitable for embedding into APK; keeping .so at \\bin'
+ print('WARN: Architecture not suitable for embedding into APK; keeping .so at \\bin')
if lib_arch_dir != '':
if env['target'] == 'release':
diff --git a/platform/android/audio_driver_jandroid.cpp b/platform/android/audio_driver_jandroid.cpp
index d293f3ed30..4a3bdd877d 100644
--- a/platform/android/audio_driver_jandroid.cpp
+++ b/platform/android/audio_driver_jandroid.cpp
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
@@ -80,8 +80,7 @@ Error AudioDriverAndroid::init() {
int mix_rate = GLOBAL_DEF("audio/mix_rate", 44100);
int latency = GLOBAL_DEF("audio/output_latency", 25);
- latency = 50;
- unsigned int buffer_size = nearest_power_of_2(latency * mix_rate / 1000);
+ unsigned int buffer_size = next_power_of_2(latency * mix_rate / 1000);
if (OS::get_singleton()->is_stdout_verbose()) {
print_line("audio buffer size: " + itos(buffer_size));
}
diff --git a/platform/android/audio_driver_jandroid.h b/platform/android/audio_driver_jandroid.h
index e2bb5ede86..8135641a62 100644
--- a/platform/android/audio_driver_jandroid.h
+++ b/platform/android/audio_driver_jandroid.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
@@ -71,7 +71,7 @@ public:
virtual void set_pause(bool p_pause);
- static void setup(jobject act);
+ static void setup(jobject p_io);
static void thread_func(JNIEnv *env);
AudioDriverAndroid();
diff --git a/platform/android/audio_driver_opensl.cpp b/platform/android/audio_driver_opensl.cpp
index acd94d2bdd..e774f5bb7d 100644
--- a/platform/android/audio_driver_opensl.cpp
+++ b/platform/android/audio_driver_opensl.cpp
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
@@ -75,29 +75,10 @@ void AudioDriverOpenSL::_buffer_callback(
}
(*queueItf)->Enqueue(queueItf, ptr, 4 * buffer_size);
-
-#if 0
- SLresult res;
- CallbackCntxt *pCntxt = (CallbackCntxt*)pContext;
- if(pCntxt->pData < (pCntxt->pDataBase + pCntxt->size))
- {
- res = (*queueItf)->Enqueue(queueItf, (void*) pCntxt->pData,
- 2 * AUDIO_DATA_BUFFER_SIZE, SL_BOOLEAN_FALSE); /* Size given
- in bytes. */
- CheckErr(res);
- /* Increase data pointer by buffer size */
- pCntxt->pData += AUDIO_DATA_BUFFER_SIZE;
- }
- }
-#endif
}
void AudioDriverOpenSL::_buffer_callbacks(
SLAndroidSimpleBufferQueueItf queueItf,
- /*SLuint32 eventFlags,
- const void * pBuffer,
- SLuint32 bufferSize,
- SLuint32 dataUsed,*/
void *pContext) {
AudioDriverOpenSL *ad = (AudioDriverOpenSL *)pContext;
@@ -113,65 +94,6 @@ const char *AudioDriverOpenSL::get_name() const {
return "Android";
}
-#if 0
-int AudioDriverOpenSL::thread_func(SceSize args, void *argp) {
-
- AudioDriverOpenSL* ad = s_ad;
- sceAudioOutput2Reserve(AUDIO_OUTPUT_SAMPLE);
-
- int half=0;
- while(!ad->exit_thread) {
-
- int16_t *ptr = &ad->outbuff[AUDIO_OUTPUT_SAMPLE*2*half];
-
-
-
- if (!ad->active) {
-
- for(int i=0;i<AUDIO_OUTPUT_SAMPLE*2;i++) {
- ptr[i]=0;
- }
-
- } else {
-
- //printf("samples: %i\n",AUDIO_OUTPUT_SAMPLE);
- ad->lock();
-
- ad->audio_server_process(AUDIO_OUTPUT_SAMPLE,ad->outbuff_32);
-
- ad->unlock();
-
- const int32_t* src_buff=ad->outbuff_32;
-
- for(int i=0;i<AUDIO_OUTPUT_SAMPLE*2;i++) {
-
- ptr[i]=src_buff[i]>>16;
- }
- }
-
-
- /* Output 16-bit PCM STEREO data that is in pcmBuf without changing the volume */
- sceAudioOutput2OutputBlocking(
- SCE_AUDIO_VOLUME_0dB*3, //0db at 0x8000, that's obvious
- ptr
- );
-
- if (half)
- half=0;
- else
- half=1;
-
- }
-
- sceAudioOutput2Release();
-
- sceKernelExitThread(SCE_KERNEL_EXIT_SUCCESS);
- ad->thread_exited=true;
- return SCE_KERNEL_EXIT_SUCCESS;
-
-}
-
-#endif
Error AudioDriverOpenSL::init() {
SLresult
@@ -228,29 +150,12 @@ void AudioDriverOpenSL::start() {
SLboolean required[MAX_NUMBER_INTERFACES];
SLInterfaceID iidArray[MAX_NUMBER_INTERFACES];
-#if 0
-
- for (int i=0; i<MAX_NUMBER_INTERFACES; i++)
- {
- required[i] = SL_BOOLEAN_FALSE;
- iidArray[i] = SL_IID_NULL;
- }
- // Set arrays required[] and iidArray[] for VOLUME interface
- required[0] = SL_BOOLEAN_TRUE;
- iidArray[0] = SL_IID_VOLUME;
-
- // Create Output Mix object to be used by player
- res = (*EngineItf)->CreateOutputMix(EngineItf, &OutputMix, 1,
- iidArray, required);
-#else
-
{
const SLInterfaceID ids[1] = { SL_IID_ENVIRONMENTALREVERB };
const SLboolean req[1] = { SL_BOOLEAN_FALSE };
res = (*EngineItf)->CreateOutputMix(EngineItf, &OutputMix, 0, ids, req);
}
-#endif
ERR_FAIL_COND(res != SL_RESULT_SUCCESS);
// Realizing the Output Mix object in synchronous mode.
res = (*OutputMix)->Realize(OutputMix, SL_BOOLEAN_FALSE);
@@ -308,44 +213,18 @@ void AudioDriverOpenSL::start() {
/* Setup to receive buffer queue event callbacks */
res = (*bufferQueueItf)->RegisterCallback(bufferQueueItf, _buffer_callbacks, this);
ERR_FAIL_COND(res != SL_RESULT_SUCCESS);
-/* Before we start set volume to -3dB (-300mB) */
-#if 0
- res = (*OutputMix)->GetInterface(OutputMix, SL_IID_VOLUME,
- (void*)&volumeItf);
- ERR_FAIL_COND( res !=SL_RESULT_SUCCESS );
- /* Setup the data source structure for the buffer queue */
-
- res = (*volumeItf)->SetVolumeLevel(volumeItf, -300);
- ERR_FAIL_COND( res !=SL_RESULT_SUCCESS );
-#endif
+
last_free = 0;
-#if 1
+
//fill up buffers
for (int i = 0; i < BUFFER_COUNT; i++) {
/* Enqueue a few buffers to get the ball rolling */
res = (*bufferQueueItf)->Enqueue(bufferQueueItf, buffers[i], 4 * buffer_size); /* Size given in */
}
-#endif
res = (*playItf)->SetPlayState(playItf, SL_PLAYSTATE_PLAYING);
ERR_FAIL_COND(res != SL_RESULT_SUCCESS);
-#if 0
- res = (*bufferQueueItf)->GetState(bufferQueueItf, &state);
- ERR_FAIL_COND( res !=SL_RESULT_SUCCESS );
- while(state.count)
- {
- (*bufferQueueItf)->GetState(bufferQueueItf, &state);
- }
- /* Make sure player is stopped */
- res = (*playItf)->SetPlayState(playItf, SL_PLAYSTATE_STOPPED);
- CheckErr(res);
- /* Destroy the player */
- (*player)->Destroy(player);
- /* Destroy Output Mix object */
- (*OutputMix)->Destroy(OutputMix);
-#endif
-
active = true;
}
diff --git a/platform/android/audio_driver_opensl.h b/platform/android/audio_driver_opensl.h
index f6270a3084..b505c5fe8a 100644
--- a/platform/android/audio_driver_opensl.h
+++ b/platform/android/audio_driver_opensl.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/android/detect.py b/platform/android/detect.py
index ad5bfb4949..65442bf6f8 100644
--- a/platform/android/detect.py
+++ b/platform/android/detect.py
@@ -14,7 +14,7 @@ def get_name():
def can_build():
- return (os.environ.has_key("ANDROID_NDK_ROOT"))
+ return ("ANDROID_NDK_ROOT" in os.environ)
def get_opts():
@@ -55,7 +55,7 @@ def configure(env):
import subprocess
def mySubProcess(cmdline, env):
- # print "SPAWNED : " + cmdline
+ # print("SPAWNED : " + cmdline)
startupinfo = subprocess.STARTUPINFO()
startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
proc = subprocess.Popen(cmdline, stdin=subprocess.PIPE, stdout=subprocess.PIPE,
@@ -63,9 +63,9 @@ def configure(env):
data, err = proc.communicate()
rv = proc.wait()
if rv:
- print "====="
- print err
- print "====="
+ print("=====")
+ print(err)
+ print("=====")
return rv
def mySpawn(sh, escape, cmd, args, env):
@@ -183,8 +183,8 @@ def configure(env):
## Compile flags
env.Append(CPPFLAGS=["-isystem", sysroot + "/usr/include"])
- env.Append(CPPFLAGS=string.split('-fpic -ffunction-sections -funwind-tables -fstack-protector-strong -fvisibility=hidden -fno-strict-aliasing'))
- env.Append(CPPFLAGS=string.split('-DNO_STATVFS -DGLES2_ENABLED'))
+ env.Append(CPPFLAGS='-fpic -ffunction-sections -funwind-tables -fstack-protector-strong -fvisibility=hidden -fno-strict-aliasing'.split())
+ env.Append(CPPFLAGS='-DNO_STATVFS -DGLES2_ENABLED'.split())
env['neon_enabled'] = False
if env['android_arch'] == 'x86':
@@ -194,11 +194,11 @@ def configure(env):
elif env["android_arch"] == "armv6":
target_opts = ['-target', 'armv6-none-linux-androideabi']
- env.Append(CPPFLAGS=string.split('-D__ARM_ARCH_6__ -march=armv6 -mfpu=vfp -mfloat-abi=softfp'))
+ env.Append(CPPFLAGS='-D__ARM_ARCH_6__ -march=armv6 -mfpu=vfp -mfloat-abi=softfp'.split())
elif env["android_arch"] == "armv7":
target_opts = ['-target', 'armv7-none-linux-androideabi']
- env.Append(CPPFLAGS=string.split('-D__ARM_ARCH_7__ -D__ARM_ARCH_7A__ -march=armv7-a -mfloat-abi=softfp'))
+ env.Append(CPPFLAGS='-D__ARM_ARCH_7__ -D__ARM_ARCH_7A__ -march=armv7-a -mfloat-abi=softfp'.split())
if env['android_neon'] == 'yes':
env['neon_enabled'] = True
env.Append(CPPFLAGS=['-mfpu=neon', '-D__ARM_NEON__'])
@@ -225,9 +225,9 @@ def configure(env):
env['LINKFLAGS'] = ['-shared', '--sysroot=' + sysroot, '-Wl,--warn-shared-textrel']
if env["android_arch"] == "armv7":
- env.Append(LINKFLAGS=string.split('-Wl,--fix-cortex-a8'))
- env.Append(LINKFLAGS=string.split('-Wl,--no-undefined -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now'))
- env.Append(LINKFLAGS=string.split('-Wl,-soname,libgodot_android.so -Wl,--gc-sections'))
+ env.Append(LINKFLAGS='-Wl,--fix-cortex-a8'.split())
+ env.Append(LINKFLAGS='-Wl,--no-undefined -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now'.split())
+ env.Append(LINKFLAGS='-Wl,-soname,libgodot_android.so -Wl,--gc-sections'.split())
if mt_link:
env.Append(LINKFLAGS=['-Wl,--threads'])
env.Append(LINKFLAGS=target_opts)
diff --git a/platform/android/dir_access_android.cpp b/platform/android/dir_access_android.cpp
index 67aa7750cd..9653a585b1 100644
--- a/platform/android/dir_access_android.cpp
+++ b/platform/android/dir_access_android.cpp
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/android/dir_access_android.h b/platform/android/dir_access_android.h
index 32986f524b..2f63befc32 100644
--- a/platform/android/dir_access_android.h
+++ b/platform/android/dir_access_android.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/android/dir_access_jandroid.cpp b/platform/android/dir_access_jandroid.cpp
index 34f4afa331..26e4684056 100644
--- a/platform/android/dir_access_jandroid.cpp
+++ b/platform/android/dir_access_jandroid.cpp
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/android/dir_access_jandroid.h b/platform/android/dir_access_jandroid.h
index 0175595543..ad89be3581 100644
--- a/platform/android/dir_access_jandroid.h
+++ b/platform/android/dir_access_jandroid.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
@@ -79,7 +79,7 @@ public:
//virtual FileType get_file_type() const;
size_t get_space_left();
- static void setup(jobject io);
+ static void setup(jobject p_io);
DirAccessJAndroid();
~DirAccessJAndroid();
diff --git a/platform/android/export/export.cpp b/platform/android/export/export.cpp
index 3c52834d92..ef348d8685 100644
--- a/platform/android/export/export.cpp
+++ b/platform/android/export/export.cpp
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
@@ -28,6 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "export.h"
+
#include "editor/editor_export.h"
#include "editor/editor_node.h"
#include "editor/editor_settings.h"
@@ -39,1865 +40,8 @@
#include "platform/android/run_icon.gen.h"
#include "project_settings.h"
#include "version.h"
-#include <string.h>
-#if 0
-
-static const char* android_perms[]={
-"ACCESS_CHECKIN_PROPERTIES",
-"ACCESS_COARSE_LOCATION",
-"ACCESS_FINE_LOCATION",
-"ACCESS_LOCATION_EXTRA_COMMANDS",
-"ACCESS_MOCK_LOCATION",
-"ACCESS_NETWORK_STATE",
-"ACCESS_SURFACE_FLINGER",
-"ACCESS_WIFI_STATE",
-"ACCOUNT_MANAGER",
-"ADD_VOICEMAIL",
-"AUTHENTICATE_ACCOUNTS",
-"BATTERY_STATS",
-"BIND_ACCESSIBILITY_SERVICE",
-"BIND_APPWIDGET",
-"BIND_DEVICE_ADMIN",
-"BIND_INPUT_METHOD",
-"BIND_NFC_SERVICE",
-"BIND_NOTIFICATION_LISTENER_SERVICE",
-"BIND_PRINT_SERVICE",
-"BIND_REMOTEVIEWS",
-"BIND_TEXT_SERVICE",
-"BIND_VPN_SERVICE",
-"BIND_WALLPAPER",
-"BLUETOOTH",
-"BLUETOOTH_ADMIN",
-"BLUETOOTH_PRIVILEGED",
-"BRICK",
-"BROADCAST_PACKAGE_REMOVED",
-"BROADCAST_SMS",
-"BROADCAST_STICKY",
-"BROADCAST_WAP_PUSH",
-"CALL_PHONE",
-"CALL_PRIVILEGED",
-"CAMERA",
-"CAPTURE_AUDIO_OUTPUT",
-"CAPTURE_SECURE_VIDEO_OUTPUT",
-"CAPTURE_VIDEO_OUTPUT",
-"CHANGE_COMPONENT_ENABLED_STATE",
-"CHANGE_CONFIGURATION",
-"CHANGE_NETWORK_STATE",
-"CHANGE_WIFI_MULTICAST_STATE",
-"CHANGE_WIFI_STATE",
-"CLEAR_APP_CACHE",
-"CLEAR_APP_USER_DATA",
-"CONTROL_LOCATION_UPDATES",
-"DELETE_CACHE_FILES",
-"DELETE_PACKAGES",
-"DEVICE_POWER",
-"DIAGNOSTIC",
-"DISABLE_KEYGUARD",
-"DUMP",
-"EXPAND_STATUS_BAR",
-"FACTORY_TEST",
-"FLASHLIGHT",
-"FORCE_BACK",
-"GET_ACCOUNTS",
-"GET_PACKAGE_SIZE",
-"GET_TASKS",
-"GET_TOP_ACTIVITY_INFO",
-"GLOBAL_SEARCH",
-"HARDWARE_TEST",
-"INJECT_EVENTS",
-"INSTALL_LOCATION_PROVIDER",
-"INSTALL_PACKAGES",
-"INSTALL_SHORTCUT",
-"INTERNAL_SYSTEM_WINDOW",
-"INTERNET",
-"KILL_BACKGROUND_PROCESSES",
-"LOCATION_HARDWARE",
-"MANAGE_ACCOUNTS",
-"MANAGE_APP_TOKENS",
-"MANAGE_DOCUMENTS",
-"MASTER_CLEAR",
-"MEDIA_CONTENT_CONTROL",
-"MODIFY_AUDIO_SETTINGS",
-"MODIFY_PHONE_STATE",
-"MOUNT_FORMAT_FILESYSTEMS",
-"MOUNT_UNMOUNT_FILESYSTEMS",
-"NFC",
-"PERSISTENT_ACTIVITY",
-"PROCESS_OUTGOING_CALLS",
-"READ_CALENDAR",
-"READ_CALL_LOG",
-"READ_CONTACTS",
-"READ_EXTERNAL_STORAGE",
-"READ_FRAME_BUFFER",
-"READ_HISTORY_BOOKMARKS",
-"READ_INPUT_STATE",
-"READ_LOGS",
-"READ_PHONE_STATE",
-"READ_PROFILE",
-"READ_SMS",
-"READ_SOCIAL_STREAM",
-"READ_SYNC_SETTINGS",
-"READ_SYNC_STATS",
-"READ_USER_DICTIONARY",
-"REBOOT",
-"RECEIVE_BOOT_COMPLETED",
-"RECEIVE_MMS",
-"RECEIVE_SMS",
-"RECEIVE_WAP_PUSH",
-"RECORD_AUDIO",
-"REORDER_TASKS",
-"RESTART_PACKAGES",
-"SEND_RESPOND_VIA_MESSAGE",
-"SEND_SMS",
-"SET_ACTIVITY_WATCHER",
-"SET_ALARM",
-"SET_ALWAYS_FINISH",
-"SET_ANIMATION_SCALE",
-"SET_DEBUG_APP",
-"SET_ORIENTATION",
-"SET_POINTER_SPEED",
-"SET_PREFERRED_APPLICATIONS",
-"SET_PROCESS_LIMIT",
-"SET_TIME",
-"SET_TIME_ZONE",
-"SET_WALLPAPER",
-"SET_WALLPAPER_HINTS",
-"SIGNAL_PERSISTENT_PROCESSES",
-"STATUS_BAR",
-"SUBSCRIBED_FEEDS_READ",
-"SUBSCRIBED_FEEDS_WRITE",
-"SYSTEM_ALERT_WINDOW",
-"TRANSMIT_IR",
-"UNINSTALL_SHORTCUT",
-"UPDATE_DEVICE_STATS",
-"USE_CREDENTIALS",
-"USE_SIP",
-"VIBRATE",
-"WAKE_LOCK",
-"WRITE_APN_SETTINGS",
-"WRITE_CALENDAR",
-"WRITE_CALL_LOG",
-"WRITE_CONTACTS",
-"WRITE_EXTERNAL_STORAGE",
-"WRITE_GSERVICES",
-"WRITE_HISTORY_BOOKMARKS",
-"WRITE_PROFILE",
-"WRITE_SECURE_SETTINGS",
-"WRITE_SETTINGS",
-"WRITE_SMS",
-"WRITE_SOCIAL_STREAM",
-"WRITE_SYNC_SETTINGS",
-"WRITE_USER_DICTIONARY",
-NULL};
-
-class EditorExportPlatformAndroid : public EditorExportPlatform {
-
- GDCLASS( EditorExportPlatformAndroid,EditorExportPlatform );
-
-
- enum {
- MAX_USER_PERMISSIONS=20,
- SCREEN_SMALL=0,
- SCREEN_NORMAL=1,
- SCREEN_LARGE=2,
- SCREEN_XLARGE=3,
- SCREEN_MAX=4
- };
-
- String custom_release_package;
- String custom_debug_package;
-
- int version_code;
- String version_name;
- String package;
- String name;
- String icon;
- String cmdline;
- bool _signed;
- bool apk_expansion;
- bool remove_prev;
- bool use_32_fb;
- bool immersive;
- bool export_arm;
- bool export_arm64;
- bool export_x86;
- String apk_expansion_salt;
- String apk_expansion_pkey;
- int orientation;
-
- String release_keystore;
- String release_password;
- String release_username;
-
- struct APKExportData {
-
- zipFile apk;
- EditorProgress *ep;
- };
-
- struct Device {
-
- String id;
- String name;
- String description;
- };
-
- Vector<Device> devices;
- bool devices_changed;
- Mutex *device_lock;
- Thread *device_thread;
- Ref<ImageTexture> logo;
-
- Set<String> perms;
- String user_perms[MAX_USER_PERMISSIONS];
- bool screen_support[SCREEN_MAX];
-
- volatile bool quit_request;
-
-
- static void _device_poll_thread(void *ud);
-
- String get_package_name();
-
- String get_project_name() const;
- void _fix_manifest(Vector<uint8_t>& p_manifest, bool p_give_internet);
- void _fix_resources(Vector<uint8_t>& p_manifest);
- static Error save_apk_file(void *p_userdata,const String& p_path, const Vector<uint8_t>& p_data,int p_file,int p_total);
- static bool _should_compress_asset(const String& p_path, const Vector<uint8_t>& p_data);
-
-protected:
-
- bool _set(const StringName& p_name, const Variant& p_value);
- bool _get(const StringName& p_name,Variant &r_ret) const;
- void _get_property_list( List<PropertyInfo> *p_list) const;
-
-public:
-
- virtual String get_name() const { return "Android"; }
- virtual ImageCompression get_image_compression() const { return IMAGE_COMPRESSION_ETC1; }
- virtual Ref<Texture> get_logo() const { return logo; }
-
-
- virtual bool poll_devices();
- virtual int get_device_count() const;
- virtual String get_device_name(int p_device) const;
- virtual String get_device_info(int p_device) const;
- virtual Error run(int p_device,int p_flags=0);
-
- virtual bool requires_password(bool p_debug) const { return !p_debug; }
- virtual String get_binary_extension() const { return "apk"; }
- virtual Error export_project(const String& p_path, bool p_debug, int p_flags=0);
-
- virtual bool can_export(String *r_error=NULL) const;
-
- EditorExportPlatformAndroid();
- ~EditorExportPlatformAndroid();
-};
-
-bool EditorExportPlatformAndroid::_set(const StringName& p_name, const Variant& p_value) {
-
- String n=p_name;
-
- if (n=="one_click_deploy/clear_previous_install")
- remove_prev=p_value;
- else if (n=="custom_package/debug")
- custom_debug_package=p_value;
- else if (n=="custom_package/release")
- custom_release_package=p_value;
- else if (n=="version/code")
- version_code=p_value;
- else if (n=="version/name")
- version_name=p_value;
- else if (n=="command_line/extra_args")
- cmdline=p_value;
- else if (n=="package/unique_name")
- package=p_value;
- else if (n=="package/name")
- name=p_value;
- else if (n=="package/icon")
- icon=p_value;
- else if (n=="package/signed")
- _signed=p_value;
- else if (n=="architecture/arm")
- export_arm=p_value;
- else if (n=="architecture/arm64")
- export_arm64=p_value;
- else if (n=="architecture/x86")
- export_x86=p_value;
- else if (n=="screen/use_32_bits_view")
- use_32_fb=p_value;
- else if (n=="screen/immersive_mode")
- immersive=p_value;
- else if (n=="screen/orientation")
- orientation=p_value;
- else if (n=="screen/support_small")
- screen_support[SCREEN_SMALL]=p_value;
- else if (n=="screen/support_normal")
- screen_support[SCREEN_NORMAL]=p_value;
- else if (n=="screen/support_large")
- screen_support[SCREEN_LARGE]=p_value;
- else if (n=="screen/support_xlarge")
- screen_support[SCREEN_XLARGE]=p_value;
- else if (n=="keystore/release")
- release_keystore=p_value;
- else if (n=="keystore/release_user")
- release_username=p_value;
- else if (n=="keystore/release_password")
- release_password=p_value;
- else if (n=="apk_expansion/enable")
- apk_expansion=p_value;
- else if (n=="apk_expansion/SALT")
- apk_expansion_salt=p_value;
- else if (n=="apk_expansion/public_key")
- apk_expansion_pkey=p_value;
- else if (n.begins_with("permissions/")) {
-
- String what = n.get_slicec('/',1).to_upper();
- bool state = p_value;
- if (state)
- perms.insert(what);
- else
- perms.erase(what);
- } else if (n.begins_with("user_permissions/")) {
-
- int which = n.get_slicec('/',1).to_int();
- ERR_FAIL_INDEX_V(which,MAX_USER_PERMISSIONS,false);
- user_perms[which]=p_value;
-
- } else
- return false;
-
- return true;
-}
-
-bool EditorExportPlatformAndroid::_get(const StringName& p_name,Variant &r_ret) const{
-
- String n=p_name;
- if (n=="one_click_deploy/clear_previous_install")
- r_ret=remove_prev;
- else if (n=="custom_package/debug")
- r_ret=custom_debug_package;
- else if (n=="custom_package/release")
- r_ret=custom_release_package;
- else if (n=="version/code")
- r_ret=version_code;
- else if (n=="version/name")
- r_ret=version_name;
- else if (n=="command_line/extra_args")
- r_ret=cmdline;
- else if (n=="package/unique_name")
- r_ret=package;
- else if (n=="package/name")
- r_ret=name;
- else if (n=="package/icon")
- r_ret=icon;
- else if (n=="package/signed")
- r_ret=_signed;
- else if (n=="architecture/arm")
- r_ret=export_arm;
- else if (n=="architecture/arm64")
- r_ret=export_arm64;
- else if (n=="architecture/x86")
- r_ret=export_x86;
- else if (n=="screen/use_32_bits_view")
- r_ret=use_32_fb;
- else if (n=="screen/immersive_mode")
- r_ret=immersive;
- else if (n=="screen/orientation")
- r_ret=orientation;
- else if (n=="screen/support_small")
- r_ret=screen_support[SCREEN_SMALL];
- else if (n=="screen/support_normal")
- r_ret=screen_support[SCREEN_NORMAL];
- else if (n=="screen/support_large")
- r_ret=screen_support[SCREEN_LARGE];
- else if (n=="screen/support_xlarge")
- r_ret=screen_support[SCREEN_XLARGE];
- else if (n=="keystore/release")
- r_ret=release_keystore;
- else if (n=="keystore/release_user")
- r_ret=release_username;
- else if (n=="keystore/release_password")
- r_ret=release_password;
- else if (n=="apk_expansion/enable")
- r_ret=apk_expansion;
- else if (n=="apk_expansion/SALT")
- r_ret=apk_expansion_salt;
- else if (n=="apk_expansion/public_key")
- r_ret=apk_expansion_pkey;
- else if (n.begins_with("permissions/")) {
-
- String what = n.get_slicec('/',1).to_upper();
- r_ret = perms.has(what);
- } else if (n.begins_with("user_permissions/")) {
-
- int which = n.get_slicec('/',1).to_int();
- ERR_FAIL_INDEX_V(which,MAX_USER_PERMISSIONS,false);
- r_ret=user_perms[which];
- } else
- return false;
-
- return true;
-}
-
-void EditorExportPlatformAndroid::_get_property_list( List<PropertyInfo> *p_list) const{
-
- p_list->push_back( PropertyInfo( Variant::BOOL, "one_click_deploy/clear_previous_install"));
- p_list->push_back( PropertyInfo( Variant::STRING, "custom_package/debug", PROPERTY_HINT_GLOBAL_FILE,"apk"));
- p_list->push_back( PropertyInfo( Variant::STRING, "custom_package/release", PROPERTY_HINT_GLOBAL_FILE,"apk"));
- p_list->push_back( PropertyInfo( Variant::STRING, "command_line/extra_args"));
- p_list->push_back( PropertyInfo( Variant::INT, "version/code", PROPERTY_HINT_RANGE,"1,65535,1"));
- p_list->push_back( PropertyInfo( Variant::STRING, "version/name") );
- p_list->push_back( PropertyInfo( Variant::STRING, "package/unique_name") );
- p_list->push_back( PropertyInfo( Variant::STRING, "package/name") );
- p_list->push_back( PropertyInfo( Variant::STRING, "package/icon",PROPERTY_HINT_FILE,"png") );
- p_list->push_back( PropertyInfo( Variant::BOOL, "package/signed") );
- p_list->push_back( PropertyInfo( Variant::BOOL, "architecture/arm") );
- p_list->push_back( PropertyInfo( Variant::BOOL, "architecture/x86") );
- p_list->push_back( PropertyInfo( Variant::BOOL, "screen/use_32_bits_view") );
- p_list->push_back( PropertyInfo( Variant::BOOL, "screen/immersive_mode") );
- p_list->push_back( PropertyInfo( Variant::INT, "screen/orientation",PROPERTY_HINT_ENUM,"Landscape,Portrait") );
- p_list->push_back( PropertyInfo( Variant::BOOL, "screen/support_small") );
- p_list->push_back( PropertyInfo( Variant::BOOL, "screen/support_normal") );
- p_list->push_back( PropertyInfo( Variant::BOOL, "screen/support_large") );
- p_list->push_back( PropertyInfo( Variant::BOOL, "screen/support_xlarge") );
- p_list->push_back( PropertyInfo( Variant::STRING, "keystore/release",PROPERTY_HINT_GLOBAL_FILE,"keystore") );
- p_list->push_back( PropertyInfo( Variant::STRING, "keystore/release_user" ) );
- p_list->push_back( PropertyInfo( Variant::STRING, "keystore/release_password" ) );
- p_list->push_back( PropertyInfo( Variant::BOOL, "apk_expansion/enable" ) );
- p_list->push_back( PropertyInfo( Variant::STRING, "apk_expansion/SALT" ) );
- p_list->push_back( PropertyInfo( Variant::STRING, "apk_expansion/public_key",PROPERTY_HINT_MULTILINE_TEXT ) );
-
- const char **perms = android_perms;
- while(*perms) {
-
- p_list->push_back( PropertyInfo( Variant::BOOL, "permissions/"+String(*perms).to_lower()));
- perms++;
- }
-
- for(int i=0;i<MAX_USER_PERMISSIONS;i++) {
-
- p_list->push_back( PropertyInfo( Variant::STRING, "user_permissions/"+itos(i)));
- }
-
- //p_list->push_back( PropertyInfo( Variant::INT, "resources/pack_mode", PROPERTY_HINT_ENUM,"Copy,Single Exec.,Pack (.pck),Bundles (Optical)"));
-
-}
-
-
-static String _parse_string(const uint8_t *p_bytes,bool p_utf8) {
-
- uint32_t offset=0;
- uint32_t len = decode_uint16(&p_bytes[offset]);
-
- if (p_utf8) {
- //don't know how to read extended utf8, this will have to be for now
- len>>=8;
-
- }
- offset+=2;
- //printf("len %i, unicode: %i\n",len,int(p_utf8));
-
- if (p_utf8) {
-
- Vector<uint8_t> str8;
- str8.resize(len+1);
- for(uint32_t i=0;i<len;i++) {
- str8[i]=p_bytes[offset+i];
- }
- str8[len]=0;
- String str;
- 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]);
- if (c==0)
- break;
- str += String::chr(c);
- }
- return str;
- }
-
-}
-
-void EditorExportPlatformAndroid::_fix_resources(Vector<uint8_t>& p_manifest) {
-
-
- const int UTF8_FLAG = 0x00000100;
- print_line("*******************GORRRGLE***********************");
-
- uint32_t header = decode_uint32(&p_manifest[0]);
- uint32_t filesize = decode_uint32(&p_manifest[4]);
- uint32_t string_block_len = decode_uint32(&p_manifest[16]);
- uint32_t string_count = decode_uint32(&p_manifest[20]);
- uint32_t string_flags = decode_uint32(&p_manifest[28]);
- const uint32_t string_table_begins = 40;
-
- Vector<String> string_table;
-
- //printf("stirng block len: %i\n",string_block_len);
- //printf("stirng count: %i\n",string_count);
- //printf("flags: %x\n",string_flags);
-
- 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();
-
- } else {
-
- String lang = str.substr(str.find_last("-")+1,str.length()).replace("-","_");
- String prop = "application/config/name_"+lang;
- if (ProjectSettings::get_singleton()->has(prop)) {
- str = ProjectSettings::get_singleton()->get(prop);
- } else {
- str = get_project_name();
- }
- }
- }
-
- string_table.push_back(str);
-
- }
-
- //write a new string table, but use 16 bits
- Vector<uint8_t> ret;
- ret.resize(string_table_begins+string_table.size()*4);
-
- for(uint32_t i=0;i<string_table_begins;i++) {
-
- ret[i]=p_manifest[i];
- }
-
- int ofs=0;
- for(int i=0;i<string_table.size();i++) {
-
- encode_uint32(ofs,&ret[string_table_begins+i*4]);
- ofs+=string_table[i].length()*2+2+2;
- }
-
- ret.resize(ret.size()+ofs);
- uint8_t *chars=&ret[ret.size()-ofs];
- for(int i=0;i<string_table.size();i++) {
-
- String s = string_table[i];
- encode_uint16(s.length(),chars);
- chars+=2;
- for(int j=0;j<s.length();j++) {
- encode_uint16(s[j],chars);
- chars+=2;
- }
- encode_uint16(0,chars);
- chars+=2;
- }
-
- //pad
- while(ret.size()%4)
- ret.push_back(0);
-
- //change flags to not use utf8
- encode_uint32(string_flags&~0x100,&ret[28]);
- //change length
- encode_uint32(ret.size()-12,&ret[16]);
- //append the rest...
- int rest_from = 12+string_block_len;
- int rest_to = ret.size();
- int rest_len = (p_manifest.size() - rest_from);
- ret.resize(ret.size() + (p_manifest.size() - rest_from) );
- for(int i=0;i<rest_len;i++) {
- ret[rest_to+i]=p_manifest[rest_from+i];
- }
- //finally update the size
- encode_uint32(ret.size(),&ret[4]);
-
-
- p_manifest=ret;
- //printf("end\n");
-}
-
-String EditorExportPlatformAndroid::get_project_name() const {
-
- String aname;
- if (this->name!="") {
- aname=this->name;
- } else {
- aname = ProjectSettings::get_singleton()->get("application/config/name");
-
- }
-
- if (aname=="") {
- aname=_MKSTR(VERSION_NAME);
- }
-
- return aname;
-}
-
-
-void EditorExportPlatformAndroid::_fix_manifest(Vector<uint8_t>& p_manifest,bool p_give_internet) {
-
-
- const int CHUNK_AXML_FILE = 0x00080003;
- const int CHUNK_RESOURCEIDS = 0x00080180;
- const int CHUNK_STRINGS = 0x001C0001;
- const int CHUNK_XML_END_NAMESPACE = 0x00100101;
- const int CHUNK_XML_END_TAG = 0x00100103;
- const int CHUNK_XML_START_NAMESPACE = 0x00100100;
- const int CHUNK_XML_START_TAG = 0x00100102;
- const int CHUNK_XML_TEXT = 0x00100104;
- const int UTF8_FLAG = 0x00000100;
-
- Vector<String> string_table;
-
- uint32_t ofs=0;
-
-
- uint32_t header = decode_uint32(&p_manifest[ofs]);
- uint32_t filesize = decode_uint32(&p_manifest[ofs+4]);
- ofs+=8;
-
- //print_line("FILESIZE: "+itos(filesize)+" ACTUAL: "+itos(p_manifest.size()));
-
- uint32_t string_count;
- uint32_t styles_count;
- uint32_t string_flags;
- uint32_t string_data_offset;
-
- uint32_t styles_offset;
- uint32_t string_table_begins;
- uint32_t string_table_ends;
- Vector<uint8_t> stable_extra;
-
- 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]);
- styles_count=decode_uint32(&p_manifest[iofs+4]);
- string_flags=decode_uint32(&p_manifest[iofs+8]);
- string_data_offset=decode_uint32(&p_manifest[iofs+12]);
- styles_offset=decode_uint32(&p_manifest[iofs+16]);
-/*
- printf("string count: %i\n",string_count);
- printf("flags: %i\n",string_flags);
- printf("sdata ofs: %i\n",string_data_offset);
- printf("styles ofs: %i\n",styles_offset);
-*/
- uint32_t st_offset=iofs+20;
- string_table.resize(string_count);
- uint32_t string_end=0;
-
- 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_EXPLAIN("Unimplemented, can't read utf8 string table.");
- ERR_FAIL_COND(string_flags&UTF8_FLAG);
-
- if (string_flags&UTF8_FLAG) {
-
-
-
- } else {
- uint32_t len = decode_uint16(&p_manifest[string_at]);
- Vector<CharType> ucstring;
- ucstring.resize(len+1);
- for(uint32_t j=0;j<len;j++) {
- uint16_t c=decode_uint16(&p_manifest[string_at+2+2*j]);
- ucstring[j]=c;
- }
- string_end=MAX(string_at+2+2*len,string_end);
- ucstring[len]=0;
- string_table[i]=ucstring.ptr();
- }
-
-
- //print_line("String "+itos(i)+": "+string_table[i]);
- }
-
- for(uint32_t i=string_end;i<(ofs+size);i++) {
- stable_extra.push_back(p_manifest[i]);
- }
-
- //printf("stable extra: %i\n",int(stable_extra.size()));
- string_table_ends=ofs+size;
-
- //print_line("STABLE SIZE: "+itos(size)+" ACTUAL: "+itos(string_table_ends));
-
- } break;
- case CHUNK_XML_START_TAG: {
-
- int iofs=ofs+8;
- uint32_t line=decode_uint32(&p_manifest[iofs]);
- uint32_t nspace=decode_uint32(&p_manifest[iofs+8]);
- uint32_t name=decode_uint32(&p_manifest[iofs+12]);
- uint32_t check=decode_uint32(&p_manifest[iofs+16]);
-
- String tname=string_table[name];
-
- //printf("NSPACE: %i\n",nspace);
- //printf("NAME: %i (%s)\n",name,tname.utf8().get_data());
- //printf("CHECK: %x\n",check);
- uint32_t attrcount=decode_uint32(&p_manifest[iofs+20]);
- iofs+=28;
- //printf("ATTRCOUNT: %x\n",attrcount);
- for(uint32_t i=0;i<attrcount;i++) {
- uint32_t attr_nspace=decode_uint32(&p_manifest[iofs]);
- uint32_t attr_name=decode_uint32(&p_manifest[iofs+4]);
- uint32_t attr_value=decode_uint32(&p_manifest[iofs+8]);
- uint32_t attr_flags=decode_uint32(&p_manifest[iofs+12]);
- uint32_t attr_resid=decode_uint32(&p_manifest[iofs+16]);
-
-
- String value;
- if (attr_value!=0xFFFFFFFF)
- value=string_table[attr_value];
- else
- value="Res #"+itos(attr_resid);
- String attrname = string_table[attr_name];
- String nspace;
- if (attr_nspace!=0xFFFFFFFF)
- nspace=string_table[attr_nspace];
- else
- nspace="";
-
- //printf("ATTR %i NSPACE: %i\n",i,attr_nspace);
- //printf("ATTR %i NAME: %i (%s)\n",i,attr_name,attrname.utf8().get_data());
- //printf("ATTR %i VALUE: %i (%s)\n",i,attr_value,value.utf8().get_data());
- //printf("ATTR %i FLAGS: %x\n",i,attr_flags);
- //printf("ATTR %i RESID: %x\n",i,attr_resid);
-
- //replace project information
- if (tname=="manifest" && attrname=="package") {
-
- print_line("FOUND package");
- string_table[attr_value]=get_package_name();
- }
-
- //print_line("tname: "+tname);
- //print_line("nspace: "+nspace);
- //print_line("attrname: "+attrname);
- if (tname=="manifest" && /*nspace=="android" &&*/ attrname=="versionCode") {
-
- print_line("FOUND versionCode");
- encode_uint32(version_code,&p_manifest[iofs+16]);
- }
-
-
- if (tname=="manifest" && /*nspace=="android" &&*/ attrname=="versionName") {
-
- print_line("FOUND versionName");
- if (attr_value==0xFFFFFFFF) {
- WARN_PRINT("Version name in a resource, should be plaintext")
- } else
- string_table[attr_value]=version_name;
- }
-
- if (tname=="activity" && /*nspace=="android" &&*/ attrname=="screenOrientation") {
-
- encode_uint32(orientation==0?0:1,&p_manifest[iofs+16]);
- /*
- print_line("FOUND screen orientation");
- if (attr_value==0xFFFFFFFF) {
- WARN_PRINT("Version name in a resource, should be plaintext")
- } else {
- string_table[attr_value]=(orientation==0?"landscape":"portrait");
- }*/
- }
-
- if (tname=="uses-permission" && /*nspace=="android" &&*/ attrname=="name") {
-
- if (value.begins_with("godot.custom")) {
-
- int which = value.get_slice(".",2).to_int();
- if (which>=0 && which<MAX_USER_PERMISSIONS && user_perms[which].strip_edges()!="") {
-
- string_table[attr_value]=user_perms[which].strip_edges();
- }
-
- } else if (value.begins_with("godot.")) {
- String perm = value.get_slice(".",1);
-
- if (perms.has(perm) || (p_give_internet && perm=="INTERNET")) {
-
- print_line("PERM: "+perm);
- string_table[attr_value]="android.permission."+perm;
- }
-
- }
- }
-
- if (tname=="supports-screens" ) {
-
- if (attrname=="smallScreens") {
-
- encode_uint32(screen_support[SCREEN_SMALL]?0xFFFFFFFF:0,&p_manifest[iofs+16]);
-
- } else if (attrname=="normalScreens") {
-
- encode_uint32(screen_support[SCREEN_NORMAL]?0xFFFFFFFF:0,&p_manifest[iofs+16]);
-
- } else if (attrname=="largeScreens") {
-
- encode_uint32(screen_support[SCREEN_LARGE]?0xFFFFFFFF:0,&p_manifest[iofs+16]);
-
- } else if (attrname=="xlargeScreens") {
-
- encode_uint32(screen_support[SCREEN_XLARGE]?0xFFFFFFFF:0,&p_manifest[iofs+16]);
-
- }
- }
-
-
- iofs+=20;
- }
-
- } break;
- }
- //printf("chunk %x: size: %d\n",chunk,size);
-
- ofs+=size;
- }
-
- //printf("end\n");
-
- //create new andriodmanifest binary
-
- Vector<uint8_t> ret;
- ret.resize(string_table_begins+string_table.size()*4);
-
- for(uint32_t i=0;i<string_table_begins;i++) {
-
- ret[i]=p_manifest[i];
- }
-
- ofs=0;
- for(int i=0;i<string_table.size();i++) {
-
- encode_uint32(ofs,&ret[string_table_begins+i*4]);
- ofs+=string_table[i].length()*2+2+2;
- //print_line("ofs: "+itos(i)+": "+itos(ofs));
- }
- ret.resize(ret.size()+ofs);
- uint8_t *chars=&ret[ret.size()-ofs];
- for(int i=0;i<string_table.size();i++) {
-
- String s = string_table[i];
- //print_line("savint string :"+s);
- encode_uint16(s.length(),chars);
- chars+=2;
- for(int j=0;j<s.length();j++) { //include zero?
- encode_uint16(s[j],chars);
- chars+=2;
- }
- encode_uint16(0,chars);
- chars+=2;
-
- }
-
-
- for(int i=0;i<stable_extra.size();i++) {
- ret.push_back(stable_extra[i]);
- }
-
- while(ret.size()%4)
- ret.push_back(0);
-
-
- uint32_t new_stable_end=ret.size();
-
- uint32_t extra = (p_manifest.size()-string_table_ends);
- ret.resize(new_stable_end + extra);
- for(uint32_t i=0;i<extra;i++)
- ret[new_stable_end+i]=p_manifest[string_table_ends+i];
-
- while(ret.size()%4)
- ret.push_back(0);
- encode_uint32(ret.size(),&ret[4]); //update new file size
-
- encode_uint32(new_stable_end-8,&ret[12]); //update new string table size
-
- //print_line("file size: "+itos(ret.size()));
-
- p_manifest=ret;
-
-#if 0
- uint32_t header[9];
- for(int i=0;i<9;i++) {
- header[i]=decode_uint32(&p_manifest[i*4]);
- }
-
- //print_line("STO: "+itos(header[3]));
- uint32_t st_offset=9*4;
- //ERR_FAIL_COND(header[3]!=0x24)
- uint32_t string_count=header[4];
-
-
- string_table.resize(string_count);
-
- for(int 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;
- uint32_t len = decode_uint16(&p_manifest[string_at]);
- Vector<CharType> ucstring;
- ucstring.resize(len+1);
- for(int j=0;j<len;j++) {
- uint16_t c=decode_uint16(&p_manifest[string_at+2+2*j]);
- ucstring[j]=c;
- }
- ucstring[len]=0;
- string_table[i]=ucstring.ptr();
- }
-
-#endif
-
-}
-
-
-
-Error EditorExportPlatformAndroid::save_apk_file(void *p_userdata,const String& p_path, const Vector<uint8_t>& p_data,int p_file,int p_total) {
-
- APKExportData *ed=(APKExportData*)p_userdata;
- String dst_path=p_path;
- dst_path=dst_path.replace_first("res://","assets/");
-
- zipOpenNewFileInZip(ed->apk,
- dst_path.utf8().get_data(),
- NULL,
- NULL,
- 0,
- NULL,
- 0,
- NULL,
- _should_compress_asset(p_path,p_data) ? Z_DEFLATED : 0,
- Z_DEFAULT_COMPRESSION);
-
-
- zipWriteInFileInZip(ed->apk,p_data.ptr(),p_data.size());
- zipCloseFileInZip(ed->apk);
- ed->ep->step("File: "+p_path,3+p_file*100/p_total);
- return OK;
-
-}
-
-bool EditorExportPlatformAndroid::_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 at runtime. Moreover, if the APK is
- * zip-aligned, assets stored as they are can be efficiently read by
- * Android by memory-mapping them.
- */
-
- // -- Unconditional uncompress to mimic AAPT plus some other
-
- static const char* unconditional_compress_ext[] = {
- // From https://github.com/android/platform_frameworks_base/blob/master/tools/aapt/Package.cpp
- // These formats are already compressed, or don't compress well:
- ".jpg", ".jpeg", ".png", ".gif",
- ".wav", ".mp2", ".mp3", ".ogg", ".aac",
- ".mpg", ".mpeg", ".mid", ".midi", ".smf", ".jet",
- ".rtttl", ".imy", ".xmf", ".mp4", ".m4a",
- ".m4v", ".3gp", ".3gpp", ".3g2", ".3gpp2",
- ".amr", ".awb", ".wma", ".wmv",
- // Godot-specific:
- ".webp", // Same reasoning as .png
- ".cfb", // Don't let small config files slow-down startup
- // Trailer for easier processing
- NULL
- };
-
- for (const char** ext=unconditional_compress_ext; *ext; ++ext) {
- if (p_path.to_lower().ends_with(String(*ext))) {
- return false;
- }
- }
-
- // -- Compressed resource?
-
- if (p_data.size() >= 4 && p_data[0]=='R' && p_data[1]=='S' && p_data[2]=='C' && p_data[3]=='C') {
- // Already compressed
- return false;
- }
-
- // --- TODO: Decide on texture resources according to their image compression setting
-
- return true;
-}
-
-
-
-Error EditorExportPlatformAndroid::export_project(const String& p_path, bool p_debug, int p_flags) {
-
- String src_apk;
-
- EditorProgress ep("export","Exporting for Android",105);
-
- if (p_debug)
- src_apk=custom_debug_package;
- else
- src_apk=custom_release_package;
-
- if (src_apk=="") {
- String err;
- if (p_debug) {
- src_apk=find_export_template("android_debug.apk", &err);
- } else {
- src_apk=find_export_template("android_release.apk", &err);
- }
- if (src_apk=="") {
- EditorNode::add_io_error(err);
- return ERR_FILE_NOT_FOUND;
- }
- }
-
- FileAccess *src_f=NULL;
- zlib_filefunc_def io = zipio_create_io_from_file(&src_f);
-
-
-
- ep.step("Creating APK",0);
-
- 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;
- }
-
- ERR_FAIL_COND_V(!pkg, ERR_CANT_OPEN);
- int ret = unzGoToFirstFile(pkg);
-
- zlib_filefunc_def io2=io;
- FileAccess *dst_f=NULL;
- io2.opaque=&dst_f;
- String unaligned_path=EditorSettings::get_singleton()->get_settings_path()+"/tmp/tmpexport-unaligned.apk";
- zipFile unaligned_apk=zipOpen2(unaligned_path.utf8().get_data(),APPEND_STATUS_CREATE,NULL,&io2);
-
-
- while(ret==UNZ_OK) {
-
- //get filename
- unz_file_info info;
- char fname[16384];
- ret = unzGetCurrentFileInfo(pkg,&info,fname,16384,NULL,0,NULL,0);
-
- bool skip=false;
-
- String file=fname;
-
- Vector<uint8_t> data;
- data.resize(info.uncompressed_size);
-
- //read
- unzOpenCurrentFile(pkg);
- unzReadCurrentFile(pkg,data.ptr(),data.size());
- unzCloseCurrentFile(pkg);
-
- //write
-
- if (file=="AndroidManifest.xml") {
-
- _fix_manifest(data,p_flags&(EXPORT_DUMB_CLIENT|EXPORT_REMOTE_DEBUG));
- }
-
- if (file=="resources.arsc") {
-
- _fix_resources(data);
- }
-
- if (file=="res/drawable/icon.png") {
- bool found=false;
-
- if (this->icon!="" && this->icon.ends_with(".png")) {
-
- FileAccess *f = FileAccess::open(this->icon,FileAccess::READ);
- if (f) {
-
- data.resize(f->get_len());
- f->get_buffer(data.ptr(),data.size());
- memdelete(f);
- found=true;
- }
-
- }
-
- if (!found) {
-
- String appicon = ProjectSettings::get_singleton()->get("application/config/icon");
- if (appicon!="" && appicon.ends_with(".png")) {
- FileAccess*f = FileAccess::open(appicon,FileAccess::READ);
- if (f) {
- data.resize(f->get_len());
- f->get_buffer(data.ptr(),data.size());
- memdelete(f);
- }
- }
- }
- }
-
- if (file=="lib/x86/libgodot_android.so" && !export_x86) {
- skip=true;
- }
-
- if (file.match("lib/armeabi*/libgodot_android.so") && !export_arm) {
- skip=true;
- }
-
- if (file.match("lib/arm64*/libgodot_android.so") && !export_arm64) {
- skip = true;
- }
-
- if (file.begins_with("META-INF") && _signed) {
- skip=true;
- }
-
- print_line("ADDING: "+file);
-
- if (!skip) {
-
- // Respect decision on compression made by AAPT for the export template
- const bool uncompressed = info.compression_method == 0;
-
- zipOpenNewFileInZip(unaligned_apk,
- file.utf8().get_data(),
- NULL,
- NULL,
- 0,
- NULL,
- 0,
- NULL,
- uncompressed ? 0 : Z_DEFLATED,
- Z_DEFAULT_COMPRESSION);
-
- zipWriteInFileInZip(unaligned_apk,data.ptr(),data.size());
- zipCloseFileInZip(unaligned_apk);
- }
-
- ret = unzGoToNextFile(pkg);
- }
-
-
- ep.step("Adding Files..",1);
- Error err=OK;
- Vector<String> cl = cmdline.strip_edges().split(" ");
- for(int i=0;i<cl.size();i++) {
- if (cl[i].strip_edges().length()==0) {
- cl.remove(i);
- i--;
- }
- }
-
- gen_export_flags(cl,p_flags);
-
- if (p_flags&EXPORT_DUMB_CLIENT) {
-
- /*String host = EditorSettings::get_singleton()->get("filesystem/file_server/host");
- int port = EditorSettings::get_singleton()->get("filesystem/file_server/post");
- String passwd = EditorSettings::get_singleton()->get("filesystem/file_server/password");
- cl.push_back("-rfs");
- cl.push_back(host+":"+itos(port));
- if (passwd!="") {
- cl.push_back("-rfs_pass");
- cl.push_back(passwd);
- }*/
-
-
- } else {
- //all files
-
- if (apk_expansion) {
-
- String apkfname="main."+itos(version_code)+"."+get_package_name()+".obb";
- String fullpath=p_path.get_base_dir().plus_file(apkfname);
- FileAccess *pf = FileAccess::open(fullpath,FileAccess::WRITE);
- if (!pf) {
- EditorNode::add_io_error("Could not write expansion package file: "+apkfname);
- return OK;
- }
- err = save_pack(pf);
- memdelete(pf);
-
- cl.push_back("-use_apk_expansion");
- cl.push_back("-apk_expansion_md5");
- cl.push_back(FileAccess::get_md5(fullpath));
- cl.push_back("-apk_expansion_key");
- cl.push_back(apk_expansion_pkey.strip_edges());
-
- } else {
-
- APKExportData ed;
- ed.ep=&ep;
- ed.apk=unaligned_apk;
-
- err = export_project_files(save_apk_file,&ed,false);
- }
-
-
- }
-
- if (use_32_fb)
- cl.push_back("-use_depth_32");
-
- if (immersive)
- cl.push_back("-use_immersive");
-
- if (cl.size()) {
- //add comandline
- Vector<uint8_t> clf;
- clf.resize(4);
- encode_uint32(cl.size(),&clf[0]);
- for(int i=0;i<cl.size();i++) {
-
- CharString txt = cl[i].utf8();
- int base = clf.size();
- clf.resize(base+4+txt.length());
- encode_uint32(txt.length(),&clf[base]);
- copymem(&clf[base+4],txt.ptr(),txt.length());
- print_line(itos(i)+" param: "+cl[i]);
- }
-
- zipOpenNewFileInZip(unaligned_apk,
- "assets/_cl_",
- NULL,
- NULL,
- 0,
- NULL,
- 0,
- NULL,
- 0, // No compress (little size gain and potentially slower startup)
- Z_DEFAULT_COMPRESSION);
-
- zipWriteInFileInZip(unaligned_apk,clf.ptr(),clf.size());
- zipCloseFileInZip(unaligned_apk);
-
- }
-
- zipClose(unaligned_apk,NULL);
- unzClose(pkg);
-
- if (err) {
- return err;
- }
-
-
-
- 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.\nResulting apk is unsigned.");
- return OK;
- }
-
- String keystore;
- String password;
- String user;
- if (p_debug) {
- 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");
-
- ep.step("Signing Debug APK..",103);
-
- } else {
- keystore=release_keystore;
- password=release_password;
- user=release_username;
-
- ep.step("Signing Release APK..",103);
-
- }
-
- if (!FileAccess::exists(keystore)) {
- EditorNode::add_io_error("Could not find keystore, unable to export.");
- return ERR_FILE_CANT_OPEN;
- }
- List<String> args;
- args.push_back("-digestalg");
- args.push_back("SHA1");
- args.push_back("-sigalg");
- args.push_back("MD5withRSA");
- String tsa_url=EditorSettings::get_singleton()->get("export/android/timestamping_authority_url");
- if (tsa_url != "") {
- args.push_back("-tsa");
- args.push_back(tsa_url);
- }
- args.push_back("-verbose");
- args.push_back("-keystore");
- args.push_back(keystore);
- args.push_back("-storepass");
- args.push_back(password);
- args.push_back(unaligned_path);
- args.push_back(user);
- int retval;
- OS::get_singleton()->execute(jarsigner,args,true,NULL,NULL,&retval);
- if (retval) {
- EditorNode::add_io_error("'jarsigner' returned with error #"+itos(retval));
- return ERR_CANT_CREATE;
- }
-
- ep.step("Verifying APK..",104);
-
- args.clear();
- args.push_back("-verify");
- args.push_back(unaligned_path);
- args.push_back("-verbose");
-
- OS::get_singleton()->execute(jarsigner,args,true,NULL,NULL,&retval);
- if (retval) {
- EditorNode::add_io_error("'jarsigner' verification of APK failed. Make sure to use jarsigner from Java 6.");
- return ERR_CANT_CREATE;
- }
-
- }
-
-
-
- // Let's zip-align (must be done after signing)
-
- static const int ZIP_ALIGNMENT = 4;
-
- ep.step("Aligning APK..",105);
-
- unzFile tmp_unaligned = unzOpen2(unaligned_path.utf8().get_data(), &io);
- if (!tmp_unaligned) {
-
- EditorNode::add_io_error("Could not find temp unaligned APK.");
- return ERR_FILE_NOT_FOUND;
- }
-
- ERR_FAIL_COND_V(!tmp_unaligned, ERR_CANT_OPEN);
- ret = unzGoToFirstFile(tmp_unaligned);
-
- io2=io;
- dst_f=NULL;
- io2.opaque=&dst_f;
- zipFile final_apk=zipOpen2(p_path.utf8().get_data(),APPEND_STATUS_CREATE,NULL,&io2);
-
- // Take files from the unaligned APK and write them out to the aligned one
- // in raw mode, i.e. not uncompressing and recompressing, aligning them as needed,
- // 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));
-
- char fname[16384];
- char extra[16384];
- ret = unzGetCurrentFileInfo(tmp_unaligned,&info,fname,16384,extra,16384-ZIP_ALIGNMENT,NULL,0);
-
- String file=fname;
-
- Vector<uint8_t> data;
- data.resize(info.compressed_size);
-
- // read
- int method, level;
- unzOpenCurrentFile2(tmp_unaligned, &method, &level, 1); // raw read
- long file_offset = unzGetCurrentFileZStreamPos64(tmp_unaligned);
- unzReadCurrentFile(tmp_unaligned,data.ptr(),data.size());
- unzCloseCurrentFile(tmp_unaligned);
-
- // align
- int padding = 0;
- if (!info.compression_method) {
- // Uncompressed file => Align
- long new_offset = file_offset + bias;
- padding = (ZIP_ALIGNMENT - (new_offset % ZIP_ALIGNMENT)) % ZIP_ALIGNMENT;
- }
-
- memset(extra + info.size_file_extra, 0, padding);
-
- // write
- zipOpenNewFileInZip2(final_apk,
- file.utf8().get_data(),
- NULL,
- extra,
- info.size_file_extra + padding,
- NULL,
- 0,
- NULL,
- method,
- level,
- 1); // raw write
- zipWriteInFileInZip(final_apk,data.ptr(),data.size());
- zipCloseFileInZipRaw(final_apk,info.uncompressed_size,info.crc);
-
- bias += padding;
-
- ret = unzGoToNextFile(tmp_unaligned);
- }
-
- zipClose(final_apk,NULL);
- unzClose(tmp_unaligned);
-
- if (err) {
- return err;
- }
-
- return OK;
-
-}
-
-
-bool EditorExportPlatformAndroid::poll_devices() {
-
- bool dc=devices_changed;
- devices_changed=false;
- return dc;
-}
-
-int EditorExportPlatformAndroid::get_device_count() const {
-
- device_lock->lock();
- int dc=devices.size();
- device_lock->unlock();
-
- return dc;
-
-}
-
-String EditorExportPlatformAndroid::get_device_name(int p_device) const {
-
- ERR_FAIL_INDEX_V(p_device,devices.size(),"");
- device_lock->lock();
- String s=devices[p_device].name;
- device_lock->unlock();
- return s;
-}
-
-String EditorExportPlatformAndroid::get_device_info(int p_device) const {
-
- ERR_FAIL_INDEX_V(p_device,devices.size(),"");
- device_lock->lock();
- String s=devices[p_device].description;
- device_lock->unlock();
- return s;
-}
-
-void EditorExportPlatformAndroid::_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");
- int ec;
- OS::get_singleton()->execute(adb,args,true,NULL,&devices,&ec);
- 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)
- continue;
- d=d.substr(0,dpos).strip_edges();
- //print_line("found devuce: "+d);
- ldevices.push_back(d);
- }
-
- ea->device_lock->lock();
-
- bool different=false;
-
- if (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;
- }
- }
- }
-
- 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++) {
- if (ea->devices[j].id==ldevices[i]) {
- d.description=ea->devices[j].description;
- d.name=ea->devices[j].name;
- }
- }
-
- if (d.description=="") {
- //in the oven, request!
- args.clear();
- args.push_back("-s");
- args.push_back(d.id);
- args.push_back("shell");
- args.push_back("cat");
- args.push_back("/system/build.prop");
- int ec;
- String dp;
-
- OS::get_singleton()->execute(adb,args,true,NULL,&dp,&ec);
-
- Vector<String> props = dp.split("\n");
- String vendor;
- String device;
- d.description+"Device ID: "+d.id+"\n";
- for(int j=0;j<props.size();j++) {
-
- String p = props[j];
- if (p.begins_with("ro.product.model=")) {
- device=p.get_slice("=",1).strip_edges();
- } else if (p.begins_with("ro.product.brand=")) {
- vendor=p.get_slice("=",1).strip_edges().capitalize();
- } else if (p.begins_with("ro.build.display.id=")) {
- d.description+="Build: "+p.get_slice("=",1).strip_edges()+"\n";
- } else if (p.begins_with("ro.build.version.release=")) {
- d.description+="Release: "+p.get_slice("=",1).strip_edges()+"\n";
- } else if (p.begins_with("ro.product.cpu.abi=")) {
- d.description+="CPU: "+p.get_slice("=",1).strip_edges()+"\n";
- } else if (p.begins_with("ro.product.manufacturer=")) {
- d.description+="Manufacturer: "+p.get_slice("=",1).strip_edges()+"\n";
- } else if (p.begins_with("ro.board.platform=")) {
- d.description+="Chipset: "+p.get_slice("=",1).strip_edges()+"\n";
- } else if (p.begins_with("ro.opengles.version=")) {
- uint32_t opengl = p.get_slice("=",1).to_int();
- d.description+="OpenGL: "+itos(opengl>>16)+"."+itos((opengl>>8)&0xFF)+"."+itos((opengl)&0xFF)+"\n";
- }
- }
-
- d.name=vendor+" "+device;
- //print_line("name: "+d.name);
- //print_line("description: "+d.description);
-
- }
-
- ndevices.push_back(d);
-
- }
-
- ea->devices=ndevices;
- ea->devices_changed=true;
- }
-
- ea->device_lock->unlock();
- }
-
- uint64_t wait = 3000000;
- uint64_t time = OS::get_singleton()->get_ticks_usec();
- while(OS::get_singleton()->get_ticks_usec() - time < wait ) {
- OS::get_singleton()->delay_usec(1000);
- if (ea->quit_request)
- break;
- }
-
- }
-
- if (EditorSettings::get_singleton()->get("export/android/shutdown_adb_on_exit")) {
- String adb=EditorSettings::get_singleton()->get("export/android/adb");
- if (!FileAccess::exists(adb)) {
- return; //adb not configured
- }
-
- List<String> args;
- args.push_back("kill-server");
- OS::get_singleton()->execute(adb,args,true);
- };
-}
-
-Error EditorExportPlatformAndroid::run(int p_device, int p_flags) {
-
- ERR_FAIL_INDEX_V(p_device,devices.size(),ERR_INVALID_PARAMETER);
- device_lock->lock();
-
- EditorProgress ep("run","Running on "+devices[p_device].name,3);
-
- String adb=EditorSettings::get_singleton()->get("export/android/adb");
- if (adb=="") {
-
- EditorNode::add_io_error("ADB executable not configured in settings, can't run.");
- device_lock->unlock();
- return ERR_UNCONFIGURED;
- }
-
- //export_temp
- ep.step("Exporting APK",0);
-
-
- bool use_adb_over_usb = bool(EDITOR_DEF("export/android/use_remote_debug_over_adb",true));
-
- if (use_adb_over_usb) {
- p_flags|=EXPORT_REMOTE_DEBUG_LOCALHOST;
- }
-
- String export_to=EditorSettings::get_singleton()->get_settings_path()+"/tmp/tmpexport.apk";
- Error err = export_project(export_to,true,p_flags);
- if (err) {
- device_lock->unlock();
- return err;
- }
-
- List<String> args;
- int rv;
-
- if (remove_prev) {
- ep.step("Uninstalling..",1);
-
- print_line("Uninstalling previous version: "+devices[p_device].name);
-
- args.push_back("-s");
- args.push_back(devices[p_device].id);
- args.push_back("uninstall");
- args.push_back(get_package_name());
-
- err = OS::get_singleton()->execute(adb,args,true,NULL,NULL,&rv);
-#if 0
- if (err || rv!=0) {
- EditorNode::add_io_error("Could not install to device.");
- device_lock->unlock();
- return ERR_CANT_CREATE;
- }
-#endif
- }
-
- print_line("Installing into device (please wait..): "+devices[p_device].name);
- ep.step("Installing to Device (please wait..)..",2);
-
- args.clear();
- args.push_back("-s");
- args.push_back(devices[p_device].id);
- args.push_back("install");
- args.push_back("-r");
- args.push_back(export_to);
-
- err = OS::get_singleton()->execute(adb,args,true,NULL,NULL,&rv);
- if (err || rv!=0) {
- EditorNode::add_io_error("Could not install to device.");
- device_lock->unlock();
- return ERR_CANT_CREATE;
- }
-
- if (use_adb_over_usb) {
-
- args.clear();
- args.push_back("reverse");
- args.push_back("--remove-all");
- err = OS::get_singleton()->execute(adb,args,true,NULL,NULL,&rv);
-
- int port = (int)EditorSettings::get_singleton()->get("network/debug/remote_port");
- args.clear();
- args.push_back("reverse");
- args.push_back("tcp:"+itos(port));
- args.push_back("tcp:"+itos(port));
-
- err = OS::get_singleton()->execute(adb,args,true,NULL,NULL,&rv);
- print_line("Reverse result: "+itos(rv));
-
- int fs_port = EditorSettings::get_singleton()->get("filesystem/file_server/port");
-
- args.clear();
- args.push_back("reverse");
- args.push_back("tcp:"+itos(fs_port));
- args.push_back("tcp:"+itos(fs_port));
-
- err = OS::get_singleton()->execute(adb,args,true,NULL,NULL,&rv);
- print_line("Reverse result2: "+itos(rv));
-
- }
-
-
- ep.step("Running on Device..",3);
- args.clear();
- args.push_back("-s");
- args.push_back(devices[p_device].id);
- args.push_back("shell");
- args.push_back("am");
- args.push_back("start");
- args.push_back("--user 0");
- args.push_back("-a");
- args.push_back("android.intent.action.MAIN");
- args.push_back("-n");
- args.push_back(get_package_name()+"/org.godotengine.godot.Godot");
-
- err = OS::get_singleton()->execute(adb,args,true,NULL,NULL,&rv);
- if (err || rv!=0) {
- EditorNode::add_io_error("Could not execute ondevice.");
- device_lock->unlock();
- return ERR_CANT_CREATE;
- }
- device_lock->unlock();
- return OK;
-}
-
-String EditorExportPlatformAndroid::get_package_name() {
-
- String pname = package;
- String basename = ProjectSettings::get_singleton()->get("application/config/name");
- basename=basename.to_lower();
-
- String name;
- bool first=true;
- for(int i=0;i<basename.length();i++) {
- CharType c = basename[i];
- if (c>='0' && c<='9' && first) {
- continue;
- }
- if ((c>='a' && c<='z') || (c>='A' && c<='Z') || (c>='0' && c<='9')) {
- name+=String::chr(c);
- first=false;
- }
- }
- if (name=="")
- name="noname";
-
- pname=pname.replace("$genname",name);
- return pname;
-
-}
-
-EditorExportPlatformAndroid::EditorExportPlatformAndroid() {
-
- version_code=1;
- version_name="1.0";
- package="org.godotengine.$genname";
- name="";
- _signed=true;
- apk_expansion=false;
- quit_request=false;
- orientation=0;
- remove_prev=true;
- use_32_fb=true;
- immersive=true;
-
- export_arm=true;
- export_arm64=false;
- export_x86=false;
-
-
- device_thread=Thread::create(_device_poll_thread,this);
- devices_changed=true;
-
- Image img( _android_logo );
- logo = Ref<ImageTexture>( memnew( ImageTexture ));
- logo->create_from_image(img);
-
- for(int i=0;i<4;i++)
- screen_support[i]=true;
-}
-
-bool EditorExportPlatformAndroid::can_export(String *r_error) const {
-
- bool valid=true;
- String adb=EditorSettings::get_singleton()->get("export/android/adb");
- String err;
-
- if (!FileAccess::exists(adb)) {
-
- valid=false;
- err+="ADB executable not configured in editor settings.\n";
- }
-
- String js = EditorSettings::get_singleton()->get("export/android/jarsigner");
-
- if (!FileAccess::exists(js)) {
-
- valid=false;
- err+="OpenJDK 6 jarsigner not configured in editor settings.\n";
- }
-
- String dk = EditorSettings::get_singleton()->get("export/android/debug_keystore");
-
- if (!FileAccess::exists(dk)) {
-
- valid=false;
- err+="Debug Keystore not configured in editor settings.\n";
- }
-
- if (!exists_export_template("android_debug.apk") || !exists_export_template("android_release.apk")) {
- valid=false;
- err+="No export templates found.\nDownload and install export templates.\n";
- }
-
- if (custom_debug_package!="" && !FileAccess::exists(custom_debug_package)) {
- valid=false;
- err+="Custom debug package not found.\n";
- }
-
- if (custom_release_package!="" && !FileAccess::exists(custom_release_package)) {
- valid=false;
- err+="Custom release package not found.\n";
- }
-
- if (apk_expansion) {
-
- /*
- if (apk_expansion_salt=="") {
- valid=false;
- err+="Invalid SALT for apk expansion.\n";
- }
- */
- if (apk_expansion_pkey=="") {
- valid=false;
- err+="Invalid public key for apk expansion.\n";
- }
- }
-
- if (r_error)
- *r_error=err;
-
- return valid;
-}
-
-
-EditorExportPlatformAndroid::~EditorExportPlatformAndroid() {
-
- quit_request=true;
- Thread::wait_to_finish(device_thread);
- memdelete(device_lock);
- memdelete(device_thread);
-}
-
-#endif
+#include <string.h>
static const char *android_perms[] = {
"ACCESS_CHECKIN_PROPERTIES",
@@ -2060,7 +204,7 @@ class EditorExportAndroid : public EditorExportPlatform {
String id;
String name;
String description;
- int release;
+ int api_level;
};
struct APKExportData {
@@ -2134,7 +278,7 @@ class EditorExportAndroid : public EditorExportPlatform {
if (ea->devices[j].id == ldevices[i]) {
d.description = ea->devices[j].description;
d.name = ea->devices[j].name;
- d.release = ea->devices[j].release;
+ d.api_level = ea->devices[j].api_level;
}
}
@@ -2155,7 +299,7 @@ class EditorExportAndroid : public EditorExportPlatform {
String vendor;
String device;
d.description + "Device ID: " + d.id + "\n";
- d.release = 0;
+ d.api_level = 0;
for (int j = 0; j < props.size(); j++) {
String p = props[j];
@@ -2166,9 +310,9 @@ class EditorExportAndroid : public EditorExportPlatform {
} else if (p.begins_with("ro.build.display.id=")) {
d.description += "Build: " + p.get_slice("=", 1).strip_edges() + "\n";
} else if (p.begins_with("ro.build.version.release=")) {
- const String release_str = p.get_slice("=", 1).strip_edges();
- d.description += "Release: " + release_str + "\n";
- d.release = release_str.to_int();
+ d.description += "Release: " + p.get_slice("=", 1).strip_edges() + "\n";
+ } else if (p.begins_with("ro.build.version.sdk=")) {
+ d.api_level = p.get_slice("=", 1).to_int();
} else if (p.begins_with("ro.product.cpu.abi=")) {
d.description += "CPU: " + p.get_slice("=", 1).strip_edges() + "\n";
} else if (p.begins_with("ro.product.manufacturer=")) {
@@ -2665,37 +809,6 @@ class EditorExportAndroid : public EditorExportPlatform {
//print_line("file size: "+itos(ret.size()));
p_manifest = ret;
-
-#if 0
- uint32_t header[9];
- for(int i=0;i<9;i++) {
- header[i]=decode_uint32(&p_manifest[i*4]);
- }
-
- //print_line("STO: "+itos(header[3]));
- uint32_t st_offset=9*4;
- //ERR_FAIL_COND(header[3]!=0x24)
- uint32_t string_count=header[4];
-
-
- string_table.resize(string_count);
-
- for(int 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;
- uint32_t len = decode_uint16(&p_manifest[string_at]);
- Vector<CharType> ucstring;
- ucstring.resize(len+1);
- for(int j=0;j<len;j++) {
- uint16_t c=decode_uint16(&p_manifest[string_at+2+2*j]);
- ucstring[j]=c;
- }
- ucstring[len]=0;
- string_table[i]=ucstring.ptr();
- }
-
-#endif
}
static String _parse_string(const uint8_t *p_bytes, bool p_utf8) {
@@ -2960,11 +1073,11 @@ public:
//export_temp
ep.step("Exporting APK", 0);
- bool use_adb_over_usb = bool(EDITOR_DEF("export/android/use_remote_debug_over_adb", true));
+ const bool use_remote = (p_debug_flags & DEBUG_FLAG_REMOTE_DEBUG) || (p_debug_flags & DEBUG_FLAG_DUMB_CLIENT);
+ const bool use_reverse = devices[p_device].api_level >= 21;
- if (use_adb_over_usb) {
+ if (use_reverse)
p_debug_flags |= DEBUG_FLAG_REMOTE_DEBUG_LOCALHOST;
- }
String export_to = EditorSettings::get_singleton()->get_settings_path() + "/tmp/tmpexport.apk";
Error err = export_project(p_preset, true, export_to, p_debug_flags);
@@ -2991,13 +1104,6 @@ public:
args.push_back(get_package_name(package_name));
err = OS::get_singleton()->execute(adb, args, true, NULL, NULL, &rv);
-#if 0
- if (err || rv!=0) {
- EditorNode::add_io_error("Could not install to device.");
- device_lock->unlock();
- return ERR_CANT_CREATE;
- }
-#endif
}
print_line("Installing into device (please wait..): " + devices[p_device].name);
@@ -3017,37 +1123,54 @@ public:
return ERR_CANT_CREATE;
}
- if (use_adb_over_usb) {
+ if (use_remote) {
+ if (use_reverse) {
- args.clear();
- args.push_back("-s");
- args.push_back(devices[p_device].id);
- args.push_back("reverse");
- args.push_back("--remove-all");
- err = OS::get_singleton()->execute(adb, args, true, NULL, NULL, &rv);
+ static const char *const msg = "** Device API >= 21; debugging over USB **";
+ EditorNode::get_singleton()->get_log()->add_message(msg);
+ print_line(String(msg).to_upper());
- int dbg_port = EditorSettings::get_singleton()->get("network/debug/remote_port");
- args.clear();
- args.push_back("-s");
- args.push_back(devices[p_device].id);
- args.push_back("reverse");
- args.push_back("tcp:" + itos(dbg_port));
- args.push_back("tcp:" + itos(dbg_port));
+ args.clear();
+ args.push_back("-s");
+ args.push_back(devices[p_device].id);
+ args.push_back("reverse");
+ args.push_back("--remove-all");
+ OS::get_singleton()->execute(adb, args, true, NULL, NULL, &rv);
- err = OS::get_singleton()->execute(adb, args, true, NULL, NULL, &rv);
- print_line("Reverse result: " + itos(rv));
+ if (p_debug_flags & DEBUG_FLAG_REMOTE_DEBUG) {
- int fs_port = EditorSettings::get_singleton()->get("filesystem/file_server/port");
+ int dbg_port = EditorSettings::get_singleton()->get("network/debug/remote_port");
+ args.clear();
+ args.push_back("-s");
+ args.push_back(devices[p_device].id);
+ args.push_back("reverse");
+ args.push_back("tcp:" + itos(dbg_port));
+ args.push_back("tcp:" + itos(dbg_port));
- args.clear();
- args.push_back("-s");
- args.push_back(devices[p_device].id);
- args.push_back("reverse");
- args.push_back("tcp:" + itos(fs_port));
- args.push_back("tcp:" + itos(fs_port));
+ OS::get_singleton()->execute(adb, args, true, NULL, NULL, &rv);
+ print_line("Reverse result: " + itos(rv));
+ }
- err = OS::get_singleton()->execute(adb, args, true, NULL, NULL, &rv);
- print_line("Reverse result2: " + itos(rv));
+ if (p_debug_flags & DEBUG_FLAG_DUMB_CLIENT) {
+
+ int fs_port = EditorSettings::get_singleton()->get("filesystem/file_server/port");
+
+ args.clear();
+ args.push_back("-s");
+ args.push_back(devices[p_device].id);
+ args.push_back("reverse");
+ args.push_back("tcp:" + itos(fs_port));
+ args.push_back("tcp:" + itos(fs_port));
+
+ err = OS::get_singleton()->execute(adb, args, true, NULL, NULL, &rv);
+ 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);
+ print_line(String(msg).to_upper());
+ }
}
ep.step("Running on Device..", 3);
@@ -3057,7 +1180,7 @@ public:
args.push_back("shell");
args.push_back("am");
args.push_back("start");
- if ((bool)EditorSettings::get_singleton()->get("export/android/force_system_user") && devices[p_device].release >= 17) { // Multi-user introduced in Android 17
+ if ((bool)EditorSettings::get_singleton()->get("export/android/force_system_user") && devices[p_device].api_level >= 17) { // Multi-user introduced in Android 17
args.push_back("--user");
args.push_back("0");
}
@@ -3188,7 +1311,7 @@ public:
bool export_arm = p_preset->get("architecture/arm");
bool export_arm64 = p_preset->get("architecture/arm64");
- bool use_32_fb = p_preset->get("screen/use_32_bits_view");
+ bool use_32_fb = p_preset->get("graphics/32_bits_framebuffer");
bool immersive = p_preset->get("screen/immersive_mode");
bool _signed = p_preset->get("package/signed");
@@ -3330,10 +1453,10 @@ public:
/*String host = EditorSettings::get_singleton()->get("filesystem/file_server/host");
int port = EditorSettings::get_singleton()->get("filesystem/file_server/post");
String passwd = EditorSettings::get_singleton()->get("filesystem/file_server/password");
- cl.push_back("-rfs");
+ cl.push_back("--remote-fs");
cl.push_back(host+":"+itos(port));
if (passwd!="") {
- cl.push_back("-rfs_pass");
+ cl.push_back("--remote-fs-password");
cl.push_back(passwd);
}*/
@@ -3350,10 +1473,10 @@ public:
return OK;
}
- cl.push_back("-use_apk_expansion");
- cl.push_back("-apk_expansion_md5");
+ cl.push_back("--use_apk_expansion");
+ cl.push_back("--apk_expansion_md5");
cl.push_back(FileAccess::get_md5(fullpath));
- cl.push_back("-apk_expansion_key");
+ cl.push_back("--apk_expansion_key");
cl.push_back(apk_expansion_pkey.strip_edges());
} else {
@@ -3367,10 +1490,10 @@ public:
}
if (use_32_fb)
- cl.push_back("-use_depth_32");
+ cl.push_back("--use_depth_32");
if (immersive)
- cl.push_back("-use_immersive");
+ cl.push_back("--use_immersive");
if (cl.size()) {
//add comandline
@@ -3618,7 +1741,6 @@ void register_android_exporter() {
EDITOR_DEF("export/android/force_system_user", false);
EDITOR_DEF("export/android/timestamping_authority_url", "");
- EDITOR_DEF("export/android/use_remote_debug_over_adb", false);
EDITOR_DEF("export/android/shutdown_adb_on_exit", true);
Ref<EditorExportAndroid> exporter = Ref<EditorExportAndroid>(memnew(EditorExportAndroid));
diff --git a/platform/android/export/export.h b/platform/android/export/export.h
index e3b0b4aab6..40ce129dcd 100644
--- a/platform/android/export/export.h
+++ b/platform/android/export/export.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/android/file_access_android.cpp b/platform/android/file_access_android.cpp
index be19f056b0..f207b81b4b 100644
--- a/platform/android/file_access_android.cpp
+++ b/platform/android/file_access_android.cpp
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/android/file_access_android.h b/platform/android/file_access_android.h
index 0ee8cd7efe..c2ce2b0bfe 100644
--- a/platform/android/file_access_android.h
+++ b/platform/android/file_access_android.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/android/file_access_jandroid.cpp b/platform/android/file_access_jandroid.cpp
index e20ffd4f8a..ad855c790d 100644
--- a/platform/android/file_access_jandroid.cpp
+++ b/platform/android/file_access_jandroid.cpp
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/android/file_access_jandroid.h b/platform/android/file_access_jandroid.h
index 9bb471246a..8060312182 100644
--- a/platform/android/file_access_jandroid.h
+++ b/platform/android/file_access_jandroid.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
@@ -71,7 +71,7 @@ public:
virtual bool file_exists(const String &p_path); ///< return true if a file exists
- static void setup(jobject io);
+ static void setup(jobject p_io);
virtual uint64_t _get_modified_time(const String &p_file) { return 0; }
diff --git a/platform/android/globals/global_defaults.cpp b/platform/android/globals/global_defaults.cpp
index 6bdc6b337c..c73b578154 100644
--- a/platform/android/globals/global_defaults.cpp
+++ b/platform/android/globals/global_defaults.cpp
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/android/globals/global_defaults.h b/platform/android/globals/global_defaults.h
index d524b56af6..8c918414d3 100644
--- a/platform/android/globals/global_defaults.h
+++ b/platform/android/globals/global_defaults.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/android/godot_android.cpp b/platform/android/godot_android.cpp
index 71db03049a..8235683496 100644
--- a/platform/android/godot_android.cpp
+++ b/platform/android/godot_android.cpp
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
@@ -565,20 +565,6 @@ static void engine_handle_cmd(struct android_app *app, int32_t cmd) {
case APP_CMD_CONFIG_CHANGED:
case APP_CMD_WINDOW_RESIZED: {
-#if 0
-// android blows
- if (engine->display_active) {
-
- EGLint w,h;
- eglQuerySurface(engine->display, engine->surface, EGL_WIDTH, &w);
- eglQuerySurface(engine->display, engine->surface, EGL_HEIGHT, &h);
- engine->os->init_video_mode(w,h);
- //print_line("RESIZED VIDEO MODE: "+itos(w)+","+itos(h));
- engine_draw_frame(engine);
-
- }
-#else
-
if (engine->display_active) {
EGLint w, h;
@@ -594,17 +580,6 @@ static void engine_handle_cmd(struct android_app *app, int32_t cmd) {
engine_draw_frame(engine);
engine->animating = 1;
-/*
- EGLint w,h;
- eglQuerySurface(engine->display, engine->surface, EGL_WIDTH, &w);
- eglQuerySurface(engine->display, engine->surface, EGL_HEIGHT, &h);
- engine->os->init_video_mode(w,h);
- //print_line("RESIZED VIDEO MODE: "+itos(w)+","+itos(h));
-
- }*/
-
-#endif
-
} break;
case APP_CMD_INIT_WINDOW:
//The window is being shown, get it ready.
@@ -616,11 +591,8 @@ static void engine_handle_cmd(struct android_app *app, int32_t cmd) {
//do initialization here, when there's OpenGL! hackish but the only way
engine->os = new OS_Android(_gfx_init, engine);
- //char *args[]={"-test","gui",NULL};
__android_log_print(ANDROID_LOG_INFO, "godot", "pre asdasd setup...");
-#if 0
- Error err = Main::setup("apk",2,args);
-#else
+
Error err = Main::setup("apk", 0, NULL);
String modules = ProjectSettings::get_singleton()->get("android/modules");
@@ -670,8 +642,6 @@ static void engine_handle_cmd(struct android_app *app, int32_t cmd) {
}
}
-#endif
-
if (!Main::start())
return; //should exit instead and print the error
@@ -739,21 +709,21 @@ static void engine_handle_cmd(struct android_app *app, int32_t cmd) {
}
}
-void android_main(struct android_app *state) {
+void android_main(struct android_app *app) {
struct engine engine;
// Make sure glue isn't stripped.
app_dummy();
memset(&engine, 0, sizeof(engine));
- state->userData = &engine;
- state->onAppCmd = engine_handle_cmd;
- state->onInputEvent = engine_handle_input;
- engine.app = state;
+ app->userData = &engine;
+ app->onAppCmd = engine_handle_cmd;
+ app->onInputEvent = engine_handle_input;
+ engine.app = app;
engine.requested_quit = false;
engine.os = NULL;
engine.display_active = false;
- FileAccessAndroid::asset_manager = state->activity->assetManager;
+ FileAccessAndroid::asset_manager = app->activity->assetManager;
// Prepare to monitor sensors
engine.sensorManager = ASensorManager_getInstance();
@@ -764,11 +734,11 @@ void android_main(struct android_app *state) {
engine.gyroscopeSensor = ASensorManager_getDefaultSensor(engine.sensorManager,
ASENSOR_TYPE_GYROSCOPE);
engine.sensorEventQueue = ASensorManager_createEventQueue(engine.sensorManager,
- state->looper, LOOPER_ID_USER, NULL, NULL);
+ app->looper, LOOPER_ID_USER, NULL, NULL);
- ANativeActivity_setWindowFlags(state->activity, AWINDOW_FLAG_FULLSCREEN | AWINDOW_FLAG_KEEP_SCREEN_ON, 0);
+ ANativeActivity_setWindowFlags(app->activity, AWINDOW_FLAG_FULLSCREEN | AWINDOW_FLAG_KEEP_SCREEN_ON, 0);
- state->activity->vm->AttachCurrentThread(&engine.jni, NULL);
+ app->activity->vm->AttachCurrentThread(&engine.jni, NULL);
// loop waiting for stuff to do.
@@ -790,7 +760,7 @@ void android_main(struct android_app *state) {
if (source != NULL) {
// LOGI("process\n");
- source->process(state, source);
+ source->process(app, source);
} else {
nullmax--;
if (nullmax < 0)
@@ -824,17 +794,16 @@ void android_main(struct android_app *state) {
}
// Check if we are exiting.
- if (state->destroyRequested != 0) {
+ if (app->destroyRequested != 0) {
if (engine.os) {
engine.os->main_loop_request_quit();
}
- state->destroyRequested = 0;
+ app->destroyRequested = 0;
}
if (engine.requested_quit) {
engine_term_display(&engine);
exit(0);
- return;
}
// LOGI("end\n");
diff --git a/platform/android/java/src/org/godotengine/godot/Dictionary.java b/platform/android/java/src/org/godotengine/godot/Dictionary.java
index b9501e0858..ed91fedd85 100644
--- a/platform/android/java/src/org/godotengine/godot/Dictionary.java
+++ b/platform/android/java/src/org/godotengine/godot/Dictionary.java
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/android/java/src/org/godotengine/godot/Godot.java b/platform/android/java/src/org/godotengine/godot/Godot.java
index d620b2b9c4..eab0387f32 100644
--- a/platform/android/java/src/org/godotengine/godot/Godot.java
+++ b/platform/android/java/src/org/godotengine/godot/Godot.java
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
@@ -387,7 +387,7 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
new_cmdline = new String[ 2 ];
}
- new_cmdline[cll]="-main_pack";
+ new_cmdline[cll]="--main_pack";
new_cmdline[cll+1]=expansion_pack_path;
command_line=new_cmdline;
}
@@ -452,9 +452,9 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
for(int i=0;i<command_line.length;i++) {
boolean has_extra = i< command_line.length -1;
- if (command_line[i].equals("-use_depth_32")) {
+ if (command_line[i].equals("--use_depth_32")) {
use_32_bits=true;
- } else if (command_line[i].equals("-use_immersive")) {
+ } else if (command_line[i].equals("--use_immersive")) {
use_immersive=true;
if(Build.VERSION.SDK_INT >= 19.0){ // check if the application runs on an android 4.4+
window.getDecorView().setSystemUiVisibility(
@@ -467,12 +467,12 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
UiChangeListener();
}
- } else if (command_line[i].equals("-use_apk_expansion")) {
+ } else if (command_line[i].equals("--use_apk_expansion")) {
use_apk_expansion=true;
- } else if (has_extra && command_line[i].equals("-apk_expansion_md5")) {
+ } else if (has_extra && command_line[i].equals("--apk_expansion_md5")) {
main_pack_md5=command_line[i+1];
i++;
- } else if (has_extra && command_line[i].equals("-apk_expansion_key")) {
+ } else if (has_extra && command_line[i].equals("--apk_expansion_key")) {
main_pack_key=command_line[i+1];
SharedPreferences prefs = getSharedPreferences("app_data_keys", MODE_PRIVATE);
Editor editor = prefs.edit();
diff --git a/platform/android/java/src/org/godotengine/godot/GodotDownloaderAlarmReceiver.java b/platform/android/java/src/org/godotengine/godot/GodotDownloaderAlarmReceiver.java
index 6cdc6be793..2c668dd586 100644
--- a/platform/android/java/src/org/godotengine/godot/GodotDownloaderAlarmReceiver.java
+++ b/platform/android/java/src/org/godotengine/godot/GodotDownloaderAlarmReceiver.java
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/android/java/src/org/godotengine/godot/GodotDownloaderService.java b/platform/android/java/src/org/godotengine/godot/GodotDownloaderService.java
index 38d30c108c..97ba7826fb 100644
--- a/platform/android/java/src/org/godotengine/godot/GodotDownloaderService.java
+++ b/platform/android/java/src/org/godotengine/godot/GodotDownloaderService.java
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/android/java/src/org/godotengine/godot/GodotIO.java b/platform/android/java/src/org/godotengine/godot/GodotIO.java
index ecb623452c..989fd2b609 100644
--- a/platform/android/java/src/org/godotengine/godot/GodotIO.java
+++ b/platform/android/java/src/org/godotengine/godot/GodotIO.java
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/android/java/src/org/godotengine/godot/GodotLib.java b/platform/android/java/src/org/godotengine/godot/GodotLib.java
index 1ed04d9d27..b487c17f53 100644
--- a/platform/android/java/src/org/godotengine/godot/GodotLib.java
+++ b/platform/android/java/src/org/godotengine/godot/GodotLib.java
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
@@ -48,7 +48,7 @@ public class GodotLib {
public static native void initialize(Godot p_instance,boolean need_reload_hook,String[] p_cmdline,Object p_asset_manager);
public static native void resize(int width, int height,boolean reload);
public static native void newcontext(boolean p_32_bits);
- public static native void quit();
+ public static native void back();
public static native void step();
public static native void touch(int what,int pointer,int howmany, int[] arr);
public static native void accelerometer(float x, float y, float z);
diff --git a/platform/android/java/src/org/godotengine/godot/GodotPaymentV3.java b/platform/android/java/src/org/godotengine/godot/GodotPaymentV3.java
index 3cb8fd3da8..a16c67523e 100644
--- a/platform/android/java/src/org/godotengine/godot/GodotPaymentV3.java
+++ b/platform/android/java/src/org/godotengine/godot/GodotPaymentV3.java
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/android/java/src/org/godotengine/godot/GodotView.java b/platform/android/java/src/org/godotengine/godot/GodotView.java
index c6c68c36b0..19fcf8e687 100644
--- a/platform/android/java/src/org/godotengine/godot/GodotView.java
+++ b/platform/android/java/src/org/godotengine/godot/GodotView.java
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
@@ -264,7 +264,7 @@ public class GodotView extends GLSurfaceView implements InputDeviceListener {
@Override public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
- GodotLib.quit();
+ GodotLib.back();
// press 'back' button should not terminate program
//normal handle 'back' event in game logic
return true;
diff --git a/platform/android/java/src/org/godotengine/godot/input/GodotEditText.java b/platform/android/java/src/org/godotengine/godot/input/GodotEditText.java
index bf5239aa77..d8a3ac5591 100644
--- a/platform/android/java/src/org/godotengine/godot/input/GodotEditText.java
+++ b/platform/android/java/src/org/godotengine/godot/input/GodotEditText.java
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/android/java/src/org/godotengine/godot/input/GodotTextInputWrapper.java b/platform/android/java/src/org/godotengine/godot/input/GodotTextInputWrapper.java
index 1dbcb78ada..c2d03e4ecc 100644
--- a/platform/android/java/src/org/godotengine/godot/input/GodotTextInputWrapper.java
+++ b/platform/android/java/src/org/godotengine/godot/input/GodotTextInputWrapper.java
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/android/java/src/org/godotengine/godot/payments/ConsumeTask.java b/platform/android/java/src/org/godotengine/godot/payments/ConsumeTask.java
index c37821ffd9..8622f4ccff 100644
--- a/platform/android/java/src/org/godotengine/godot/payments/ConsumeTask.java
+++ b/platform/android/java/src/org/godotengine/godot/payments/ConsumeTask.java
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/android/java/src/org/godotengine/godot/payments/GenericConsumeTask.java b/platform/android/java/src/org/godotengine/godot/payments/GenericConsumeTask.java
index 72126a8f64..0afe35510c 100644
--- a/platform/android/java/src/org/godotengine/godot/payments/GenericConsumeTask.java
+++ b/platform/android/java/src/org/godotengine/godot/payments/GenericConsumeTask.java
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/android/java/src/org/godotengine/godot/payments/HandlePurchaseTask.java b/platform/android/java/src/org/godotengine/godot/payments/HandlePurchaseTask.java
index e223bbb8c0..7318ae2fc6 100644
--- a/platform/android/java/src/org/godotengine/godot/payments/HandlePurchaseTask.java
+++ b/platform/android/java/src/org/godotengine/godot/payments/HandlePurchaseTask.java
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/android/java/src/org/godotengine/godot/payments/PaymentsCache.java b/platform/android/java/src/org/godotengine/godot/payments/PaymentsCache.java
index fa5564a3f4..69ac02e902 100644
--- a/platform/android/java/src/org/godotengine/godot/payments/PaymentsCache.java
+++ b/platform/android/java/src/org/godotengine/godot/payments/PaymentsCache.java
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/android/java/src/org/godotengine/godot/payments/PaymentsManager.java b/platform/android/java/src/org/godotengine/godot/payments/PaymentsManager.java
index 6f308af360..b327265abb 100644
--- a/platform/android/java/src/org/godotengine/godot/payments/PaymentsManager.java
+++ b/platform/android/java/src/org/godotengine/godot/payments/PaymentsManager.java
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/android/java/src/org/godotengine/godot/payments/PurchaseTask.java b/platform/android/java/src/org/godotengine/godot/payments/PurchaseTask.java
index 81352b0cf4..6ecea0106c 100644
--- a/platform/android/java/src/org/godotengine/godot/payments/PurchaseTask.java
+++ b/platform/android/java/src/org/godotengine/godot/payments/PurchaseTask.java
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/android/java/src/org/godotengine/godot/payments/ReleaseAllConsumablesTask.java b/platform/android/java/src/org/godotengine/godot/payments/ReleaseAllConsumablesTask.java
index 9d40371b9b..d831e45694 100644
--- a/platform/android/java/src/org/godotengine/godot/payments/ReleaseAllConsumablesTask.java
+++ b/platform/android/java/src/org/godotengine/godot/payments/ReleaseAllConsumablesTask.java
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/android/java/src/org/godotengine/godot/payments/ValidateTask.java b/platform/android/java/src/org/godotengine/godot/payments/ValidateTask.java
index 09f80df403..6e058c140c 100644
--- a/platform/android/java/src/org/godotengine/godot/payments/ValidateTask.java
+++ b/platform/android/java/src/org/godotengine/godot/payments/ValidateTask.java
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/android/java/src/org/godotengine/godot/utils/Crypt.java b/platform/android/java/src/org/godotengine/godot/utils/Crypt.java
index 02a2fba854..2fd66553f6 100644
--- a/platform/android/java/src/org/godotengine/godot/utils/Crypt.java
+++ b/platform/android/java/src/org/godotengine/godot/utils/Crypt.java
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/android/java/src/org/godotengine/godot/utils/CustomSSLSocketFactory.java b/platform/android/java/src/org/godotengine/godot/utils/CustomSSLSocketFactory.java
index 7881754fb2..c9532a5d01 100644
--- a/platform/android/java/src/org/godotengine/godot/utils/CustomSSLSocketFactory.java
+++ b/platform/android/java/src/org/godotengine/godot/utils/CustomSSLSocketFactory.java
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/android/java/src/org/godotengine/godot/utils/HttpRequester.java b/platform/android/java/src/org/godotengine/godot/utils/HttpRequester.java
index b314fb721b..0711f30b8b 100644
--- a/platform/android/java/src/org/godotengine/godot/utils/HttpRequester.java
+++ b/platform/android/java/src/org/godotengine/godot/utils/HttpRequester.java
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/android/java/src/org/godotengine/godot/utils/RequestParams.java b/platform/android/java/src/org/godotengine/godot/utils/RequestParams.java
index 41d26ba70f..ded11550bb 100644
--- a/platform/android/java/src/org/godotengine/godot/utils/RequestParams.java
+++ b/platform/android/java/src/org/godotengine/godot/utils/RequestParams.java
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/android/java_class_wrapper.cpp b/platform/android/java_class_wrapper.cpp
index bd266c76bf..8606ea41a0 100644
--- a/platform/android/java_class_wrapper.cpp
+++ b/platform/android/java_class_wrapper.cpp
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
@@ -112,7 +112,7 @@ bool JavaClass::_call_method(JavaObject *p_instance, const StringName &p_method,
Ref<Reference> ref = *p_args[i];
if (!ref.is_null()) {
- if (ref->cast_to<JavaObject>()) {
+ if (Object::cast_to<JavaObject>(ref.ptr())) {
Ref<JavaObject> jo = ref;
//could be faster
diff --git a/platform/android/java_class_wrapper.h b/platform/android/java_class_wrapper.h
index f990708bdf..1274b4bea9 100644
--- a/platform/android/java_class_wrapper.h
+++ b/platform/android/java_class_wrapper.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/android/java_glue.cpp b/platform/android/java_glue.cpp
index 683e1cfb22..06abe9d751 100644
--- a/platform/android/java_glue.cpp
+++ b/platform/android/java_glue.cpp
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
@@ -844,7 +844,7 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_initialize(JNIEnv *en
} else {
//__android_log_print(ANDROID_LOG_INFO,"godot","cmdline arg %i is: %s\n",i,rawString);
- if (strcmp(rawString, "-main_pack") == 0)
+ if (strcmp(rawString, "--main_pack") == 0)
use_apk_expansion = true;
}
@@ -866,13 +866,7 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_initialize(JNIEnv *en
__android_log_print(ANDROID_LOG_INFO, "godot", "**SETUP");
-#if 0
- char *args[]={"-test","render",NULL};
- __android_log_print(ANDROID_LOG_INFO,"godot","pre asdasd setup...");
- Error err = Main::setup("apk",2,args,false);
-#else
Error err = Main::setup("apk", cmdlen, (char **)cmdline, false);
-#endif
if (err != OK) {
__android_log_print(ANDROID_LOG_INFO, "godot", "*****UNABLE TO SETUP");
@@ -1008,7 +1002,9 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_step(JNIEnv *env, job
ProjectSettings::get_singleton()->add_singleton(ProjectSettings::Singleton("JavaClassWrapper", java_class_wrapper));
_initialize_java_modules();
- Main::setup2();
+ // Since Godot is initialized on the UI thread, _main_thread_id was set to that thread's id,
+ // but for Godot purposes, the main thread is the one running the game loop
+ Main::setup2(Thread::get_caller_id());
++step;
suspend_mutex->unlock();
input_mutex->unlock();
diff --git a/platform/android/java_glue.h b/platform/android/java_glue.h
index f400f41e28..64970040f8 100644
--- a/platform/android/java_glue.h
+++ b/platform/android/java_glue.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
@@ -40,7 +40,7 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_initialize(JNIEnv *en
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_resize(JNIEnv *env, jobject obj, jint width, jint height, jboolean reload);
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_newcontext(JNIEnv *env, jobject obj, bool p_32_bits);
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_step(JNIEnv *env, jobject obj);
-JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_quit(JNIEnv *env, jobject obj);
+JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_back(JNIEnv *env, jobject obj);
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_touch(JNIEnv *env, jobject obj, jint ev, jint pointer, jint count, jintArray positions);
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_key(JNIEnv *env, jobject obj, jint p_scancode, jint p_unicode_char, jboolean p_pressed);
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_joybutton(JNIEnv *env, jobject obj, jint p_device, jint p_button, jboolean p_pressed);
@@ -56,8 +56,8 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_focusout(JNIEnv *env,
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_singleton(JNIEnv *env, jobject obj, jstring name, jobject p_object);
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_method(JNIEnv *env, jobject obj, jstring sname, jstring name, jstring ret, jobjectArray args);
JNIEXPORT jstring JNICALL Java_org_godotengine_godot_GodotLib_getGlobal(JNIEnv *env, jobject obj, jstring path);
-JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_callobject(JNIEnv *env, jobject obj, jint ID, jstring method, jobjectArray params);
-JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_calldeferred(JNIEnv *env, jobject obj, jint ID, jstring method, jobjectArray params);
+JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_callobject(JNIEnv *env, jobject p_obj, jint ID, jstring method, jobjectArray params);
+JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_calldeferred(JNIEnv *env, jobject p_obj, jint ID, jstring method, jobjectArray params);
}
#endif
diff --git a/platform/android/os_android.cpp b/platform/android/os_android.cpp
index a027e78de9..1de2608b9e 100644
--- a/platform/android/os_android.cpp
+++ b/platform/android/os_android.cpp
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
@@ -146,7 +146,6 @@ void OS_Android::initialize(const VideoMode &p_desired, int p_video_driver, int
physics_server = memnew(PhysicsServerSW);
physics_server->init();
- //physics_2d_server = memnew( Physics2DServerSW );
physics_2d_server = Physics2DServerWrapMT::init_server<Physics2DServerSW>();
physics_2d_server->init();
@@ -160,43 +159,6 @@ void OS_Android::set_main_loop(MainLoop *p_main_loop) {
main_loop = p_main_loop;
input->set_main_loop(p_main_loop);
-#if 0
-
- print_line("preGS");
- FileAccess *f=memnew( FileAccessAndroid );
- print("made f %p\n",f);
- Error err = f->open("AndroidManifest.xml",FileAccess::READ);
- if (err) {
-
- print("************NO FILE!!\n");
- } else {
- print("************YES FILE!!\n");
- }
- f->close();
- print_line("end");
-
-
- AAssetDir* aad = AAssetManager_openDir(FileAccessAndroid::asset_manager,".");
-
- if (aad) {
-
- print_line("DIR OPEN OK");
-
- const char *fn= AAssetDir_getNextFileName(aad);
-
- while(fn) {
-
- print_line("FNAME: "+String(fn));
- fn= AAssetDir_getNextFileName(aad);
- }
-
- AAssetDir_close(aad);
- } else {
-
- print_line("DIR NO OPEN");
- }
-
-#endif
}
void OS_Android::delete_main_loop() {
diff --git a/platform/android/os_android.h b/platform/android/os_android.h
index 54d7e562e0..119c14bff3 100644
--- a/platform/android/os_android.h
+++ b/platform/android/os_android.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
@@ -110,11 +110,8 @@ private:
mutable String data_dir_cache;
-#if 0
- AudioDriverAndroid audio_driver_android;
-#else
+ //AudioDriverAndroid audio_driver_android;
AudioDriverOpenSL audio_driver_android;
-#endif
const char *gl_extensions;
diff --git a/platform/android/platform_config.h b/platform/android/platform_config.h
index 48bcadcc29..b1c3f027f3 100644
--- a/platform/android/platform_config.h
+++ b/platform/android/platform_config.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/android/power_android.cpp b/platform/android/power_android.cpp
index bb5a1db250..98d4d810b9 100644
--- a/platform/android/power_android.cpp
+++ b/platform/android/power_android.cpp
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/android/power_android.h b/platform/android/power_android.h
index 328a4506a1..fc618c660d 100644
--- a/platform/android/power_android.h
+++ b/platform/android/power_android.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/android/thread_jandroid.cpp b/platform/android/thread_jandroid.cpp
index 924ae3fe43..79488197ea 100644
--- a/platform/android/thread_jandroid.cpp
+++ b/platform/android/thread_jandroid.cpp
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
@@ -29,9 +29,19 @@
/*************************************************************************/
#include "thread_jandroid.h"
+#include "core/safe_refcount.h"
#include "os/memory.h"
#include "script_language.h"
+static pthread_key_t _create_thread_id_key() {
+ pthread_key_t key;
+ pthread_key_create(&key, NULL);
+ return key;
+}
+
+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;
@@ -47,7 +57,8 @@ void *ThreadAndroid::thread_callback(void *userdata) {
ThreadAndroid *t = reinterpret_cast<ThreadAndroid *>(userdata);
setup_thread();
ScriptServer::thread_enter(); //scripts may need to attach a stack
- t->id = (ID)pthread_self();
+ t->id = atomic_increment(&next_thread_id);
+ pthread_setspecific(thread_id_key, (void *)t->id);
t->callback(t->user);
ScriptServer::thread_exit();
return NULL;
@@ -68,7 +79,7 @@ Thread *ThreadAndroid::create_func_jandroid(ThreadCreateCallback p_callback, voi
Thread::ID ThreadAndroid::get_thread_id_func_jandroid() {
- return (ID)pthread_self();
+ return (ID)pthread_getspecific(thread_id_key);
}
void ThreadAndroid::wait_to_finish_func_jandroid(Thread *p_thread) {
diff --git a/platform/android/thread_jandroid.h b/platform/android/thread_jandroid.h
index 5267329744..b854a83e23 100644
--- a/platform/android/thread_jandroid.h
+++ b/platform/android/thread_jandroid.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
@@ -41,6 +41,9 @@
class ThreadAndroid : public Thread {
+ static pthread_key_t thread_id_key;
+ static ID next_thread_id;
+
pthread_t pthread;
pthread_attr_t pthread_attr;
ThreadCreateCallback callback;
diff --git a/platform/haiku/audio_driver_media_kit.cpp b/platform/haiku/audio_driver_media_kit.cpp
index 93351e0799..4d8d580660 100644
--- a/platform/haiku/audio_driver_media_kit.cpp
+++ b/platform/haiku/audio_driver_media_kit.cpp
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
@@ -43,7 +43,7 @@ Error AudioDriverMediaKit::init() {
channels = 2;
int latency = GLOBAL_DEF("audio/output_latency", 25);
- buffer_size = nearest_power_of_2(latency * mix_rate / 1000);
+ buffer_size = next_power_of_2(latency * mix_rate / 1000);
samples_in = memnew_arr(int32_t, buffer_size * channels);
media_raw_audio_format format;
diff --git a/platform/haiku/audio_driver_media_kit.h b/platform/haiku/audio_driver_media_kit.h
index 2cceb279e8..2f4752a973 100644
--- a/platform/haiku/audio_driver_media_kit.h
+++ b/platform/haiku/audio_driver_media_kit.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/haiku/context_gl_haiku.cpp b/platform/haiku/context_gl_haiku.cpp
index eb5e60152f..2b943df5ba 100644
--- a/platform/haiku/context_gl_haiku.cpp
+++ b/platform/haiku/context_gl_haiku.cpp
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/haiku/context_gl_haiku.h b/platform/haiku/context_gl_haiku.h
index 074b4bf0d1..40daf43ab9 100644
--- a/platform/haiku/context_gl_haiku.h
+++ b/platform/haiku/context_gl_haiku.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/haiku/godot_haiku.cpp b/platform/haiku/godot_haiku.cpp
index 3a8206d9d5..ffc6e56cdd 100644
--- a/platform/haiku/godot_haiku.cpp
+++ b/platform/haiku/godot_haiku.cpp
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/haiku/haiku_application.cpp b/platform/haiku/haiku_application.cpp
index 1f0c9fdcbf..d23b9e27d8 100644
--- a/platform/haiku/haiku_application.cpp
+++ b/platform/haiku/haiku_application.cpp
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/haiku/haiku_application.h b/platform/haiku/haiku_application.h
index 6e690d4ab8..2162cae892 100644
--- a/platform/haiku/haiku_application.h
+++ b/platform/haiku/haiku_application.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/haiku/haiku_direct_window.cpp b/platform/haiku/haiku_direct_window.cpp
index 4a9f8c780d..572df493ff 100644
--- a/platform/haiku/haiku_direct_window.cpp
+++ b/platform/haiku/haiku_direct_window.cpp
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/haiku/haiku_direct_window.h b/platform/haiku/haiku_direct_window.h
index 3671c3c9cb..0f3e9de85b 100644
--- a/platform/haiku/haiku_direct_window.h
+++ b/platform/haiku/haiku_direct_window.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/haiku/haiku_gl_view.cpp b/platform/haiku/haiku_gl_view.cpp
index dd568f281e..d898bd1a5d 100644
--- a/platform/haiku/haiku_gl_view.cpp
+++ b/platform/haiku/haiku_gl_view.cpp
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/haiku/haiku_gl_view.h b/platform/haiku/haiku_gl_view.h
index 14e2889d6c..10facfe0c3 100644
--- a/platform/haiku/haiku_gl_view.h
+++ b/platform/haiku/haiku_gl_view.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/haiku/key_mapping_haiku.cpp b/platform/haiku/key_mapping_haiku.cpp
index 3db31fa3e4..074f03f471 100644
--- a/platform/haiku/key_mapping_haiku.cpp
+++ b/platform/haiku/key_mapping_haiku.cpp
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/haiku/key_mapping_haiku.h b/platform/haiku/key_mapping_haiku.h
index 8d09203737..943ba21e7c 100644
--- a/platform/haiku/key_mapping_haiku.h
+++ b/platform/haiku/key_mapping_haiku.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/haiku/os_haiku.cpp b/platform/haiku/os_haiku.cpp
index e897d4c385..de2f79a0ac 100644
--- a/platform/haiku/os_haiku.cpp
+++ b/platform/haiku/os_haiku.cpp
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
@@ -27,16 +27,15 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include <Screen.h>
+#include "os_haiku.h"
-#include "drivers/gles2/rasterizer_gles2.h"
+#include "drivers/gles3/rasterizer_gles3.h"
+#include "main/main.h"
#include "servers/physics/physics_server_sw.h"
#include "servers/visual/visual_server_raster.h"
#include "servers/visual/visual_server_wrap_mt.h"
-//#include "servers/physics_2d/physics_2d_server_wrap_mt.h"
-#include "main/main.h"
-#include "os_haiku.h"
+#include <Screen.h>
OS_Haiku::OS_Haiku() {
#ifdef MEDIA_KIT_ENABLED
diff --git a/platform/haiku/os_haiku.h b/platform/haiku/os_haiku.h
index 256c9eecf7..cb68f9303f 100644
--- a/platform/haiku/os_haiku.h
+++ b/platform/haiku/os_haiku.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
@@ -96,8 +96,8 @@ public:
virtual int get_screen_count() const;
virtual int get_current_screen() const;
virtual void set_current_screen(int p_screen);
- virtual Point2 get_screen_position(int p_screen = 0) const;
- virtual Size2 get_screen_size(int p_screen = 0) const;
+ virtual Point2 get_screen_position(int p_screen = -1) const;
+ virtual Size2 get_screen_size(int p_screen = -1) const;
virtual void set_window_title(const String &p_title);
virtual Size2 get_window_size() const;
virtual void set_window_size(const Size2 p_size);
diff --git a/platform/haiku/platform_config.h b/platform/haiku/platform_config.h
index e59b9bac80..27731a7b74 100644
--- a/platform/haiku/platform_config.h
+++ b/platform/haiku/platform_config.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/haiku/power_haiku.cpp b/platform/haiku/power_haiku.cpp
index b0d01df982..449b43a621 100644
--- a/platform/haiku/power_haiku.cpp
+++ b/platform/haiku/power_haiku.cpp
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/haiku/power_haiku.h b/platform/haiku/power_haiku.h
index 711ad86a02..12513bdaef 100644
--- a/platform/haiku/power_haiku.h
+++ b/platform/haiku/power_haiku.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/iphone/app_delegate.h b/platform/iphone/app_delegate.h
index f357427144..4a1f52565a 100644
--- a/platform/iphone/app_delegate.h
+++ b/platform/iphone/app_delegate.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/iphone/app_delegate.mm b/platform/iphone/app_delegate.mm
index 362cfd1478..c7b65b476b 100644
--- a/platform/iphone/app_delegate.mm
+++ b/platform/iphone/app_delegate.mm
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/iphone/audio_driver_iphone.cpp b/platform/iphone/audio_driver_iphone.cpp
index 57b6388016..dbc5bdb654 100644
--- a/platform/iphone/audio_driver_iphone.cpp
+++ b/platform/iphone/audio_driver_iphone.cpp
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
@@ -46,10 +46,8 @@ Error AudioDriverIphone::init() {
strdesc.mBytesPerPacket =
strdesc.mBytesPerFrame * strdesc.mFramesPerPacket;
- OSStatus result = noErr;
AURenderCallbackStruct callback;
AudioComponentDescription desc;
- AudioComponent comp = NULL;
const AudioUnitElement output_bus = 0;
const AudioUnitElement bus = output_bus;
const AudioUnitScope scope = kAudioUnitScope_Input;
@@ -57,10 +55,10 @@ Error AudioDriverIphone::init() {
zeromem(&desc, sizeof(desc));
desc.componentType = kAudioUnitType_Output;
desc.componentSubType = kAudioUnitSubType_RemoteIO; /* !!! FIXME: ? */
- comp = AudioComponentFindNext(NULL, &desc);
+ AudioComponent comp = AudioComponentFindNext(NULL, &desc);
desc.componentManufacturer = kAudioUnitManufacturer_Apple;
- result = AudioComponentInstanceNew(comp, &audio_unit);
+ OSStatus result = AudioComponentInstanceNew(comp, &audio_unit);
ERR_FAIL_COND_V(result != noErr, FAILED);
ERR_FAIL_COND_V(comp == NULL, FAILED);
diff --git a/platform/iphone/audio_driver_iphone.h b/platform/iphone/audio_driver_iphone.h
index c620e9068c..930ed168f7 100644
--- a/platform/iphone/audio_driver_iphone.h
+++ b/platform/iphone/audio_driver_iphone.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/iphone/detect.py b/platform/iphone/detect.py
index 1d802ff288..0b81422fa3 100644
--- a/platform/iphone/detect.py
+++ b/platform/iphone/detect.py
@@ -13,7 +13,7 @@ def get_name():
def can_build():
- if sys.platform == 'darwin' or os.environ.has_key("OSXCROSS_IOS"):
+ if sys.platform == 'darwin' or ("OSXCROSS_IOS" in os.environ):
return True
return False
@@ -83,11 +83,11 @@ def configure(env):
if (env["arch"] == "x86"):
env['IPHONEPLATFORM'] = 'iPhoneSimulator'
env['ENV']['MACOSX_DEPLOYMENT_TARGET'] = '10.6'
- env.Append(CCFLAGS=string.split('-arch i386 -fobjc-abi-version=2 -fobjc-legacy-dispatch -fmessage-length=0 -fpascal-strings -fblocks -fasm-blocks -D__IPHONE_OS_VERSION_MIN_REQUIRED=40100 -isysroot $IPHONESDK -mios-simulator-version-min=4.3 -DCUSTOM_MATRIX_TRANSFORM_H=\\\"build/iphone/matrix4_iphone.h\\\" -DCUSTOM_VECTOR3_TRANSFORM_H=\\\"build/iphone/vector3_iphone.h\\\"'))
+ env.Append(CCFLAGS='-arch i386 -fobjc-abi-version=2 -fobjc-legacy-dispatch -fmessage-length=0 -fpascal-strings -fblocks -fasm-blocks -D__IPHONE_OS_VERSION_MIN_REQUIRED=40100 -isysroot $IPHONESDK -mios-simulator-version-min=4.3 -DCUSTOM_MATRIX_TRANSFORM_H=\\\"build/iphone/matrix4_iphone.h\\\" -DCUSTOM_VECTOR3_TRANSFORM_H=\\\"build/iphone/vector3_iphone.h\\\"'.split())
elif (env["arch"] == "arm"):
- env.Append(CCFLAGS=string.split('-fno-objc-arc -arch armv7 -fmessage-length=0 -fno-strict-aliasing -fdiagnostics-print-source-range-info -fdiagnostics-show-category=id -fdiagnostics-parseable-fixits -fpascal-strings -fblocks -isysroot $IPHONESDK -fvisibility=hidden -mthumb "-DIBOutlet=__attribute__((iboutlet))" "-DIBOutletCollection(ClassName)=__attribute__((iboutletcollection(ClassName)))" "-DIBAction=void)__attribute__((ibaction)" -miphoneos-version-min=9.0 -MMD -MT dependencies'))
+ env.Append(CCFLAGS='-fno-objc-arc -arch armv7 -fmessage-length=0 -fno-strict-aliasing -fdiagnostics-print-source-range-info -fdiagnostics-show-category=id -fdiagnostics-parseable-fixits -fpascal-strings -fblocks -isysroot $IPHONESDK -fvisibility=hidden -mthumb "-DIBOutlet=__attribute__((iboutlet))" "-DIBOutletCollection(ClassName)=__attribute__((iboutletcollection(ClassName)))" "-DIBAction=void)__attribute__((ibaction)" -miphoneos-version-min=9.0 -MMD -MT dependencies'.split())
elif (env["arch"] == "arm64"):
- env.Append(CCFLAGS=string.split('-fno-objc-arc -arch arm64 -fmessage-length=0 -fno-strict-aliasing -fdiagnostics-print-source-range-info -fdiagnostics-show-category=id -fdiagnostics-parseable-fixits -fpascal-strings -fblocks -fvisibility=hidden -MMD -MT dependencies -miphoneos-version-min=9.0 -isysroot $IPHONESDK'))
+ env.Append(CCFLAGS='-fno-objc-arc -arch arm64 -fmessage-length=0 -fno-strict-aliasing -fdiagnostics-print-source-range-info -fdiagnostics-show-category=id -fdiagnostics-parseable-fixits -fpascal-strings -fblocks -fvisibility=hidden -MMD -MT dependencies -miphoneos-version-min=9.0 -isysroot $IPHONESDK'.split())
env.Append(CPPFLAGS=['-DNEED_LONG_INT'])
env.Append(CPPFLAGS=['-DLIBYUV_DISABLE_NEON'])
diff --git a/platform/iphone/export/export.cpp b/platform/iphone/export/export.cpp
index 6ae2a0692d..8bb7f23ead 100644
--- a/platform/iphone/export/export.cpp
+++ b/platform/iphone/export/export.cpp
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/iphone/export/export.h b/platform/iphone/export/export.h
index 6e9324aed7..1b96b8338a 100644
--- a/platform/iphone/export/export.h
+++ b/platform/iphone/export/export.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/iphone/game_center.h b/platform/iphone/game_center.h
index cda6f78a1f..c0a7830fe9 100644
--- a/platform/iphone/game_center.h
+++ b/platform/iphone/game_center.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/iphone/game_center.mm b/platform/iphone/game_center.mm
index f9bc70b7c4..c05bdea005 100644
--- a/platform/iphone/game_center.mm
+++ b/platform/iphone/game_center.mm
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/iphone/gl_view.h b/platform/iphone/gl_view.h
index 14e9a66a4a..a9fd8d5711 100644
--- a/platform/iphone/gl_view.h
+++ b/platform/iphone/gl_view.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/iphone/gl_view.mm b/platform/iphone/gl_view.mm
index f2778e8165..3e206c3a2c 100644
--- a/platform/iphone/gl_view.mm
+++ b/platform/iphone/gl_view.mm
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/iphone/globals/global_defaults.cpp b/platform/iphone/globals/global_defaults.cpp
index aa4662302d..4bdc716d6e 100644
--- a/platform/iphone/globals/global_defaults.cpp
+++ b/platform/iphone/globals/global_defaults.cpp
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/iphone/globals/global_defaults.h b/platform/iphone/globals/global_defaults.h
index 6fe1027287..ee8ae833b9 100644
--- a/platform/iphone/globals/global_defaults.h
+++ b/platform/iphone/globals/global_defaults.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/iphone/godot_iphone.cpp b/platform/iphone/godot_iphone.cpp
index 4d34ebedf9..8c6d6d8da4 100644
--- a/platform/iphone/godot_iphone.cpp
+++ b/platform/iphone/godot_iphone.cpp
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/iphone/icloud.h b/platform/iphone/icloud.h
index 67d12a990a..7ab3e04bb8 100644
--- a/platform/iphone/icloud.h
+++ b/platform/iphone/icloud.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/iphone/icloud.mm b/platform/iphone/icloud.mm
index 94c3d2ef91..84458ed79f 100644
--- a/platform/iphone/icloud.mm
+++ b/platform/iphone/icloud.mm
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/iphone/in_app_store.h b/platform/iphone/in_app_store.h
index 153c46bd7b..4c12f825c1 100644
--- a/platform/iphone/in_app_store.h
+++ b/platform/iphone/in_app_store.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/iphone/in_app_store.mm b/platform/iphone/in_app_store.mm
index 710df0f757..9efd4b9891 100644
--- a/platform/iphone/in_app_store.mm
+++ b/platform/iphone/in_app_store.mm
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/iphone/ios.h b/platform/iphone/ios.h
index 2572d626d2..0c2e6b4aa6 100644
--- a/platform/iphone/ios.h
+++ b/platform/iphone/ios.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/iphone/ios.mm b/platform/iphone/ios.mm
index 6c95903241..add0949f94 100644
--- a/platform/iphone/ios.mm
+++ b/platform/iphone/ios.mm
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/iphone/main.m b/platform/iphone/main.m
index 6757cc8146..0de5c3b41b 100644
--- a/platform/iphone/main.m
+++ b/platform/iphone/main.m
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/iphone/os_iphone.cpp b/platform/iphone/os_iphone.cpp
index df497349ae..0e3eeed114 100644
--- a/platform/iphone/os_iphone.cpp
+++ b/platform/iphone/os_iphone.cpp
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/iphone/os_iphone.h b/platform/iphone/os_iphone.h
index cf2766bb33..475dceebf2 100644
--- a/platform/iphone/os_iphone.h
+++ b/platform/iphone/os_iphone.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
@@ -47,7 +47,6 @@
#include "servers/visual_server.h"
class AudioDriverIphone;
-// class RasterizerGLES2;
class OSIPhone : public OS_Unix {
@@ -67,9 +66,6 @@ private:
uint8_t supported_orientations;
- // Rasterizer *rasterizer;
- // RasterizerGLES2* rasterizer_gles22;
-
VisualServer *visual_server;
PhysicsServer *physics_server;
Physics2DServer *physics_2d_server;
diff --git a/platform/iphone/platform_config.h b/platform/iphone/platform_config.h
index 7e4b533254..54de66082e 100644
--- a/platform/iphone/platform_config.h
+++ b/platform/iphone/platform_config.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/iphone/platform_refcount.h b/platform/iphone/platform_refcount.h
index c02e709ea1..8d04340793 100644
--- a/platform/iphone/platform_refcount.h
+++ b/platform/iphone/platform_refcount.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/iphone/power_iphone.cpp b/platform/iphone/power_iphone.cpp
index 5192f8e593..2811e62108 100644
--- a/platform/iphone/power_iphone.cpp
+++ b/platform/iphone/power_iphone.cpp
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/iphone/power_iphone.h b/platform/iphone/power_iphone.h
index 174ee6c63b..b4fb8d62dc 100644
--- a/platform/iphone/power_iphone.h
+++ b/platform/iphone/power_iphone.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/iphone/sem_iphone.cpp b/platform/iphone/sem_iphone.cpp
index 4614b201a4..623749f891 100644
--- a/platform/iphone/sem_iphone.cpp
+++ b/platform/iphone/sem_iphone.cpp
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/iphone/sem_iphone.h b/platform/iphone/sem_iphone.h
index 90db0fb74d..9ae201557f 100644
--- a/platform/iphone/sem_iphone.h
+++ b/platform/iphone/sem_iphone.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/iphone/view_controller.h b/platform/iphone/view_controller.h
index 57ed576c25..ed33e5fdf3 100644
--- a/platform/iphone/view_controller.h
+++ b/platform/iphone/view_controller.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/iphone/view_controller.mm b/platform/iphone/view_controller.mm
index 574598e1d3..23d60cc5d5 100644
--- a/platform/iphone/view_controller.mm
+++ b/platform/iphone/view_controller.mm
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
@@ -42,7 +42,7 @@ int add_path(int p_argc, char **p_args) {
if (!str)
return p_argc;
- p_args[p_argc++] = "-path";
+ p_args[p_argc++] = "--path";
[str retain]; // memory leak lol (maybe make it static here and delete it in ViewController destructor? @todo
p_args[p_argc++] = (char *)[str cString];
p_args[p_argc] = NULL;
diff --git a/platform/javascript/audio_driver_javascript.cpp b/platform/javascript/audio_driver_javascript.cpp
index 3e37ec293e..4c0e5fd966 100644
--- a/platform/javascript/audio_driver_javascript.cpp
+++ b/platform/javascript/audio_driver_javascript.cpp
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/javascript/audio_driver_javascript.h b/platform/javascript/audio_driver_javascript.h
index 7ccaff0f43..c5cebe800f 100644
--- a/platform/javascript/audio_driver_javascript.h
+++ b/platform/javascript/audio_driver_javascript.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/javascript/audio_server_javascript.cpp b/platform/javascript/audio_server_javascript.cpp
index f9b7890e12..ab9f66ce5b 100644
--- a/platform/javascript/audio_server_javascript.cpp
+++ b/platform/javascript/audio_server_javascript.cpp
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
@@ -28,6 +28,8 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "audio_server_javascript.h"
+
+// FIXME: Needs to be ported to the new AudioServer API in 3.0
#if 0
#include "emscripten.h"
diff --git a/platform/javascript/audio_server_javascript.h b/platform/javascript/audio_server_javascript.h
index 58c240f793..0773459f56 100644
--- a/platform/javascript/audio_server_javascript.h
+++ b/platform/javascript/audio_server_javascript.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
@@ -29,6 +29,8 @@
/*************************************************************************/
#ifndef AUDIO_SERVER_JAVASCRIPT_H
#define AUDIO_SERVER_JAVASCRIPT_H
+
+// FIXME: Needs to be ported to the new AudioServer API in 3.0
#if 0
#include "servers/audio_server.h"
diff --git a/platform/javascript/detect.py b/platform/javascript/detect.py
index 68c8d1eea5..5f066f1b15 100644
--- a/platform/javascript/detect.py
+++ b/platform/javascript/detect.py
@@ -13,7 +13,7 @@ def get_name():
def can_build():
- return (os.environ.has_key("EMSCRIPTEN_ROOT"))
+ return ("EMSCRIPTEN_ROOT" in os.environ)
def get_opts():
diff --git a/platform/javascript/dom_keys.h b/platform/javascript/dom_keys.h
index 4b8b764c45..d63f165382 100644
--- a/platform/javascript/dom_keys.h
+++ b/platform/javascript/dom_keys.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/javascript/export/export.cpp b/platform/javascript/export/export.cpp
index b436d52363..5a161dd0ab 100644
--- a/platform/javascript/export/export.cpp
+++ b/platform/javascript/export/export.cpp
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/javascript/export/export.h b/platform/javascript/export/export.h
index 910c4119f7..0cea0a213b 100644
--- a/platform/javascript/export/export.h
+++ b/platform/javascript/export/export.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/javascript/javascript_eval.cpp b/platform/javascript/javascript_eval.cpp
index c9312e8d30..74f8d80a76 100644
--- a/platform/javascript/javascript_eval.cpp
+++ b/platform/javascript/javascript_eval.cpp
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/javascript/javascript_eval.h b/platform/javascript/javascript_eval.h
index 4a732cec76..ed7cf383da 100644
--- a/platform/javascript/javascript_eval.h
+++ b/platform/javascript/javascript_eval.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/javascript/javascript_main.cpp b/platform/javascript/javascript_main.cpp
index 6b1d574496..4c948bf181 100644
--- a/platform/javascript/javascript_main.cpp
+++ b/platform/javascript/javascript_main.cpp
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/javascript/os_javascript.cpp b/platform/javascript/os_javascript.cpp
index d339baf024..a0e5610591 100644
--- a/platform/javascript/os_javascript.cpp
+++ b/platform/javascript/os_javascript.cpp
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
@@ -687,8 +687,6 @@ OS::VideoMode OS_JavaScript::get_video_mode(int p_screen) const {
Size2 OS_JavaScript::get_screen_size(int p_screen) const {
- ERR_FAIL_COND_V(p_screen != 0, Size2());
-
EmscriptenFullscreenChangeEvent ev;
EMSCRIPTEN_RESULT result = emscripten_get_fullscreen_status(&ev);
ERR_FAIL_COND_V(result != EMSCRIPTEN_RESULT_SUCCESS, Size2());
diff --git a/platform/javascript/os_javascript.h b/platform/javascript/os_javascript.h
index 13c500b3dc..f78a3f2768 100644
--- a/platform/javascript/os_javascript.h
+++ b/platform/javascript/os_javascript.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
@@ -124,7 +124,7 @@ public:
virtual VideoMode get_video_mode(int p_screen = 0) const;
virtual void get_fullscreen_mode_list(List<VideoMode> *p_list, int p_screen = 0) const;
- virtual Size2 get_screen_size(int p_screen = 0) const;
+ virtual Size2 get_screen_size(int p_screen = -1) const;
virtual void set_window_size(const Size2);
virtual Size2 get_window_size() const;
diff --git a/platform/javascript/platform_config.h b/platform/javascript/platform_config.h
index 48bcadcc29..b1c3f027f3 100644
--- a/platform/javascript/platform_config.h
+++ b/platform/javascript/platform_config.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/javascript/power_javascript.cpp b/platform/javascript/power_javascript.cpp
index bd4502fc2a..3d54146595 100644
--- a/platform/javascript/power_javascript.cpp
+++ b/platform/javascript/power_javascript.cpp
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/javascript/power_javascript.h b/platform/javascript/power_javascript.h
index c7b853ce11..834d765557 100644
--- a/platform/javascript/power_javascript.h
+++ b/platform/javascript/power_javascript.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/osx/audio_driver_osx.cpp b/platform/osx/audio_driver_osx.cpp
index d7a91b1653..8c5a734f76 100644
--- a/platform/osx/audio_driver_osx.cpp
+++ b/platform/osx/audio_driver_osx.cpp
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
@@ -30,6 +30,10 @@
#ifdef OSX_ENABLED
#include "audio_driver_osx.h"
+#include "core/project_settings.h"
+#include "os/os.h"
+
+#define kOutputBus 0
static OSStatus outputDeviceAddressCB(AudioObjectID inObjectID, UInt32 inNumberAddresses, const AudioObjectPropertyAddress *inAddresses, void *__nullable inClientData) {
AudioDriverOSX *driver = (AudioDriverOSX *)inClientData;
@@ -40,42 +44,69 @@ static OSStatus outputDeviceAddressCB(AudioObjectID inObjectID, UInt32 inNumberA
}
Error AudioDriverOSX::initDevice() {
+ AudioComponentDescription desc;
+ zeromem(&desc, sizeof(desc));
+ desc.componentType = kAudioUnitType_Output;
+ desc.componentSubType = kAudioUnitSubType_HALOutput;
+ desc.componentManufacturer = kAudioUnitManufacturer_Apple;
+
+ AudioComponent comp = AudioComponentFindNext(NULL, &desc);
+ ERR_FAIL_COND_V(comp == NULL, FAILED);
+
+ OSStatus result = AudioComponentInstanceNew(comp, &audio_unit);
+ ERR_FAIL_COND_V(result != noErr, FAILED);
+
AudioStreamBasicDescription strdesc;
+
+ // TODO: Implement this
+ /*zeromem(&strdesc, sizeof(strdesc));
+ UInt32 size = sizeof(strdesc);
+ result = AudioUnitGetProperty(audio_unit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Output, kOutputBus, &strdesc, &size);
+ ERR_FAIL_COND_V(result != noErr, FAILED);
+
+ switch (strdesc.mChannelsPerFrame) {
+ case 2: // Stereo
+ case 6: // Surround 5.1
+ case 8: // Surround 7.1
+ channels = strdesc.mChannelsPerFrame;
+ break;
+
+ default:
+ // Unknown number of channels, default to stereo
+ channels = 2;
+ break;
+ }*/
+
+ mix_rate = GLOBAL_DEF("audio/mix_rate", 44100);
+
+ zeromem(&strdesc, sizeof(strdesc));
strdesc.mFormatID = kAudioFormatLinearPCM;
strdesc.mFormatFlags = kLinearPCMFormatFlagIsSignedInteger | kLinearPCMFormatFlagIsPacked;
strdesc.mChannelsPerFrame = channels;
- strdesc.mSampleRate = 44100;
+ strdesc.mSampleRate = mix_rate;
strdesc.mFramesPerPacket = 1;
strdesc.mBitsPerChannel = 16;
strdesc.mBytesPerFrame = strdesc.mBitsPerChannel * strdesc.mChannelsPerFrame / 8;
strdesc.mBytesPerPacket = strdesc.mBytesPerFrame * strdesc.mFramesPerPacket;
- OSStatus result;
- AURenderCallbackStruct callback;
- AudioComponentDescription desc;
- AudioComponent comp = NULL;
- const AudioUnitElement output_bus = 0;
- const AudioUnitElement bus = output_bus;
- const AudioUnitScope scope = kAudioUnitScope_Input;
-
- zeromem(&desc, sizeof(desc));
- desc.componentType = kAudioUnitType_Output;
- desc.componentSubType = kAudioUnitSubType_HALOutput;
- desc.componentManufacturer = kAudioUnitManufacturer_Apple;
+ result = AudioUnitSetProperty(audio_unit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Input, kOutputBus, &strdesc, sizeof(strdesc));
+ ERR_FAIL_COND_V(result != noErr, FAILED);
- comp = AudioComponentFindNext(NULL, &desc);
- ERR_FAIL_COND_V(comp == NULL, FAILED);
+ int latency = GLOBAL_DEF("audio/output_latency", 25);
+ unsigned int buffer_size = closest_power_of_2(latency * mix_rate / 1000);
- result = AudioComponentInstanceNew(comp, &audio_unit);
- ERR_FAIL_COND_V(result != noErr, FAILED);
+ if (OS::get_singleton()->is_stdout_verbose()) {
+ print_line("audio buffer size: " + itos(buffer_size) + " calculated latency: " + itos(buffer_size * 1000 / mix_rate));
+ }
- result = AudioUnitSetProperty(audio_unit, kAudioUnitProperty_StreamFormat, scope, bus, &strdesc, sizeof(strdesc));
- ERR_FAIL_COND_V(result != noErr, FAILED);
+ samples_in.resize(buffer_size);
+ buffer_frames = buffer_size / channels;
+ AURenderCallbackStruct callback;
zeromem(&callback, sizeof(AURenderCallbackStruct));
callback.inputProc = &AudioDriverOSX::output_callback;
callback.inputProcRefCon = this;
- result = AudioUnitSetProperty(audio_unit, kAudioUnitProperty_SetRenderCallback, scope, bus, &callback, sizeof(callback));
+ result = AudioUnitSetProperty(audio_unit, kAudioUnitProperty_SetRenderCallback, kAudioUnitScope_Input, kOutputBus, &callback, sizeof(callback));
ERR_FAIL_COND_V(result != noErr, FAILED);
result = AudioUnitInitialize(audio_unit);
@@ -114,15 +145,10 @@ Error AudioDriverOSX::init() {
result = AudioObjectAddPropertyListener(kAudioObjectSystemObject, &outputDeviceAddress, &outputDeviceAddressCB, this);
ERR_FAIL_COND_V(result != noErr, FAILED);
- const int samples = 1024;
- samples_in = memnew_arr(int32_t, samples); // whatever
- buffer_frames = samples / channels;
-
return initDevice();
};
Error AudioDriverOSX::reopen() {
- Error err;
bool restart = false;
lock();
@@ -131,7 +157,7 @@ Error AudioDriverOSX::reopen() {
restart = true;
}
- err = finishDevice();
+ Error err = finishDevice();
if (err != OK) {
ERR_PRINT("finishDevice failed");
unlock();
@@ -179,7 +205,7 @@ OSStatus AudioDriverOSX::output_callback(void *inRefCon,
while (frames_left) {
int frames = MIN(frames_left, ad->buffer_frames);
- ad->audio_server_process(frames, ad->samples_in);
+ ad->audio_server_process(frames, ad->samples_in.ptr());
for (int j = 0; j < frames * ad->channels; j++) {
@@ -232,29 +258,33 @@ bool AudioDriverOSX::try_lock() {
}
void AudioDriverOSX::finish() {
- OSStatus result;
-
finishDevice();
- result = AudioObjectRemovePropertyListener(kAudioObjectSystemObject, &outputDeviceAddress, &outputDeviceAddressCB, this);
+ OSStatus result = AudioObjectRemovePropertyListener(kAudioObjectSystemObject, &outputDeviceAddress, &outputDeviceAddressCB, this);
if (result != noErr) {
ERR_PRINT("AudioObjectRemovePropertyListener failed");
}
+ AURenderCallbackStruct callback;
+ zeromem(&callback, sizeof(AURenderCallbackStruct));
+ result = AudioUnitSetProperty(audio_unit, kAudioUnitProperty_SetRenderCallback, kAudioUnitScope_Input, kOutputBus, &callback, sizeof(callback));
+ if (result != noErr) {
+ ERR_PRINT("AudioUnitSetProperty failed");
+ }
+
if (mutex) {
memdelete(mutex);
mutex = NULL;
}
-
- if (samples_in) {
- memdelete_arr(samples_in);
- samples_in = NULL;
- }
};
AudioDriverOSX::AudioDriverOSX() {
+ active = false;
mutex = NULL;
- samples_in = NULL;
+
+ mix_rate = 44100;
+ channels = 2;
+ samples_in.clear();
};
AudioDriverOSX::~AudioDriverOSX(){};
diff --git a/platform/osx/audio_driver_osx.h b/platform/osx/audio_driver_osx.h
index 287c9d6cbf..ac178b89f3 100644
--- a/platform/osx/audio_driver_osx.h
+++ b/platform/osx/audio_driver_osx.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
@@ -44,10 +44,12 @@ class AudioDriverOSX : public AudioDriver {
bool active;
Mutex *mutex;
+ int mix_rate;
int channels;
- int32_t *samples_in;
int buffer_frames;
+ Vector<int32_t> samples_in;
+
static OSStatus output_callback(void *inRefCon,
AudioUnitRenderActionFlags *ioActionFlags,
const AudioTimeStamp *inTimeStamp,
diff --git a/platform/osx/detect.py b/platform/osx/detect.py
index d9891dda61..d3ebdfe992 100644
--- a/platform/osx/detect.py
+++ b/platform/osx/detect.py
@@ -12,7 +12,7 @@ def get_name():
def can_build():
- if (sys.platform == "darwin" or os.environ.has_key("OSXCROSS_ROOT")):
+ if (sys.platform == "darwin" or ("OSXCROSS_ROOT" in os.environ)):
return True
return False
@@ -65,10 +65,14 @@ def configure(env):
else: # osxcross build
root = os.environ.get("OSXCROSS_ROOT", 0)
- if env["bits"] == "64":
+ if env["bits"] == "fat":
basecmd = root + "/target/bin/x86_64-apple-" + env["osxcross_sdk"] + "-"
- else:
+ env.Append(CCFLAGS=['-arch', 'i386', '-arch', 'x86_64'])
+ env.Append(LINKFLAGS=['-arch', 'i386', '-arch', 'x86_64'])
+ elif env["bits"] == "32":
basecmd = root + "/target/bin/i386-apple-" + env["osxcross_sdk"] + "-"
+ else: # 64-bit, default
+ basecmd = root + "/target/bin/x86_64-apple-" + env["osxcross_sdk"] + "-"
env['CC'] = basecmd + "cc"
env['CXX'] = basecmd + "c++"
diff --git a/platform/osx/dir_access_osx.h b/platform/osx/dir_access_osx.h
index 6dcff3898c..c988dfe425 100644
--- a/platform/osx/dir_access_osx.h
+++ b/platform/osx/dir_access_osx.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/osx/dir_access_osx.mm b/platform/osx/dir_access_osx.mm
index 37ba0e6b19..6e8ceb5e19 100644
--- a/platform/osx/dir_access_osx.mm
+++ b/platform/osx/dir_access_osx.mm
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/osx/export/export.cpp b/platform/osx/export/export.cpp
index 03f424de8d..7f749030ec 100644
--- a/platform/osx/export/export.cpp
+++ b/platform/osx/export/export.cpp
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/osx/export/export.h b/platform/osx/export/export.h
index 50604f068f..bb87c8a6b7 100644
--- a/platform/osx/export/export.h
+++ b/platform/osx/export/export.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/osx/godot_main_osx.mm b/platform/osx/godot_main_osx.mm
index 0bf678f9b7..83d782cc2f 100644
--- a/platform/osx/godot_main_osx.mm
+++ b/platform/osx/godot_main_osx.mm
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/osx/joypad_osx.cpp b/platform/osx/joypad_osx.cpp
index 1a4b3a460e..ab323ad410 100644
--- a/platform/osx/joypad_osx.cpp
+++ b/platform/osx/joypad_osx.cpp
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
@@ -217,10 +217,9 @@ static void joypad_added_callback(void *ctx, IOReturn res, void *sender, IOHIDDe
}
static bool is_joypad(IOHIDDeviceRef p_device_ref) {
- CFTypeRef refCF = NULL;
int usage_page = 0;
int usage = 0;
- refCF = IOHIDDeviceGetProperty(p_device_ref, CFSTR(kIOHIDPrimaryUsagePageKey));
+ CFTypeRef refCF = IOHIDDeviceGetProperty(p_device_ref, CFSTR(kIOHIDPrimaryUsagePageKey));
if (refCF) {
CFNumberGetValue((CFNumberRef)refCF, kCFNumberSInt32Type, &usage_page);
}
@@ -289,13 +288,11 @@ static String _hex_str(uint8_t p_byte) {
bool JoypadOSX::configure_joypad(IOHIDDeviceRef p_device_ref, joypad *p_joy) {
- CFTypeRef refCF = NULL;
-
p_joy->device_ref = p_device_ref;
/* get device name */
String name;
char c_name[256];
- refCF = IOHIDDeviceGetProperty(p_device_ref, CFSTR(kIOHIDProductKey));
+ CFTypeRef refCF = IOHIDDeviceGetProperty(p_device_ref, CFSTR(kIOHIDProductKey));
if (!refCF) {
refCF = IOHIDDeviceGetProperty(p_device_ref, CFSTR(kIOHIDManufacturerKey));
}
@@ -334,8 +331,7 @@ bool JoypadOSX::configure_joypad(IOHIDDeviceRef p_device_ref, joypad *p_joy) {
input->joy_connection_changed(id, true, name, guid);
}
- CFArrayRef array = NULL;
- array = IOHIDDeviceCopyMatchingElements(p_device_ref, NULL, kIOHIDOptionsTypeNone);
+ CFArrayRef array = IOHIDDeviceCopyMatchingElements(p_device_ref, NULL, kIOHIDOptionsTypeNone);
if (array) {
p_joy->add_hid_elements(array);
CFRelease(array);
diff --git a/platform/osx/joypad_osx.h b/platform/osx/joypad_osx.h
index bfbc523cff..e271f4b947 100644
--- a/platform/osx/joypad_osx.h
+++ b/platform/osx/joypad_osx.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/osx/os_osx.h b/platform/osx/os_osx.h
index 56e6802eeb..ebaebd84ce 100644
--- a/platform/osx/os_osx.h
+++ b/platform/osx/os_osx.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
@@ -160,6 +160,8 @@ public:
virtual MainLoop *get_main_loop() const;
+ virtual String get_system_dir(SystemDir p_dir) const;
+
virtual bool can_draw() const;
virtual void set_clipboard(const String &p_text);
@@ -187,9 +189,9 @@ public:
virtual int get_screen_count() const;
virtual int get_current_screen() const;
virtual void set_current_screen(int p_screen);
- virtual Point2 get_screen_position(int p_screen = 0) const;
- virtual Size2 get_screen_size(int p_screen = 0) const;
- virtual int get_screen_dpi(int p_screen = 0) const;
+ virtual Point2 get_screen_position(int p_screen = -1) const;
+ virtual Size2 get_screen_size(int p_screen = -1) const;
+ virtual int get_screen_dpi(int p_screen = -1) const;
virtual Point2 get_window_position() const;
virtual void set_window_position(const Point2 &p_position);
diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm
index 6d8a6eca66..f502fb9a9c 100644
--- a/platform/osx/os_osx.mm
+++ b/platform/osx/os_osx.mm
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
@@ -137,6 +137,11 @@ static bool mouse_down_control = false;
//_GodotInputMonitorChange();
}
+- (void)showAbout:(id)sender {
+ if (OS_OSX::singleton->get_main_loop())
+ OS_OSX::singleton->get_main_loop()->notification(MainLoop::NOTIFICATION_WM_ABOUT);
+}
+
@end
@interface GodotWindowDelegate : NSObject {
@@ -1322,6 +1327,46 @@ MainLoop *OS_OSX::get_main_loop() const {
return main_loop;
}
+String OS_OSX::get_system_dir(SystemDir p_dir) const {
+
+ NSSearchPathDirectory id = 0;
+
+ switch (p_dir) {
+ case SYSTEM_DIR_DESKTOP: {
+ id = NSDesktopDirectory;
+ } break;
+ case SYSTEM_DIR_DOCUMENTS: {
+ id = NSDocumentDirectory;
+ } break;
+ case SYSTEM_DIR_DOWNLOADS: {
+ id = NSDownloadsDirectory;
+ } break;
+ case SYSTEM_DIR_MOVIES: {
+ id = NSMoviesDirectory;
+ } break;
+ case SYSTEM_DIR_MUSIC: {
+ id = NSMusicDirectory;
+ } break;
+ case SYSTEM_DIR_PICTURES: {
+ id = NSPicturesDirectory;
+ } break;
+ }
+
+ String ret;
+ if (id) {
+
+ NSArray *paths = NSSearchPathForDirectoriesInDomains(id, NSUserDomainMask, YES);
+ if (paths && [paths count] >= 1) {
+
+ char *utfs = strdup([[paths firstObject] UTF8String]);
+ ret.parse_utf8(utfs);
+ free(utfs);
+ }
+ }
+
+ return ret;
+}
+
bool OS_OSX::can_draw() const {
return true;
@@ -1428,6 +1473,10 @@ void OS_OSX::set_current_screen(int p_screen) {
};
Point2 OS_OSX::get_screen_position(int p_screen) const {
+ if (p_screen == -1) {
+ p_screen = get_current_screen();
+ }
+
NSArray *screenArray = [NSScreen screens];
if (p_screen < [screenArray count]) {
float displayScale = 1.0;
@@ -1444,6 +1493,10 @@ Point2 OS_OSX::get_screen_position(int p_screen) const {
}
int OS_OSX::get_screen_dpi(int p_screen) const {
+ if (p_screen == -1) {
+ p_screen = get_current_screen();
+ }
+
NSArray *screenArray = [NSScreen screens];
if (p_screen < [screenArray count]) {
float displayScale = 1.0;
@@ -1464,6 +1517,10 @@ int OS_OSX::get_screen_dpi(int p_screen) const {
}
Size2 OS_OSX::get_screen_size(int p_screen) const {
+ if (p_screen == -1) {
+ p_screen = get_current_screen();
+ }
+
NSArray *screenArray = [NSScreen screens];
if (p_screen < [screenArray count]) {
float displayScale = 1.0;
@@ -1514,9 +1571,14 @@ Point2 OS_OSX::get_window_position() const {
void OS_OSX::set_window_position(const Point2 &p_position) {
- Point2 size = p_position;
- size /= display_scale;
- [window_object setFrame:NSMakeRect(size.x, size.y, [window_object frame].size.width, [window_object frame].size.height) display:YES];
+ Size2 scr = get_screen_size();
+ NSPoint pos;
+
+ pos.x = p_position.x / display_scale;
+ // For OS X the y starts at the bottom
+ pos.y = (scr.height - p_position.y) / display_scale;
+
+ [window_object setFrameTopLeftPoint:pos];
_update_window();
};
@@ -1897,7 +1959,7 @@ OS_OSX::OS_OSX() {
// Setup Apple menu
NSMenu *apple_menu = [[NSMenu alloc] initWithTitle:@""];
title = [NSString stringWithFormat:NSLocalizedString(@"About %@", nil), nsappname];
- [apple_menu addItemWithTitle:title action:@selector(orderFrontStandardAboutPanel:) keyEquivalent:@""];
+ [apple_menu addItemWithTitle:title action:@selector(showAbout:) keyEquivalent:@""];
[apple_menu addItem:[NSMenuItem separatorItem]];
diff --git a/platform/osx/platform_config.h b/platform/osx/platform_config.h
index 487077e651..d2474fcfc7 100644
--- a/platform/osx/platform_config.h
+++ b/platform/osx/platform_config.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/osx/power_osx.cpp b/platform/osx/power_osx.cpp
index 2ef1a65ff1..24591e48b1 100644
--- a/platform/osx/power_osx.cpp
+++ b/platform/osx/power_osx.cpp
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/osx/power_osx.h b/platform/osx/power_osx.h
index 6d984ec466..692c850d7c 100644
--- a/platform/osx/power_osx.h
+++ b/platform/osx/power_osx.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/osx/sem_osx.cpp b/platform/osx/sem_osx.cpp
index b1eeccfec5..f75ac181bf 100644
--- a/platform/osx/sem_osx.cpp
+++ b/platform/osx/sem_osx.cpp
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/osx/sem_osx.h b/platform/osx/sem_osx.h
index 3025318c4b..2b408b00de 100644
--- a/platform/osx/sem_osx.h
+++ b/platform/osx/sem_osx.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/server/godot_server.cpp b/platform/server/godot_server.cpp
index ed0100ac93..2fd8c315de 100644
--- a/platform/server/godot_server.cpp
+++ b/platform/server/godot_server.cpp
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/server/os_server.cpp b/platform/server/os_server.cpp
index 89af785d29..44034e815d 100644
--- a/platform/server/os_server.cpp
+++ b/platform/server/os_server.cpp
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/server/os_server.h b/platform/server/os_server.h
index 7c29b1e232..f3db053be3 100644
--- a/platform/server/os_server.h
+++ b/platform/server/os_server.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/server/platform_config.h b/platform/server/platform_config.h
index 48bcadcc29..b1c3f027f3 100644
--- a/platform/server/platform_config.h
+++ b/platform/server/platform_config.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/uwp/app.cpp b/platform/uwp/app.cpp
index c773c0b746..c565999d82 100644
--- a/platform/uwp/app.cpp
+++ b/platform/uwp/app.cpp
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
@@ -512,7 +512,7 @@ void App::UpdateWindowSize(Size size) {
char **App::get_command_line(unsigned int *out_argc) {
- static char *fail_cl[] = { "-path", "game", NULL };
+ static char *fail_cl[] = { "--path", "game", NULL };
*out_argc = 2;
FILE *f = _wfopen(L"__cl__.cl", L"rb");
diff --git a/platform/uwp/app.h b/platform/uwp/app.h
index 9cbe7669c9..e079fa9c9d 100644
--- a/platform/uwp/app.h
+++ b/platform/uwp/app.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/uwp/detect.py b/platform/uwp/detect.py
index 64dac93f1f..23929dd804 100644
--- a/platform/uwp/detect.py
+++ b/platform/uwp/detect.py
@@ -145,8 +145,8 @@ def configure(env):
env.Append(CPPFLAGS=['/AI', vc_base_path + 'lib/store/references'])
env.Append(CPPFLAGS=['/AI', vc_base_path + 'lib/x86/store/references'])
- env.Append(CCFLAGS=string.split('/FS /MP /GS /wd"4453" /wd"28204" /wd"4291" /Zc:wchar_t /Gm- /fp:precise /D "_UNICODE" /D "UNICODE" /D "WINAPI_FAMILY=WINAPI_FAMILY_APP" /errorReport:prompt /WX- /Zc:forScope /Gd /EHsc /nologo'))
- env.Append(CXXFLAGS=string.split('/ZW /FS'))
+ env.Append(CCFLAGS='/FS /MP /GS /wd"4453" /wd"28204" /wd"4291" /Zc:wchar_t /Gm- /fp:precise /D "_UNICODE" /D "UNICODE" /D "WINAPI_FAMILY=WINAPI_FAMILY_APP" /errorReport:prompt /WX- /Zc:forScope /Gd /EHsc /nologo'.split())
+ env.Append(CXXFLAGS='/ZW /FS'.split())
env.Append(CCFLAGS=['/AI', vc_base_path + '\\vcpackages', '/AI', os.environ['WINDOWSSDKDIR'] + '\\References\\CommonConfiguration\\Neutral'])
## Link flags
diff --git a/platform/uwp/export/export.cpp b/platform/uwp/export/export.cpp
index a1aa58a5e7..c129743507 100644
--- a/platform/uwp/export/export.cpp
+++ b/platform/uwp/export/export.cpp
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
@@ -171,7 +171,7 @@ class AppxPackager {
}
Vector<uint8_t> make_file_header(FileMeta p_file_meta);
- void store_central_dir_header(const FileMeta p_file, bool p_do_hash = true);
+ void store_central_dir_header(const FileMeta &p_file, bool p_do_hash = true);
Vector<uint8_t> make_end_of_central_record();
String content_type(String p_extension);
@@ -329,7 +329,7 @@ Vector<uint8_t> AppxPackager::make_file_header(FileMeta p_file_meta) {
return buf;
}
-void AppxPackager::store_central_dir_header(const FileMeta p_file, bool p_do_hash) {
+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();
@@ -869,19 +869,19 @@ class EditorExportUWP : public EditorExportPlatform {
StreamTexture *image;
if (p_path.find("StoreLogo") != -1) {
- image = p_preset->get("images/store_logo").is_zero() ? NULL : ((Object *)p_preset->get("images/store_logo"))->cast_to<StreamTexture>();
+ image = p_preset->get("images/store_logo").is_zero() ? NULL : Object::cast_to<StreamTexture>(((Object *)p_preset->get("images/store_logo")));
} else if (p_path.find("Square44x44Logo") != -1) {
- image = p_preset->get("images/square44x44_logo").is_zero() ? NULL : ((Object *)p_preset->get("images/square44x44_logo"))->cast_to<StreamTexture>();
+ image = p_preset->get("images/square44x44_logo").is_zero() ? NULL : Object::cast_to<StreamTexture>(((Object *)p_preset->get("images/square44x44_logo")));
} else if (p_path.find("Square71x71Logo") != -1) {
- image = p_preset->get("images/square71x71_logo").is_zero() ? NULL : ((Object *)p_preset->get("images/square71x71_logo"))->cast_to<StreamTexture>();
+ image = p_preset->get("images/square71x71_logo").is_zero() ? NULL : Object::cast_to<StreamTexture>(((Object *)p_preset->get("images/square71x71_logo")));
} else if (p_path.find("Square150x150Logo") != -1) {
- image = p_preset->get("images/square150x150_logo").is_zero() ? NULL : ((Object *)p_preset->get("images/square150x150_logo"))->cast_to<StreamTexture>();
+ image = p_preset->get("images/square150x150_logo").is_zero() ? NULL : Object::cast_to<StreamTexture>(((Object *)p_preset->get("images/square150x150_logo")));
} else if (p_path.find("Square310x310Logo") != -1) {
- image = p_preset->get("images/square310x310_logo").is_zero() ? NULL : ((Object *)p_preset->get("images/square310x310_logo"))->cast_to<StreamTexture>();
+ image = p_preset->get("images/square310x310_logo").is_zero() ? NULL : Object::cast_to<StreamTexture>(((Object *)p_preset->get("images/square310x310_logo")));
} else if (p_path.find("Wide310x150Logo") != -1) {
- image = p_preset->get("images/wide310x150_logo").is_zero() ? NULL : ((Object *)p_preset->get("images/wide310x150_logo"))->cast_to<StreamTexture>();
+ image = p_preset->get("images/wide310x150_logo").is_zero() ? NULL : Object::cast_to<StreamTexture>(((Object *)p_preset->get("images/wide310x150_logo")));
} else if (p_path.find("SplashScreen") != -1) {
- image = p_preset->get("images/splash_screen").is_zero() ? NULL : ((Object *)p_preset->get("images/splash_screen"))->cast_to<StreamTexture>();
+ image = p_preset->get("images/splash_screen").is_zero() ? NULL : Object::cast_to<StreamTexture>(((Object *)p_preset->get("images/splash_screen")));
}
if (!image) return data;
@@ -1162,37 +1162,37 @@ public:
err += "\nInvalid background color.";
}
- if (!p_preset->get("images/store_logo").is_zero() && !_valid_image(((Object *)p_preset->get("images/store_logo"))->cast_to<StreamTexture>(), 50, 50)) {
+ if (!p_preset->get("images/store_logo").is_zero() && !_valid_image((Object::cast_to<StreamTexture>((Object *)p_preset->get("images/store_logo"))), 50, 50)) {
valid = false;
err += "\nInvalid Store Logo image dimensions (should be 50x50).";
}
- if (!p_preset->get("images/square44x44_logo").is_zero() && !_valid_image(((Object *)p_preset->get("images/square44x44_logo"))->cast_to<StreamTexture>(), 44, 44)) {
+ if (!p_preset->get("images/square44x44_logo").is_zero() && !_valid_image((Object::cast_to<StreamTexture>((Object *)p_preset->get("images/square44x44_logo"))), 44, 44)) {
valid = false;
err += "\nInvalid square 44x44 logo image dimensions (should be 44x44).";
}
- if (!p_preset->get("images/square71x71_logo").is_zero() && !_valid_image(((Object *)p_preset->get("images/square71x71_logo"))->cast_to<StreamTexture>(), 71, 71)) {
+ if (!p_preset->get("images/square71x71_logo").is_zero() && !_valid_image((Object::cast_to<StreamTexture>((Object *)p_preset->get("images/square71x71_logo"))), 71, 71)) {
valid = false;
err += "\nInvalid square 71x71 logo image dimensions (should be 71x71).";
}
- if (!p_preset->get("images/square150x150_logo").is_zero() && !_valid_image(((Object *)p_preset->get("images/square150x150_logo"))->cast_to<StreamTexture>(), 150, 0)) {
+ if (!p_preset->get("images/square150x150_logo").is_zero() && !_valid_image((Object::cast_to<StreamTexture>((Object *)p_preset->get("images/square150x150_logo"))), 150, 0)) {
valid = false;
err += "\nInvalid square 150x150 logo image dimensions (should be 150x150).";
}
- if (!p_preset->get("images/square310x310_logo").is_zero() && !_valid_image(((Object *)p_preset->get("images/square310x310_logo"))->cast_to<StreamTexture>(), 310, 310)) {
+ if (!p_preset->get("images/square310x310_logo").is_zero() && !_valid_image((Object::cast_to<StreamTexture>((Object *)p_preset->get("images/square310x310_logo"))), 310, 310)) {
valid = false;
err += "\nInvalid square 310x310 logo image dimensions (should be 310x310).";
}
- if (!p_preset->get("images/wide310x150_logo").is_zero() && !_valid_image(((Object *)p_preset->get("images/wide310x150_logo"))->cast_to<StreamTexture>(), 310, 150)) {
+ if (!p_preset->get("images/wide310x150_logo").is_zero() && !_valid_image((Object::cast_to<StreamTexture>((Object *)p_preset->get("images/wide310x150_logo"))), 310, 150)) {
valid = false;
err += "\nInvalid wide 310x150 logo image dimensions (should be 310x150).";
}
- if (!p_preset->get("images/splash_screen").is_zero() && !_valid_image(((Object *)p_preset->get("images/splash_screen"))->cast_to<StreamTexture>(), 620, 300)) {
+ if (!p_preset->get("images/splash_screen").is_zero() && !_valid_image((Object::cast_to<StreamTexture>((Object *)p_preset->get("images/splash_screen"))), 620, 300)) {
valid = false;
err += "\nInvalid splash screen image dimensions (should be 620x300).";
}
@@ -1330,7 +1330,7 @@ public:
}
if (!(p_flags & DEBUG_FLAG_DUMB_CLIENT)) {
- cl.push_back("-path");
+ cl.push_back("--path");
cl.push_back("game");
}
diff --git a/platform/uwp/export/export.h b/platform/uwp/export/export.h
index 81bd848241..558af38a70 100644
--- a/platform/uwp/export/export.h
+++ b/platform/uwp/export/export.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/uwp/gl_context_egl.cpp b/platform/uwp/gl_context_egl.cpp
index 57c4c5d572..dd186c97d6 100644
--- a/platform/uwp/gl_context_egl.cpp
+++ b/platform/uwp/gl_context_egl.cpp
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/uwp/gl_context_egl.h b/platform/uwp/gl_context_egl.h
index 908b8dceec..1b24780b29 100644
--- a/platform/uwp/gl_context_egl.h
+++ b/platform/uwp/gl_context_egl.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/uwp/joypad_uwp.cpp b/platform/uwp/joypad_uwp.cpp
index f3d4eb99c8..0f84bd55a3 100644
--- a/platform/uwp/joypad_uwp.cpp
+++ b/platform/uwp/joypad_uwp.cpp
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
@@ -54,7 +54,7 @@ void JoypadUWP::process_controllers() {
case ControllerType::GAMEPAD_CONTROLLER: {
- GamepadReading reading = ((Gamepad ^) joy.controller_reference)->GetCurrentReading();
+ GamepadReading reading = ((Gamepad ^)joy.controller_reference)->GetCurrentReading();
int button_mask = (int)GamepadButtons::Menu;
for (int j = 0; j < 14; j++) {
@@ -161,7 +161,7 @@ void JoypadUWP::joypad_vibration_start(int p_device, float p_weak_magnitude, flo
GamepadVibration vibration;
vibration.LeftMotor = p_strong_magnitude;
vibration.RightMotor = p_weak_magnitude;
- ((Gamepad ^) joy.controller_reference)->Vibration = vibration;
+ ((Gamepad ^)joy.controller_reference)->Vibration = vibration;
joy.ff_timestamp = p_timestamp;
joy.ff_end_timestamp = p_duration == 0 ? 0 : p_timestamp + (uint64_t)(p_duration * 1000000.0);
@@ -175,7 +175,7 @@ void JoypadUWP::joypad_vibration_stop(int p_device, uint64_t p_timestamp) {
GamepadVibration vibration;
vibration.LeftMotor = 0.0;
vibration.RightMotor = 0.0;
- ((Gamepad ^) joy.controller_reference)->Vibration = vibration;
+ ((Gamepad ^)joy.controller_reference)->Vibration = vibration;
joy.ff_timestamp = p_timestamp;
joy.vibrating = false;
diff --git a/platform/uwp/joypad_uwp.h b/platform/uwp/joypad_uwp.h
index c55e1e7ab7..4efec485fa 100644
--- a/platform/uwp/joypad_uwp.h
+++ b/platform/uwp/joypad_uwp.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/uwp/os_uwp.cpp b/platform/uwp/os_uwp.cpp
index fabb227bf5..3a8932aae2 100644
--- a/platform/uwp/os_uwp.cpp
+++ b/platform/uwp/os_uwp.cpp
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/uwp/os_uwp.h b/platform/uwp/os_uwp.h
index dfa21a0934..5f36396017 100644
--- a/platform/uwp/os_uwp.h
+++ b/platform/uwp/os_uwp.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/uwp/platform_config.h b/platform/uwp/platform_config.h
index 77d2c9cadb..abe14f7578 100644
--- a/platform/uwp/platform_config.h
+++ b/platform/uwp/platform_config.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/uwp/power_uwp.cpp b/platform/uwp/power_uwp.cpp
index ece07f84ad..07a726647d 100644
--- a/platform/uwp/power_uwp.cpp
+++ b/platform/uwp/power_uwp.cpp
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/uwp/power_uwp.h b/platform/uwp/power_uwp.h
index c23d712980..9a9811a4f5 100644
--- a/platform/uwp/power_uwp.h
+++ b/platform/uwp/power_uwp.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/uwp/thread_uwp.cpp b/platform/uwp/thread_uwp.cpp
index 0549a8ed47..7c8c2b204a 100644
--- a/platform/uwp/thread_uwp.cpp
+++ b/platform/uwp/thread_uwp.cpp
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/uwp/thread_uwp.h b/platform/uwp/thread_uwp.h
index b8cccfb7c3..0446bd36ca 100644
--- a/platform/uwp/thread_uwp.h
+++ b/platform/uwp/thread_uwp.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/windows/context_gl_win.cpp b/platform/windows/context_gl_win.cpp
index f8aed0ccab..328b987f1f 100644
--- a/platform/windows/context_gl_win.cpp
+++ b/platform/windows/context_gl_win.cpp
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/windows/context_gl_win.h b/platform/windows/context_gl_win.h
index b3cab7806d..912d4d0133 100644
--- a/platform/windows/context_gl_win.h
+++ b/platform/windows/context_gl_win.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/windows/ctxgl_procaddr.cpp b/platform/windows/ctxgl_procaddr.cpp
index e01c3fc252..c0c900acca 100644
--- a/platform/windows/ctxgl_procaddr.cpp
+++ b/platform/windows/ctxgl_procaddr.cpp
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/windows/ctxgl_procaddr.h b/platform/windows/ctxgl_procaddr.h
index ecef01aadf..61fa6d7fbd 100644
--- a/platform/windows/ctxgl_procaddr.h
+++ b/platform/windows/ctxgl_procaddr.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/windows/detect.py b/platform/windows/detect.py
index 4d93b3f244..d239ccf7d2 100644
--- a/platform/windows/detect.py
+++ b/platform/windows/detect.py
@@ -14,69 +14,56 @@ def get_name():
def can_build():
if (os.name == "nt"):
- # building natively on windows!
- if (os.getenv("VCINSTALLDIR")):
+ # Building natively on Windows
+ if (os.getenv("VCINSTALLDIR")): # MSVC
return True
- else:
- print("\nMSVC not detected, attempting MinGW.")
- mingw32 = ""
- mingw64 = ""
- if (os.getenv("MINGW32_PREFIX")):
- mingw32 = os.getenv("MINGW32_PREFIX")
- if (os.getenv("MINGW64_PREFIX")):
- mingw64 = os.getenv("MINGW64_PREFIX")
-
- test = "gcc --version > NUL 2>&1"
- if os.system(test) != 0 and os.system(mingw32 + test) != 0 and os.system(mingw64 + test) != 0:
- print("- could not detect gcc.")
- print("Please, make sure a path to a MinGW /bin directory is accessible into the environment PATH.\n")
- return False
- else:
- print("- gcc detected.")
+ print("MSVC not detected (no VCINSTALLDIR environment variable), attempting MinGW.")
+ mingw32 = ""
+ mingw64 = ""
+ if (os.getenv("MINGW32_PREFIX")):
+ mingw32 = os.getenv("MINGW32_PREFIX")
+ if (os.getenv("MINGW64_PREFIX")):
+ mingw64 = os.getenv("MINGW64_PREFIX")
+
+ test = "gcc --version > NUL 2>&1"
+ if (os.system(test) == 0 or os.system(mingw32 + test) == 0 or os.system(mingw64 + test) == 0):
return True
if (os.name == "posix"):
-
- mingw = "i586-mingw32msvc-"
- mingw64 = "x86_64-w64-mingw32-"
+ # Cross-compiling with MinGW-w64 (old MinGW32 is not supported)
mingw32 = "i686-w64-mingw32-"
+ mingw64 = "x86_64-w64-mingw32-"
if (os.getenv("MINGW32_PREFIX")):
mingw32 = os.getenv("MINGW32_PREFIX")
- mingw = mingw32
if (os.getenv("MINGW64_PREFIX")):
mingw64 = os.getenv("MINGW64_PREFIX")
test = "gcc --version > /dev/null 2>&1"
- if (os.system(mingw + test) == 0 or os.system(mingw64 + test) == 0 or os.system(mingw32 + test) == 0):
+ if (os.system(mingw64 + test) == 0 or os.system(mingw32 + test) == 0):
return True
+ print("Could not detect MinGW. Ensure its binaries are in your PATH or that MINGW32_PREFIX or MINGW64_PREFIX are properly defined.")
return False
def get_opts():
- mingw = ""
mingw32 = ""
mingw64 = ""
if (os.name == "posix"):
- mingw = "i586-mingw32msvc-"
mingw32 = "i686-w64-mingw32-"
mingw64 = "x86_64-w64-mingw32-"
- if os.system(mingw32 + "gcc --version > /dev/null 2>&1") != 0:
- mingw32 = mingw
-
if (os.getenv("MINGW32_PREFIX")):
mingw32 = os.getenv("MINGW32_PREFIX")
- mingw = mingw32
if (os.getenv("MINGW64_PREFIX")):
mingw64 = os.getenv("MINGW64_PREFIX")
return [
- ('mingw_prefix', 'MinGW Prefix', mingw32),
- ('mingw_prefix_64', 'MinGW Prefix 64 bits', mingw64),
+ ('mingw_prefix_32', 'MinGW prefix (Win32)', mingw32),
+ ('mingw_prefix_64', 'MinGW prefix (Win64)', mingw64),
]
@@ -88,12 +75,10 @@ def get_flags():
def build_res_file(target, source, env):
- cmdbase = ""
if (env["bits"] == "32"):
- cmdbase = env['mingw_prefix']
+ cmdbase = env['mingw_prefix_32']
else:
cmdbase = env['mingw_prefix_64']
- CPPPATH = env['CPPPATH']
cmdbase = cmdbase + 'windres --include-dir . '
import subprocess
for x in range(len(source)):
@@ -111,8 +96,10 @@ def configure(env):
env.Append(CPPPATH=['#platform/windows'])
- # Targeted Windows version: Vista (and later)
- winver = "0x0600" # Windows Vista is the minimum target for windows builds
+ # Targeted Windows version: 7 (and later), minimum supported version
+ # XP support dropped after EOL due to missing API for IPv6 and other issues
+ # Vista support dropped after EOL due to GH-10243
+ winver = "0x0601"
if (os.name == "nt" and os.getenv("VCINSTALLDIR")): # MSVC
@@ -184,6 +171,7 @@ def configure(env):
env.Append(CCFLAGS=['/DWINDOWS_ENABLED'])
env.Append(CCFLAGS=['/DOPENGL_ENABLED'])
env.Append(CCFLAGS=['/DRTAUDIO_ENABLED'])
+ env.Append(CCFLAGS=['/DWASAPI_ENABLED'])
env.Append(CCFLAGS=['/DTYPED_METHOD_BIND'])
env.Append(CCFLAGS=['/DWIN32'])
env.Append(CCFLAGS=['/DWINVER=%s' % winver, '/D_WIN32_WINNT=%s' % winver])
@@ -247,7 +235,7 @@ def configure(env):
env.Append(LINKFLAGS=['-static'])
env.Append(LINKFLAGS=['-static-libgcc'])
env.Append(LINKFLAGS=['-static-libstdc++'])
- mingw_prefix = env["mingw_prefix"]
+ mingw_prefix = env["mingw_prefix_32"]
else:
env.Append(LINKFLAGS=['-static'])
mingw_prefix = env["mingw_prefix_64"]
@@ -265,8 +253,9 @@ def configure(env):
env.Append(CCFLAGS=['-DWINDOWS_ENABLED', '-mwindows'])
env.Append(CCFLAGS=['-DOPENGL_ENABLED'])
env.Append(CCFLAGS=['-DRTAUDIO_ENABLED'])
+ env.Append(CCFLAGS=['-DWASAPI_ENABLED'])
env.Append(CCFLAGS=['-DWINVER=%s' % winver, '-D_WIN32_WINNT=%s' % winver])
- env.Append(LIBS=['mingw32', 'opengl32', 'dsound', 'ole32', 'd3d9', 'winmm', 'gdi32', 'iphlpapi', 'shlwapi', 'wsock32', 'ws2_32', 'kernel32', 'oleaut32', 'dinput8', 'dxguid'])
+ env.Append(LIBS=['mingw32', 'opengl32', 'dsound', 'ole32', 'd3d9', 'winmm', 'gdi32', 'iphlpapi', 'shlwapi', 'wsock32', 'ws2_32', 'kernel32', 'oleaut32', 'dinput8', 'dxguid', 'ksuser'])
env.Append(CPPFLAGS=['-DMINGW_ENABLED'])
diff --git a/platform/windows/export/export.cpp b/platform/windows/export/export.cpp
index 6cb33e2ff0..5301aa9e95 100644
--- a/platform/windows/export/export.cpp
+++ b/platform/windows/export/export.cpp
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/windows/export/export.h b/platform/windows/export/export.h
index ea9113c674..cc85339312 100644
--- a/platform/windows/export/export.h
+++ b/platform/windows/export/export.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/windows/godot_win.cpp b/platform/windows/godot_win.cpp
index df2d96e516..d2ac6ecb50 100644
--- a/platform/windows/godot_win.cpp
+++ b/platform/windows/godot_win.cpp
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
@@ -136,8 +136,13 @@ int widechar_main(int argc, wchar_t **argv) {
Error err = Main::setup(argv_utf8[0], argc - 1, &argv_utf8[1]);
- if (err != OK)
+ if (err != OK) {
+ for (int i = 0; i < argc; ++i) {
+ delete[] argv_utf8[i];
+ }
+ delete[] argv_utf8;
return 255;
+ }
if (Main::start())
os.run();
diff --git a/platform/windows/joypad.cpp b/platform/windows/joypad.cpp
index 7263e89c1a..cde72c98c9 100644
--- a/platform/windows/joypad.cpp
+++ b/platform/windows/joypad.cpp
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
@@ -235,13 +235,13 @@ void JoypadWindows::setup_joypad_object(const DIDEVICEOBJECTINSTANCE *ob, int p_
}
}
-BOOL CALLBACK JoypadWindows::enumCallback(const DIDEVICEINSTANCE *instance, void *pContext) {
+BOOL CALLBACK JoypadWindows::enumCallback(const DIDEVICEINSTANCE *p_instance, void *p_context) {
- JoypadWindows *self = (JoypadWindows *)pContext;
- if (self->is_xinput_device(&instance->guidProduct)) {
+ JoypadWindows *self = (JoypadWindows *)p_context;
+ if (self->is_xinput_device(&p_instance->guidProduct)) {
return DIENUM_CONTINUE;
}
- self->setup_dinput_joypad(instance);
+ self->setup_dinput_joypad(p_instance);
return DIENUM_CONTINUE;
}
diff --git a/platform/windows/joypad.h b/platform/windows/joypad.h
index 7cd791e78f..059c577bb6 100644
--- a/platform/windows/joypad.h
+++ b/platform/windows/joypad.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/windows/key_mapping_win.cpp b/platform/windows/key_mapping_win.cpp
index 83e2af72b2..57f8e965de 100644
--- a/platform/windows/key_mapping_win.cpp
+++ b/platform/windows/key_mapping_win.cpp
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/windows/key_mapping_win.h b/platform/windows/key_mapping_win.h
index af91676dff..139f047d17 100644
--- a/platform/windows/key_mapping_win.h
+++ b/platform/windows/key_mapping_win.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/windows/lang_table.h b/platform/windows/lang_table.h
index 7cf2bb391b..d54894afce 100644
--- a/platform/windows/lang_table.h
+++ b/platform/windows/lang_table.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp
index f72e5ef595..deb9c25576 100644
--- a/platform/windows/os_windows.cpp
+++ b/platform/windows/os_windows.cpp
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
@@ -63,12 +63,11 @@ __attribute__((visibility("default"))) DWORD NvOptimusEnablement = 0x00000001;
#endif
}
-#ifndef WM_MOUSEHWHEEL
-#define WM_MOUSEHWHEEL 0x020e
+// Workaround mingw-w64 < 4.0 bug
+#ifndef WM_TOUCH
+#define WM_TOUCH 576
#endif
-//#define STDOUT_FILE
-
extern HINSTANCE godot_hinstance;
void RedirectIOToConsole() {
@@ -717,8 +716,7 @@ LRESULT OS_Windows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
} break;
case WM_DROPFILES: {
- HDROP hDropInfo = NULL;
- hDropInfo = (HDROP)wParam;
+ HDROP hDropInfo = (HDROP)wParam;
const int buffsize = 4096;
wchar_t buf[buffsize];
@@ -889,23 +887,6 @@ static int QueryDpiForMonitor(HMONITOR hmon, _MonitorDpiType dpiType = MDT_Defau
return (dpiX + dpiY) / 2;
}
-BOOL CALLBACK OS_Windows::MonitorEnumProc(HMONITOR hMonitor, HDC hdcMonitor, LPRECT lprcMonitor, LPARAM dwData) {
- OS_Windows *self = (OS_Windows *)OS::get_singleton();
- MonitorInfo minfo;
- minfo.hMonitor = hMonitor;
- minfo.hdcMonitor = hdcMonitor;
- minfo.rect.position.x = lprcMonitor->left;
- minfo.rect.position.y = lprcMonitor->top;
- minfo.rect.size.x = lprcMonitor->right - lprcMonitor->left;
- minfo.rect.size.y = lprcMonitor->bottom - lprcMonitor->top;
-
- minfo.dpi = QueryDpiForMonitor(hMonitor);
-
- self->monitor_info.push_back(minfo);
-
- return TRUE;
-}
-
void OS_Windows::initialize(const VideoMode &p_desired, int p_video_driver, int p_audio_driver) {
main_loop = NULL;
@@ -941,9 +922,6 @@ void OS_Windows::initialize(const VideoMode &p_desired, int p_video_driver, int
return; // Return
}
- EnumDisplayMonitors(NULL, NULL, MonitorEnumProc, 0);
-
- print_line("DETECTED MONITORS: " + itos(monitor_info.size()));
pre_fs_valid = true;
if (video_mode.fullscreen) {
@@ -1217,8 +1195,6 @@ void OS_Windows::finalize() {
physics_2d_server->finish();
memdelete(physics_2d_server);
-
- monitor_info.clear();
}
void OS_Windows::finalize_core() {
@@ -1344,51 +1320,131 @@ OS::VideoMode OS_Windows::get_video_mode(int p_screen) const {
void OS_Windows::get_fullscreen_mode_list(List<VideoMode> *p_list, int p_screen) const {
}
+static BOOL CALLBACK _MonitorEnumProcCount(HMONITOR hMonitor, HDC hdcMonitor, LPRECT lprcMonitor, LPARAM dwData) {
+
+ int *data = (int *)dwData;
+ (*data)++;
+ return TRUE;
+}
+
int OS_Windows::get_screen_count() const {
- return monitor_info.size();
+ int data = 0;
+ EnumDisplayMonitors(NULL, NULL, _MonitorEnumProcCount, (LPARAM)&data);
+ return data;
}
-int OS_Windows::get_current_screen() const {
- HMONITOR monitor = MonitorFromWindow(hWnd, MONITOR_DEFAULTTONEAREST);
- for (int i = 0; i < monitor_info.size(); i++) {
- if (monitor_info[i].hMonitor == monitor)
- return i;
+typedef struct {
+ int count;
+ int screen;
+ HMONITOR monitor;
+} 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;
}
- return 0;
+ data->count++;
+ return TRUE;
}
-void OS_Windows::set_current_screen(int p_screen) {
- ERR_FAIL_INDEX(p_screen, monitor_info.size());
+int OS_Windows::get_current_screen() const {
+
+ EnumScreenData data = { 0, 0, MonitorFromWindow(hWnd, MONITOR_DEFAULTTONEAREST) };
+ EnumDisplayMonitors(NULL, NULL, _MonitorEnumProcScreen, (LPARAM)&data);
+ return data.screen;
+}
+
+void OS_Windows::set_current_screen(int p_screen) {
Vector2 ofs = get_window_position() - get_screen_position(get_current_screen());
set_window_position(ofs + get_screen_position(p_screen));
}
+typedef struct {
+ int count;
+ int screen;
+ Point2 pos;
+} 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;
+ data->pos.y = lprcMonitor->top;
+ }
+
+ data->count++;
+ return TRUE;
+}
+
Point2 OS_Windows::get_screen_position(int p_screen) const {
- ERR_FAIL_INDEX_V(p_screen, monitor_info.size(), Point2());
- return Vector2(monitor_info[p_screen].rect.position);
+ EnumPosData data = { 0, p_screen == -1 ? get_current_screen() : p_screen, Point2() };
+ EnumDisplayMonitors(NULL, NULL, _MonitorEnumProcPos, (LPARAM)&data);
+ return data.pos;
+}
+
+typedef struct {
+ int count;
+ int screen;
+ Size2 size;
+} EnumSizeData;
+
+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;
+ data->size.y = lprcMonitor->bottom - lprcMonitor->top;
+ }
+
+ data->count++;
+ return TRUE;
}
+
Size2 OS_Windows::get_screen_size(int p_screen) const {
- ERR_FAIL_INDEX_V(p_screen, monitor_info.size(), Point2());
- return Vector2(monitor_info[p_screen].rect.size);
+ EnumSizeData data = { 0, p_screen == -1 ? get_current_screen() : p_screen, Size2() };
+ EnumDisplayMonitors(NULL, NULL, _MonitorEnumProcSize, (LPARAM)&data);
+ return data.size;
+}
+
+typedef struct {
+ int count;
+ int screen;
+ int dpi;
+} EnumDpiData;
+
+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);
+ }
+
+ data->count++;
+ return TRUE;
}
int OS_Windows::get_screen_dpi(int p_screen) const {
- ERR_FAIL_INDEX_V(p_screen, monitor_info.size(), 72);
- UINT dpix, dpiy;
- return monitor_info[p_screen].dpi;
+ EnumDpiData data = { 0, p_screen == -1 ? get_current_screen() : p_screen, 72 };
+ EnumDisplayMonitors(NULL, NULL, _MonitorEnumProcDpi, (LPARAM)&data);
+ return data.dpi;
}
+
Point2 OS_Windows::get_window_position() const {
RECT r;
GetWindowRect(hWnd, &r);
return Point2(r.left, r.top);
}
+
void OS_Windows::set_window_position(const Point2 &p_position) {
if (video_mode.fullscreen) return;
@@ -1571,7 +1627,6 @@ Error OS_Windows::close_dynamic_library(void *p_library_handle) {
}
Error OS_Windows::get_dynamic_library_symbol_handle(void *p_library_handle, const String p_name, void *&p_symbol_handle, bool p_optional) {
- char *error;
p_symbol_handle = (void *)GetProcAddress((HMODULE)p_library_handle, p_name.utf8().get_data());
if (!p_symbol_handle) {
if (!p_optional) {
@@ -2304,6 +2359,9 @@ OS_Windows::OS_Windows(HINSTANCE _hInstance) {
#endif
user_proc = NULL;
+#ifdef WASAPI_ENABLED
+ AudioDriverManager::add_driver(&driver_wasapi);
+#endif
#ifdef RTAUDIO_ENABLED
AudioDriverManager::add_driver(&driver_rtaudio);
#endif
diff --git a/platform/windows/os_windows.h b/platform/windows/os_windows.h
index beaf5d5e35..0c5965bf51 100644
--- a/platform/windows/os_windows.h
+++ b/platform/windows/os_windows.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
@@ -32,6 +32,7 @@
#include "context_gl_win.h"
#include "drivers/rtaudio/audio_driver_rtaudio.h"
+#include "drivers/wasapi/audio_driver_wasapi.h"
#include "os/input.h"
#include "os/os.h"
#include "power_windows.h"
@@ -123,6 +124,9 @@ class OS_Windows : public OS {
PowerWindows *power_manager;
+#ifdef WASAPI_ENABLED
+ AudioDriverWASAPI driver_wasapi;
+#endif
#ifdef RTAUDIO_ENABLED
AudioDriverRtAudio driver_rtaudio;
#endif
@@ -164,22 +168,12 @@ protected:
};
Map<ProcessID, ProcessInfo> *process_map;
- struct MonitorInfo {
- HMONITOR hMonitor;
- HDC hdcMonitor;
- Rect2 rect;
- int dpi;
- };
-
bool pre_fs_valid;
RECT pre_fs_rect;
- Vector<MonitorInfo> monitor_info;
bool maximized;
bool minimized;
bool borderless;
- static BOOL CALLBACK MonitorEnumProc(HMONITOR hMonitor, HDC hdcMonitor, LPRECT lprcMonitor, LPARAM dwData);
-
public:
LRESULT WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
@@ -204,9 +198,9 @@ public:
virtual int get_screen_count() const;
virtual int get_current_screen() const;
virtual void set_current_screen(int p_screen);
- virtual Point2 get_screen_position(int p_screen = 0) const;
- virtual Size2 get_screen_size(int p_screen = 0) const;
- virtual int get_screen_dpi(int p_screen = 0) const;
+ virtual Point2 get_screen_position(int p_screen = -1) const;
+ virtual Size2 get_screen_size(int p_screen = -1) const;
+ virtual int get_screen_dpi(int p_screen = -1) const;
virtual Point2 get_window_position() const;
virtual void set_window_position(const Point2 &p_position);
diff --git a/platform/windows/packet_peer_udp_winsock.cpp b/platform/windows/packet_peer_udp_winsock.cpp
index f3b91c1b56..d414ec891e 100644
--- a/platform/windows/packet_peer_udp_winsock.cpp
+++ b/platform/windows/packet_peer_udp_winsock.cpp
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
@@ -118,7 +118,7 @@ void PacketPeerUDPWinsock::_set_sock_blocking(bool p_blocking) {
};
}
-Error PacketPeerUDPWinsock::listen(int p_port, IP_Address p_bind_address, int p_recv_buffer_size) {
+Error PacketPeerUDPWinsock::listen(int p_port, const IP_Address &p_bind_address, int p_recv_buffer_size) {
ERR_FAIL_COND_V(sockfd != -1, ERR_ALREADY_IN_USE);
ERR_FAIL_COND_V(!p_bind_address.is_valid() && !p_bind_address.is_wildcard(), ERR_INVALID_PARAMETER);
diff --git a/platform/windows/packet_peer_udp_winsock.h b/platform/windows/packet_peer_udp_winsock.h
index ceb6df71aa..8a6951fd6e 100644
--- a/platform/windows/packet_peer_udp_winsock.h
+++ b/platform/windows/packet_peer_udp_winsock.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
@@ -67,7 +67,7 @@ public:
virtual int get_max_packet_size() const;
- virtual Error listen(int p_port, IP_Address p_bind_address = IP_Address("*"), int p_recv_buffer_size = 65536);
+ virtual Error listen(int p_port, const IP_Address &p_bind_address = IP_Address("*"), int p_recv_buffer_size = 65536);
virtual void close();
virtual Error wait();
virtual bool is_listening() const;
diff --git a/platform/windows/platform_config.h b/platform/windows/platform_config.h
index a0fc65ca89..832504b9c5 100644
--- a/platform/windows/platform_config.h
+++ b/platform/windows/platform_config.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/windows/power_windows.cpp b/platform/windows/power_windows.cpp
index 428bc5dcc2..b37e189a3a 100644
--- a/platform/windows/power_windows.cpp
+++ b/platform/windows/power_windows.cpp
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/windows/power_windows.h b/platform/windows/power_windows.h
index 164f1d7d95..9da9841f48 100644
--- a/platform/windows/power_windows.h
+++ b/platform/windows/power_windows.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/windows/stream_peer_winsock.cpp b/platform/windows/stream_peer_winsock.cpp
index 18c5a40b80..a9d9cb9373 100644
--- a/platform/windows/stream_peer_winsock.cpp
+++ b/platform/windows/stream_peer_winsock.cpp
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/windows/stream_peer_winsock.h b/platform/windows/stream_peer_winsock.h
index aa60a6500b..26e2a3e4c9 100644
--- a/platform/windows/stream_peer_winsock.h
+++ b/platform/windows/stream_peer_winsock.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/windows/tcp_server_winsock.cpp b/platform/windows/tcp_server_winsock.cpp
index 3292813d4e..de300befa7 100644
--- a/platform/windows/tcp_server_winsock.cpp
+++ b/platform/windows/tcp_server_winsock.cpp
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
@@ -63,7 +63,7 @@ void TCPServerWinsock::cleanup() {
};
};
-Error TCPServerWinsock::listen(uint16_t p_port, const IP_Address p_bind_address) {
+Error TCPServerWinsock::listen(uint16_t p_port, const IP_Address &p_bind_address) {
ERR_FAIL_COND_V(listen_sockfd != -1, ERR_ALREADY_IN_USE);
ERR_FAIL_COND_V(!p_bind_address.is_valid() && !p_bind_address.is_wildcard(), ERR_INVALID_PARAMETER);
diff --git a/platform/windows/tcp_server_winsock.h b/platform/windows/tcp_server_winsock.h
index 7e5d1e750e..a3e01098ed 100644
--- a/platform/windows/tcp_server_winsock.h
+++ b/platform/windows/tcp_server_winsock.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
@@ -40,7 +40,7 @@ class TCPServerWinsock : public TCP_Server {
static TCP_Server *_create();
public:
- virtual Error listen(uint16_t p_port, const IP_Address p_bind_address = IP_Address("*"));
+ virtual Error listen(uint16_t p_port, const IP_Address &p_bind_address = IP_Address("*"));
virtual bool is_connection_available() const;
virtual Ref<StreamPeerTCP> take_connection();
diff --git a/platform/x11/context_gl_x11.cpp b/platform/x11/context_gl_x11.cpp
index ddf17481b1..0cc9734119 100644
--- a/platform/x11/context_gl_x11.cpp
+++ b/platform/x11/context_gl_x11.cpp
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
@@ -83,13 +83,24 @@ static int ctxErrorHandler(Display *dpy, XErrorEvent *ev) {
return 0;
}
-Error ContextGL_X11::initialize() {
+static void set_class_hint(Display *p_display, Window p_window) {
+ XClassHint *classHint;
- GLXCREATECONTEXTATTRIBSARBPROC glXCreateContextAttribsARB = NULL;
+ /* set the name and class hints for the window manager to use */
+ classHint = XAllocClassHint();
+ if (classHint) {
+ classHint->res_name = (char *)"Godot_Engine";
+ classHint->res_class = (char *)"Godot";
+ }
+ XSetClassHint(p_display, p_window, classHint);
+ XFree(classHint);
+}
+
+Error ContextGL_X11::initialize() {
//const char *extensions = glXQueryExtensionsString(x11_display, DefaultScreen(x11_display));
- glXCreateContextAttribsARB = (GLXCREATECONTEXTATTRIBSARBPROC)glXGetProcAddress((const GLubyte *)"glXCreateContextAttribsARB");
+ GLXCREATECONTEXTATTRIBSARBPROC glXCreateContextAttribsARB = (GLXCREATECONTEXTATTRIBSARBPROC)glXGetProcAddress((const GLubyte *)"glXCreateContextAttribsARB");
ERR_FAIL_COND_V(!glXCreateContextAttribsARB, ERR_UNCONFIGURED);
@@ -127,6 +138,7 @@ Error ContextGL_X11::initialize() {
*/
x11_window = XCreateWindow(x11_display, RootWindow(x11_display, vi->screen), 0, 0, OS::get_singleton()->get_video_mode().width, OS::get_singleton()->get_video_mode().height, 0, vi->depth, InputOutput, vi->visual, CWBorderPixel | CWColormap | CWEventMask, &swa);
ERR_FAIL_COND_V(!x11_window, ERR_UNCONFIGURED);
+ set_class_hint(x11_display, x11_window);
XMapWindow(x11_display, x11_window);
//};
diff --git a/platform/x11/context_gl_x11.h b/platform/x11/context_gl_x11.h
index acb3f38894..ba01b51d59 100644
--- a/platform/x11/context_gl_x11.h
+++ b/platform/x11/context_gl_x11.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/x11/detect.py b/platform/x11/detect.py
index 79778136ad..086681d4a4 100644
--- a/platform/x11/detect.py
+++ b/platform/x11/detect.py
@@ -74,7 +74,9 @@ def configure(env):
## Build type
if (env["target"] == "release"):
- env.Prepend(CCFLAGS=['-Ofast'])
+ # -O3 -ffast-math is identical to -Ofast. We need to split it out so we can selectively disable
+ # -ffast-math in code for which it generates wrong results.
+ env.Prepend(CCFLAGS=['-O3', '-ffast-math'])
if (env["debug_release"] == "yes"):
env.Prepend(CCFLAGS=['-g2'])
@@ -188,6 +190,11 @@ def configure(env):
if any(platform.machine() in s for s in list_of_x86):
env["x86_libtheora_opt_gcc"] = True
+ # On Linux wchar_t should be 32-bits
+ # 16-bit library shouldn't be required due to compiler optimisations
+ if (env['builtin_pcre2'] == 'no'):
+ env.ParseConfig('pkg-config libpcre2-32 --cflags --libs')
+
## Flags
if (os.system("pkg-config --exists alsa") == 0): # 0 means found
diff --git a/platform/x11/export/export.cpp b/platform/x11/export/export.cpp
index c8d6220aed..59b1a44247 100644
--- a/platform/x11/export/export.cpp
+++ b/platform/x11/export/export.cpp
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
@@ -28,6 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "export.h"
+
#include "editor/editor_export.h"
#include "platform/x11/logo.gen.h"
#include "scene/resources/texture.h"
@@ -51,23 +52,4 @@ void register_x11_exporter() {
platform->set_os_name("X11");
EditorExport::get_singleton()->add_export_platform(platform);
-
-#if 0
- Image img(_x11_logo);
- Ref<ImageTexture> logo = memnew( ImageTexture );
- logo->create_from_image(img);
-
- {
- Ref<EditorExportPlatformPC> exporter = Ref<EditorExportPlatformPC>( memnew(EditorExportPlatformPC) );
- exporter->set_binary_extension("");
- exporter->set_release_binary32("linux_x11_32_release");
- exporter->set_debug_binary32("linux_x11_32_debug");
- exporter->set_release_binary64("linux_x11_64_release");
- exporter->set_debug_binary64("linux_x11_64_debug");
- exporter->set_name("Linux X11");
- exporter->set_logo(logo);
- EditorImportExport::get_singleton()->add_export_platform(exporter);
- }
-
-#endif
}
diff --git a/platform/x11/export/export.h b/platform/x11/export/export.h
index 755b73d2c9..b70633266f 100644
--- a/platform/x11/export/export.h
+++ b/platform/x11/export/export.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/x11/godot_x11.cpp b/platform/x11/godot_x11.cpp
index 6f418b213f..2e43613e5d 100644
--- a/platform/x11/godot_x11.cpp
+++ b/platform/x11/godot_x11.cpp
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
@@ -45,8 +45,10 @@ int main(int argc, char *argv[]) {
getcwd(cwd, PATH_MAX);
Error err = Main::setup(argv[0], argc - 1, &argv[1]);
- if (err != OK)
+ if (err != OK) {
+ free(cwd);
return 255;
+ }
if (Main::start())
os.run(); // it is actually the OS that decides how to run
diff --git a/platform/x11/joypad_linux.cpp b/platform/x11/joypad_linux.cpp
index 2502b2d51f..3453297716 100644
--- a/platform/x11/joypad_linux.cpp
+++ b/platform/x11/joypad_linux.cpp
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/x11/joypad_linux.h b/platform/x11/joypad_linux.h
index a0ac559b1c..b34d98b77a 100644
--- a/platform/x11/joypad_linux.h
+++ b/platform/x11/joypad_linux.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
@@ -80,22 +80,22 @@ private:
static void joy_thread_func(void *p_user);
- int get_joy_from_path(String path) const;
+ int get_joy_from_path(String p_path) const;
void setup_joypad_properties(int p_id);
void close_joypad(int p_id = -1);
#ifdef UDEV_ENABLED
- void enumerate_joypads(struct udev *_udev);
- void monitor_joypads(struct udev *_udev);
+ void enumerate_joypads(struct udev *p_udev);
+ void monitor_joypads(struct udev *p_udev);
#endif
void monitor_joypads();
void run_joypad_thread();
- void open_joypad(const char *path);
+ void open_joypad(const char *p_path);
void joypad_vibration_start(int p_id, float p_weak_magnitude, float p_strong_magnitude, float p_duration, uint64_t p_timestamp);
void joypad_vibration_stop(int p_id, uint64_t p_timestamp);
- InputDefault::JoyAxis axis_correct(const input_absinfo *abs, int value) const;
+ InputDefault::JoyAxis axis_correct(const input_absinfo *p_abs, int p_value) const;
};
#endif
diff --git a/platform/x11/key_mapping_x11.cpp b/platform/x11/key_mapping_x11.cpp
index 32a9806b22..95ac2fe6b6 100644
--- a/platform/x11/key_mapping_x11.cpp
+++ b/platform/x11/key_mapping_x11.cpp
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/x11/key_mapping_x11.h b/platform/x11/key_mapping_x11.h
index 41060c9303..7b11cb5ccc 100644
--- a/platform/x11/key_mapping_x11.h
+++ b/platform/x11/key_mapping_x11.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp
index ade3a0a0c5..2d33d25773 100644
--- a/platform/x11/os_x11.cpp
+++ b/platform/x11/os_x11.cpp
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
@@ -116,24 +116,22 @@ void OS_X11::initialize(const VideoMode &p_desired, int p_video_driver, int p_au
/** XLIB INITIALIZATION **/
x11_display = XOpenDisplay(NULL);
+ char *modifiers = NULL;
Bool xkb_dar = False;
if (x11_display) {
XAutoRepeatOn(x11_display);
xkb_dar = XkbSetDetectableAutoRepeat(x11_display, True, NULL);
- }
-
- char *modifiers = NULL;
- // Try to support IME if detectable auto-repeat is supported
-
- if (xkb_dar == True) {
+ // Try to support IME if detectable auto-repeat is supported
+ if (xkb_dar == True) {
// Xutf8LookupString will be used later instead of XmbLookupString before
// the multibyte sequences can be converted to unicode string.
#ifdef X_HAVE_UTF8_STRING
- modifiers = XSetLocaleModifiers("");
+ modifiers = XSetLocaleModifiers("");
#endif
+ }
}
if (modifiers == NULL) {
@@ -141,8 +139,6 @@ void OS_X11::initialize(const VideoMode &p_desired, int p_video_driver, int p_au
WARN_PRINT("IME is disabled");
}
modifiers = XSetLocaleModifiers("@im=none");
- }
- if (modifiers == NULL) {
WARN_PRINT("Error setting locale modifiers");
}
@@ -191,8 +187,7 @@ void OS_X11::initialize(const VideoMode &p_desired, int p_video_driver, int p_au
::XIMStyles *xim_styles = NULL;
xim_style = 0L;
- char *imvalret = NULL;
- imvalret = XGetIMValues(xim, XNQueryInputStyle, &xim_styles, NULL);
+ char *imvalret = XGetIMValues(xim, XNQueryInputStyle, &xim_styles, NULL);
if (imvalret != NULL || xim_styles == NULL) {
fprintf(stderr, "Input method doesn't support any styles\n");
}
@@ -351,20 +346,9 @@ void OS_X11::initialize(const VideoMode &p_desired, int p_video_driver, int p_au
XChangeWindowAttributes(x11_display, x11_window, CWEventMask, &new_attr);
- XClassHint *classHint;
-
/* set the titlebar name */
XStoreName(x11_display, x11_window, "Godot");
- /* set the name and class hints for the window manager to use */
- classHint = XAllocClassHint();
- if (classHint) {
- classHint->res_name = (char *)"Godot_Engine";
- classHint->res_class = (char *)"Godot";
- }
- XSetClassHint(x11_display, x11_window, classHint);
- XFree(classHint);
-
wm_delete = XInternAtom(x11_display, "WM_DELETE_WINDOW", true);
XSetWMProtocols(x11_display, x11_window, &wm_delete, 1);
@@ -550,6 +534,8 @@ void OS_X11::finalize() {
physics_2d_server->finish();
memdelete(physics_2d_server);
+ memdelete(power_manager);
+
if (xrandr_handle)
dlclose(xrandr_handle);
@@ -773,6 +759,10 @@ void OS_X11::set_current_screen(int p_screen) {
}
Point2 OS_X11::get_screen_position(int p_screen) const {
+ if (p_screen == -1) {
+ p_screen = get_current_screen();
+ }
+
// Using Xinerama Extension
int event_base, error_base;
const Bool ext_okay = XineramaQueryExtension(x11_display, &event_base, &error_base);
@@ -794,6 +784,10 @@ Point2 OS_X11::get_screen_position(int p_screen) const {
}
Size2 OS_X11::get_screen_size(int p_screen) const {
+ if (p_screen == -1) {
+ p_screen = get_current_screen();
+ }
+
// Using Xinerama Extension
int event_base, error_base;
const Bool ext_okay = XineramaQueryExtension(x11_display, &event_base, &error_base);
@@ -809,6 +803,9 @@ Size2 OS_X11::get_screen_size(int p_screen) const {
}
int OS_X11::get_screen_dpi(int p_screen) const {
+ if (p_screen == -1) {
+ p_screen = get_current_screen();
+ }
//invalid screen?
ERR_FAIL_INDEX_V(p_screen, get_screen_count(), 0);
@@ -1604,8 +1601,7 @@ void OS_X11::process_xevents() {
Point2i pos(event.xmotion.x, event.xmotion.y);
if (mouse_mode == MOUSE_MODE_CAPTURED) {
-#if 1
- //Vector2 c = Point2i(current_videomode.width/2,current_videomode.height/2);
+
if (pos == Point2i(current_videomode.width / 2, current_videomode.height / 2)) {
//this sucks, it's a hack, etc and is a little inaccurate, etc.
//but nothing I can do, X11 sucks.
@@ -1618,17 +1614,6 @@ void OS_X11::process_xevents() {
pos = last_mouse_pos + (pos - center);
center = new_center;
do_mouse_warp = window_has_focus; // warp the cursor if we're focused in
-#else
- //Dear X11, thanks for making my life miserable
-
- center.x = current_videomode.width / 2;
- center.y = current_videomode.height / 2;
- pos = last_mouse_pos + (pos - center);
- if (pos == last_mouse_pos)
- break;
- XWarpPointer(x11_display, None, x11_window,
- 0, 0, 0, 0, (int)center.x, (int)center.y);
-#endif
}
if (!last_mouse_pos_valid) {
@@ -2151,8 +2136,7 @@ bool OS_X11::is_vsync_enabled() const {
void OS_X11::set_context(int p_context) {
- XClassHint *classHint = NULL;
- classHint = XAllocClassHint();
+ XClassHint *classHint = XAllocClassHint();
if (classHint) {
if (p_context == CONTEXT_EDITOR)
diff --git a/platform/x11/os_x11.h b/platform/x11/os_x11.h
index db70f8f84a..51240fa023 100644
--- a/platform/x11/os_x11.h
+++ b/platform/x11/os_x11.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
@@ -233,9 +233,9 @@ public:
virtual int get_screen_count() const;
virtual int get_current_screen() const;
virtual void set_current_screen(int p_screen);
- virtual Point2 get_screen_position(int p_screen = 0) const;
- virtual Size2 get_screen_size(int p_screen = 0) const;
- virtual int get_screen_dpi(int p_screen = 0) const;
+ virtual Point2 get_screen_position(int p_screen = -1) const;
+ virtual Size2 get_screen_size(int p_screen = -1) const;
+ virtual int get_screen_dpi(int p_screen = -1) const;
virtual Point2 get_window_position() const;
virtual void set_window_position(const Point2 &p_position);
virtual Size2 get_window_size() const;
diff --git a/platform/x11/platform_config.h b/platform/x11/platform_config.h
index 1a1de42b47..85af12372f 100644
--- a/platform/x11/platform_config.h
+++ b/platform/x11/platform_config.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/x11/power_x11.cpp b/platform/x11/power_x11.cpp
index 8e69a2223f..32100354a6 100644
--- a/platform/x11/power_x11.cpp
+++ b/platform/x11/power_x11.cpp
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
@@ -58,6 +58,7 @@ Adapted from corresponding SDL 2.0 code.
#include <stdio.h>
#include <unistd.h>
+#include "core/error_macros.h"
#include <dirent.h>
#include <fcntl.h>
#include <sys/stat.h>
@@ -254,9 +255,9 @@ bool PowerX11::GetPowerInfo_Linux_proc_acpi() {
this->power_state = POWERSTATE_UNKNOWN;
dirp->change_dir(proc_acpi_battery_path);
- dirp->list_dir_begin();
+ Error err = dirp->list_dir_begin();
- if (dirp == NULL) {
+ if (err != OK) {
return false; /* can't use this interface. */
} else {
node = dirp->get_next();
@@ -268,8 +269,8 @@ bool PowerX11::GetPowerInfo_Linux_proc_acpi() {
}
dirp->change_dir(proc_acpi_ac_adapter_path);
- dirp->list_dir_begin();
- if (dirp == NULL) {
+ err = dirp->list_dir_begin();
+ if (err != OK) {
return false; /* can't use this interface. */
} else {
node = dirp->get_next();
@@ -438,9 +439,9 @@ bool PowerX11::GetPowerInfo_Linux_sys_class_power_supply(/*PowerState *state, in
DirAccess *dirp = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
dirp->change_dir(base);
- dirp->list_dir_begin();
+ Error err = dirp->list_dir_begin();
- if (!dirp) {
+ if (err != OK) {
return false;
}
diff --git a/platform/x11/power_x11.h b/platform/x11/power_x11.h
index 64ed5fe26a..e34223036d 100644
--- a/platform/x11/power_x11.h
+++ b/platform/x11/power_x11.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */