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 <echosys@noreply.localhost>
Co-committed-by: echosys <echosys@noreply.localhost>
This commit is contained in:
echosys 2024-08-11 12:11:13 +00:00 committed by spectranator
parent 0719273fed
commit 587825f60a

View file

@ -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) {