Skip to content

Commit

Permalink
try fix crashing
Browse files Browse the repository at this point in the history
  • Loading branch information
SolDev69 committed May 23, 2024
1 parent aa1e079 commit b8eeae7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
1 change: 0 additions & 1 deletion ,gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
.vscode/

/.gradle
/build
/*/build
Expand Down
14 changes: 14 additions & 0 deletions app_solcraftlauncher/src/main/java/net/kdt/pojavlaunch/Tools.java
Original file line number Diff line number Diff line change
Expand Up @@ -1158,18 +1158,32 @@ 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<String> rendererIds = new ArrayList<>(defaultRenderers.length);
List<String> rendererNames = new ArrayList<>(defaultRendererNames.length);
List<String> galliumIds = new ArrayList<>(defaultDrivers.length);
List<String> galliumNames = new ArrayList<>(defaultDriverNames.length);
for(int i = 0; i < defaultRenderers.length; i++) {
String rendererId = defaultRenderers[i];
if(rendererId.contains("vulkan") && !deviceHasVulkan) continue;
if(rendererId.contains("zink") && !deviceHasZinkBinary) continue;
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]));

Expand Down

0 comments on commit b8eeae7

Please sign in to comment.