mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2025-09-15 15:48:26 -04:00
Add automatic OpenGL 1 selection for older versions
This commit is contained in:
parent
e1a47e504b
commit
7b756a1925
@ -132,6 +132,9 @@ public final class Tools {
|
|||||||
PojavLoginActivity.disableSplash(gamedirPath);
|
PojavLoginActivity.disableSplash(gamedirPath);
|
||||||
String[] launchArgs = getMinecraftArgs(profile, versionInfo, gamedirPath);
|
String[] launchArgs = getMinecraftArgs(profile, versionInfo, gamedirPath);
|
||||||
|
|
||||||
|
// Select the appropriate openGL version
|
||||||
|
OldVersionsUtils.selectOpenGlVersion(versionInfo);
|
||||||
|
|
||||||
// ctx.appendlnToLog("Minecraft Args: " + Arrays.toString(launchArgs));
|
// ctx.appendlnToLog("Minecraft Args: " + Arrays.toString(launchArgs));
|
||||||
|
|
||||||
String launchClassPath = generateLaunchClassPath(versionInfo,versionName);
|
String launchClassPath = generateLaunchClassPath(versionInfo,versionName);
|
||||||
|
@ -5,6 +5,8 @@ public class ExtraConstants {
|
|||||||
public static final String RELEASE_TABLE = "release_table";
|
public static final String RELEASE_TABLE = "release_table";
|
||||||
/* ExtraCore constant: an ArrayList of Strings, where each String is a Minecraft version name */
|
/* ExtraCore constant: an ArrayList of Strings, where each String is a Minecraft version name */
|
||||||
public static final String VERSION_LIST= "lac_version_list";
|
public static final String VERSION_LIST= "lac_version_list";
|
||||||
/* ExraCore constant: Serpent's back button tracking thing */
|
/* ExtraCore constant: Serpent's back button tracking thing */
|
||||||
public static final String BACK_PREFERENCE = "back_preference";
|
public static final String BACK_PREFERENCE = "back_preference";
|
||||||
|
/* ExtraCore constant: The OPENGL version that should be exposed */
|
||||||
|
public static final String OPEN_GL_VERSION = "open_gl_version";
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,6 @@ public class LauncherPreferences {
|
|||||||
public static int PREF_CONTROL_BOTTOM_OFFSET = 0;
|
public static int PREF_CONTROL_BOTTOM_OFFSET = 0;
|
||||||
public static int PREF_CONTROL_LEFT_OFFSET = 0;
|
public static int PREF_CONTROL_LEFT_OFFSET = 0;
|
||||||
public static boolean PREF_SUSTAINED_PERFORMANCE = false;
|
public static boolean PREF_SUSTAINED_PERFORMANCE = false;
|
||||||
public static String PREF_GLES_SHRINK_HACK = "0";
|
|
||||||
public static boolean PREF_VIRTUAL_MOUSE_START = false;
|
public static boolean PREF_VIRTUAL_MOUSE_START = false;
|
||||||
public static boolean PREF_ARC_CAPES = false;
|
public static boolean PREF_ARC_CAPES = false;
|
||||||
public static boolean PREF_USE_ALTERNATE_SURFACE = true;
|
public static boolean PREF_USE_ALTERNATE_SURFACE = true;
|
||||||
@ -67,7 +66,6 @@ public class LauncherPreferences {
|
|||||||
PREF_CONTROL_BOTTOM_OFFSET = DEFAULT_PREF.getInt("controlBottomOffset", 0);
|
PREF_CONTROL_BOTTOM_OFFSET = DEFAULT_PREF.getInt("controlBottomOffset", 0);
|
||||||
PREF_CONTROL_LEFT_OFFSET = DEFAULT_PREF.getInt("controlLeftOffset", 0);
|
PREF_CONTROL_LEFT_OFFSET = DEFAULT_PREF.getInt("controlLeftOffset", 0);
|
||||||
PREF_SUSTAINED_PERFORMANCE = DEFAULT_PREF.getBoolean("sustainedPerformance", false);
|
PREF_SUSTAINED_PERFORMANCE = DEFAULT_PREF.getBoolean("sustainedPerformance", false);
|
||||||
PREF_GLES_SHRINK_HACK = DEFAULT_PREF.getString("gl4es_shrink_hack", "0");
|
|
||||||
PREF_VIRTUAL_MOUSE_START = DEFAULT_PREF.getBoolean("mouse_start", false);
|
PREF_VIRTUAL_MOUSE_START = DEFAULT_PREF.getBoolean("mouse_start", false);
|
||||||
PREF_ARC_CAPES = DEFAULT_PREF.getBoolean("arc_capes",false);
|
PREF_ARC_CAPES = DEFAULT_PREF.getBoolean("arc_capes",false);
|
||||||
PREF_USE_ALTERNATE_SURFACE = DEFAULT_PREF.getBoolean("alternate_surface", false);
|
PREF_USE_ALTERNATE_SURFACE = DEFAULT_PREF.getBoolean("alternate_surface", false);
|
||||||
|
@ -4,7 +4,6 @@ import static net.kdt.pojavlaunch.Architecture.ARCH_X86;
|
|||||||
import static net.kdt.pojavlaunch.Architecture.is64BitsDevice;
|
import static net.kdt.pojavlaunch.Architecture.is64BitsDevice;
|
||||||
import static net.kdt.pojavlaunch.Tools.LOCAL_RENDERER;
|
import static net.kdt.pojavlaunch.Tools.LOCAL_RENDERER;
|
||||||
import static net.kdt.pojavlaunch.Tools.currentDisplayMetrics;
|
import static net.kdt.pojavlaunch.Tools.currentDisplayMetrics;
|
||||||
import static net.kdt.pojavlaunch.prefs.LauncherPreferences.PREF_GLES_SHRINK_HACK;
|
|
||||||
|
|
||||||
import android.app.*;
|
import android.app.*;
|
||||||
import android.content.*;
|
import android.content.*;
|
||||||
@ -17,6 +16,8 @@ import com.oracle.dalvik.*;
|
|||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import net.kdt.pojavlaunch.*;
|
import net.kdt.pojavlaunch.*;
|
||||||
|
import net.kdt.pojavlaunch.extra.ExtraConstants;
|
||||||
|
import net.kdt.pojavlaunch.extra.ExtraCore;
|
||||||
import net.kdt.pojavlaunch.prefs.*;
|
import net.kdt.pojavlaunch.prefs.*;
|
||||||
import org.lwjgl.glfw.*;
|
import org.lwjgl.glfw.*;
|
||||||
|
|
||||||
@ -196,12 +197,12 @@ public class JREUtils {
|
|||||||
// On certain GLES drivers, overloading default functions shader hack fails, so disable it
|
// On certain GLES drivers, overloading default functions shader hack fails, so disable it
|
||||||
envMap.put("LIBGL_NOINTOVLHACK", "1");
|
envMap.put("LIBGL_NOINTOVLHACK", "1");
|
||||||
|
|
||||||
// The shrink hack can be enabled from the experimental settings
|
|
||||||
envMap.put("LIBGL_SHRINK", PREF_GLES_SHRINK_HACK);
|
|
||||||
|
|
||||||
// Fix white color on banner and sheep, since GL4ES 1.1.5
|
// Fix white color on banner and sheep, since GL4ES 1.1.5
|
||||||
envMap.put("LIBGL_NORMALIZE", "1");
|
envMap.put("LIBGL_NORMALIZE", "1");
|
||||||
|
|
||||||
|
// The OPEN GL version is changed according
|
||||||
|
envMap.put("LIBGL_ES", (String) ExtraCore.getValue(ExtraConstants.OPEN_GL_VERSION));
|
||||||
|
|
||||||
envMap.put("MESA_GLSL_CACHE_DIR", activity.getCacheDir().getAbsolutePath());
|
envMap.put("MESA_GLSL_CACHE_DIR", activity.getCacheDir().getAbsolutePath());
|
||||||
if (LOCAL_RENDERER != null) {
|
if (LOCAL_RENDERER != null) {
|
||||||
envMap.put("MESA_GL_VERSION_OVERRIDE", LOCAL_RENDERER.equals("opengles3_virgl")?"4.3":"4.6");
|
envMap.put("MESA_GL_VERSION_OVERRIDE", LOCAL_RENDERER.equals("opengles3_virgl")?"4.3":"4.6");
|
||||||
|
@ -0,0 +1,36 @@
|
|||||||
|
package net.kdt.pojavlaunch.utils;
|
||||||
|
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
|
import net.kdt.pojavlaunch.JMinecraftVersionList;
|
||||||
|
import net.kdt.pojavlaunch.extra.ExtraConstants;
|
||||||
|
import net.kdt.pojavlaunch.extra.ExtraCore;
|
||||||
|
import net.kdt.pojavlaunch.value.launcherprofiles.MinecraftProfile;
|
||||||
|
|
||||||
|
import java.sql.Date;
|
||||||
|
import java.text.ParseException;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
|
/** Class here to help with various stuff to help run lower versions smoothly */
|
||||||
|
public class OldVersionsUtils {
|
||||||
|
/** Lower minecraft versions fare better with opengl 1
|
||||||
|
* @param version The version about to be launched
|
||||||
|
*/
|
||||||
|
public static void selectOpenGlVersion(JMinecraftVersionList.Version version){
|
||||||
|
// 1309989600 is 2011-07-07 2011-07-07T22:00:00+00:00
|
||||||
|
String creationDate = version.releaseTime;
|
||||||
|
if(creationDate == null || creationDate.isEmpty()){
|
||||||
|
ExtraCore.setValue(ExtraConstants.OPEN_GL_VERSION, "2");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
String openGlVersion = new SimpleDateFormat("yyyy-MM-dd", Locale.ENGLISH).parse(creationDate.substring(0, creationDate.indexOf("T"))).before(new Date(2011-1900, 6, 7)) ? "1" : "2";
|
||||||
|
ExtraCore.setValue(ExtraConstants.OPEN_GL_VERSION, openGlVersion);
|
||||||
|
}catch (ParseException exception){
|
||||||
|
Log.e("OPENGL SELECTION", exception.toString());
|
||||||
|
ExtraCore.setValue(ExtraConstants.OPEN_GL_VERSION, "2");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user