summaryrefslogtreecommitdiff
path: root/src/android/app
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/android/app
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/android/app')
-rw-r--r--src/android/app/src/main/jni/native.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/android/app/src/main/jni/native.cpp b/src/android/app/src/main/jni/native.cpp
index ebf38b34f..849d8367c 100644
--- a/src/android/app/src/main/jni/native.cpp
+++ b/src/android/app/src/main/jni/native.cpp
@@ -459,8 +459,8 @@ int Java_org_yuzu_yuzu_1emu_NativeLibrary_installFileToNand(JNIEnv* env, jobject
jlambdaClass, "invoke", "(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;");
const auto callback = [env, jcallback, jlambdaInvokeMethod](size_t max, size_t progress) {
auto jwasCancelled = env->CallObjectMethod(jcallback, jlambdaInvokeMethod,
- Common::Android::ToJDouble(env, max),
- Common::Android::ToJDouble(env, progress));
+ Common::Android::ToJLong(env, max),
+ Common::Android::ToJLong(env, progress));
return Common::Android::GetJBoolean(env, jwasCancelled);
};
@@ -791,8 +791,8 @@ jobjectArray Java_org_yuzu_yuzu_1emu_NativeLibrary_verifyInstalledContents(JNIEn
jlambdaClass, "invoke", "(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;");
const auto callback = [env, jcallback, jlambdaInvokeMethod](size_t max, size_t progress) {
auto jwasCancelled = env->CallObjectMethod(jcallback, jlambdaInvokeMethod,
- Common::Android::ToJDouble(env, max),
- Common::Android::ToJDouble(env, progress));
+ Common::Android::ToJLong(env, max),
+ Common::Android::ToJLong(env, progress));
return Common::Android::GetJBoolean(env, jwasCancelled);
};
@@ -814,8 +814,8 @@ jint Java_org_yuzu_yuzu_1emu_NativeLibrary_verifyGameContents(JNIEnv* env, jobje
jlambdaClass, "invoke", "(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;");
const auto callback = [env, jcallback, jlambdaInvokeMethod](size_t max, size_t progress) {
auto jwasCancelled = env->CallObjectMethod(jcallback, jlambdaInvokeMethod,
- Common::Android::ToJDouble(env, max),
- Common::Android::ToJDouble(env, progress));
+ Common::Android::ToJLong(env, max),
+ Common::Android::ToJLong(env, progress));
return Common::Android::GetJBoolean(env, jwasCancelled);
};
auto& session = EmulationSession::GetInstance();