summaryrefslogtreecommitdiff
path: root/platform/android/java_glue.cpp
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2014-06-11 10:41:43 -0300
committerJuan Linietsky <reduzio@gmail.com>2014-06-11 10:41:43 -0300
commit64e83bfd1404ea593f0c79b478d196a3fcde42a8 (patch)
treec18c61da239443532a94fb9fa54df702df12a90b /platform/android/java_glue.cpp
parent9b8696d3dd92e2ed6f310ad0f0bf3c2182c9c6ae (diff)
parent5f5cd5e6d1508f85ac1bffa44e122b4dc0e2bb1d (diff)
Merge branch 'master' of https://github.com/okamstudio/godot
Diffstat (limited to 'platform/android/java_glue.cpp')
-rw-r--r--platform/android/java_glue.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/platform/android/java_glue.cpp b/platform/android/java_glue.cpp
index 4362b8f2c4..b11994eef0 100644
--- a/platform/android/java_glue.cpp
+++ b/platform/android/java_glue.cpp
@@ -153,6 +153,14 @@ jvalue _variant_to_jvalue(JNIEnv *env, Variant::Type p_type, const Variant* p_ar
v.l=arr;
} break;
+ case Variant::RAW_ARRAY: {
+ DVector<uint8_t> array = *p_arg;
+ 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;
+
+ } break;
case Variant::REAL_ARRAY: {
DVector<float> array = *p_arg;
@@ -244,6 +252,19 @@ Variant _jobject_to_variant(JNIEnv * env, jobject obj) {
return sarr;
};
+ if (name == "[B") {
+
+ jbyteArray arr = (jbyteArray)obj;
+ int fCount = env->GetArrayLength(arr);
+ DVector<uint8_t> sarr;
+ sarr.resize(fCount);
+
+ DVector<uint8_t>::Write w = sarr.write();
+ env->GetByteArrayRegion(arr,0,fCount,reinterpret_cast<signed char*>(w.ptr()));
+ w = DVector<uint8_t>::Write();
+ return sarr;
+ };
+
if (name == "java.lang.Float" || name == "java.lang.Double") {
jclass nclass = env->FindClass("java/lang/Number");
@@ -1346,6 +1367,7 @@ static Variant::Type get_jni_type(const String& p_type) {
{"double", Variant::REAL},
{"java.lang.String",Variant::STRING},
{"[I",Variant::INT_ARRAY},
+ {"[B",Variant::RAW_ARRAY},
{"[F",Variant::REAL_ARRAY},
{"[java.lang.String",Variant::STRING_ARRAY},
{"com.android.godot.Dictionary", Variant::DICTIONARY},
@@ -1381,6 +1403,7 @@ static const char* get_jni_sig(const String& p_type) {
{"java.lang.String","Ljava/lang/String;"},
{"com.android.godot.Dictionary", "Lcom/android/godot/Dictionary;"},
{"[I","[I"},
+ {"[B","[B"},
{"[F","[F"},
{"[java.lang.String","[Ljava/lang/String;"},
{NULL,"V"}