From 31ce3c5fd0300aac1e86bced1efc5f9ec94bdb6b Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Thu, 13 Mar 2014 22:57:24 -0300 Subject: -fix bug in cache for atlas import/export -fix some menus -fixed bug in out transition curves -detect and remove file:/// in collada -remove multiscript for now -remove dependencies on mouse in OS, moved to Input -avoid fscache from screwing up (fix might make it slower, but it works) -funcref was missing, it's there now --- platform/android/java_glue.cpp | 43 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) (limited to 'platform/android/java_glue.cpp') diff --git a/platform/android/java_glue.cpp b/platform/android/java_glue.cpp index cbe17f2f7..dbd9f2bf0 100644 --- a/platform/android/java_glue.cpp +++ b/platform/android/java_glue.cpp @@ -568,6 +568,11 @@ static jmethodID _hideKeyboard=0; static jmethodID _setScreenOrientation=0; static jmethodID _getUniqueID=0; +static jmethodID _playVideo=0; +static jmethodID _isVideoPlaying=0; +static jmethodID _pauseVideo=0; +static jmethodID _stopVideo=0; + static void _gfx_init_func(void* ud, bool gl2) { @@ -628,6 +633,31 @@ static void _hide_vk() { env->CallVoidMethod(godot_io, _hideKeyboard); }; +// virtual Error native_video_play(String p_path); +// virtual bool native_video_is_playing(); +// virtual void native_video_pause(); +// virtual void native_video_stop(); + +static void _play_video(const String& p_path) { + +} + +static bool _is_video_playing() { + JNIEnv* env = ThreadAndroid::get_env(); + return env->CallBooleanMethod(godot_io, _isVideoPlaying); + //return false; +} + +static void _pause_video() { + JNIEnv* env = ThreadAndroid::get_env(); + env->CallVoidMethod(godot_io, _pauseVideo); +} + +static void _stop_video() { + JNIEnv* env = ThreadAndroid::get_env(); + env->CallVoidMethod(godot_io, _stopVideo); +} + JNIEXPORT void JNICALL Java_com_android_godot_GodotLib_initialize(JNIEnv * env, jobject obj, jobject activity,jboolean p_need_reload_hook) { __android_log_print(ANDROID_LOG_INFO,"godot","**INIT EVENT! - %p\n",env); @@ -675,6 +705,11 @@ JNIEXPORT void JNICALL Java_com_android_godot_GodotLib_initialize(JNIEnv * env, _showKeyboard = env->GetMethodID(c,"showKeyboard","(Ljava/lang/String;)V"); _hideKeyboard = env->GetMethodID(c,"hideKeyboard","()V"); _setScreenOrientation = env->GetMethodID(c,"setScreenOrientation","(I)V"); + + _playVideo = env->GetMethodID(c,"playVideo","(Ljava/lang/String;)V"); + _isVideoPlaying = env->GetMethodID(c,"isVideoPlaying","()Z"); + _pauseVideo = env->GetMethodID(c,"pauseVideo","()V"); + _stopVideo = env->GetMethodID(c,"stopVideo","()V"); } ThreadAndroid::make_default(jvm); @@ -685,7 +720,7 @@ JNIEXPORT void JNICALL Java_com_android_godot_GodotLib_initialize(JNIEnv * env, - os_android = new OS_Android(_gfx_init_func,env,_open_uri,_get_data_dir,_get_locale, _get_model,_show_vk, _hide_vk,_set_screen_orient,_get_unique_id); + os_android = new OS_Android(_gfx_init_func,env,_open_uri,_get_data_dir,_get_locale, _get_model,_show_vk, _hide_vk,_set_screen_orient,_get_unique_id, _play_video, _is_video_playing, _pause_video, _stop_video); os_android->set_need_reload_hooks(p_need_reload_hook); char wd[500]; @@ -803,6 +838,12 @@ static void _initialize_java_modules() { __android_log_print(ANDROID_LOG_INFO,"godot","****^*^*?^*^*class data %x",singletonClass); jmethodID initialize = env->GetStaticMethodID(singletonClass, "initialize", "(Landroid/app/Activity;)Lcom/android/godot/Godot$SingletonBase;"); + if (!initialize) { + + ERR_EXPLAIN("Couldn't find proper initialize function 'public static Godot.SingletonBase Class::initialize(Activity p_activity)' initializer for singleton class: "+m); + ERR_CONTINUE(!initialize); + + } jobject obj = env->CallStaticObjectMethod(singletonClass,initialize,_godot_instance); __android_log_print(ANDROID_LOG_INFO,"godot","****^*^*?^*^*class instance %x",obj); jobject gob = env->NewGlobalRef(obj); -- cgit v1.2.3-70-g09d2 From 9f33134c93ecbadda70e8eefc50563e29b2eb7f2 Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Sat, 5 Apr 2014 12:39:30 -0300 Subject: -Support for changing fonts -Detect when free() might crash the project and throw error -fixed 2D Bounce in physics (3d still broken) -renamed “on_top” property to “behind_parent”, which makes more sense, old on_top remains there for compatibility but is invisible. -large amount of fixes --- core/bind/core_bind.cpp | 7 + core/bind/core_bind.h | 2 + core/io/resource_format_binary.cpp | 1 + core/message_queue.cpp | 3 +- core/object.cpp | 54 +++++- core/object.h | 8 +- core/os/os.cpp | 5 + core/os/os.h | 1 + demos/2d/platformer/player.xml | 176 +++++++++--------- demos/2d/platformer/stage.xml | 42 ++--- drivers/unix/os_unix.cpp | 6 + drivers/unix/os_unix.h | 1 + modules/SCsub | 1 - modules/gdscript/gd_functions.cpp | 2 +- modules/gdscript/gd_script.cpp | 13 ++ platform/android/AndroidManifest.xml.template | 2 +- platform/android/java/ant.properties | 5 - .../android/java/src/com/android/godot/Godot.java | 3 +- .../java/src/com/android/godot/GodotPaymentV3.java | 83 +++++++++ .../com/android/godot/payments/ConsumeTask.java | 71 +++++++ .../android/godot/payments/HandlePurchaseTask.java | 79 ++++++++ .../com/android/godot/payments/PaymentsCache.java | 42 +++++ .../android/godot/payments/PaymentsManager.java | 151 +++++++++++++++ .../com/android/godot/payments/PurchaseTask.java | 121 ++++++++++++ .../com/android/godot/payments/ValidateTask.java | 97 ++++++++++ .../java/src/com/android/godot/utils/Crypt.java | 39 ++++ .../godot/utils/CustomSSLSocketFactory.java | 54 ++++++ .../src/com/android/godot/utils/HttpRequester.java | 206 +++++++++++++++++++++ .../src/com/android/godot/utils/RequestParams.java | 58 ++++++ .../vending/billing/IInAppBillingService.aidl | 144 ++++++++++++++ platform/android/java_glue.cpp | 9 +- platform/iphone/app_delegate.mm | 11 +- platform/iphone/detect.py | 1 - platform/iphone/gl_view.mm | 25 +-- platform/iphone/in_app_store.mm | 25 +++ platform/isim/detect.py | 1 - scene/2d/canvas_item.cpp | 25 ++- scene/2d/canvas_item.h | 9 +- scene/gui/control.cpp | 2 + scene/main/node.h | 2 + servers/physics_2d/body_pair_2d_sw.cpp | 15 +- servers/physics_2d/body_pair_2d_sw.h | 2 + tools/editor/code_editor.cpp | 18 +- tools/editor/code_editor.h | 4 +- tools/editor/editor_node.cpp | 8 + tools/editor/editor_settings.cpp | 10 +- tools/editor/property_editor.cpp | 9 +- 47 files changed, 1492 insertions(+), 161 deletions(-) create mode 100644 platform/android/java/src/com/android/godot/GodotPaymentV3.java create mode 100644 platform/android/java/src/com/android/godot/payments/ConsumeTask.java create mode 100644 platform/android/java/src/com/android/godot/payments/HandlePurchaseTask.java create mode 100644 platform/android/java/src/com/android/godot/payments/PaymentsCache.java create mode 100644 platform/android/java/src/com/android/godot/payments/PaymentsManager.java create mode 100644 platform/android/java/src/com/android/godot/payments/PurchaseTask.java create mode 100644 platform/android/java/src/com/android/godot/payments/ValidateTask.java create mode 100644 platform/android/java/src/com/android/godot/utils/Crypt.java create mode 100644 platform/android/java/src/com/android/godot/utils/CustomSSLSocketFactory.java create mode 100644 platform/android/java/src/com/android/godot/utils/HttpRequester.java create mode 100644 platform/android/java/src/com/android/godot/utils/RequestParams.java create mode 100644 platform/android/java/src/com/android/vending/billing/IInAppBillingService.aidl (limited to 'platform/android/java_glue.cpp') diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp index 1b4ca8151..e3360a23d 100644 --- a/core/bind/core_bind.cpp +++ b/core/bind/core_bind.cpp @@ -246,6 +246,12 @@ Error _OS::kill(int p_pid) { return OS::get_singleton()->kill(p_pid); } +int _OS::get_process_ID() const { + + return OS::get_singleton()->get_process_ID(); +}; + + bool _OS::has_environment(const String& p_var) const { return OS::get_singleton()->has_environment(p_var); @@ -561,6 +567,7 @@ void _OS::_bind_methods() { ObjectTypeDB::bind_method(_MD("execute","path","arguments","blocking"),&_OS::execute); ObjectTypeDB::bind_method(_MD("kill","pid"),&_OS::kill); ObjectTypeDB::bind_method(_MD("shell_open","uri"),&_OS::shell_open); + ObjectTypeDB::bind_method(_MD("get_process_ID"),&_OS::get_process_ID); ObjectTypeDB::bind_method(_MD("get_environment","environment"),&_OS::get_environment); ObjectTypeDB::bind_method(_MD("has_environment","environment"),&_OS::has_environment); diff --git a/core/bind/core_bind.h b/core/bind/core_bind.h index 3d03247c0..008472654 100644 --- a/core/bind/core_bind.h +++ b/core/bind/core_bind.h @@ -117,6 +117,8 @@ public: Error kill(int p_pid); Error shell_open(String p_uri); + int get_process_ID() const; + bool has_environment(const String& p_var) const; String get_environment(const String& p_var) const; diff --git a/core/io/resource_format_binary.cpp b/core/io/resource_format_binary.cpp index 47f278596..33f4cafed 100644 --- a/core/io/resource_format_binary.cpp +++ b/core/io/resource_format_binary.cpp @@ -949,6 +949,7 @@ String ResourceInteractiveLoaderBinary::recognize(FileAccess *p_f) { } else if (header[0]!='R' || header[1]!='S' || header[2]!='R' || header[3]!='C') { //not normal + error=ERR_FILE_UNRECOGNIZED; return ""; } diff --git a/core/message_queue.cpp b/core/message_queue.cpp index a9c49fbef..dbf6217dc 100644 --- a/core/message_queue.cpp +++ b/core/message_queue.cpp @@ -378,11 +378,12 @@ void MessageQueue::flush() { } } - message->~Message(); read_pos+=sizeof(Message); if (message->type!=TYPE_NOTIFICATION) read_pos+=sizeof(Variant)*message->args; + message->~Message(); + _THREAD_SAFE_UNLOCK_ } diff --git a/core/object.cpp b/core/object.cpp index 692010b1b..b40f4ec15 100644 --- a/core/object.cpp +++ b/core/object.cpp @@ -33,6 +33,30 @@ #include "message_queue.h" #include "core_string_names.h" #include "translation.h" + +#ifdef DEBUG_ENABLED + +struct _ObjectDebugLock { + + Object *obj; + + _ObjectDebugLock(Object *p_obj) { + obj=p_obj; + obj->_lock_index.ref(); + } + ~_ObjectDebugLock() { + obj->_lock_index.unref(); + } +}; + +#define OBJ_DEBUG_LOCK _ObjectDebugLock _debug_lock(this); + +#else + +#define OBJ_DEBUG_LOCK + +#endif + Array convert_property_list(const List * p_list) { Array va; @@ -562,13 +586,22 @@ void Object::call_multilevel(const StringName& p_method,const Variant** p_args,i ERR_FAIL(); return; } + + + if (_lock_index.get()>1) { + ERR_EXPLAIN("Object is locked and can't be freed."); + ERR_FAIL(); + return; + } #endif + //must be here, must be before everything, memdelete(this); return; } //Variant ret; + OBJ_DEBUG_LOCK Variant::CallError error; @@ -594,6 +627,7 @@ void Object::call_multilevel_reversed(const StringName& p_method,const Variant** MethodBind *method=ObjectTypeDB::get_method(get_type_name(),p_method); Variant::CallError error; + OBJ_DEBUG_LOCK if (method) { @@ -813,6 +847,15 @@ Variant Object::call(const StringName& p_method,const Variant** p_args,int p_arg ERR_EXPLAIN("Can't 'free' a reference."); ERR_FAIL_V(Variant()); } + + if (_lock_index.get()>1) { + r_error.argument=0; + r_error.error=Variant::CallError::CALL_ERROR_INVALID_METHOD; + ERR_EXPLAIN("Object is locked and can't be freed."); + ERR_FAIL_V(Variant()); + + } + #endif //must be here, must be before everything, memdelete(this); @@ -821,7 +864,7 @@ Variant Object::call(const StringName& p_method,const Variant** p_args,int p_arg } Variant ret; - + OBJ_DEBUG_LOCK if (script_instance) { ret = script_instance->call(p_method,p_args,p_argcount,r_error); //force jumptable @@ -902,7 +945,7 @@ void Object::set_script(const RefPtr& p_script) { Ref