summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
Diffstat (limited to 'platform')
-rw-r--r--platform/android/AndroidManifest.xml.template3
-rw-r--r--platform/android/SCsub2
-rw-r--r--platform/android/audio_driver_opensl.cpp8
-rw-r--r--platform/android/java_glue.cpp113
-rw-r--r--platform/android/os_android.cpp2
-rw-r--r--platform/bb10/SCsub10
-rw-r--r--platform/bb10/bar/bar-descriptor.xml30
-rw-r--r--platform/bb10/detect.py2
-rw-r--r--platform/bb10/export/export.cpp79
-rw-r--r--platform/bb10/os_bb10.cpp2
-rwxr-xr-xplatform/iphone/gl_view.h2
-rwxr-xr-xplatform/iphone/gl_view.mm52
-rw-r--r--platform/windows/detect.py4
-rw-r--r--platform/windows/os_windows.cpp11
14 files changed, 209 insertions, 111 deletions
diff --git a/platform/android/AndroidManifest.xml.template b/platform/android/AndroidManifest.xml.template
index 60861db603..d31bdbfa53 100644
--- a/platform/android/AndroidManifest.xml.template
+++ b/platform/android/AndroidManifest.xml.template
@@ -10,7 +10,7 @@
android:largeScreens="true"
android:xlargeScreens="true"/>
- <application android:label="@string/godot_project_name_string" android:icon="@drawable/icon" android:allowBackup="false">
+ <application android:label="@string/godot_project_name_string" android:icon="@drawable/icon" android:allowBackup="false" $$ADD_APPATTRIBUTE_CHUNKS$$ >
<activity android:name="com.android.godot.Godot"
android:label="@string/godot_project_name_string"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
@@ -33,6 +33,7 @@ $$ADD_APPLICATION_CHUNKS$$
</application>
<uses-feature android:glEsVersion="0x00020000"/>
+$$ADD_PERMISSION_CHUNKS$$
<uses-permission android:name="godot.ACCESS_CHECKIN_PROPERTIES"/>
<uses-permission android:name="godot.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="godot.ACCESS_FINE_LOCATION"/>
diff --git a/platform/android/SCsub b/platform/android/SCsub
index cffec5ae95..6feeb8b365 100644
--- a/platform/android/SCsub
+++ b/platform/android/SCsub
@@ -56,6 +56,8 @@ pp_basein = open(abspath+"/AndroidManifest.xml.template","rb")
pp_baseout = open(abspath+"/java/AndroidManifest.xml","wb")
manifest = pp_basein.read()
manifest = manifest.replace("$$ADD_APPLICATION_CHUNKS$$",env.android_manifest_chunk)
+manifest = manifest.replace("$$ADD_PERMISSION_CHUNKS$$",env.android_permission_chunk)
+manifest = manifest.replace("$$ADD_APPATTRIBUTE_CHUNKS$$",env.android_appattributes_chunk)
pp_baseout.write( manifest )
diff --git a/platform/android/audio_driver_opensl.cpp b/platform/android/audio_driver_opensl.cpp
index 857d1a4a54..4c0c095e10 100644
--- a/platform/android/audio_driver_opensl.cpp
+++ b/platform/android/audio_driver_opensl.cpp
@@ -396,6 +396,14 @@ void AudioDriverOpenSL::finish(){
void AudioDriverOpenSL::set_pause(bool p_pause) {
pause=p_pause;
+
+ if (active) {
+ if (pause) {
+ (*playItf)->SetPlayState(playItf, SL_PLAYSTATE_PAUSED);
+ } else {
+ (*playItf)->SetPlayState(playItf, SL_PLAYSTATE_PLAYING);
+ }
+ }
}
diff --git a/platform/android/java_glue.cpp b/platform/android/java_glue.cpp
index 0312d13644..349db08e36 100644
--- a/platform/android/java_glue.cpp
+++ b/platform/android/java_glue.cpp
@@ -45,9 +45,18 @@ static JavaClassWrapper *java_class_wrapper=NULL;
static OS_Android *os_android=NULL;
-jvalue _variant_to_jvalue(JNIEnv *env, Variant::Type p_type, const Variant* p_arg, bool force_jobject = false) {
+struct jvalret {
- jvalue v;
+ jobject obj;
+ jvalue val;
+ jvalret() { obj=NULL; }
+
+
+};
+
+jvalret _variant_to_jvalue(JNIEnv *env, Variant::Type p_type, const Variant* p_arg, bool force_jobject = false) {
+
+ jvalret v;
switch(p_type) {
@@ -59,9 +68,12 @@ jvalue _variant_to_jvalue(JNIEnv *env, Variant::Type p_type, const Variant* p_ar
jvalue val;
val.z = (bool)(*p_arg);
jobject obj = env->NewObjectA(bclass, ctor, &val);
- v.l = obj;
+ v.val.l = obj;
+ v.obj=obj;
+ env->DeleteLocalRef(bclass);
} else {
- v.z=*p_arg;
+ v.val.z=*p_arg;
+
};
} break;
case Variant::INT: {
@@ -73,10 +85,13 @@ jvalue _variant_to_jvalue(JNIEnv *env, Variant::Type p_type, const Variant* p_ar
jvalue val;
val.i = (int)(*p_arg);
jobject obj = env->NewObjectA(bclass, ctor, &val);
- v.l = obj;
+ v.val.l = obj;
+ v.obj=obj;
+ env->DeleteLocalRef(bclass);
} else {
- v.i=*p_arg;
+ v.val.i=*p_arg;
+
};
} break;
case Variant::REAL: {
@@ -88,17 +103,20 @@ jvalue _variant_to_jvalue(JNIEnv *env, Variant::Type p_type, const Variant* p_ar
jvalue val;
val.d = (double)(*p_arg);
jobject obj = env->NewObjectA(bclass, ctor, &val);
- v.l = obj;
+ v.val.l = obj;
+ v.obj=obj;
+ env->DeleteLocalRef(bclass);
} else {
- v.f=*p_arg;
+ v.val.f=*p_arg;
};
} break;
case Variant::STRING: {
String s = *p_arg;
jstring jStr = env->NewStringUTF(s.utf8().get_data());
- v.l=jStr;
+ v.val.l=jStr;
+ v.obj=jStr;
} break;
case Variant::STRING_ARRAY: {
@@ -107,9 +125,12 @@ jvalue _variant_to_jvalue(JNIEnv *env, Variant::Type p_type, const Variant* p_ar
for(int j=0;j<sarray.size();j++) {
- env->SetObjectArrayElement(arr,j,env->NewStringUTF( sarray[j].utf8().get_data() ));
+ jstring str = env->NewStringUTF( sarray[j].utf8().get_data() );
+ env->SetObjectArrayElement(arr,j,str);
+ env->DeleteLocalRef(str);
}
- v.l=arr;
+ v.val.l=arr;
+ v.obj=arr;
} break;
@@ -124,27 +145,36 @@ jvalue _variant_to_jvalue(JNIEnv *env, Variant::Type p_type, const Variant* p_ar
jobjectArray jkeys = env->NewObjectArray(keys.size(), env->FindClass("java/lang/String"), env->NewStringUTF(""));
for (int j=0; j<keys.size(); j++) {
- env->SetObjectArrayElement(jkeys, j, env->NewStringUTF(String(keys[j]).utf8().get_data()));
+ jstring str = env->NewStringUTF(String(keys[j]).utf8().get_data());
+ env->SetObjectArrayElement(jkeys, j, str);
+ env->DeleteLocalRef(str);
};
jmethodID set_keys = env->GetMethodID(dclass, "set_keys", "([Ljava/lang/String;)V");
jvalue val;
val.l = jkeys;
env->CallVoidMethodA(jdict, set_keys, &val);
+ env->DeleteLocalRef(jkeys);
jobjectArray jvalues = env->NewObjectArray(keys.size(), env->FindClass("java/lang/Object"), NULL);
for (int j=0; j<keys.size(); j++) {
Variant var = dict[keys[j]];
- val = _variant_to_jvalue(env, var.get_type(), &var, true);
- env->SetObjectArrayElement(jvalues, j, val.l);
+ jvalret v = _variant_to_jvalue(env, var.get_type(), &var, true);
+ env->SetObjectArrayElement(jvalues, j, v.val.l);
+ if (v.obj) {
+ env->DeleteLocalRef(v.obj);
+ }
};
jmethodID set_values = env->GetMethodID(dclass, "set_values", "([Ljava/lang/Object;)V");
val.l = jvalues;
env->CallVoidMethodA(jdict, set_values, &val);
+ env->DeleteLocalRef(jvalues);
+ env->DeleteLocalRef(dclass);
- v.l = jdict;
+ v.val.l = jdict;
+ v.obj=jdict;
} break;
case Variant::INT_ARRAY: {
@@ -153,7 +183,8 @@ jvalue _variant_to_jvalue(JNIEnv *env, Variant::Type p_type, const Variant* p_ar
jintArray arr = env->NewIntArray(array.size());
DVector<int>::Read r = array.read();
env->SetIntArrayRegion(arr,0,array.size(),r.ptr());
- v.l=arr;
+ v.val.l=arr;
+ v.obj=arr;
} break;
case Variant::RAW_ARRAY: {
@@ -161,7 +192,8 @@ jvalue _variant_to_jvalue(JNIEnv *env, Variant::Type p_type, const Variant* p_ar
jbyteArray arr = env->NewByteArray(array.size());
DVector<uint8_t>::Read r = array.read();
env->SetByteArrayRegion(arr,0,array.size(),reinterpret_cast<const signed char*>(r.ptr()));
- v.l=arr;
+ v.val.l=arr;
+ v.obj=arr;
} break;
case Variant::REAL_ARRAY: {
@@ -170,12 +202,13 @@ jvalue _variant_to_jvalue(JNIEnv *env, Variant::Type p_type, const Variant* p_ar
jfloatArray arr = env->NewFloatArray(array.size());
DVector<float>::Read r = array.read();
env->SetFloatArrayRegion(arr,0,array.size(),r.ptr());
- v.l=arr;
+ v.val.l=arr;
+ v.obj=arr;
} break;
default: {
- v.i = 0;
+ v.val.i = 0;
} break;
}
@@ -193,8 +226,11 @@ String _get_class_name(JNIEnv * env, jclass cls, bool* array) {
jboolean isarr = env->CallBooleanMethod(cls, isArray);
(*array) = isarr ? true : false;
}
+ String name = env->GetStringUTFChars( clsName, NULL );
+ env->DeleteLocalRef(clsName);
+
+ return name;
- return env->GetStringUTFChars( clsName, NULL );
};
@@ -223,6 +259,8 @@ Variant _jobject_to_variant(JNIEnv * env, jobject obj) {
jstring string = (jstring) env->GetObjectArrayElement(arr, i);
const char *rawString = env->GetStringUTFChars(string, 0);
sarr.push_back(String(rawString));
+ env->DeleteLocalRef(string);
+
}
return sarr;
@@ -321,30 +359,34 @@ Variant _jobject_to_variant(JNIEnv * env, jobject obj) {
jobjectArray arr = (jobjectArray)obj;
int objCount = env->GetArrayLength(arr);
- Array varr;
+ Array varr(true);
for (int i=0; i<objCount; i++) {
jobject jobj = env->GetObjectArrayElement(arr, i);
Variant v = _jobject_to_variant(env, jobj);
varr.push_back(v);
+ env->DeleteLocalRef(jobj);
+
}
return varr;
};
- if (name == "com.android.godot.Dictionary") {
+ if (name == "java.util.HashMap" || name == "com.android.godot.Dictionary") {
- Dictionary ret;
+ Dictionary ret(true);
jclass oclass = c;
jmethodID get_keys = env->GetMethodID(oclass, "get_keys", "()[Ljava/lang/String;");
jobjectArray arr = (jobjectArray)env->CallObjectMethod(obj, get_keys);
StringArray keys = _jobject_to_variant(env, arr);
+ env->DeleteLocalRef(arr);
jmethodID get_values = env->GetMethodID(oclass, "get_values", "()[Ljava/lang/Object;");
arr = (jobjectArray)env->CallObjectMethod(obj, get_values);
Array vals = _jobject_to_variant(env, arr);
+ env->DeleteLocalRef(arr);
//print_line("adding " + String::num(keys.size()) + " to Dictionary!");
for (int i=0; i<keys.size(); i++) {
@@ -352,9 +394,12 @@ Variant _jobject_to_variant(JNIEnv * env, jobject obj) {
ret[keys[i]] = vals[i];
};
+
return ret;
};
+ env->DeleteLocalRef(c);
+
return Variant();
};
@@ -432,9 +477,13 @@ public:
JNIEnv *env = ThreadAndroid::get_env();
//print_line("argcount "+String::num(p_argcount));
+ List<jobject> to_erase;
for(int i=0;i<p_argcount;i++) {
- v[i] = _variant_to_jvalue(env, E->get().argtypes[i], p_args[i]);
+ jvalret vr = _variant_to_jvalue(env, E->get().argtypes[i], p_args[i]);
+ v[i] = vr.val;
+ if (vr.obj)
+ to_erase.push_back(vr.obj);
}
//print_line("calling method!!");
@@ -468,6 +517,7 @@ public:
jobject o = env->CallObjectMethodA(instance,E->get().method,v);
String str = env->GetStringUTFChars((jstring)o, NULL );
ret=str;
+ env->DeleteLocalRef(o);
} break;
case Variant::STRING_ARRAY: {
@@ -475,6 +525,7 @@ public:
ret = _jobject_to_variant(env, arr);
+ env->DeleteLocalRef(arr);
} break;
case Variant::INT_ARRAY: {
@@ -488,6 +539,7 @@ public:
env->GetIntArrayRegion(arr,0,fCount,w.ptr());
w = DVector<int>::Write();
ret=sarr;
+ env->DeleteLocalRef(arr);
} break;
case Variant::REAL_ARRAY: {
@@ -501,6 +553,7 @@ public:
env->GetFloatArrayRegion(arr,0,fCount,w.ptr());
w = DVector<float>::Write();
ret=sarr;
+ env->DeleteLocalRef(arr);
} break;
case Variant::DICTIONARY: {
@@ -508,6 +561,7 @@ public:
//print_line("call dictionary");
jobject obj = env->CallObjectMethodA(instance, E->get().method, v);
ret = _jobject_to_variant(env, obj);
+ env->DeleteLocalRef(obj);
} break;
default: {
@@ -518,6 +572,10 @@ public:
} break;
}
+ while (to_erase.size()) {
+ env->DeleteLocalRef(to_erase.front()->get());
+ to_erase.pop_front();
+ }
//print_line("success");
return ret;
@@ -872,6 +930,7 @@ static void _initialize_java_modules() {
String modules = Globals::get_singleton()->get("android/modules");
Vector<String> mods = modules.split(",",false);
+ print_line("ANDROID MODULES : " + modules);
__android_log_print(ANDROID_LOG_INFO,"godot","mod count: %i",mods.size());
if (mods.size()) {
@@ -1571,6 +1630,8 @@ JNIEXPORT void JNICALL Java_com_android_godot_GodotLib_callobject(JNIEnv * env,
memnew_placement(&vlist[i], Variant);
vlist[i] = v;
vptr[i] = &vlist[i];
+ env->DeleteLocalRef(obj);
+
};
Variant::CallError err;
@@ -1588,13 +1649,15 @@ JNIEXPORT void JNICALL Java_com_android_godot_GodotLib_calldeferred(JNIEnv * env
int count = env->GetArrayLength(params);
Variant args[VARIANT_ARG_MAX];
-// print_line("Java->GD call: "+obj->get_type()+"::"+str_method+" argc "+itos(count));
+ //print_line("Java->GD call: "+obj->get_type()+"::"+str_method+" argc "+itos(count));
for (int i=0; i<MIN(count,VARIANT_ARG_MAX); i++) {
jobject obj = env->GetObjectArrayElement(params, i);
if (obj)
args[i] = _jobject_to_variant(env, obj);
+ env->DeleteLocalRef(obj);
+
// print_line("\targ"+itos(i)+": "+Variant::get_type_name(args[i].get_type()));
};
diff --git a/platform/android/os_android.cpp b/platform/android/os_android.cpp
index 6f1c03b593..6b91c01dfc 100644
--- a/platform/android/os_android.cpp
+++ b/platform/android/os_android.cpp
@@ -151,7 +151,7 @@ void OS_Android::initialize(const VideoMode& p_desired,int p_video_driver,int p_
sample_manager = memnew( SampleManagerMallocSW );
audio_server = memnew( AudioServerSW(sample_manager) );
- audio_server->set_mixer_params(AudioMixerSW::INTERPOLATION_LINEAR,false);
+ audio_server->set_mixer_params(AudioMixerSW::INTERPOLATION_LINEAR,true);
audio_server->init();
spatial_sound_server = memnew( SpatialSoundServerSW );
diff --git a/platform/bb10/SCsub b/platform/bb10/SCsub
index 2e8ef47005..24f2b5d242 100644
--- a/platform/bb10/SCsub
+++ b/platform/bb10/SCsub
@@ -18,13 +18,5 @@ if env['bb10_lgles_override'] == "yes":
prog = None
-if env["target"]=="release":
- prog = env_bps.Program('#platform/bb10/godot_bb10_opt', bb10_lib)
-else:
- prog = env_bps.Program('#platform/bb10/godot_bb10', bb10_lib)
-
-import os
-fname = os.path.basename(str(prog[0]))
-
-env.Command('#bin/'+fname, prog, Copy('bin/'+fname, prog[0]))
+prog = env_bps.Program('#bin/godot', bb10_lib)
diff --git a/platform/bb10/bar/bar-descriptor.xml b/platform/bb10/bar/bar-descriptor.xml
index df5d34e077..0ba70b7180 100644
--- a/platform/bb10/bar/bar-descriptor.xml
+++ b/platform/bb10/bar/bar-descriptor.xml
@@ -1,65 +1,53 @@
-<?xml version="1.0" encoding="utf-8" standalone="no"?>
+<?xml version='1.0' encoding='utf-8' standalone='no'?>
<qnx xmlns="http://www.qnx.com/schemas/application/1.0">
-
-<!-- BlackBerry® 10 application descriptor file.
+ <!-- BlackBerry® 10 application descriptor file.
Specifies parameters for identifying, installing, and launching native applications on BlackBerry® 10 OS.
-->
-
<!-- A universally unique application identifier. Must be unique across all BlackBerry applications.
Using a reverse DNS-style name as the id is recommended. (Eg. com.example.ExampleApplication.) Required. -->
<id>com.godot.game</id>
-
<!-- The name that is displayed in the BlackBerry application installer.
May have multiple values for each language. See samples or xsd schema file. Optional. -->
<name>Godot Game</name>
-
<!-- A string value of the format <0-999>.<0-999>.<0-999> that represents application version which can be used to check for application upgrade.
Values can also be 1-part or 2-part. It is not necessary to have a 3-part value.
An updated version of application must have a versionNumber value higher than the previous version. Required. -->
<versionNumber>0.0.1</versionNumber>
-
<!-- Fourth digit segment of the package version. First three segments are taken from the
<versionNumber> element. Must be an integer from 0 to 2^16-1 -->
<buildId>0</buildId>
-
<!-- Description, displayed in the BlackBerry application installer.
May have multiple values for each language. See samples or xsd schema file. Optional. -->
<description>Game made with Godot Engine</description>
-
<!-- Name of author which is used for signing. Must match the developer name of your development certificate. -->
<author>You Name or Company</author>
<authorId>authorIDherePlease</authorId>
-
<!-- Unique author ID assigned by signing authority. Required if using debug tokens. -->
<!-- <authorId>ABC1234YjsnUk235h</authorId> -->
-
<initialWindow>
<aspectRatio>landscape</aspectRatio>
<autoOrients>false</autoOrients>
<systemChrome>none</systemChrome>
<transparent>false</transparent>
</initialWindow>
-
<!-- The category where the application appears. Either core.games or core.media. -->
<category>core.games</category>
<permission>read_device_identifying_information</permission>
<permission>access_internet</permission>
- <asset path="assets">assets</asset>
+ <asset path="data.pck">data.pck</asset>
<configuration name="Device-Debug">
- <platformArchitecture>armle-v7</platformArchitecture>
- <asset path="godot_bb10.qnx.armle" entry="true" type="Qnx/Elf">godot_bb10.qnx.armle</asset>
+ <platformArchitecture>armle-v7</platformArchitecture>
+ <asset type="Qnx/Elf" path="godot.bb10.debug.qnx.armle" entry="true">godot.bb10.debug.qnx.armle</asset>
</configuration>
<configuration name="Device-Release">
- <platformArchitecture>armle-v7</platformArchitecture>
- <asset path="godot_bb10_opt.qnx.armle" entry="true" type="Qnx/Elf">godot_bb10_opt.qnx.armle</asset>
+ <platformArchitecture>armle-v7</platformArchitecture>
+ <asset type="Qnx/Elf" path="godot.bb10.opt.qnx.armle" entry="true">godot.bb10.opt.qnx.armle</asset>
</configuration>
<!-- The icon for the application. -->
<icon>
- <image>icon.png</image>
+ <image>icon.png</image>
</icon>
-
<!-- Ensure that shared libraries in the package are found at run-time. -->
- <env var="LD_LIBRARY_PATH" value="app/native/lib:/usr/lib/qt4/lib"/>
-
+ <env value="app/native/lib:/usr/lib/qt4/lib" var="LD_LIBRARY_PATH"/>
</qnx>
diff --git a/platform/bb10/detect.py b/platform/bb10/detect.py
index 3ddb7a4450..f134a9df19 100644
--- a/platform/bb10/detect.py
+++ b/platform/bb10/detect.py
@@ -81,8 +81,6 @@ def configure(env):
if (env["target"]=="release"):
env.Append(CCFLAGS=['-O3','-DRELEASE_BUILD'])
- env['OBJSUFFIX'] = "_opt"+env['OBJSUFFIX']
- env['LIBSUFFIX'] = "_opt"+env['LIBSUFFIX']
elif (env["target"]=="debug"):
diff --git a/platform/bb10/export/export.cpp b/platform/bb10/export/export.cpp
index d40cb82cdf..7862ecd493 100644
--- a/platform/bb10/export/export.cpp
+++ b/platform/bb10/export/export.cpp
@@ -321,12 +321,29 @@ Error EditorExportPlatformBB10::export_project(const String& p_path, bool p_debu
//BE SUPER CAREFUL WITH THIS PLEASE!!!
//BLACKBERRY THIS IS YOUR FAULT FOR NOT MAKING A BETTER WAY!!
- if (bar_dir.ends_with("bb10_export")) {
- Error err = da->erase_contents_recursive();
- if (err!=OK) {
+ bool berr = bar_dir.ends_with("bb10_export");
+ if (berr) {
+ if (da->list_dir_begin()) {
EditorNode::add_io_error("Can't ensure that dir is empty:\n"+bar_dir);
- ERR_FAIL_COND_V(err!=OK,err);
- }
+ ERR_FAIL_COND_V(berr,FAILED);
+ };
+
+ String f = da->get_next();
+ while (f != "") {
+
+ if (f == "." || f == "..") {
+ f = da->get_next();
+ continue;
+ };
+ Error err = da->remove(bar_dir + "/" + f);
+ if (err != OK) {
+ EditorNode::add_io_error("Can't ensure that dir is empty:\n"+bar_dir);
+ ERR_FAIL_COND_V(err!=OK,err);
+ };
+ f = da->get_next();
+ };
+
+ da->list_dir_end();
} else {
print_line("ARE YOU CRAZY??? THIS IS A SERIOUS BUG HERE!!!");
@@ -405,52 +422,23 @@ Error EditorExportPlatformBB10::export_project(const String& p_path, bool p_debu
ret = unzGoToNextFile(pkg);
}
- ep.step("Finding Files..",1);
-
- Vector<StringName> files=get_dependencies(false);
-
ep.step("Adding Files..",2);
- da->change_dir(bar_dir);
- da->make_dir("assets");
- Error err = da->change_dir("assets");
- ERR_FAIL_COND_V(err,err);
-
- String asset_dir=da->get_current_dir();
- if (!asset_dir.ends_with("/"))
- asset_dir+="/";
-
- for(int i=0;i<files.size();i++) {
-
- String fname=files[i];
- Vector<uint8_t> data = get_exported_file(fname);
- /*
- FileAccess *f=FileAccess::open(files[i],FileAccess::READ);
- if (!f) {
- EditorNode::add_io_error("Couldn't read: "+String(files[i]));
- }
- ERR_CONTINUE(!f);
- data.resize(f->get_len());
- f->get_buffer(data.ptr(),data.size());
-*/
- String dst_path=fname;
- dst_path=dst_path.replace_first("res://",asset_dir);
-
- da->make_dir_recursive(dst_path.get_base_dir());
-
- ep.step("Adding File: "+String(files[i]).get_file(),3+i*100/files.size());
-
- FileAccessRef fr = FileAccess::open(dst_path,FileAccess::WRITE);
- fr->store_buffer(data.ptr(),data.size());
+ FileAccess* dst = FileAccess::open(bar_dir+"/data.pck", FileAccess::WRITE);
+ if (!dst) {
+ EditorNode::add_io_error("Can't copy executable file to:\n "+p_path);
+ return ERR_FILE_CANT_WRITE;
}
-
+ save_pack(dst, false, 1024);
+ dst->close();
+ memdelete(dst);
ep.step("Creating BAR Package..",104);
String bb_packager=EditorSettings::get_singleton()->get("blackberry/host_tools");
bb_packager=bb_packager.plus_file("blackberry-nativepackager");
if (OS::get_singleton()->get_name()=="Windows")
- bb_packager+=".exe";
+ bb_packager+=".bat";
if (!FileAccess::exists(bb_packager)) {
@@ -482,7 +470,7 @@ Error EditorExportPlatformBB10::export_project(const String& p_path, bool p_debu
int ec;
- err = OS::get_singleton()->execute(bb_packager,args,true,NULL,NULL,&ec);
+ Error err = OS::get_singleton()->execute(bb_packager,args,true,NULL,NULL,&ec);
if (err!=OK)
return err;
@@ -493,7 +481,6 @@ Error EditorExportPlatformBB10::export_project(const String& p_path, bool p_debu
}
-
bool EditorExportPlatformBB10::poll_devices() {
bool dc=devices_changed;
@@ -537,7 +524,7 @@ void EditorExportPlatformBB10::_device_poll_thread(void *ud) {
bb_deploy=bb_deploy.plus_file("blackberry-deploy");
bool windows = OS::get_singleton()->get_name()=="Windows";
if (windows)
- bb_deploy+=".exe";
+ bb_deploy+=".bat";
if (!FileAccess::exists(bb_deploy)) {
OS::get_singleton()->delay_usec(3000000);
@@ -639,7 +626,7 @@ Error EditorExportPlatformBB10::run(int p_device, bool p_dumb) {
String bb_deploy=EditorSettings::get_singleton()->get("blackberry/host_tools");
bb_deploy=bb_deploy.plus_file("blackberry-deploy");
if (OS::get_singleton()->get_name()=="Windows")
- bb_deploy+=".exe";
+ bb_deploy+=".bat";
if (!FileAccess::exists(bb_deploy)) {
EditorNode::add_io_error("Blackberry Deploy not found:\n"+bb_deploy);
diff --git a/platform/bb10/os_bb10.cpp b/platform/bb10/os_bb10.cpp
index ff43a68b1d..d89033b1df 100644
--- a/platform/bb10/os_bb10.cpp
+++ b/platform/bb10/os_bb10.cpp
@@ -619,7 +619,7 @@ OSBB10::OSBB10() {
printf("godot bb10!\n");
getcwd(launch_dir, sizeof(launch_dir));
printf("launch dir %s\n", launch_dir);
- chdir("app/native/assets");
+ chdir("app/native");
launch_dir_ptr = launch_dir;
}
diff --git a/platform/iphone/gl_view.h b/platform/iphone/gl_view.h
index a5b1b8731f..04334991fd 100755
--- a/platform/iphone/gl_view.h
+++ b/platform/iphone/gl_view.h
@@ -101,6 +101,8 @@
- (BOOL)createFramebuffer;
- (void)destroyFramebuffer;
+- (void)audioRouteChangeListenerCallback:(NSNotification*)notification;
+
@property NSTimeInterval animationInterval;
@end
diff --git a/platform/iphone/gl_view.mm b/platform/iphone/gl_view.mm
index 0625361b96..3d6c48ffaf 100755
--- a/platform/iphone/gl_view.mm
+++ b/platform/iphone/gl_view.mm
@@ -119,6 +119,8 @@ bool _play_video(String p_path, float p_volume, String p_audio_track, String p_s
name:AVPlayerItemDidPlayToEndTimeNotification
object:[_instance.avPlayer currentItem]];
+ [_instance.avPlayer addObserver:_instance forKeyPath:@"rate" options:NSKeyValueObservingOptionNew context:0];
+
[_instance.avPlayerLayer setFrame:_instance.bounds];
[_instance.layer addSublayer:_instance.avPlayerLayer];
[_instance.avPlayer play];
@@ -610,6 +612,39 @@ static void clear_touches() {
printf("inserting text with character %i\n", character[0]);
};
+- (void)audioRouteChangeListenerCallback:(NSNotification*)notification
+{
+ printf("*********** route changed!%i\n");
+ NSDictionary *interuptionDict = notification.userInfo;
+
+ NSInteger routeChangeReason = [[interuptionDict valueForKey:AVAudioSessionRouteChangeReasonKey] integerValue];
+
+ switch (routeChangeReason) {
+
+ case AVAudioSessionRouteChangeReasonNewDeviceAvailable:
+ NSLog(@"AVAudioSessionRouteChangeReasonNewDeviceAvailable");
+ NSLog(@"Headphone/Line plugged in");
+ break;
+
+ case AVAudioSessionRouteChangeReasonOldDeviceUnavailable:
+ NSLog(@"AVAudioSessionRouteChangeReasonOldDeviceUnavailable");
+ NSLog(@"Headphone/Line was pulled. Resuming video play....");
+ if (_is_video_playing) {
+
+ dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 0.5f * NSEC_PER_SEC), dispatch_get_main_queue(), ^{
+ [_instance.avPlayer play]; // NOTE: change this line according your current player implementation
+ NSLog(@"resumed play");
+ });
+ };
+ break;
+
+ case AVAudioSessionRouteChangeReasonCategoryChange:
+ // called at start - also when other audio wants to play
+ NSLog(@"AVAudioSessionRouteChangeReasonCategoryChange");
+ break;
+ }
+}
+
// When created via code however, we get initWithFrame
-(id)initWithFrame:(CGRect)frame
@@ -625,6 +660,11 @@ static void clear_touches() {
init_touches();
self. multipleTouchEnabled = YES;
+ printf("******** adding observer for sound routing changes\n");
+ [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(audioRouteChangeListenerCallback:)
+ name:AVAudioSessionRouteChangeNotification
+ object:nil];
+
//self.autoresizesSubviews = YES;
//[self setAutoresizingMask:UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleWidth];
@@ -674,6 +714,18 @@ static void clear_touches() {
video_current_time = kCMTimeZero;
}
}
+
+ if (object == _instance.avPlayer && [keyPath isEqualToString:@"rate"]) {
+ NSLog(@"Player playback rate changed: %.5f", _instance.avPlayer.rate);
+ if (_is_video_playing() && _instance.avPlayer.rate == 0.0 && !_instance.avPlayer.error) {
+ dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 0.5f * NSEC_PER_SEC), dispatch_get_main_queue(), ^{
+ [_instance.avPlayer play]; // NOTE: change this line according your current player implementation
+ NSLog(@"resumed play");
+ });
+
+ NSLog(@" . . . PAUSED (or just started)");
+ }
+ }
}
- (void)playerItemDidReachEnd:(NSNotification *)notification {
diff --git a/platform/windows/detect.py b/platform/windows/detect.py
index 16dd695c59..62bab00f7b 100644
--- a/platform/windows/detect.py
+++ b/platform/windows/detect.py
@@ -115,7 +115,7 @@ def configure(env):
env.Append(CCFLAGS=['/DGLES2_ENABLED'])
env.Append(CCFLAGS=['/DGLEW_ENABLED'])
- LIBS=['winmm','opengl32','dsound','kernel32','ole32','user32','gdi32', 'IPHLPAPI', 'wsock32', 'shell32','advapi32']
+ LIBS=['winmm','opengl32','dsound','kernel32','ole32','user32','gdi32', 'IPHLPAPI','Shlwapi', 'wsock32', 'shell32','advapi32']
env.Append(LINKFLAGS=[p+env["LIBSUFFIX"] for p in LIBS])
env.Append(LIBPATH=[os.getenv("WindowsSdkDir")+"/Lib"])
@@ -229,7 +229,7 @@ def configure(env):
env.Append(CCFLAGS=['-DWINDOWS_ENABLED','-mwindows'])
env.Append(CPPFLAGS=['-DRTAUDIO_ENABLED'])
env.Append(CCFLAGS=['-DGLES2_ENABLED','-DGLEW_ENABLED'])
- env.Append(LIBS=['mingw32','opengl32', 'dsound', 'ole32', 'd3d9','winmm','gdi32','iphlpapi','wsock32','kernel32'])
+ env.Append(LIBS=['mingw32','opengl32', 'dsound', 'ole32', 'd3d9','winmm','gdi32','iphlpapi','shlwapi','wsock32','kernel32'])
if (env["bits"]=="32" and env["mingw64_for_32"]!="yes"):
# env.Append(LIBS=['gcc_s'])
diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp
index 13f2c32e77..e392a56aa8 100644
--- a/platform/windows/os_windows.cpp
+++ b/platform/windows/os_windows.cpp
@@ -715,9 +715,14 @@ String OS_Windows::get_joystick_name(int id, JOYCAPS jcaps)
return "";
_snprintf( buffer, sizeof(buffer), "%s\\%s", REGSTR_PATH_JOYOEM, OEM);
- res = RegOpenKeyEx ( HKEY_LOCAL_MACHINE, buffer, 0, KEY_QUERY_VALUE, &hKey);
- if (res != ERROR_SUCCESS)
- return "";
+ res = RegOpenKeyEx(HKEY_LOCAL_MACHINE, buffer, 0, KEY_QUERY_VALUE, &hKey);
+ if (res != ERROR_SUCCESS)
+ {
+ res = RegOpenKeyEx(HKEY_CURRENT_USER, buffer, 0, KEY_QUERY_VALUE, &hKey);
+ if (res != ERROR_SUCCESS)
+ return "";
+ }
+
sz = sizeof(buffer);
res = RegQueryValueEx(hKey, REGSTR_VAL_JOYOEMNAME, 0, 0, (LPBYTE) buffer,