Manual RAM allocator

This commit is contained in:
artdeell 2021-03-20 16:27:01 +03:00
parent 665de1767d
commit b7220184ab
7 changed files with 46 additions and 16 deletions

View file

@ -70,6 +70,22 @@ public final class Tools
public static final String LIBNAME_OPTIFINE = "optifine:OptiFine";
public static void launchMinecraft(final LoggableActivity ctx, MinecraftAccount profile, String versionName) throws Throwable {
ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo();
((ActivityManager)ctx.getSystemService(Context.ACTIVITY_SERVICE)).getMemoryInfo(mi);
if(LauncherPreferences.PREF_RAM_ALLOCATION > (mi.availMem/1048576L)) {
ctx.runOnUiThread(new Runnable() {
@Override
public void run() {
androidx.appcompat.app.AlertDialog.Builder b = new androidx.appcompat.app.AlertDialog.Builder(ctx)
.setMessage(ctx.getString(R.string.memory_warning_msg,(mi.availMem/1048576L),LauncherPreferences.PREF_RAM_ALLOCATION))
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {}
});
b.show();
}
});
}
JMinecraftVersionList.Version versionInfo = Tools.getVersionInfo(null,versionName);
PerVersionConfig.update();
PerVersionConfig.VersionConfig pvcConfig = PerVersionConfig.configMap.get(versionName);