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;
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

View File

@ -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<String> 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();