From b8eeae79a3f9b550a203f1a7250c44167db4f63d Mon Sep 17 00:00:00 2001 From: SolDev69 Date: Thu, 23 May 2024 12:46:29 -0400 Subject: [PATCH] try fix crashing --- ,gitignore | 1 - .../src/main/java/net/kdt/pojavlaunch/Tools.java | 14 ++++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/,gitignore b/,gitignore index 4a681e0fcb..45ce51b182 100644 --- a/,gitignore +++ b/,gitignore @@ -1,5 +1,4 @@ .vscode/ - /.gradle /build /*/build diff --git a/app_solcraftlauncher/src/main/java/net/kdt/pojavlaunch/Tools.java b/app_solcraftlauncher/src/main/java/net/kdt/pojavlaunch/Tools.java index 44323efbf1..ab94b3040e 100644 --- a/app_solcraftlauncher/src/main/java/net/kdt/pojavlaunch/Tools.java +++ b/app_solcraftlauncher/src/main/java/net/kdt/pojavlaunch/Tools.java @@ -1158,11 +1158,15 @@ public static RenderersList getCompatibleRenderers(Context context) { Resources resources = context.getResources(); String[] defaultRenderers = resources.getStringArray(R.array.renderer_values); String[] defaultRendererNames = resources.getStringArray(R.array.renderer); + String[] defaultDrivers = resources.getStringArray(R.array.mesa_renderer_values); + String[] defaultDriverNames = resources.getStringArray(R.array.mesa_renderers); boolean deviceHasVulkan = checkVulkanSupport(context.getPackageManager()); // Currently, only 32-bit x86 does not have the Zink binary boolean deviceHasZinkBinary = !(Architecture.is32BitsDevice() && Architecture.isx86Device()); List rendererIds = new ArrayList<>(defaultRenderers.length); List rendererNames = new ArrayList<>(defaultRendererNames.length); + List galliumIds = new ArrayList<>(defaultDrivers.length); + List galliumNames = new ArrayList<>(defaultDriverNames.length); for(int i = 0; i < defaultRenderers.length; i++) { String rendererId = defaultRenderers[i]; if(rendererId.contains("vulkan") && !deviceHasVulkan) continue; @@ -1170,6 +1174,16 @@ public static RenderersList getCompatibleRenderers(Context context) { rendererIds.add(rendererId); rendererNames.add(defaultRendererNames[i]); } + + for (int i = 0; i < defaultDrivers.length; i++) + { + String driverId = defaultDrivers[i]; + if(driverId.contains("vulkan") && !deviceHasVulkan) continue; + if(driverId.contains("zink") && !deviceHasZinkBinary) continue; + galliumIds.add(driverId); + galliumNames.add(defaultDriverNames[i]); + } + sCompatibleRenderers = new RenderersList(rendererIds, rendererNames.toArray(new String[0]));