Add more conditions to the pvc migrator

This commit is contained in:
SerpentSpirale 2022-04-03 22:44:54 +02:00
parent 1e18827a15
commit 44baff916d

View File

@ -399,6 +399,7 @@ public class PojavLoginActivity extends BaseActivity {
} }
} }
} }
private void migrateToProfiles() { private void migrateToProfiles() {
try { try {
if(!PerVersionConfig.exists()) return; if(!PerVersionConfig.exists()) return;
@ -407,16 +408,22 @@ public class PojavLoginActivity extends BaseActivity {
if(PerVersionConfig.erase()) { if(PerVersionConfig.erase()) {
for (String version : PerVersionConfig.configMap.keySet()) { for (String version : PerVersionConfig.configMap.keySet()) {
PerVersionConfig.VersionConfig config = PerVersionConfig.configMap.get(version); PerVersionConfig.VersionConfig config = PerVersionConfig.configMap.get(version);
if (config != null) { if(config == null) continue; // Skip the version
MinecraftProfile profile = new MinecraftProfile(); // Replaced by gl4es_extra
profile.lastVersionId = version; if(config.renderer.contains("opengles")) config.renderer = null;
profile.name = getString(R.string.migrated_profile_str, version); if(config.renderer == null && config.gamePath == null &&
profile.pojavRendererName = config.renderer; config.jvmArgs == null && config.selectedRuntime == null){
profile.gameDir = config.gamePath; continue; // Empty pvc, skip it.
profile.javaDir = Tools.LAUNCHERPROFILES_RTPREFIX + config.selectedRuntime;
profile.javaArgs = config.jvmArgs;
LauncherProfiles.mainProfileJson.profiles.put("pvc-migrated-" + version, profile);
} }
MinecraftProfile profile = new MinecraftProfile();
profile.lastVersionId = version;
profile.name = getString(R.string.migrated_profile_str, version);
profile.pojavRendererName = config.renderer;
profile.gameDir = config.gamePath;
profile.javaDir = Tools.LAUNCHERPROFILES_RTPREFIX + config.selectedRuntime;
profile.javaArgs = config.jvmArgs;
LauncherProfiles.mainProfileJson.profiles.put("pvc-migrated-" + version, profile);
} }
LauncherProfiles.update(); LauncherProfiles.update();
}else{ }else{
@ -426,6 +433,7 @@ public class PojavLoginActivity extends BaseActivity {
Log.e("ProfileMigrator","Failed to migrate!",e); Log.e("ProfileMigrator","Failed to migrate!",e);
} }
} }
private boolean installRuntimeAutomatically(AssetManager am, boolean otherRuntimesAvailable) { private boolean installRuntimeAutomatically(AssetManager am, boolean otherRuntimesAvailable) {
/* Check if JRE is included */ /* Check if JRE is included */
String rt_version = null; String rt_version = null;