summaryrefslogtreecommitdiff
path: root/Source/Android/jni/AndroidCommon/AndroidCommon.cpp
diff options
context:
space:
mode:
authorJosJuice <josjuice@gmail.com>2018-06-01 09:36:29 +0200
committerJosJuice <josjuice@gmail.com>2018-06-06 17:34:07 +0200
commit1c027bc148574cf0b05cd04f8ce15132e8115170 (patch)
treecf7d352f8cc68bc26b37168f86c8314d448903a7 /Source/Android/jni/AndroidCommon/AndroidCommon.cpp
parentdaee5a4b43e95f50a1b024348a19d7f2bb48bdbc (diff)
Use UICommon's game list code on Android
Deduplicates code, and gets rid of some problems the old code had (such as: bad performance when calling native functions, only one disc showing up for multi-disc games, Wii banners being low-res, unnecessarily much effort being needed for adding more metadata).
Diffstat (limited to 'Source/Android/jni/AndroidCommon/AndroidCommon.cpp')
-rw-r--r--Source/Android/jni/AndroidCommon/AndroidCommon.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/Source/Android/jni/AndroidCommon/AndroidCommon.cpp b/Source/Android/jni/AndroidCommon/AndroidCommon.cpp
new file mode 100644
index 0000000000..350ea5483e
--- /dev/null
+++ b/Source/Android/jni/AndroidCommon/AndroidCommon.cpp
@@ -0,0 +1,26 @@
+// Copyright 2018 Dolphin Emulator Project
+// Licensed under GPLv2+
+// Refer to the license.txt file included.
+
+#include "jni/AndroidCommon/AndroidCommon.h"
+
+#include <string>
+
+#include <jni.h>
+
+std::string GetJString(JNIEnv* env, jstring jstr)
+{
+ std::string result = "";
+ if (!jstr)
+ return result;
+
+ const char* s = env->GetStringUTFChars(jstr, nullptr);
+ result = s;
+ env->ReleaseStringUTFChars(jstr, s);
+ return result;
+}
+
+jstring ToJString(JNIEnv* env, const std::string& str)
+{
+ return env->NewStringUTF(str.c_str());
+}