summaryrefslogtreecommitdiff
path: root/src/common/android/android_common.cpp
diff options
context:
space:
mode:
authorechosys <echosys@noreply.localhost>2024-10-03 12:08:28 +0000
committerMike Lothian <mike@fireburn.co.uk>2024-12-20 15:24:58 +0000
commit15b173988a151fb4aa513dd0c556ef290a91a794 (patch)
treec470eff26ffd8255aa20e05014488e9004a0ea9e /src/common/android/android_common.cpp
parent2ed4e7a2aef999dd3569d043546dbc6d7a6a08b8 (diff)
Fix Android crash caused by incorrect type in progress dialog callbacks (#58)
Bug discovered via an incomplete fix in Sudachi. Some Progress Dialog callbacks pass the wrong type (Double instead of Long) from C++ to Java code causing a crash at runtime. To fix this a new function is implemented to convert to a Java Long and that is used instead of the function that converts to a Double. Reviewed-on: http://vub63vv26q6v27xzv2dtcd25xumubshogm67yrpaz2rculqxs7jlfqad.onion/torzu-emu/torzu/pulls/58 Co-authored-by: echosys <echosys@noreply.localhost> Co-committed-by: echosys <echosys@noreply.localhost>
Diffstat (limited to 'src/common/android/android_common.cpp')
-rw-r--r--src/common/android/android_common.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/common/android/android_common.cpp b/src/common/android/android_common.cpp
index e79005658..8913413c0 100644
--- a/src/common/android/android_common.cpp
+++ b/src/common/android/android_common.cpp
@@ -54,6 +54,14 @@ jobject ToJInteger(JNIEnv* env, s32 value) {
return env->NewObject(GetIntegerClass(), GetIntegerConstructor(), value);
}
+s64 GetJLong(JNIEnv* env, jobject jlong) {
+ return env->GetLongField(jlong, GetIntegerValueField());
+}
+
+jobject ToJLong(JNIEnv* env, s64 value) {
+ return env->NewObject(GetLongClass(), GetLongConstructor(), value);
+}
+
bool GetJBoolean(JNIEnv* env, jobject jboolean) {
return env->GetBooleanField(jboolean, GetBooleanValueField());
}