A lot of changes

- Force profiles, no more profiles on/off switch!
- (probably partially) Conventionalize all profile changes
- Rename most variables for the changes to look nice
- Squash a couple null checks
- Separate cache from adapter and change how it works
- Don't keep Context
This commit is contained in:
artdeell 2022-03-17 19:03:38 +03:00
parent a4eabb69fc
commit 965cad4fd7
11 changed files with 206 additions and 274 deletions

View file

@ -107,14 +107,14 @@ public abstract class BaseLauncherActivity extends BaseActivity {
} else if (canBack) { } else if (canBack) {
v.setEnabled(false); v.setEnabled(false);
mTask = new MinecraftDownloaderTask(this); mTask = new MinecraftDownloaderTask(this);
if(LauncherPreferences.PREF_ENABLE_PROFILES) {
LauncherProfiles.update(); LauncherProfiles.update();
if (LauncherProfiles.mainProfileJson != null && LauncherProfiles.mainProfileJson.profiles != null && LauncherProfiles.mainProfileJson.profiles.containsKey(mProfile.selectedProfile + "")) { if (LauncherProfiles.mainProfileJson != null && LauncherProfiles.mainProfileJson.profiles != null && LauncherProfiles.mainProfileJson.profiles.containsKey(mProfile.selectedProfile + "")) {
MinecraftProfile prof = LauncherProfiles.mainProfileJson.profiles.get(mProfile.selectedProfile + ""); MinecraftProfile prof = LauncherProfiles.mainProfileJson.profiles.get(mProfile.selectedProfile + "");
if (prof != null && prof.lastVersionId != null) { if (prof != null && prof.lastVersionId != null) {
if (mProfile.accessToken.equals("0")) { if (mProfile.accessToken.equals("0")) {
String versionId = getVersionId(prof.lastVersionId);
File verJsonFile = new File(Tools.DIR_HOME_VERSION, File verJsonFile = new File(Tools.DIR_HOME_VERSION,
mProfile.selectedVersion + "/" + mProfile.selectedVersion + ".json"); versionId + "/" + versionId + ".json");
if (verJsonFile.exists()) { if (verJsonFile.exists()) {
mTask.onPostExecute(null); mTask.onPostExecute(null);
} else { } else {
@ -124,14 +124,11 @@ public abstract class BaseLauncherActivity extends BaseActivity {
.setPositiveButton(android.R.string.ok, null) .setPositiveButton(android.R.string.ok, null)
.show(); .show();
} }
} }else {
mTask.execute(getVersionId(prof.lastVersionId)); mTask.execute(getVersionId(prof.lastVersionId));
} }
} }
}else{
mTask.execute(mProfile.selectedVersion);
} }
} }
} }
@ -196,7 +193,6 @@ public abstract class BaseLauncherActivity extends BaseActivity {
@Override @Override
protected void onPause() { protected void onPause() {
super.onPause(); super.onPause();
if((!LauncherPreferences.PREF_ENABLE_PROFILES) && versionListener != null) ExtraCore.removeExtraListenerFromValue("lac_version_list",versionListener);
} }
public static void updateVersionSpinner(Context ctx, ArrayList<String> value, Spinner mVersionSelector, String defaultSelection) { public static void updateVersionSpinner(Context ctx, ArrayList<String> value, Spinner mVersionSelector, String defaultSelection) {
@ -213,22 +209,6 @@ public abstract class BaseLauncherActivity extends BaseActivity {
protected void onResume(){ protected void onResume(){
super.onResume(); super.onResume();
new RefreshVersionListTask(this).execute(); new RefreshVersionListTask(this).execute();
if(!LauncherPreferences.PREF_ENABLE_PROFILES) {
ArrayList<String> vlst = (ArrayList<String>) ExtraCore.getValue("lac_version_list");
if(vlst != null) {
setupVersionSelector();
updateVersionSpinner(this, vlst, mVersionSelector, mProfile.selectedVersion);
}
versionListener = (key, value) -> {
if(value != null) {
setupVersionSelector();
updateVersionSpinner(this, value, mVersionSelector, mProfile.selectedVersion);
}
return false;
};
ExtraCore.addExtraListener("lac_version_list",versionListener);
}
if(listRefreshListener != null) { if(listRefreshListener != null) {
LauncherPreferences.DEFAULT_PREF.unregisterOnSharedPreferenceChangeListener(listRefreshListener); LauncherPreferences.DEFAULT_PREF.unregisterOnSharedPreferenceChangeListener(listRefreshListener);
} }
@ -243,17 +223,6 @@ public abstract class BaseLauncherActivity extends BaseActivity {
} }
}; };
LauncherPreferences.DEFAULT_PREF.registerOnSharedPreferenceChangeListener(listRefreshListener); LauncherPreferences.DEFAULT_PREF.registerOnSharedPreferenceChangeListener(listRefreshListener);
if(profileEnableListener != null) {
LauncherPreferences.DEFAULT_PREF.unregisterOnSharedPreferenceChangeListener(profileEnableListener);
}
profileEnableListener = ((sharedPreferences, key) -> {
if(key.equals("enable_profiles")) {
LauncherPreferences.PREF_ENABLE_PROFILES = sharedPreferences.getBoolean("enable_profiles",false);
this.recreate();
profileEnableListener = null;
}
});
LauncherPreferences.DEFAULT_PREF.registerOnSharedPreferenceChangeListener(profileEnableListener);
System.out.println("call to onResume"); System.out.println("call to onResume");
final int uiOptions = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION; final int uiOptions = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
final View decorView = getWindow().getDecorView(); final View decorView = getWindow().getDecorView();

View file

@ -27,7 +27,6 @@ import net.kdt.pojavlaunch.customcontrols.*;
import net.kdt.pojavlaunch.multirt.MultiRTUtils; import net.kdt.pojavlaunch.multirt.MultiRTUtils;
import net.kdt.pojavlaunch.prefs.*; import net.kdt.pojavlaunch.prefs.*;
import net.kdt.pojavlaunch.profiles.ProfileAdapter;
import net.kdt.pojavlaunch.utils.*; import net.kdt.pojavlaunch.utils.*;
import net.kdt.pojavlaunch.value.*; import net.kdt.pojavlaunch.value.*;
import net.kdt.pojavlaunch.value.launcherprofiles.LauncherProfiles; import net.kdt.pojavlaunch.value.launcherprofiles.LauncherProfiles;
@ -50,6 +49,7 @@ public class BaseMainActivity extends BaseActivity {
private LoggerView loggerView; private LoggerView loggerView;
MinecraftAccount mProfile; MinecraftAccount mProfile;
MinecraftProfile minecraftProfile;
private DrawerLayout drawerLayout; private DrawerLayout drawerLayout;
private NavigationView navDrawer; private NavigationView navDrawer;
@ -71,44 +71,29 @@ public class BaseMainActivity extends BaseActivity {
loggerView = findViewById(R.id.mainLoggerView); loggerView = findViewById(R.id.mainLoggerView);
mProfile = PojavProfile.getCurrentProfileContent(this); mProfile = PojavProfile.getCurrentProfileContent(this);
String runtime = LauncherPreferences.PREF_DEFAULT_RUNTIME; minecraftProfile = LauncherProfiles.mainProfileJson.profiles.get(mProfile.selectedProfile);
if(!LauncherPreferences.PREF_ENABLE_PROFILES) { if(minecraftProfile == null) {
mVersionInfo = Tools.getVersionInfo(null, mProfile.selectedVersion);
PerVersionConfig.update();
PerVersionConfig.VersionConfig config = PerVersionConfig.configMap.get(mProfile.selectedVersion);
if(config != null) {
if(config.selectedRuntime != null) {
if(MultiRTUtils.forceReread(config.selectedRuntime).versionString != null) {
runtime = config.selectedRuntime;
}
}
if(config.renderer != null) {
Tools.LOCAL_RENDERER = config.renderer;
}
}
}else{
LauncherProfiles.update();
MinecraftProfile prof = LauncherProfiles.mainProfileJson.profiles.get(mProfile.selectedProfile);
if(prof == null) {
Toast.makeText(this,"Attempted to launch nonexistent profile",Toast.LENGTH_SHORT).show(); Toast.makeText(this,"Attempted to launch nonexistent profile",Toast.LENGTH_SHORT).show();
finish(); finish();
return; return;
} }
String runtime = LauncherPreferences.PREF_DEFAULT_RUNTIME;
LauncherProfiles.update();
mVersionInfo = Tools.getVersionInfo(null, BaseLauncherActivity.getVersionId( mVersionInfo = Tools.getVersionInfo(null, BaseLauncherActivity.getVersionId(
prof.lastVersionId)); minecraftProfile.lastVersionId));
if(prof.javaDir != null && prof.javaDir.startsWith(Tools.LAUNCHERPROFILES_RTPREFIX)) { if(minecraftProfile.javaDir != null && minecraftProfile.javaDir.startsWith(Tools.LAUNCHERPROFILES_RTPREFIX)) {
String runtimeName = prof.javaDir.substring(Tools.LAUNCHERPROFILES_RTPREFIX.length()); String runtimeName = minecraftProfile.javaDir.substring(Tools.LAUNCHERPROFILES_RTPREFIX.length());
if(MultiRTUtils.forceReread(runtimeName).versionString != null) { if(MultiRTUtils.forceReread(runtimeName).versionString != null) {
runtime = runtimeName; runtime = runtimeName;
} }
} }
if(prof.__P_renderer_name != null) { if(minecraftProfile.pojavRendererName != null) {
Log.i("RdrDebug","__P_renderer="+prof.__P_renderer_name); Log.i("RdrDebug","__P_renderer="+minecraftProfile.pojavRendererName);
Tools.LOCAL_RENDERER = prof.__P_renderer_name; Tools.LOCAL_RENDERER = minecraftProfile.pojavRendererName;
}
} }
setTitle("Minecraft " + mProfile.selectedVersion); setTitle("Minecraft " + minecraftProfile.lastVersionId);
MultiRTUtils.setRuntimeNamed(this,runtime); MultiRTUtils.setRuntimeNamed(this,runtime);
// Minecraft 1.13+ // Minecraft 1.13+
@ -231,14 +216,10 @@ public class BaseMainActivity extends BaseActivity {
"" : " (" + mVersionInfo.inheritsFrom + ")")); "" : " (" + mVersionInfo.inheritsFrom + ")"));
JREUtils.redirectAndPrintJRELog(this); JREUtils.redirectAndPrintJRELog();
if(!LauncherPreferences.PREF_ENABLE_PROFILES){
Tools.launchMinecraft(this, mProfile, mProfile.selectedVersion);
}else{
LauncherProfiles.update(); LauncherProfiles.update();
Tools.launchMinecraft(this, mProfile, BaseLauncherActivity.getVersionId( Tools.launchMinecraft(this, mProfile, BaseLauncherActivity.getVersionId(
LauncherProfiles.mainProfileJson.profiles.get(mProfile.selectedProfile).lastVersionId)); minecraftProfile.lastVersionId));
}
} }
private void checkJavaArgsIsLaunchable(String jreVersion) throws Throwable { private void checkJavaArgsIsLaunchable(String jreVersion) throws Throwable {

View file

@ -41,6 +41,7 @@ import net.kdt.pojavlaunch.prefs.PerVersionConfigDialog;
import net.kdt.pojavlaunch.prefs.screens.LauncherPreferenceFragment; import net.kdt.pojavlaunch.prefs.screens.LauncherPreferenceFragment;
import net.kdt.pojavlaunch.profiles.ProfileAdapter; import net.kdt.pojavlaunch.profiles.ProfileAdapter;
import net.kdt.pojavlaunch.profiles.ProfileEditor; import net.kdt.pojavlaunch.profiles.ProfileEditor;
import net.kdt.pojavlaunch.profiles.ProfileIconCache;
import net.kdt.pojavlaunch.value.MinecraftAccount; import net.kdt.pojavlaunch.value.MinecraftAccount;
import net.kdt.pojavlaunch.value.launcherprofiles.LauncherProfiles; import net.kdt.pojavlaunch.value.launcherprofiles.LauncherProfiles;
@ -91,7 +92,7 @@ public class PojavLauncherActivity extends BaseLauncherActivity
protected void onDestroy() { protected void onDestroy() {
ExtraCore.removeExtraListenerFromValue("back_preference", backPreferenceListener); ExtraCore.removeExtraListenerFromValue("back_preference", backPreferenceListener);
super.onDestroy(); super.onDestroy();
ProfileAdapter.clearIconCache(); ProfileIconCache.clearIconCache();
Log.i("LauncherActivity","Destroyed!"); Log.i("LauncherActivity","Destroyed!");
} }
@ -191,32 +192,27 @@ public class PojavLauncherActivity extends BaseLauncherActivity
setupBasicList(this); setupBasicList(this);
//mAvailableVersions; //mAvailableVersions;
if(!LauncherPreferences.PREF_ENABLE_PROFILES) { ProfileAdapter profileAdapter = new ProfileAdapter(this);
ArrayAdapter<String> adapterVer = new ArrayAdapter<>(this, android.R.layout.simple_spinner_item, basicVersionList); ProfileEditor editor = new ProfileEditor(this,(name, isNew, deleting)->{
adapterVer.setDropDownViewResource(android.R.layout.simple_list_item_single_choice);
mVersionSelector.setAdapter(adapterVer);
}else{
ProfileAdapter pad = new ProfileAdapter(this);
ProfileEditor dialog = new ProfileEditor(this,(name, isNew, deleting)->{
LauncherProfiles.update(); LauncherProfiles.update();
if(isNew) { if(isNew) {
mVersionSelector.setSelection(pad.resolveProfileIndex(name)); mVersionSelector.setSelection(profileAdapter.resolveProfileIndex(name));
} }
if(deleting) { if(deleting) {
mVersionSelector.setSelection(0); mVersionSelector.setSelection(0);
} }
pad.notifyDataSetChanged(); profileAdapter.notifyDataSetChanged();
}); });
mVersionSelector.setOnLongClickListener((v)->dialog.show(mProfile.selectedProfile)); mVersionSelector.setOnLongClickListener((v)->editor.show(mProfile.selectedProfile));
mVersionSelector.setAdapter(pad); mVersionSelector.setAdapter(profileAdapter);
mVersionSelector.setSelection(pad.resolveProfileIndex(mProfile.selectedProfile)); mVersionSelector.setSelection(profileAdapter.resolveProfileIndex(mProfile.selectedProfile));
mVersionSelector.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener(){ mVersionSelector.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener(){
@Override @Override
public void onItemSelected(AdapterView<?> p1, View p2, int p3, long p4) public void onItemSelected(AdapterView<?> p1, View p2, int p3, long p4)
{ {
String profileName = p1.getItemAtPosition(p3).toString(); String profileName = p1.getItemAtPosition(p3).toString();
if(profileName.equals(ProfileAdapter.CREATE_PROFILE_MAGIC)) { if(profileName.equals(ProfileAdapter.CREATE_PROFILE_MAGIC)) {
dialog.show(profileName); editor.show(profileName);
mVersionSelector.setSelection(0); mVersionSelector.setSelection(0);
}else { }else {
mProfile.selectedProfile = p1.getItemAtPosition(p3).toString(); mProfile.selectedProfile = p1.getItemAtPosition(p3).toString();
@ -236,7 +232,6 @@ public class PojavLauncherActivity extends BaseLauncherActivity
// TODO: Implement this method // TODO: Implement this method
} }
}); });
}
// //
statusIsLaunching(false); statusIsLaunching(false);

View file

@ -120,23 +120,14 @@ public final class Tools {
JMinecraftVersionList.Version versionInfo = Tools.getVersionInfo(null,versionName); JMinecraftVersionList.Version versionInfo = Tools.getVersionInfo(null,versionName);
String gamedirPath = Tools.DIR_GAME_NEW; String gamedirPath = Tools.DIR_GAME_NEW;
if(!LauncherPreferences.PREF_ENABLE_PROFILES) {
PerVersionConfig.update();
PerVersionConfig.VersionConfig pvcConfig = PerVersionConfig.configMap.get(versionName);
if (pvcConfig != null && pvcConfig.gamePath != null && !pvcConfig.gamePath.isEmpty())
gamedirPath = pvcConfig.gamePath;
if (pvcConfig != null && pvcConfig.jvmArgs != null && !pvcConfig.jvmArgs.isEmpty())
LauncherPreferences.PREF_CUSTOM_JAVA_ARGS = pvcConfig.jvmArgs;
}else{
if(activity instanceof BaseMainActivity) { if(activity instanceof BaseMainActivity) {
LauncherProfiles.update(); LauncherProfiles.update();
MinecraftProfile prof = LauncherProfiles.mainProfileJson.profiles.get(((BaseMainActivity)activity).mProfile.selectedProfile); MinecraftProfile minecraftProfile = ((BaseMainActivity)activity).minecraftProfile;
if(prof == null) throw new Exception("Launching empty Profile"); if(minecraftProfile == null) throw new Exception("Launching empty Profile");
if(prof.gameDir != null && !prof.gameDir.isEmpty()) if(minecraftProfile.gameDir != null && !minecraftProfile.gameDir.isEmpty())
gamedirPath = prof.gameDir; gamedirPath = minecraftProfile.gameDir;
if(prof.javaArgs != null && !prof.javaArgs.isEmpty()) if(minecraftProfile.javaArgs != null && !minecraftProfile.javaArgs.isEmpty())
LauncherPreferences.PREF_CUSTOM_JAVA_ARGS = prof.javaArgs; LauncherPreferences.PREF_CUSTOM_JAVA_ARGS = minecraftProfile.javaArgs;
}
} }
PojavLoginActivity.disableSplash(gamedirPath); PojavLoginActivity.disableSplash(gamedirPath);
String[] launchArgs = getMinecraftArgs(profile, versionInfo, gamedirPath); String[] launchArgs = getMinecraftArgs(profile, versionInfo, gamedirPath);

View file

@ -34,7 +34,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 boolean PREF_ENABLE_PROFILES = true;
public static String PREF_GLES_SHRINK_HACK = "0"; public static String PREF_GLES_SHRINK_HACK = "0";
public static boolean PREF_VBO_DISABLE_HACK = false; public static boolean PREF_VBO_DISABLE_HACK = false;
public static boolean PREF_VIRTUAL_MOUSE_START = false; public static boolean PREF_VIRTUAL_MOUSE_START = false;
@ -71,7 +70,6 @@ public class LauncherPreferences
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_GLES_SHRINK_HACK = DEFAULT_PREF.getString("gl4es_shrink_hack", "0");
PREF_VBO_DISABLE_HACK = DEFAULT_PREF.getBoolean("vbo_disable_hack", false); PREF_VBO_DISABLE_HACK = DEFAULT_PREF.getBoolean("vbo_disable_hack", false);
PREF_ENABLE_PROFILES = DEFAULT_PREF.getBoolean("enable_profiles", false);
PREF_VIRTUAL_MOUSE_START = DEFAULT_PREF.getBoolean("mouse_start", false); PREF_VIRTUAL_MOUSE_START = DEFAULT_PREF.getBoolean("mouse_start", false);
PREF_OPENGL_VERSION_HACK = DEFAULT_PREF.getBoolean("gles_version_hack", false); PREF_OPENGL_VERSION_HACK = DEFAULT_PREF.getBoolean("gles_version_hack", false);
PREF_ARC_CAPES = DEFAULT_PREF.getBoolean("arc_capes",false); PREF_ARC_CAPES = DEFAULT_PREF.getBoolean("arc_capes",false);

View file

@ -27,14 +27,12 @@ import java.util.Map;
*/ */
public class ProfileAdapter extends BaseAdapter { public class ProfileAdapter extends BaseAdapter {
Map<String, MinecraftProfile> profiles; Map<String, MinecraftProfile> profiles;
ArrayList<DataSetObserver> observers = new ArrayList<>();
static final Map<String, Bitmap> iconCache = new HashMap<>();
static final String BASE64_PNG_HEADER = "data:image/png;base64,";
public static final String CREATE_PROFILE_MAGIC = "___extra____profile-create"; public static final String CREATE_PROFILE_MAGIC = "___extra____profile-create";
static final MinecraftProfile DUMMY = new MinecraftProfile(); static final MinecraftProfile DUMMY = new MinecraftProfile();
static MinecraftProfile CREATE_PROFILE; static MinecraftProfile CREATE_PROFILE;
List<String> profileList; List<String> profileList;
public ProfileAdapter(Context ctx) { public ProfileAdapter(Context context) {
ProfileIconCache.initDefault(context);
LauncherProfiles.update(); LauncherProfiles.update();
profiles = new HashMap<>(LauncherProfiles.mainProfileJson.profiles); profiles = new HashMap<>(LauncherProfiles.mainProfileJson.profiles);
if(CREATE_PROFILE == null) { if(CREATE_PROFILE == null) {
@ -45,8 +43,7 @@ public class ProfileAdapter extends BaseAdapter {
profileList = new ArrayList<>(Arrays.asList(profiles.keySet().toArray(new String[0]))); profileList = new ArrayList<>(Arrays.asList(profiles.keySet().toArray(new String[0])));
profileList.add(ProfileAdapter.CREATE_PROFILE_MAGIC); profileList.add(ProfileAdapter.CREATE_PROFILE_MAGIC);
profiles.put(CREATE_PROFILE_MAGIC, CREATE_PROFILE); profiles.put(CREATE_PROFILE_MAGIC, CREATE_PROFILE);
if(!iconCache.containsKey(null))
iconCache.put(null,BitmapFactory.decodeResource(ctx.getResources(),R.drawable.ic_menu_java));
} }
/* /*
@ -57,15 +54,6 @@ public class ProfileAdapter extends BaseAdapter {
public int getCount() { public int getCount() {
return profileList.size(); return profileList.size();
} }
public static void clearIconCache() {
for(String s : iconCache.keySet()) {
Bitmap bmp = iconCache.get(s);
if(bmp != null) {
bmp.recycle();
}
}
iconCache.clear();
}
/* /*
* Gets the profile at a given index * Gets the profile at a given index
* @param position index to retreive * @param position index to retreive
@ -115,35 +103,27 @@ public class ProfileAdapter extends BaseAdapter {
return v; return v;
} }
public void setViewProfile(View v, String nm) { public void setViewProfile(View v, String nm) {
MinecraftProfile prof = profiles.get(nm); MinecraftProfile minecraftProfile = profiles.get(nm);
if(prof == null) prof = DUMMY; if(minecraftProfile == null) minecraftProfile = DUMMY;
Bitmap cachedIcon = iconCache.get(nm); Bitmap cachedIcon = ProfileIconCache.getCachedIcon(nm);
ImageView iconView = v.findViewById(R.id.vprof_icon_view); ImageView iconView = v.findViewById(R.id.vprof_icon_view);
if(cachedIcon == null && prof.icon != null) { if(cachedIcon == null) {
if (prof.icon.startsWith(BASE64_PNG_HEADER)) { cachedIcon = ProfileIconCache.tryResolveIcon(nm,minecraftProfile.icon);
byte[] pngBytes = Base64.decode(prof.icon.substring(BASE64_PNG_HEADER.length()), Base64.DEFAULT);
cachedIcon = BitmapFactory.decodeByteArray(pngBytes,0,pngBytes.length);
iconCache.put(nm,cachedIcon);
}else{
Log.i("IconParser","Unsupported icon: "+prof.icon);
cachedIcon = iconCache.get(null);
} }
}
iconView.setImageBitmap(cachedIcon); iconView.setImageBitmap(cachedIcon);
if(prof.name != null && !prof.name.isEmpty()) if(minecraftProfile.name != null && !minecraftProfile.name.isEmpty())
((TextView)v.findViewById(R.id.vprof_profile_name_view)).setText(prof.name); ((TextView)v.findViewById(R.id.vprof_profile_name_view)).setText(minecraftProfile.name);
else else
((TextView)v.findViewById(R.id.vprof_profile_name_view)).setText(R.string.unnamed); ((TextView)v.findViewById(R.id.vprof_profile_name_view)).setText(R.string.unnamed);
TextView tv = v.findViewById(R.id.vprof_version_id_view); TextView tv = v.findViewById(R.id.vprof_version_id_view);
if(prof.lastVersionId != null) switch (prof.lastVersionId) { if(minecraftProfile.lastVersionId != null) switch (minecraftProfile.lastVersionId) {
case "latest-release": case "latest-release":
tv.setText(R.string.profiles_latest_release); tv.setText(R.string.profiles_latest_release);
case "latest-snapshot": case "latest-snapshot":
tv.setText(R.string.profiles_latest_snapshot); tv.setText(R.string.profiles_latest_snapshot);
default: default:
tv.setText(prof.lastVersionId); tv.setText(minecraftProfile.lastVersionId);
} else tv.setText(android.R.string.unknownName); } else tv.setText(android.R.string.unknownName);
} }

View file

@ -1,9 +1,11 @@
package net.kdt.pojavlaunch.profiles; package net.kdt.pojavlaunch.profiles;
import android.app.Activity;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.content.Context; import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.graphics.Bitmap;
import android.os.Handler;
import android.os.Looper;
import android.util.Log; import android.util.Log;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
@ -25,6 +27,7 @@ import net.kdt.pojavlaunch.multirt.MultiRTUtils;
import net.kdt.pojavlaunch.multirt.RTSpinnerAdapter; import net.kdt.pojavlaunch.multirt.RTSpinnerAdapter;
import net.kdt.pojavlaunch.value.launcherprofiles.LauncherProfiles; import net.kdt.pojavlaunch.value.launcherprofiles.LauncherProfiles;
import net.kdt.pojavlaunch.value.launcherprofiles.MinecraftProfile; import net.kdt.pojavlaunch.value.launcherprofiles.MinecraftProfile;
import net.kdt.pojavlaunch.multirt.Runtime;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
@ -34,37 +37,37 @@ import java.util.Map;
import java.util.UUID; import java.util.UUID;
public class ProfileEditor implements ExtraListener<ArrayList<String>> { public class ProfileEditor implements ExtraListener<ArrayList<String>> {
View mainView; private final View mainView;
TextView profileNameView; private final TextView profileNameView;
ImageView profileIconView; private final ImageView profileIconView;
Spinner versionSpinner; private final Spinner versionSpinner;
Spinner javaRuntimeSpinner; private final Spinner javaRuntimeSpinner;
Spinner rendererSpinner; private final Spinner rendererSpinner;
List<MultiRTUtils.Runtime> runtimes; private final List<String> renderNames;
List<String> renderNames; private final AlertDialog dialog;
AlertDialog dialog; private String selectedVersionId;
Context context; private String editingProfile;
String selectedVersionId; private final EditSaveCallback editSaveCallback;
String editingProfile; private final Handler uiThreadHandler;
EditSaveCallback cb;
public static MinecraftProfile generateTemplate() { public static MinecraftProfile generateTemplate() {
MinecraftProfile TEMPLATE = new MinecraftProfile(); MinecraftProfile TEMPLATE = new MinecraftProfile();
TEMPLATE.name = "New"; TEMPLATE.name = "New";
TEMPLATE.lastVersionId = "latest-release"; TEMPLATE.lastVersionId = "latest-release";
return TEMPLATE; return TEMPLATE;
} }
public ProfileEditor(Context _ctx, EditSaveCallback cb) { public ProfileEditor(Context _ctx, EditSaveCallback editSaveCallback) {
context = _ctx; this.editSaveCallback = editSaveCallback;
this.cb = cb; uiThreadHandler = new Handler(Looper.getMainLooper());
LayoutInflater infl = LayoutInflater.from(_ctx); LayoutInflater inflater = LayoutInflater.from(_ctx);
mainView = infl.inflate(R.layout.version_profile_editor,null); mainView = inflater.inflate(R.layout.version_profile_editor,null);
AlertDialog.Builder bldr = new AlertDialog.Builder(_ctx); AlertDialog.Builder builder = new AlertDialog.Builder(_ctx);
bldr.setView(mainView); builder.setView(mainView);
profileNameView = mainView.findViewById(R.id.vprof_editior_profile_name); profileNameView = mainView.findViewById(R.id.vprof_editior_profile_name);
versionSpinner = mainView.findViewById(R.id.vprof_editor_version_spinner); versionSpinner = mainView.findViewById(R.id.vprof_editor_version_spinner);
javaRuntimeSpinner = mainView.findViewById(R.id.vprof_editor_spinner_runtime); javaRuntimeSpinner = mainView.findViewById(R.id.vprof_editor_spinner_runtime);
rendererSpinner = mainView.findViewById(R.id.vprof_editor_profile_renderer); rendererSpinner = mainView.findViewById(R.id.vprof_editor_profile_renderer);
{ {
Context context = rendererSpinner.getContext();
List<String> renderList = new ArrayList<>(); List<String> renderList = new ArrayList<>();
Collections.addAll(renderList, context.getResources().getStringArray(R.array.renderer)); Collections.addAll(renderList, context.getResources().getStringArray(R.array.renderer));
renderList.add("Default"); renderList.add("Default");
@ -72,60 +75,58 @@ public class ProfileEditor implements ExtraListener<ArrayList<String>> {
rendererSpinner.setAdapter(new ArrayAdapter<>(context, android.R.layout.simple_spinner_dropdown_item,renderList)); rendererSpinner.setAdapter(new ArrayAdapter<>(context, android.R.layout.simple_spinner_dropdown_item,renderList));
} }
profileIconView = mainView.findViewById(R.id.vprof_editor_icon); profileIconView = mainView.findViewById(R.id.vprof_editor_icon);
bldr.setPositiveButton(R.string.global_save,this::save); builder.setPositiveButton(R.string.global_save,this::save);
bldr.setNegativeButton(android.R.string.cancel,(dialog,which)->destroy(dialog)); builder.setNegativeButton(android.R.string.cancel,(dialog,which)->destroy(dialog));
bldr.setNeutralButton(R.string.global_delete,(dialogInterface, i) -> { builder.setNeutralButton(R.string.global_delete,(dialogInterface, i) -> {
LauncherProfiles.mainProfileJson.profiles.remove(editingProfile); LauncherProfiles.mainProfileJson.profiles.remove(editingProfile);
this.cb.onSave(editingProfile,false, true); this.editSaveCallback.onSave(editingProfile,false, true);
}); });
bldr.setOnDismissListener(this::destroy); builder.setOnDismissListener(this::destroy);
dialog = bldr.create(); dialog = builder.create();
} }
public boolean show(@NonNull String profile) { public boolean show(@NonNull String profile) {
MinecraftProfile prof; MinecraftProfile minecraftProfile;
if(!ProfileAdapter.CREATE_PROFILE_MAGIC.equals(profile)) { if(!ProfileAdapter.CREATE_PROFILE_MAGIC.equals(profile)) {
prof = LauncherProfiles.mainProfileJson.profiles.get(profile); minecraftProfile = LauncherProfiles.mainProfileJson.profiles.get(profile);
if (prof == null) return true; if (minecraftProfile == null) return true;
editingProfile = profile; editingProfile = profile;
}else{ }else{
prof = generateTemplate(); minecraftProfile = generateTemplate();
String uuid = UUID.randomUUID().toString(); String uuid = UUID.randomUUID().toString();
while(LauncherProfiles.mainProfileJson.profiles.containsKey(uuid)) { while(LauncherProfiles.mainProfileJson.profiles.containsKey(uuid)) {
uuid = UUID.randomUUID().toString(); uuid = UUID.randomUUID().toString();
} }
editingProfile = uuid; editingProfile = uuid;
} }
runtimes = MultiRTUtils.getRuntimes(); List<Runtime> runtimes = MultiRTUtils.getRuntimes();
Context context = javaRuntimeSpinner.getContext();
javaRuntimeSpinner.setAdapter(new RTSpinnerAdapter(context, runtimes)); javaRuntimeSpinner.setAdapter(new RTSpinnerAdapter(context, runtimes));
int jvm_index = runtimes.indexOf(new MultiRTUtils.Runtime("<Default>")); int jvmIndex = runtimes.indexOf(new Runtime("<Default>"));
int rnd_index = rendererSpinner.getAdapter().getCount()-1; int rendererIndex = rendererSpinner.getAdapter().getCount()-1;
if (prof.javaDir != null) { if (minecraftProfile.javaDir != null) {
String selectedRuntime = prof.javaDir.substring(Tools.LAUNCHERPROFILES_RTPREFIX.length()); String selectedRuntime = minecraftProfile.javaDir.substring(Tools.LAUNCHERPROFILES_RTPREFIX.length());
int nindex = runtimes.indexOf(new MultiRTUtils.Runtime(selectedRuntime)); int nindex = runtimes.indexOf(new Runtime(selectedRuntime));
if (nindex != -1) jvm_index = nindex; if (nindex != -1) jvmIndex = nindex;
} }
if(prof.__P_renderer_name != null) { if(minecraftProfile.pojavRendererName != null) {
int nindex = renderNames.indexOf(prof.__P_renderer_name); int nindex = renderNames.indexOf(minecraftProfile.pojavRendererName);
if(nindex != -1) rnd_index = nindex; if(nindex != -1) rendererIndex = nindex;
} }
javaRuntimeSpinner.setSelection(jvm_index); javaRuntimeSpinner.setSelection(jvmIndex);
rendererSpinner.setSelection(rnd_index); rendererSpinner.setSelection(rendererIndex);
ExtraCore.addExtraListener("lac_version_list",this); ExtraCore.addExtraListener("lac_version_list",this);
profileNameView.setText(prof.name); profileNameView.setText(minecraftProfile.name);
if(ProfileAdapter.iconCache.containsKey(profile)) { Bitmap profileIcon = ProfileIconCache.getCachedIcon(profile);
Log.i("ProfileEditor","Icon resolved!"); if(profileIcon == null) {
profileIconView.setImageBitmap(ProfileAdapter.iconCache.get(profile)); profileIcon = ProfileIconCache.tryResolveIcon(profile,minecraftProfile.icon);
}else {
Log.i("ProfileEditor","No resolved icon.");
Log.i("ProfileEditor", ProfileAdapter.iconCache.keySet().toString());
profileIconView.setImageBitmap(ProfileAdapter.iconCache.get(null));
} }
if(prof.lastVersionId != null && !"latest-release".equals(prof.lastVersionId) && !"latest-snapshot".equals(prof.lastVersionId)) profileIconView.setImageBitmap(profileIcon);
selectedVersionId = prof.lastVersionId; if(minecraftProfile.lastVersionId != null && !"latest-release".equals(minecraftProfile.lastVersionId) && !"latest-snapshot".equals(minecraftProfile.lastVersionId))
else if(prof.lastVersionId != null) { selectedVersionId = minecraftProfile.lastVersionId;
else if(minecraftProfile.lastVersionId != null) {
Map<String,String> releaseTable = (Map<String,String>)ExtraCore.getValue("release_table"); Map<String,String> releaseTable = (Map<String,String>)ExtraCore.getValue("release_table");
if(releaseTable != null) { if(releaseTable != null) {
switch (prof.lastVersionId) { switch (minecraftProfile.lastVersionId) {
case "latest-release": case "latest-release":
selectedVersionId = releaseTable.get("release"); selectedVersionId = releaseTable.get("release");
case "latest-snapshot": case "latest-snapshot":
@ -146,32 +147,36 @@ public class ProfileEditor implements ExtraListener<ArrayList<String>> {
return true; return true;
} }
public void save(DialogInterface dialog, int which) { public void save(DialogInterface dialog, int which) {
System.out.println(editingProfile); System.out.println(editingProfile);
MinecraftProfile prof; MinecraftProfile profile;
boolean isNew; boolean isNew;
if(LauncherProfiles.mainProfileJson.profiles.containsKey(editingProfile)) { if(LauncherProfiles.mainProfileJson.profiles.containsKey(editingProfile)) {
prof = LauncherProfiles.mainProfileJson.profiles.get(editingProfile); profile = LauncherProfiles.mainProfileJson.profiles.get(editingProfile);
LauncherProfiles.mainProfileJson.profiles.remove(editingProfile); if(profile == null) {
isNew = false; profile = new MinecraftProfile();
isNew = true;
}else{ }else{
prof = new MinecraftProfile(); isNew = false;
}
LauncherProfiles.mainProfileJson.profiles.remove(editingProfile);
}else{
profile = new MinecraftProfile();
isNew = true; isNew = true;
} }
prof.name = profileNameView.getText().toString(); profile.name = profileNameView.getText().toString();
prof.lastVersionId = (String)versionSpinner.getSelectedItem(); profile.lastVersionId = (String)versionSpinner.getSelectedItem();
MultiRTUtils.Runtime selectedRuntime = (MultiRTUtils.Runtime) javaRuntimeSpinner.getSelectedItem(); Runtime selectedRuntime = (Runtime) javaRuntimeSpinner.getSelectedItem();
if(selectedRuntime.name.equals("<Default>")) { if(selectedRuntime.name.equals("<Default>")) {
prof.javaDir = null; profile.javaDir = null;
}else if(selectedRuntime.versionString == null) { }else if(selectedRuntime.versionString == null) {
prof.javaDir = null; profile.javaDir = null;
}else{ }else{
prof.javaDir = Tools.LAUNCHERPROFILES_RTPREFIX+selectedRuntime.name; profile.javaDir = Tools.LAUNCHERPROFILES_RTPREFIX+selectedRuntime.name;
} }
if(rendererSpinner.getSelectedItemPosition() == renderNames.size()) prof.__P_renderer_name = null; if(rendererSpinner.getSelectedItemPosition() == renderNames.size()) profile.pojavRendererName = null;
else prof.__P_renderer_name = renderNames.get(rendererSpinner.getSelectedItemPosition()); else profile.pojavRendererName = renderNames.get(rendererSpinner.getSelectedItemPosition());
LauncherProfiles.mainProfileJson.profiles.put(editingProfile,prof); LauncherProfiles.mainProfileJson.profiles.put(editingProfile,profile);
cb.onSave(editingProfile,isNew, false); editSaveCallback.onSave(editingProfile,isNew, false);
destroy(dialog); destroy(dialog);
} }
public void destroy(@NonNull DialogInterface dialog) { public void destroy(@NonNull DialogInterface dialog) {
@ -181,9 +186,9 @@ public class ProfileEditor implements ExtraListener<ArrayList<String>> {
} }
@Override @Override
public boolean onValueSet(String key, @Nullable ArrayList<String> value) { public boolean onValueSet(String key, @Nullable ArrayList<String> value) {
if(value != null) ((Activity)context).runOnUiThread(()->{ if(value != null) {
BaseLauncherActivity.updateVersionSpinner(context,value,versionSpinner, selectedVersionId); uiThreadHandler.post(() -> BaseLauncherActivity.updateVersionSpinner(mainView.getContext(), value, versionSpinner, selectedVersionId));
}); }
return false; return false;
} }
public interface EditSaveCallback { public interface EditSaveCallback {

View file

@ -0,0 +1,54 @@
package net.kdt.pojavlaunch.profiles;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.util.Base64;
import android.util.Log;
import net.kdt.pojavlaunch.R;
import java.util.HashMap;
import java.util.Map;
public class ProfileIconCache {
private static final String BASE64_PNG_HEADER = "data:image/png;base64,";
private static final Map<String, Bitmap> iconCache = new HashMap<>();
private static Bitmap defaultIcon;
public static void initDefault(Context context) {
if(defaultIcon == null)
defaultIcon = BitmapFactory.decodeResource(context.getResources(), R.drawable.ic_menu_java);
}
public static void clearIconCache() {
for(String key : iconCache.keySet()) {
Bitmap bitmap = iconCache.get(key);
if(bitmap != defaultIcon && bitmap != null) {
bitmap.recycle();
}
}
iconCache.clear();
}
public static Bitmap getCachedIcon(String key) {
return iconCache.get(key);
}
public static Bitmap submitIcon(String key, String base64) {
byte[] pngBytes = Base64.decode(base64, Base64.DEFAULT);
Bitmap cachedIcon = BitmapFactory.decodeByteArray(pngBytes,0,pngBytes.length);
iconCache.put(key, cachedIcon);
return cachedIcon;
}
public static Bitmap tryResolveIcon(String profileName, String b64Icon) {
Bitmap icon;
if (b64Icon != null && b64Icon.startsWith(BASE64_PNG_HEADER)) {
icon = ProfileIconCache.submitIcon(profileName, b64Icon.substring(BASE64_PNG_HEADER.length()));
}else{
Log.i("IconParser","Unsupported icon: "+b64Icon);
icon = ProfileIconCache.pushDefaultIcon(profileName);
}
return icon;
}
public static Bitmap pushDefaultIcon(String key) {
iconCache.put(key, defaultIcon);
return defaultIcon;
}
}

View file

@ -91,40 +91,19 @@ public class MinecraftDownloaderTask extends AsyncTask<String, String, Throwable
//Now we have the reliable information to check if our runtime settings are good enough //Now we have the reliable information to check if our runtime settings are good enough
if(verInfo.javaVersion != null) { //1.17+ if(verInfo.javaVersion != null) { //1.17+
LauncherProfiles.update();
MinecraftProfile minecraftProfile = LauncherProfiles.mainProfileJson.profiles.get(mActivity.mProfile.selectedProfile);
if(minecraftProfile == null) throw new SilentException();
String selectedRuntime = null; String selectedRuntime = null;
if(!LauncherPreferences.PREF_ENABLE_PROFILES) { if(minecraftProfile.javaDir != null && minecraftProfile.javaDir.startsWith(Tools.LAUNCHERPROFILES_RTPREFIX)) {
PerVersionConfig.update(); selectedRuntime = minecraftProfile.javaDir.substring(Tools.LAUNCHERPROFILES_RTPREFIX.length());
PerVersionConfig.VersionConfig cfg = PerVersionConfig.configMap.get(p1[0]);
if (cfg == null) {
cfg = new PerVersionConfig.VersionConfig();
PerVersionConfig.configMap.put(p1[0], cfg);
} }
}else{ Runtime runtime = selectedRuntime != null?MultiRTUtils.read(selectedRuntime):MultiRTUtils.read(LauncherPreferences.PREF_DEFAULT_RUNTIME);
LauncherProfiles.update(); if(runtime.javaVersion < verInfo.javaVersion.majorVersion) {
MinecraftProfile prof = LauncherProfiles.mainProfileJson.profiles.get(mActivity.mProfile.selectedProfile); String appropriateRuntime = MultiRTUtils.getNearestJreName(verInfo.javaVersion.majorVersion);
if(prof == null) throw new SilentException();
if(prof.javaDir != null && prof.javaDir.startsWith(Tools.LAUNCHERPROFILES_RTPREFIX)) {
selectedRuntime = prof.javaDir.substring(Tools.LAUNCHERPROFILES_RTPREFIX.length());
}
}
MultiRTUtils.Runtime r = selectedRuntime != null?MultiRTUtils.read(selectedRuntime):MultiRTUtils.read(LauncherPreferences.PREF_DEFAULT_RUNTIME);
if(r.javaVersion < verInfo.javaVersion.majorVersion) {
String appropriateRuntime = MultiRTUtils.getNearestJREName(verInfo.javaVersion.majorVersion);
if(appropriateRuntime != null) { if(appropriateRuntime != null) {
if(!LauncherPreferences.PREF_ENABLE_PROFILES) { minecraftProfile.javaDir = Tools.LAUNCHERPROFILES_RTPREFIX+appropriateRuntime;
PerVersionConfig.VersionConfig cfg = PerVersionConfig.configMap.get(p1[0]);
if (cfg == null) {
cfg = new PerVersionConfig.VersionConfig();
PerVersionConfig.configMap.put(p1[0], cfg);
}
cfg.selectedRuntime = appropriateRuntime;
PerVersionConfig.update();
}else{
MinecraftProfile prof = LauncherProfiles.mainProfileJson.profiles.get(mActivity.mProfile.selectedProfile);
if(prof == null) throw new SilentException();
prof.javaDir = Tools.LAUNCHERPROFILES_RTPREFIX+appropriateRuntime;
LauncherProfiles.update(); LauncherProfiles.update();
}
}else{ }else{
mActivity.runOnUiThread(()->{ mActivity.runOnUiThread(()->{
AlertDialog.Builder bldr = new AlertDialog.Builder(mActivity); AlertDialog.Builder bldr = new AlertDialog.Builder(mActivity);

View file

@ -1,7 +1,6 @@
package net.kdt.pojavlaunch.utils; package net.kdt.pojavlaunch.utils;
import android.app.Activity; import android.app.Activity;
import android.content.Context;
import android.content.res.AssetManager; import android.content.res.AssetManager;
import android.util.Log; import android.util.Log;
@ -25,7 +24,6 @@ import java.io.InputStream;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
public class V117CompatUtil { public class V117CompatUtil {
@ -114,18 +112,11 @@ public class V117CompatUtil {
List<String> packList =getTexturePackList(MCOptionUtils.get("resourcePacks")); List<String> packList =getTexturePackList(MCOptionUtils.get("resourcePacks"));
String renderer; String renderer;
String gamePath; String gamePath;
if(!LauncherPreferences.PREF_ENABLE_PROFILES) {
PerVersionConfig.update();
PerVersionConfig.VersionConfig cfg = PerVersionConfig.configMap.get(version);
renderer = cfg != null && cfg.renderer != null?cfg.renderer:LauncherPreferences.PREF_RENDERER;
gamePath = cfg != null && cfg.gamePath != null?cfg.gamePath:Tools.DIR_GAME_NEW;
}else{
LauncherProfiles.update(); LauncherProfiles.update();
MinecraftProfile prof = LauncherProfiles.mainProfileJson.profiles.get(((BaseLauncherActivity)ctx).mProfile.selectedProfile); MinecraftProfile prof = LauncherProfiles.mainProfileJson.profiles.get(((BaseLauncherActivity)ctx).mProfile.selectedProfile);
if(prof == null) throw new MinecraftDownloaderTask.SilentException(); if(prof == null) throw new MinecraftDownloaderTask.SilentException();
renderer = prof.__P_renderer_name != null?prof.__P_renderer_name:LauncherPreferences.PREF_RENDERER; renderer = prof.pojavRendererName != null?prof.pojavRendererName :LauncherPreferences.PREF_RENDERER;
gamePath = prof.gameDir != null?prof.gameDir:Tools.DIR_GAME_NEW; gamePath = prof.gameDir != null?prof.gameDir:Tools.DIR_GAME_NEW;
}
//String //String
if(renderer.equals("vulkan_zink") || renderer.equals("opengles3_virgl")) return; //don't install for zink/virgl users; if(renderer.equals("vulkan_zink") || renderer.equals("opengles3_virgl")) return; //don't install for zink/virgl users;
@ -160,25 +151,14 @@ public class V117CompatUtil {
} }
switch(proceed.get()) { switch(proceed.get()) {
case 1: case 1:
if(!LauncherPreferences.PREF_ENABLE_PROFILES) { MinecraftProfile minecraftProfile = LauncherProfiles.mainProfileJson.profiles.get(((BaseLauncherActivity)ctx).mProfile.selectedProfile);
PerVersionConfig.VersionConfig cfg = PerVersionConfig.configMap.get(version); if(minecraftProfile == null) throw new MinecraftDownloaderTask.SilentException();
if (cfg == null) { minecraftProfile.pojavRendererName = "opengles3";
cfg = new PerVersionConfig.VersionConfig();
PerVersionConfig.configMap.put(version, cfg);
}
cfg.renderer = "opengles3";
PerVersionConfig.update();
}else{
MinecraftProfile prof = LauncherProfiles.mainProfileJson.profiles.get(((BaseLauncherActivity)ctx).mProfile.selectedProfile);
if(prof == null) throw new MinecraftDownloaderTask.SilentException();
prof.__P_renderer_name = "opengles3";
LauncherProfiles.update(); LauncherProfiles.update();
}
copyResourcePack(gamePath,ctx.getAssets()); copyResourcePack(gamePath,ctx.getAssets());
if(!packList.contains("\"assets-v0.zip\"")) packList.add(0,"\"assets-v0.zip\""); if(!packList.contains("\"assets-v0.zip\"")) packList.add(0,"\"assets-v0.zip\"");
MCOptionUtils.set("resourcePacks",regenPackList(packList)); MCOptionUtils.set("resourcePacks",regenPackList(packList));
MCOptionUtils.save(); MCOptionUtils.save();
PerVersionConfig.update();
break; break;
case 0: case 0:
throw new MinecraftDownloaderTask.SilentException(); throw new MinecraftDownloaderTask.SilentException();

View file

@ -13,6 +13,6 @@ public class MinecraftProfile
public String javaArgs; public String javaArgs;
public String logConfig; public String logConfig;
public boolean logConfigIsXML; public boolean logConfigIsXML;
public String __P_renderer_name; public String pojavRendererName;
public MinecraftResolution[] resolution; public MinecraftResolution[] resolution;
} }