From a919ef23a0f23dc6f45a8453e96b5cb5e1b50cd5 Mon Sep 17 00:00:00 2001 From: SerpentSpirale Date: Sun, 3 Apr 2022 22:05:23 +0200 Subject: [PATCH] Update 1.17 checks --- .../net/kdt/pojavlaunch/utils/JREUtils.java | 7 ++-- .../kdt/pojavlaunch/utils/V117CompatUtil.java | 32 +++++++++---------- 2 files changed, 17 insertions(+), 22 deletions(-) diff --git a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/utils/JREUtils.java b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/utils/JREUtils.java index e75cafe37..355212ce5 100644 --- a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/utils/JREUtils.java +++ b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/utils/JREUtils.java @@ -429,11 +429,7 @@ public class JREUtils { String renderLibrary; switch (LOCAL_RENDERER){ case "opengles2": renderLibrary = "libgl4es_114.so"; break; - case "opengles2_5": - case "opengles3": renderLibrary = "libgl4es_115.so"; break; - case "opengles3_virgl": case "vulkan_zink": renderLibrary = "libOSMesa_8.so"; break; - case "opengles3_vgpu" : renderLibrary = "libvgpu.so"; break; default: Log.w("RENDER_LIBRARY", "No renderer selected, defaulting to opengles2"); renderLibrary = "libgl4es_114.so"; @@ -478,7 +474,8 @@ public class JREUtils { } return false; } - private static int getDetectedVersion() { + + public static int getDetectedVersion() { /* * Get all the device configurations and check the EGL_RENDERABLE_TYPE attribute * to determine the highest ES version supported by any config. The diff --git a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/utils/V117CompatUtil.java b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/utils/V117CompatUtil.java index a8fcbbfcd..6bb2a53df 100644 --- a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/utils/V117CompatUtil.java +++ b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/utils/V117CompatUtil.java @@ -104,7 +104,7 @@ public class V117CompatUtil { return ret.toString(); } - public static void runCheck(String version, Activity ctx) throws Exception{ + public static void runCheck(String version, Activity activity) throws Exception{ MCOptionUtils.load(); @@ -112,35 +112,33 @@ public class V117CompatUtil { List packList =getTexturePackList(MCOptionUtils.get("resourcePacks")); String renderer; String gamePath; - LauncherProfiles.update(); - MinecraftProfile prof = LauncherProfiles.mainProfileJson.profiles.get(((BaseLauncherActivity)ctx).mProfile.selectedProfile); - if(prof == null) throw new MinecraftDownloaderTask.SilentException(); - renderer = prof.pojavRendererName != null?prof.pojavRendererName :LauncherPreferences.PREF_RENDERER; - gamePath = prof.gameDir != null?prof.gameDir:Tools.DIR_GAME_NEW; + LauncherProfiles.update(); + MinecraftProfile prof = LauncherProfiles.mainProfileJson.profiles.get(((BaseLauncherActivity)activity).mProfile.selectedProfile); + if(prof == null) throw new MinecraftDownloaderTask.SilentException(); + renderer = prof.pojavRendererName != null ? prof.pojavRendererName : LauncherPreferences.PREF_RENDERER; + gamePath = prof.gameDir != null ? prof.gameDir : Tools.DIR_GAME_NEW; //String if(renderer.equals("vulkan_zink") || renderer.equals("opengles3_virgl")) return; //don't install for zink/virgl users; - if(packList.contains("\"assets-v0.zip\"") && renderer.equals("opengles3")) return; + if(packList.contains("\"assets-v0.zip\"")) return; + if(JREUtils.getDetectedVersion() >= 3) return; // GL4ES_extra supports 1.17+ Object lock = new Object(); AtomicInteger proceed = new AtomicInteger(0); - ctx.runOnUiThread(() -> { - AlertDialog.Builder builder = new AlertDialog.Builder(ctx); + activity.runOnUiThread(() -> { + AlertDialog.Builder builder = new AlertDialog.Builder(activity); builder.setTitle(R.string.global_warinng); builder.setMessage(R.string.compat_117_message); builder.setPositiveButton(android.R.string.ok, (dialog, which) -> { proceed.set(1); synchronized (lock) { lock.notifyAll(); } - dialog.dismiss(); }); builder.setNegativeButton(android.R.string.cancel, (dialog, which) -> { synchronized (lock) { lock.notifyAll(); } - dialog.dismiss(); }); builder.setNeutralButton(R.string.compat_11x_playanyway, (dialog, which) -> { proceed.set(2); synchronized (lock) { lock.notifyAll(); } - dialog.dismiss(); }); builder.setCancelable(false); builder.show(); @@ -151,11 +149,11 @@ public class V117CompatUtil { } switch(proceed.get()) { case 1: - MinecraftProfile minecraftProfile = LauncherProfiles.mainProfileJson.profiles.get(((BaseLauncherActivity)ctx).mProfile.selectedProfile); - if(minecraftProfile == null) throw new MinecraftDownloaderTask.SilentException(); - minecraftProfile.pojavRendererName = "opengles3"; - LauncherProfiles.update(); - copyResourcePack(gamePath,ctx.getAssets()); + MinecraftProfile minecraftProfile = LauncherProfiles.mainProfileJson.profiles.get(((BaseLauncherActivity)activity).mProfile.selectedProfile); + if(minecraftProfile == null) throw new MinecraftDownloaderTask.SilentException(); + minecraftProfile.pojavRendererName = "opengles2"; + LauncherProfiles.update(); + copyResourcePack(gamePath,activity.getAssets()); if(!packList.contains("\"assets-v0.zip\"")) packList.add(0,"\"assets-v0.zip\""); MCOptionUtils.set("resourcePacks",regenPackList(packList)); MCOptionUtils.save();