mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2026-04-18 16:46:58 -04:00
Tweak(jvm arg): take control of -XX:ActiveProcessorCount
Setting it ourselves guarantee a better experience by default
This commit is contained in:
@@ -155,7 +155,7 @@ public class LauncherPreferences {
|
||||
|
||||
/// Find a correct resolution for the device
|
||||
///
|
||||
/// Some devices are shipped with ridiculously high resolution, which can cause performance issues
|
||||
/// Some devices are shipped with a ridiculously high resolution, which can cause performance issues
|
||||
/// This function will try to find a resolution that is good enough for the device
|
||||
private static int findBestResolution(Context context, boolean isDevicePowerful) {
|
||||
DisplayMetrics metrics = context.getResources().getDisplayMetrics();
|
||||
|
||||
@@ -295,6 +295,8 @@ public class JREUtils {
|
||||
purgeArg(userArgs, "-Dorg.lwjgl.opengl.libname");
|
||||
// Don't let the user specify a custom Freetype library (as the user is unlikely to specify a version compiled for Android)
|
||||
purgeArg(userArgs, "-Dorg.lwjgl.freetype.libname");
|
||||
// Overridden by us to specify the exact number of cores that the android system has
|
||||
purgeArg(userArgs, "-XX:ActiveProcessorCount");
|
||||
|
||||
//Add automatically generated args
|
||||
userArgs.add("-Xms" + LauncherPreferences.PREF_RAM_ALLOCATION + "M");
|
||||
@@ -305,6 +307,9 @@ public class JREUtils {
|
||||
// that we ship with Java (since it may be older than what's needed)
|
||||
userArgs.add("-Dorg.lwjgl.freetype.libname="+ NATIVE_LIB_DIR+"/libfreetype.so");
|
||||
|
||||
// Some phones are not using the right number of cores, fix that
|
||||
userArgs.add("-XX:ActiveProcessorCount=" + java.lang.Runtime.getRuntime().availableProcessors());
|
||||
|
||||
userArgs.addAll(JVMArgs);
|
||||
activity.runOnUiThread(() -> Toast.makeText(activity, activity.getString(R.string.autoram_info_msg,LauncherPreferences.PREF_RAM_ALLOCATION), Toast.LENGTH_SHORT).show());
|
||||
System.out.println(JVMArgs);
|
||||
|
||||
Reference in New Issue
Block a user