diff --git a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/MainActivity.java b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/MainActivity.java
index 5b63a8173..757c7579b 100644
--- a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/MainActivity.java
+++ b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/MainActivity.java
@@ -73,6 +73,8 @@ import org.lwjgl.glfw.CallbackBridge;
import java.io.File;
import java.io.IOException;
+import java.util.Objects;
+
public class MainActivity extends BaseActivity implements ControlButtonMenuListener, EditorExitable, ServiceConnection {
public static volatile ClipboardManager GLOBAL_CLIPBOARD;
public static final String INTENT_MINECRAFT_VERSION = "intent_version";
@@ -356,11 +358,50 @@ public class MainActivity extends BaseActivity implements ControlButtonMenuListe
}
private void runCraft(String versionId, JMinecraftVersionList.Version version) throws Throwable {
- if(Tools.LOCAL_RENDERER == null) {
- Integer iSelectedMcVer = Tools.mcVersiontoInt(Tools.getSelectedVanillaMcVer());
- if (iSelectedMcVer >= 1021005) {
- Tools.LOCAL_RENDERER = "opengles_mobileglues";
- } else Tools.LOCAL_RENDERER = "opengles2";
+ // Autoselect renderer
+ if (Tools.LOCAL_RENDERER == null) {
+ String assetVersion;
+ if (version.inheritsFrom != null) { // We are almost definitely modded if this runs
+ File vanillaJsonFile = new File(Tools.DIR_HOME_VERSION + "/" + version.inheritsFrom + "/" + version.inheritsFrom + ".json");
+ JMinecraftVersionList.Version vanillaJson;
+ try { // Get the vanilla json from modded instance
+ vanillaJson = Tools.GLOBAL_GSON.fromJson(Tools.read(vanillaJsonFile.getAbsolutePath()), JMinecraftVersionList.Version.class);
+ } catch (IOException ignored) { // Should never happen, we check for this in MinecraftDownloader().start()
+ throw new RuntimeException(getString(R.string.error_vanilla_json_corrupt));
+ }
+ // Something went wrong if this is somehow not the case anymore
+ if (!Objects.equals(vanillaJson.assets, vanillaJson.assetIndex.id))
+ Tools.showErrorRemote(new RuntimeException(getString(R.string.error_vanilla_json_corrupt)));
+ assetVersion = vanillaJson.assets;
+ } else {
+ // Else assume we are vanilla
+ if (!Objects.equals(version.assets, version.assetIndex.id))
+ Tools.showErrorRemote(new RuntimeException(getString(R.string.error_vanilla_json_corrupt)));
+ assetVersion = version.assets;
+ }
+ // 25w09a is when HolyGL4ES starts showing a black screen upon world load.
+ // There is no way to consistently check for that without breaking mod loaders
+ // for old versions like legacy fabric so we start from 25w07a instead
+
+ // 25w07a assets and assetIndex.id is set to 23, 25w08a and 25w09a is 24.
+
+ // 1.19.3 snapshots and all future versions restarted assets and assetsIndex.id
+ // to 1 and started counting up from there
+
+ // Previous versions had "1.19" and "1.18" and such, with April Fools versions
+ // being even more inconsistent like "3D Shareware v1.34" for the 2019 April Fools
+ // or 1.RV-Pre1 for 2016, thankfully now they don't seem to do that anymore and just
+ // use the incrementing system they now have
+
+ // I could probably read the manifest itself then check which position the `id` field is
+ // and count from there since its ordered latest to oldest but that uses way more code
+ // for basically 3 peoples benefit
+ try {
+ int assetID = Integer.parseInt(assetVersion);
+ // Check if below 25w08a
+ Tools.LOCAL_RENDERER = (assetID <= 23) ? "opengles2" : "opengles_mobileglues";
+ // Then assume 1.19.2 and below
+ } catch (NumberFormatException e) { Tools.LOCAL_RENDERER = "opengles2"; }
}
if(!Tools.checkRendererCompatible(this, Tools.LOCAL_RENDERER)) {
Tools.RenderersList renderersList = Tools.getCompatibleRenderers(this);
diff --git a/app_pojavlauncher/src/main/res/values/strings.xml b/app_pojavlauncher/src/main/res/values/strings.xml
index 5b830b622..04a41f500 100644
--- a/app_pojavlauncher/src/main/res/values/strings.xml
+++ b/app_pojavlauncher/src/main/res/values/strings.xml
@@ -469,4 +469,5 @@
Force enable TouchController integration, even if mod file is not found.
TouchController vibrate length
Set the length of the vibration when using TouchController.
+ Vanilla json seems to be corrupt. Please send a bug report on github or discord.