From 587825f60af42452541f705030c580714a22fb1c Mon Sep 17 00:00:00 2001 From: echosys Date: Sun, 11 Aug 2024 12:11:13 +0000 Subject: [PATCH] Fix x86_64 build for Android (#49) Fixes x86_64 builds for Android by stubbing a function that calls into libadrenotools to query GPU driver information. libadrenotools is only available for arm64. The function should not be called anyways, as the menu that would display the information is disabled on unsupported devices. To enable x86_64 for building change the line `abiFilters += listOf("arm64-v8a")` in `src/android/app/build.gradle.kts` to `abiFilters += listOf("arm64-v8a", "x86_64")`. I did not do this by default as it significantly increases the build time (the native part needs to be build once for each architecture) and increases the app size (this is less of a concern as games are already significantly larger). It might allow usage on Chromebooks (the internet tells me those run on x86_64) and some few Android devices. The main advantage I see is for development of the app itself, as it allows running it in waydroid for local testing. Reviewed-on: http://vub63vv26q6v27xzv2dtcd25xumubshogm67yrpaz2rculqxs7jlfqad.onion/torzu-emu/torzu/pulls/49 Co-authored-by: echosys Co-committed-by: echosys --- src/android/app/src/main/jni/native.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/android/app/src/main/jni/native.cpp b/src/android/app/src/main/jni/native.cpp index 5d484a85e..ebf38b34f 100644 --- a/src/android/app/src/main/jni/native.cpp +++ b/src/android/app/src/main/jni/native.cpp @@ -525,6 +525,7 @@ jboolean JNICALL Java_org_yuzu_yuzu_1emu_utils_GpuDriverHelper_supportsCustomDri jobjectArray Java_org_yuzu_yuzu_1emu_utils_GpuDriverHelper_getSystemDriverInfo( JNIEnv* env, jobject j_obj, jobject j_surf, jstring j_hook_lib_dir) { +#ifdef ARCHITECTURE_arm64 const char* file_redirect_dir_{}; int featureFlags{}; std::string hook_lib_dir = Common::Android::GetJString(env, j_hook_lib_dir); @@ -553,6 +554,11 @@ jobjectArray Java_org_yuzu_yuzu_1emu_utils_GpuDriverHelper_getSystemDriverInfo( env->SetObjectArrayElement(j_driver_info, 1, Common::Android::ToJString(env, device.GetDriverName())); return j_driver_info; +#else + jobjectArray j_driver_info = env->NewObjectArray( + 2, Common::Android::GetStringClass(), Common::Android::ToJString(env, "UNKNOWN")); + return j_driver_info; +#endif } jboolean Java_org_yuzu_yuzu_1emu_NativeLibrary_reloadKeys(JNIEnv* env, jclass clazz) {