diff options
Diffstat (limited to 'platform')
-rw-r--r-- | platform/android/java_glue.cpp | 8 | ||||
-rw-r--r-- | platform/android/os_android.cpp | 29 | ||||
-rw-r--r-- | platform/android/os_android.h | 2 | ||||
-rw-r--r-- | platform/haiku/context_gl_haiku.cpp | 12 | ||||
-rw-r--r-- | platform/haiku/context_gl_haiku.h | 5 | ||||
-rw-r--r-- | platform/haiku/detect.py | 6 | ||||
-rw-r--r-- | platform/windows/joystick.cpp | 2 | ||||
-rw-r--r-- | platform/x11/detect.py | 4 |
8 files changed, 55 insertions, 13 deletions
diff --git a/platform/android/java_glue.cpp b/platform/android/java_glue.cpp index 5fd2ab8910..3ea2ab1641 100644 --- a/platform/android/java_glue.cpp +++ b/platform/android/java_glue.cpp @@ -259,8 +259,7 @@ Variant _jobject_to_variant(JNIEnv * env, jobject obj) { for (int i=0; i<stringCount; i++) { jstring string = (jstring) env->GetObjectArrayElement(arr, i); - const char *rawString = env->GetStringUTFChars(string, 0); - sarr.push_back(String(rawString)); + sarr.push_back(String::utf8(env->GetStringUTFChars(string, NULL))); env->DeleteLocalRef(string); } @@ -506,7 +505,7 @@ public: } break; case Variant::BOOL: { - ret = env->CallBooleanMethodA(instance,E->get().method,v); + ret = env->CallBooleanMethodA(instance,E->get().method,v)==JNI_TRUE; //print_line("call bool"); } break; case Variant::INT: { @@ -521,8 +520,7 @@ public: case Variant::STRING: { jobject o = env->CallObjectMethodA(instance,E->get().method,v); - String str = env->GetStringUTFChars((jstring)o, NULL ); - ret=str; + ret = String::utf8(env->GetStringUTFChars((jstring)o, NULL)); env->DeleteLocalRef(o); } break; case Variant::STRING_ARRAY: { diff --git a/platform/android/os_android.cpp b/platform/android/os_android.cpp index 4e6dfb2db2..13cdf2a020 100644 --- a/platform/android/os_android.cpp +++ b/platform/android/os_android.cpp @@ -708,8 +708,33 @@ void OS_Android::set_need_reload_hooks(bool p_needs_them) { String OS_Android::get_data_dir() const { - if (get_data_dir_func) - return get_data_dir_func(); + if (data_dir_cache!=String()) + return data_dir_cache; + + if (get_data_dir_func) { + String data_dir=get_data_dir_func(); + + //store current dir + char real_current_dir_name[2048]; + getcwd(real_current_dir_name,2048); + + //go to data dir + chdir(data_dir.utf8().get_data()); + + //get actual data dir, so we resolve potential symlink (Android 6.0+ seems to use symlink) + char data_current_dir_name[2048]; + getcwd(data_current_dir_name,2048); + + //cache by parsing utf8 + data_dir_cache.parse_utf8(data_current_dir_name); + + //restore original dir so we don't mess things up + chdir(real_current_dir_name); + + return data_dir_cache; + } + + return "."; //return Globals::get_singleton()->get_singleton_object("GodotOS")->call("get_data_dir"); }; diff --git a/platform/android/os_android.h b/platform/android/os_android.h index 843b3c4788..e82e08ea49 100644 --- a/platform/android/os_android.h +++ b/platform/android/os_android.h @@ -123,6 +123,8 @@ private: PhysicsServer *physics_server; Physics2DServer *physics_2d_server; + mutable String data_dir_cache; + #if 0 AudioDriverAndroid audio_driver_android; #else diff --git a/platform/haiku/context_gl_haiku.cpp b/platform/haiku/context_gl_haiku.cpp index 2fedd1532a..bf890d14bf 100644 --- a/platform/haiku/context_gl_haiku.cpp +++ b/platform/haiku/context_gl_haiku.cpp @@ -35,6 +35,8 @@ ContextGL_Haiku::ContextGL_Haiku(HaikuDirectWindow* p_window) { uint32 type = BGL_RGB | BGL_DOUBLE | BGL_DEPTH; view = new HaikuGLView(window->Bounds(), type); + + use_vsync = false; } ContextGL_Haiku::~ContextGL_Haiku() { @@ -57,7 +59,7 @@ void ContextGL_Haiku::make_current() { } void ContextGL_Haiku::swap_buffers() { - view->SwapBuffers(); + view->SwapBuffers(use_vsync); } int ContextGL_Haiku::get_window_width() { @@ -68,4 +70,12 @@ int ContextGL_Haiku::get_window_height() { return window->Bounds().IntegerHeight(); } +void ContextGL_Haiku::set_use_vsync(bool p_use) { + use_vsync = p_use; +} + +bool ContextGL_Haiku::is_using_vsync() const { + return use_vsync; +} + #endif diff --git a/platform/haiku/context_gl_haiku.h b/platform/haiku/context_gl_haiku.h index 91aae6b382..c7f80543aa 100644 --- a/platform/haiku/context_gl_haiku.h +++ b/platform/haiku/context_gl_haiku.h @@ -40,6 +40,8 @@ class ContextGL_Haiku : public ContextGL { private: HaikuGLView* view; HaikuDirectWindow* window; + + bool use_vsync; public: ContextGL_Haiku(HaikuDirectWindow* p_window); @@ -51,6 +53,9 @@ public: virtual void swap_buffers(); virtual int get_window_width(); virtual int get_window_height(); + + virtual void set_use_vsync(bool p_use); + virtual bool is_using_vsync() const; }; #endif diff --git a/platform/haiku/detect.py b/platform/haiku/detect.py index 6d1a96a8da..f36b0c567e 100644 --- a/platform/haiku/detect.py +++ b/platform/haiku/detect.py @@ -24,7 +24,7 @@ def get_opts(): def get_flags(): return [ ('builtin_zlib', 'no'), - #('glew', 'yes'), # TODO: investigate the GLEW situation on Haiku + ('glew', 'yes'), ] def configure(env): @@ -38,8 +38,8 @@ def configure(env): env.Append(CPPPATH = ['#platform/haiku']) - env["CC"] = "gcc" - env["CXX"] = "g++" + env["CC"] = "gcc-x86" + env["CXX"] = "g++-x86" if (env["target"]=="release"): if (env["debug_release"]=="yes"): diff --git a/platform/windows/joystick.cpp b/platform/windows/joystick.cpp index 663bbe3b9b..e69bfe6a52 100644 --- a/platform/windows/joystick.cpp +++ b/platform/windows/joystick.cpp @@ -283,7 +283,7 @@ void joystick_windows::close_joystick(int id) { d_joysticks[id].attached = false; attached_joysticks[d_joysticks[id].id] = false; d_joysticks[id].guid.Data1 = d_joysticks[id].guid.Data2 = d_joysticks[id].guid.Data3 = 0; - input->joy_connection_changed(id, false, ""); + input->joy_connection_changed(d_joysticks[id].id, false, ""); joystick_count--; } diff --git a/platform/x11/detect.py b/platform/x11/detect.py index 5f272536ba..54940866b2 100644 --- a/platform/x11/detect.py +++ b/platform/x11/detect.py @@ -209,5 +209,7 @@ def configure(env): if (env["use_static_cpp"]=="yes"): env.Append(LINKFLAGS=['-static-libstdc++']) - env["x86_opt_gcc"]=True + list_of_x86 = ['x86_64', 'x86', 'i386', 'i586'] + if any(platform.machine() in s for s in list_of_x86): + env["x86_opt_gcc"]=True |