Ass support for adoptable storage, let me use my 256 GB !

This commit is contained in:
SerpentSpirale 2021-08-19 11:58:01 +02:00
parent f7b80d5c52
commit a477a58b4e
2 changed files with 17 additions and 2 deletions

View File

@ -42,8 +42,8 @@ public final class Tools {
public static final String URL_HOME = "https://pojavlauncherteam.github.io/PojavLauncher"; public static final String URL_HOME = "https://pojavlauncherteam.github.io/PojavLauncher";
public static String DIR_DATA = "/data/data/" + BuildConfig.APPLICATION_ID; public static String DIR_DATA; //Initialized later to get context
public static String MULTIRT_HOME = DIR_DATA+"/runtimes"; public static String MULTIRT_HOME;
public static String LOCAL_RENDERER = null; public static String LOCAL_RENDERER = null;
public static int DEVICE_ARCHITECTURE; public static int DEVICE_ARCHITECTURE;
@ -71,6 +71,18 @@ public final class Tools {
public static final String LIBNAME_OPTIFINE = "optifine:OptiFine"; public static final String LIBNAME_OPTIFINE = "optifine:OptiFine";
/**
* Since some constant requires the use of the Context object
* You can call this function to initialize them.
* Any value (in)directly dependant on DIR_DATA should be set only here.
*/
public static void initContextConstants(Context ctx){
DIR_DATA = ctx.getFilesDir().getParent();
MULTIRT_HOME = DIR_DATA+"/runtimes";
}
public static void launchMinecraft(final LoggableActivity ctx, MinecraftAccount profile, String versionName) throws Throwable { public static void launchMinecraft(final LoggableActivity ctx, MinecraftAccount profile, String versionName) throws Throwable {
ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo(); ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo();
((ActivityManager)ctx.getSystemService(Context.ACTIVITY_SERVICE)).getMemoryInfo(mi); ((ActivityManager)ctx.getSystemService(Context.ACTIVITY_SERVICE)).getMemoryInfo(mi);

View File

@ -30,6 +30,9 @@ public class LauncherPreferences
public static int PREF_RAM_ALLOCATION; public static int PREF_RAM_ALLOCATION;
public static String PREF_DEFAULT_RUNTIME; public static String PREF_DEFAULT_RUNTIME;
public static void loadPreferences(Context ctx) { public static void loadPreferences(Context ctx) {
//Required for the data folder.
Tools.initContextConstants(ctx);
PREF_RENDERER = DEFAULT_PREF.getString("renderer", "opengles2"); PREF_RENDERER = DEFAULT_PREF.getString("renderer", "opengles2");
PREF_BUTTONSIZE = DEFAULT_PREF.getInt("buttonscale", 100); PREF_BUTTONSIZE = DEFAULT_PREF.getInt("buttonscale", 100);