Feats: preference isolation & profile management

- Rewrote LauncherPreferences -> PLPreferences
 + Now the file layout is the same as UI layout
 + (get/set)Preference are replaced with corresponding get/set types + Getting/setting is now done through keyPath instead of manually iterating over subdictionaries.
 + Implemented an isolation layer, allowing an instance to have its own settings. This is off by default

- Implemented launcher_profiles
 + Added Profile manager that can be accessed from the sidebar
 + Moved "Game directory (instances)" to this screen
 + Replaced version selector with profile selector. Version selector is moved into profile editor.

- Other changes
 + Cleanup code by using NSPredicate instead of huge for loops
 + Titles in settings are made multilined
 + Controller config: replaced bar button items with localized ones

Due to how large the changes are, this is committed directly to the mainline branch. Bugs are expected to be found (although I did enough tests for this locally)
This commit is contained in:
khanhduytran0 committed 2023-07-06 13:59:07 +07:00
1 parent ab458a4599
commit 6cf61e62c0
52 files changed
+1514 -579

No files matched your search

@@ -52,6 +52,7 @@ public final class Tools
public static final String DIR_GAME_HOME = System.getenv("POJAV_HOME");
public static final String DIR_GAME_NEW = System.getenv("POJAV_GAME_DIR"); // path to "Library/Application Support/minecraft"
public static final String DIR_GAME_PROFILE = System.getProperty("user.dir");
public static final String DIR_APP_DATA = System.getenv("POJAV_HOME");
public static final String DIR_ACCOUNT_NEW = DIR_APP_DATA + "/accounts";
@@ -120,7 +121,7 @@ public final class Tools
versionName = versionInfo.inheritsFrom;
}
File gameDir = new File(Tools.DIR_GAME_NEW);
File gameDir = new File(Tools.DIR_GAME_PROFILE);
gameDir.mkdirs();
Map<String, String> varArgMap = new ArrayMap<String, String>();
@@ -17,7 +17,7 @@ public class MCOptionUtils
}
try {
BufferedReader reader = new BufferedReader(new FileReader(Tools.DIR_GAME_NEW + "/options.txt"));
BufferedReader reader = new BufferedReader(new FileReader(Tools.DIR_GAME_PROFILE + "/options.txt"));
String line;
while ((line = reader.readLine()) != null) {
mLineList.add(line);
@@ -71,7 +71,7 @@ public class MCOptionUtils
}
try {
Tools.write(Tools.DIR_GAME_NEW + "/options.txt", result.toString());
Tools.write(Tools.DIR_GAME_PROFILE + "/options.txt", result.toString());
} catch (IOException e) {
System.err.println("Could not save options.txt");
e.printStackTrace();