Update 1.17 checks

This commit is contained in:
SerpentSpirale 2022-04-03 22:05:23 +02:00
parent dd34db663b
commit a919ef23a0
2 changed files with 17 additions and 22 deletions

View File

@ -429,11 +429,7 @@ public class JREUtils {
String renderLibrary; String renderLibrary;
switch (LOCAL_RENDERER){ switch (LOCAL_RENDERER){
case "opengles2": renderLibrary = "libgl4es_114.so"; break; 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 "vulkan_zink": renderLibrary = "libOSMesa_8.so"; break;
case "opengles3_vgpu" : renderLibrary = "libvgpu.so"; break;
default: default:
Log.w("RENDER_LIBRARY", "No renderer selected, defaulting to opengles2"); Log.w("RENDER_LIBRARY", "No renderer selected, defaulting to opengles2");
renderLibrary = "libgl4es_114.so"; renderLibrary = "libgl4es_114.so";
@ -478,7 +474,8 @@ public class JREUtils {
} }
return false; return false;
} }
private static int getDetectedVersion() {
public static int getDetectedVersion() {
/* /*
* Get all the device configurations and check the EGL_RENDERABLE_TYPE attribute * Get all the device configurations and check the EGL_RENDERABLE_TYPE attribute
* to determine the highest ES version supported by any config. The * to determine the highest ES version supported by any config. The

View File

@ -104,7 +104,7 @@ public class V117CompatUtil {
return ret.toString(); 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(); MCOptionUtils.load();
@ -112,35 +112,33 @@ public class V117CompatUtil {
List<String> packList =getTexturePackList(MCOptionUtils.get("resourcePacks")); List<String> packList =getTexturePackList(MCOptionUtils.get("resourcePacks"));
String renderer; String renderer;
String gamePath; String gamePath;
LauncherProfiles.update(); LauncherProfiles.update();
MinecraftProfile prof = LauncherProfiles.mainProfileJson.profiles.get(((BaseLauncherActivity)ctx).mProfile.selectedProfile); MinecraftProfile prof = LauncherProfiles.mainProfileJson.profiles.get(((BaseLauncherActivity)activity).mProfile.selectedProfile);
if(prof == null) throw new MinecraftDownloaderTask.SilentException(); if(prof == null) throw new MinecraftDownloaderTask.SilentException();
renderer = prof.pojavRendererName != null?prof.pojavRendererName :LauncherPreferences.PREF_RENDERER; renderer = prof.pojavRendererName != null ? prof.pojavRendererName : LauncherPreferences.PREF_RENDERER;
gamePath = prof.gameDir != null?prof.gameDir:Tools.DIR_GAME_NEW; gamePath = prof.gameDir != null ? prof.gameDir : Tools.DIR_GAME_NEW;
//String //String
if(renderer.equals("vulkan_zink") || renderer.equals("opengles3_virgl")) return; //don't install for zink/virgl users; 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(); Object lock = new Object();
AtomicInteger proceed = new AtomicInteger(0); AtomicInteger proceed = new AtomicInteger(0);
ctx.runOnUiThread(() -> { activity.runOnUiThread(() -> {
AlertDialog.Builder builder = new AlertDialog.Builder(ctx); AlertDialog.Builder builder = new AlertDialog.Builder(activity);
builder.setTitle(R.string.global_warinng); builder.setTitle(R.string.global_warinng);
builder.setMessage(R.string.compat_117_message); builder.setMessage(R.string.compat_117_message);
builder.setPositiveButton(android.R.string.ok, (dialog, which) -> { builder.setPositiveButton(android.R.string.ok, (dialog, which) -> {
proceed.set(1); proceed.set(1);
synchronized (lock) { lock.notifyAll(); } synchronized (lock) { lock.notifyAll(); }
dialog.dismiss();
}); });
builder.setNegativeButton(android.R.string.cancel, (dialog, which) -> { builder.setNegativeButton(android.R.string.cancel, (dialog, which) -> {
synchronized (lock) { lock.notifyAll(); } synchronized (lock) { lock.notifyAll(); }
dialog.dismiss();
}); });
builder.setNeutralButton(R.string.compat_11x_playanyway, (dialog, which) -> { builder.setNeutralButton(R.string.compat_11x_playanyway, (dialog, which) -> {
proceed.set(2); proceed.set(2);
synchronized (lock) { lock.notifyAll(); } synchronized (lock) { lock.notifyAll(); }
dialog.dismiss();
}); });
builder.setCancelable(false); builder.setCancelable(false);
builder.show(); builder.show();
@ -151,11 +149,11 @@ public class V117CompatUtil {
} }
switch(proceed.get()) { switch(proceed.get()) {
case 1: case 1:
MinecraftProfile minecraftProfile = LauncherProfiles.mainProfileJson.profiles.get(((BaseLauncherActivity)ctx).mProfile.selectedProfile); MinecraftProfile minecraftProfile = LauncherProfiles.mainProfileJson.profiles.get(((BaseLauncherActivity)activity).mProfile.selectedProfile);
if(minecraftProfile == null) throw new MinecraftDownloaderTask.SilentException(); if(minecraftProfile == null) throw new MinecraftDownloaderTask.SilentException();
minecraftProfile.pojavRendererName = "opengles3"; minecraftProfile.pojavRendererName = "opengles2";
LauncherProfiles.update(); LauncherProfiles.update();
copyResourcePack(gamePath,ctx.getAssets()); copyResourcePack(gamePath,activity.getAssets());
if(!packList.contains("\"assets-v0.zip\"")) packList.add(0,"\"assets-v0.zip\""); if(!packList.contains("\"assets-v0.zip\"")) packList.add(0,"\"assets-v0.zip\"");
MCOptionUtils.set("resourcePacks",regenPackList(packList)); MCOptionUtils.set("resourcePacks",regenPackList(packList));
MCOptionUtils.save(); MCOptionUtils.save();