MultiMC-like instances:
- now stores the minecraft directory in .pojavlauncher/instances/default - configurable straight from the preferences - migrates your existing minecraft folder to instances/default - moves L/AS/m from Documents/ to .pojavlauncher/ - changes home directory to .pojavlauncher/ - automatically switches the L/AS/m symlink based on the current instance - accounts stay the same between instances
This commit is contained in:
1 parent
65be49ab87
commit
15a6cf0acf
7 files changed
+112
-40
No files matched your search
+1
-2
@@ -3,9 +3,8 @@
|
|||||||
set -e
|
set -e
|
||||||
|
|
||||||
chown -R 501:501 /var/mobile/Documents/.pojavlauncher
|
chown -R 501:501 /var/mobile/Documents/.pojavlauncher
|
||||||
chown -R 501:501 /var/mobile/Documents/minecraft
|
|
||||||
chmod -R 0755 /var/mobile/Documents/.pojavlauncher
|
chmod -R 0755 /var/mobile/Documents/.pojavlauncher
|
||||||
chmod -R 0755 /var/mobile/Documents/minecraft
|
|
||||||
|
|
||||||
echo " "
|
echo " "
|
||||||
echo "PojavLauncher has been installed! Take a look at the wiki to learn more about PojavLauncher at https://bit.ly/2PgpexZ."
|
echo "PojavLauncher has been installed! Take a look at the wiki to learn more about PojavLauncher at https://bit.ly/2PgpexZ."
|
||||||
|
|
||||||
@@ -55,8 +55,8 @@ public final class Tools
|
|||||||
public static String DIR_DATA = System.getenv("BUNDLE_PATH");
|
public static String DIR_DATA = System.getenv("BUNDLE_PATH");
|
||||||
public static String CURRENT_ARCHITECTURE;
|
public static String CURRENT_ARCHITECTURE;
|
||||||
|
|
||||||
public static final String DIR_GAME_HOME = System.getenv("HOME") + "/Documents";
|
public static final String DIR_GAME_HOME = System.getenv("POJAV_HOME");
|
||||||
public static final String DIR_GAME_NEW = DIR_GAME_HOME + "/minecraft";
|
public static final String DIR_GAME_NEW = System.getenv("POJAV_GAME_DIR");
|
||||||
|
|
||||||
public static final String DIR_APP_DATA = System.getenv("POJAV_HOME");
|
public static final String DIR_APP_DATA = System.getenv("POJAV_HOME");
|
||||||
public static final String DIR_ACCOUNT_NEW = DIR_APP_DATA + "/accounts";
|
public static final String DIR_ACCOUNT_NEW = DIR_APP_DATA + "/accounts";
|
||||||
@@ -431,7 +431,7 @@ public final class Tools
|
|||||||
String libAddedName = libAdded.name.substring(0, libAdded.name.lastIndexOf(":"));
|
String libAddedName = libAdded.name.substring(0, libAdded.name.lastIndexOf(":"));
|
||||||
|
|
||||||
if (libAddedName.equals(libName)) {
|
if (libAddedName.equals(libName)) {
|
||||||
System.out.println("Library " + libName + ": Replaced version " +
|
System.out.println("Library " + libName + ": Replaced version " +
|
||||||
libAdded.name.substring(libAddedName.length() + 1) + " with " +
|
libAdded.name.substring(libAddedName.length() + 1) + " with " +
|
||||||
lib.name.substring(libName.length() + 1));
|
lib.name.substring(libName.length() + 1));
|
||||||
libList.set(i, lib);
|
libList.set(i, lib);
|
||||||
@@ -531,7 +531,7 @@ public final class Tools
|
|||||||
public static File lastFileModified(String dir) {
|
public static File lastFileModified(String dir) {
|
||||||
File fl = new File(dir);
|
File fl = new File(dir);
|
||||||
|
|
||||||
File[] files = fl.listFiles(new FileFilter() {
|
File[] files = fl.listFiles(new FileFilter() {
|
||||||
public boolean accept(File file) {
|
public boolean accept(File file) {
|
||||||
return file.isFile();
|
return file.isFile();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -140,12 +140,12 @@ package:
|
|||||||
cp JavaApp/local_out/launcher.jar Natives/build/PojavLauncher.app/libs/launcher.jar || exit 1; \
|
cp JavaApp/local_out/launcher.jar Natives/build/PojavLauncher.app/libs/launcher.jar || exit 1; \
|
||||||
cp -R JavaApp/libs/* Natives/build/PojavLauncher.app/libs/ || exit 1; \
|
cp -R JavaApp/libs/* Natives/build/PojavLauncher.app/libs/ || exit 1; \
|
||||||
cp -R JavaApp/libs_caciocavallo/* Natives/build/PojavLauncher.app/libs_caciocavallo/ || exit 1; \
|
cp -R JavaApp/libs_caciocavallo/* Natives/build/PojavLauncher.app/libs_caciocavallo/ || exit 1; \
|
||||||
mkdir -p packages/pojavlauncher_iphoneos-arm/{Applications,var/mobile/Documents/{minecraft,.pojavlauncher,Library/{Application\ Support,Caches}}} || exit 1; \
|
mkdir -p packages/pojavlauncher_iphoneos-arm/{Applications,var/mobile/Documents/.pojavlauncher/{instances/default,Library/{Application\ Support,Caches}}} || exit 1; \
|
||||||
( cd packages/pojavlauncher_iphoneos-arm/var/mobile/Documents && ln -sf ../../minecraft "Library/Application Support/minecraft" ) || exit 1; \
|
( cd packages/pojavlauncher_iphoneos-arm/var/mobile/Documents/.pojavlauncher && ln -sf ../../instances/default Library/Application\ Support/minecraft ) || exit 1; \
|
||||||
if [ '$(NOSTDIN)' = '1' ]; then \
|
if [ '$(NOSTDIN)' = '1' ]; then \
|
||||||
echo '$(SUDOPASS)' | sudo -S chown 501:501 packages/pojavlauncher_iphoneos-arm/var/mobile/Documents/* || exit 1; \
|
echo '$(SUDOPASS)' | sudo -S chown -R 501:501 packages/pojavlauncher_iphoneos-arm/var/mobile/Documents/.pojavlauncher || exit 1; \
|
||||||
else \
|
else \
|
||||||
sudo chown 501:501 packages/pojavlauncher_iphoneos-arm/var/mobile/Documents/* || exit 1; \
|
sudo chown -R 501:501 packages/pojavlauncher_iphoneos-arm/var/mobile/Documents/.pojavlauncher || exit 1; \
|
||||||
fi; \
|
fi; \
|
||||||
cp -R Natives/build/PojavLauncher.app packages/pojavlauncher_iphoneos-arm/Applications; \
|
cp -R Natives/build/PojavLauncher.app packages/pojavlauncher_iphoneos-arm/Applications; \
|
||||||
cp -R DEBIAN packages/pojavlauncher_iphoneos-arm/DEBIAN; \
|
cp -R DEBIAN packages/pojavlauncher_iphoneos-arm/DEBIAN; \
|
||||||
@@ -163,12 +163,12 @@ package:
|
|||||||
cp -R JavaApp/libs Natives/build/PojavLauncher.app/libs || exit 1; \
|
cp -R JavaApp/libs Natives/build/PojavLauncher.app/libs || exit 1; \
|
||||||
cp -R JavaApp/libs_caciocavallo Natives/build/PojavLauncher.app/libs_caciocavallo || exit 1; \
|
cp -R JavaApp/libs_caciocavallo Natives/build/PojavLauncher.app/libs_caciocavallo || exit 1; \
|
||||||
cp JavaApp/local_out/launcher.jar Natives/build/PojavLauncher.app/libs/ || exit 1; \
|
cp JavaApp/local_out/launcher.jar Natives/build/PojavLauncher.app/libs/ || exit 1; \
|
||||||
mkdir -p packages/pojavlauncher_iphoneos-arm/{Applications,var/mobile/Documents/{minecraft,.pojavlauncher,Library/{Application\ Support,Caches}}} || exit 1; \
|
mkdir -p packages/pojavlauncher_iphoneos-arm/{Applications,var/mobile/Documents/.pojavlauncher/{instances/default,Library/{Application\ Support,Caches}}} || exit 1; \
|
||||||
( cd packages/pojavlauncher_iphoneos-arm/var/mobile/Documents && ln -sf ../../minecraft "Library/Application Support/minecraft" ) || exit 1; \
|
( cd packages/pojavlauncher_iphoneos-arm/var/mobile/Documents/.pojavlauncher && ln -sf ../../instances/default Library/Application\ Support/minecraft ) || exit 1; \
|
||||||
if [ '$(NOSTDIN)' = '1' ]; then \
|
if [ '$(NOSTDIN)' = '1' ]; then \
|
||||||
echo '$(SUDOPASS)' | sudo -S chown 501:501 packages/pojavlauncher_iphoneos-arm/var/mobile/Documents/* || exit 1; \
|
echo '$(SUDOPASS)' | sudo -S chown -R 501:501 packages/pojavlauncher_iphoneos-arm/var/mobile/Documents/.pojavlauncher || exit 1; \
|
||||||
else \
|
else \
|
||||||
sudo chown 501:501 packages/pojavlauncher_iphoneos-arm/var/mobile/Documents/* || exit 1; \
|
sudo chown -R 501:501 packages/pojavlauncher_iphoneos-arm/var/mobile/Documents/.pojavlauncher || exit 1; \
|
||||||
fi; \
|
fi; \
|
||||||
cp -R Natives/build/PojavLauncher.app packages/pojavlauncher_iphoneos-arm/Applications; \
|
cp -R Natives/build/PojavLauncher.app packages/pojavlauncher_iphoneos-arm/Applications; \
|
||||||
cp -R DEBIAN packages/pojavlauncher_iphoneos-arm/DEBIAN; \
|
cp -R DEBIAN packages/pojavlauncher_iphoneos-arm/DEBIAN; \
|
||||||
@@ -239,9 +239,15 @@ deploy:
|
|||||||
|
|
||||||
clean:
|
clean:
|
||||||
@echo 'Starting build task - cleaning build workspace'
|
@echo 'Starting build task - cleaning build workspace'
|
||||||
@rm -rf Natives/build
|
@if [ '$(NOSTDIN)' = '1' ]; then \
|
||||||
@rm -rf JavaApp/build
|
echo '$(SUDOPASS)' | sudo -S rm -rf Natives/build; \
|
||||||
@rm -rf packages
|
echo '$(SUDOPASS)' | sudo -S rm -rf JavaApp/build; \
|
||||||
|
echo '$(SUDOPASS)' | sudo -S rm -rf packages; \
|
||||||
|
else \
|
||||||
|
sudo rm -rf Natives/build; \
|
||||||
|
sudo rm -rf JavaApp/build; \
|
||||||
|
sudo rm -rf packages; \
|
||||||
|
fi
|
||||||
@echo 'Finished build task - cleaned build workspace'
|
@echo 'Finished build task - cleaned build workspace'
|
||||||
|
|
||||||
help:
|
help:
|
||||||
|
|||||||
+38
-5
@@ -74,9 +74,11 @@ static BOOL filteredSessionID;
|
|||||||
const char *javaHome;
|
const char *javaHome;
|
||||||
const char *renderer;
|
const char *renderer;
|
||||||
const char *allocmem;
|
const char *allocmem;
|
||||||
|
const char *multidir;
|
||||||
NSString *javaHome_pre;
|
NSString *javaHome_pre;
|
||||||
NSString *renderer_pre;
|
NSString *renderer_pre;
|
||||||
NSString *allocmem_pre;
|
NSString *allocmem_pre;
|
||||||
|
NSString *multidir_pre;
|
||||||
|
|
||||||
static void *logger_thread() {
|
static void *logger_thread() {
|
||||||
ssize_t rsize;
|
ssize_t rsize;
|
||||||
@@ -231,10 +233,9 @@ int launchJVM(int argc, char *argv[]) {
|
|||||||
if (!started) {
|
if (!started) {
|
||||||
debug("[Pre-init] Staring logging STDIO as jrelog:V\n");
|
debug("[Pre-init] Staring logging STDIO as jrelog:V\n");
|
||||||
// Redirect stdio to latestlog.txt
|
// Redirect stdio to latestlog.txt
|
||||||
int ret;
|
|
||||||
char newname[2048];
|
char newname[2048];
|
||||||
sprintf(newname, "%s/latestlog.old.txt", homeDir);
|
sprintf(newname, "%s/latestlog.old.txt", homeDir);
|
||||||
ret = rename(log_path, newname);
|
rename(log_path, newname);
|
||||||
FILE* logFile = fopen(log_path, "w");
|
FILE* logFile = fopen(log_path, "w");
|
||||||
if (!logFile) {
|
if (!logFile) {
|
||||||
debug("[Pre-init] Error: failed to open %s: %s", log_path, strerror(errno));
|
debug("[Pre-init] Error: failed to open %s: %s", log_path, strerror(errno));
|
||||||
@@ -394,6 +395,7 @@ int launchJVM(int argc, char *argv[]) {
|
|||||||
|
|
||||||
allocmem_pre = [getPreference(@"allocated_memory") stringValue];
|
allocmem_pre = [getPreference(@"allocated_memory") stringValue];
|
||||||
allocmem = [allocmem_pre cStringUsingEncoding:NSUTF8StringEncoding];
|
allocmem = [allocmem_pre cStringUsingEncoding:NSUTF8StringEncoding];
|
||||||
|
|
||||||
char controlPath[2048];
|
char controlPath[2048];
|
||||||
sprintf(controlPath, "%s/controlmap", homeDir);
|
sprintf(controlPath, "%s/controlmap", homeDir);
|
||||||
mkdir(controlPath, S_IRWXU | S_IRWXG | S_IRWXO);
|
mkdir(controlPath, S_IRWXU | S_IRWXG | S_IRWXO);
|
||||||
@@ -417,7 +419,38 @@ int launchJVM(int argc, char *argv[]) {
|
|||||||
closedir(d);
|
closedir(d);
|
||||||
}
|
}
|
||||||
debug("[Pre-init] Classpath generated: %s", classpath);
|
debug("[Pre-init] Classpath generated: %s", classpath);
|
||||||
|
|
||||||
|
multidir_pre = getPreference(@"game_directory");
|
||||||
|
multidir = [multidir_pre cStringUsingEncoding:NSUTF8StringEncoding];
|
||||||
|
if ([multidir_pre length] == 0) {
|
||||||
|
multidir_pre = @"default";
|
||||||
|
multidir = [multidir_pre cStringUsingEncoding:NSUTF8StringEncoding];
|
||||||
|
setPreference(@"game_directory", multidir_pre);
|
||||||
|
debug("[Pre-init] MULTI_DIR environment variable was not set. Defaulting to %s for future use.\n", renderer);
|
||||||
|
} else {
|
||||||
|
multidir = [multidir_pre cStringUsingEncoding:NSUTF8StringEncoding];
|
||||||
|
debug("[Pre-init] Restored preference: MULTI_DIR is set to %s\n", multidir);
|
||||||
|
}
|
||||||
|
char *multidir_char = calloc(1, 2048);
|
||||||
|
char *librarySym = calloc(1, 2048);
|
||||||
|
snprintf(multidir_char, 2048, "%s/instances/%s", getenv("POJAV_HOME"), multidir);
|
||||||
|
snprintf(librarySym, 2048, "%s/Library/Application Support/minecraft", getenv("POJAV_HOME"));
|
||||||
|
remove(librarySym);
|
||||||
|
symlink(multidir_char, librarySym);
|
||||||
|
setenv("POJAV_GAME_DIR", multidir_char, 1);
|
||||||
|
|
||||||
|
char *oldGameDir = calloc(1, 2048);
|
||||||
|
snprintf(oldGameDir, 2048, "%s/Documents/minecraft", getenv("HOME"));
|
||||||
|
if (0 == access(oldGameDir, F_OK)) {
|
||||||
|
rename(oldGameDir, multidir_char);
|
||||||
|
debug("[Pre-Init] Migrated old minecraft folder to new location.");
|
||||||
|
}
|
||||||
|
|
||||||
|
char *oldLibraryDir = calloc(1, 2048);
|
||||||
|
snprintf(oldLibraryDir, 2048, "%s/Documents/Library", getenv("HOME"));
|
||||||
|
if (0 == access(oldLibraryDir, F_OK)) {
|
||||||
|
remove(oldLibraryDir);
|
||||||
|
}
|
||||||
// Check if JVM restarts
|
// Check if JVM restarts
|
||||||
if (!started) {
|
if (!started) {
|
||||||
char *frameworkPath = calloc(1, 2048);
|
char *frameworkPath = calloc(1, 2048);
|
||||||
@@ -428,8 +461,8 @@ int launchJVM(int argc, char *argv[]) {
|
|||||||
char *memMax = calloc(1, 2048);
|
char *memMax = calloc(1, 2048);
|
||||||
snprintf(frameworkPath, 2048, "-Djava.library.path=%s/Frameworks", getenv("BUNDLE_PATH"));
|
snprintf(frameworkPath, 2048, "-Djava.library.path=%s/Frameworks", getenv("BUNDLE_PATH"));
|
||||||
snprintf(javaPath, 2048, "%s/bin/java", javaHome);
|
snprintf(javaPath, 2048, "%s/bin/java", javaHome);
|
||||||
snprintf(userDir, 2048, "-Duser.dir=%s/Documents/minecraft", getenv("HOME"));
|
snprintf(userDir, 2048, "-Duser.dir=%s", getenv("POJAV_GAME_DIR"));
|
||||||
snprintf(userHome, 2048, "-Duser.home=%s/Documents", getenv("HOME"));
|
snprintf(userHome, 2048, "-Duser.home=%s", getenv("POJAV_HOME"));
|
||||||
snprintf(memMin, 2048, "-Xms%sM", allocmem);
|
snprintf(memMin, 2048, "-Xms%sM", allocmem);
|
||||||
snprintf(memMax, 2048, "-Xmx%sM", allocmem);
|
snprintf(memMax, 2048, "-Xmx%sM", allocmem);
|
||||||
|
|
||||||
|
|||||||
@@ -34,43 +34,42 @@
|
|||||||
self.view.backgroundColor = [UIColor whiteColor];
|
self.view.backgroundColor = [UIColor whiteColor];
|
||||||
}
|
}
|
||||||
|
|
||||||
UILabel *boldJDKView = [[UILabel alloc] initWithFrame:CGRectMake(20.0, 4.0, width - 40, 30.0)];
|
UILabel *boldJDKView = [[UILabel alloc] initWithFrame:CGRectMake(4.0, 4.0, width - 40, 30.0)];
|
||||||
boldJDKView.text = @"Modded versions before 1.16";
|
boldJDKView.text = @"Modded versions before 1.16";
|
||||||
boldJDKView.lineBreakMode = NSLineBreakByWordWrapping;
|
boldJDKView.lineBreakMode = NSLineBreakByWordWrapping;
|
||||||
boldJDKView.numberOfLines = 0;
|
boldJDKView.numberOfLines = 0;
|
||||||
[scrollView addSubview:boldJDKView];
|
[scrollView addSubview:boldJDKView];
|
||||||
[boldJDKView setFont:[UIFont boldSystemFontOfSize:20]];
|
[boldJDKView setFont:[UIFont boldSystemFontOfSize:20]];
|
||||||
|
|
||||||
UILabel *JDKView = [[UILabel alloc] initWithFrame:CGRectMake(20.0, boldJDKView.frame.origin.y + boldJDKView.frame.size.height, width - 40, 30.0)];
|
UILabel *JDKView = [[UILabel alloc] initWithFrame:CGRectMake(4.0, boldJDKView.frame.origin.y + boldJDKView.frame.size.height, width - 40, 30.0)];
|
||||||
JDKView.text = @"In order to use these versions, you need to install openjdk-8-jre from Doregon's Repo and write the following in /var/mobile/Documents/.pojavlauncher/custom_env.txt:\n\n"
|
JDKView.text = @"In order to use these versions, you need to install openjdk-8-jre from Doregon's Repo and change Java home in Preferences to'/usr/lib/jvm/java-8-openjdk.";
|
||||||
"JAVA_HOME=/usr/lib/jvm/java-8-openjdk";
|
|
||||||
JDKView.lineBreakMode = NSLineBreakByWordWrapping;
|
JDKView.lineBreakMode = NSLineBreakByWordWrapping;
|
||||||
JDKView.numberOfLines = 0;
|
JDKView.numberOfLines = 0;
|
||||||
[JDKView sizeToFit];
|
[JDKView sizeToFit];
|
||||||
[scrollView addSubview:JDKView];
|
[scrollView addSubview:JDKView];
|
||||||
|
|
||||||
UILabel *boldSnapView = [[UILabel alloc] initWithFrame:CGRectMake(20.0, JDKView.frame.origin.y + JDKView.frame.size.height, width - 40, 30.0)];
|
UILabel *boldSnapView = [[UILabel alloc] initWithFrame:CGRectMake(4.0, JDKView.frame.origin.y + JDKView.frame.size.height, width - 40, 30.0)];
|
||||||
boldSnapView.text = @"Vanilla versions after 21w08b";
|
boldSnapView.text = @"Vanilla versions after 21w08b";
|
||||||
boldSnapView.lineBreakMode = NSLineBreakByWordWrapping;
|
boldSnapView.lineBreakMode = NSLineBreakByWordWrapping;
|
||||||
boldSnapView.numberOfLines = 0;
|
boldSnapView.numberOfLines = 0;
|
||||||
[scrollView addSubview:boldSnapView];
|
[scrollView addSubview:boldSnapView];
|
||||||
[boldSnapView setFont:[UIFont boldSystemFontOfSize:20]];
|
[boldSnapView setFont:[UIFont boldSystemFontOfSize:20]];
|
||||||
|
|
||||||
UILabel *snapView = [[UILabel alloc] initWithFrame:CGRectMake(20.0, boldSnapView.frame.origin.y + boldSnapView.frame.size.height, width - 40, 30.0)];
|
UILabel *snapView = [[UILabel alloc] initWithFrame:CGRectMake(4.0, boldSnapView.frame.origin.y + boldSnapView.frame.size.height, width - 40, 30.0)];
|
||||||
snapView.text = @"In order to use these versions, you need to follow the instructions on our website (Updates > Preliminary support for 1.17)";
|
snapView.text = @"In order to use these versions, you need to follow the instructions on our website (Updates > Preliminary support for 1.17)";
|
||||||
snapView.lineBreakMode = NSLineBreakByWordWrapping;
|
snapView.lineBreakMode = NSLineBreakByWordWrapping;
|
||||||
snapView.numberOfLines = 0;
|
snapView.numberOfLines = 0;
|
||||||
[snapView sizeToFit];
|
[snapView sizeToFit];
|
||||||
[scrollView addSubview:snapView];
|
[scrollView addSubview:snapView];
|
||||||
|
|
||||||
UILabel *boldJetsamView = [[UILabel alloc] initWithFrame:CGRectMake(20.0, snapView.frame.origin.y + snapView.frame.size.height, width - 40, 30.0)];
|
UILabel *boldJetsamView = [[UILabel alloc] initWithFrame:CGRectMake(4.0, snapView.frame.origin.y + snapView.frame.size.height, width - 40, 30.0)];
|
||||||
boldJetsamView.text = @"Jetsam crashes";
|
boldJetsamView.text = @"Jetsam crashes";
|
||||||
boldJetsamView.lineBreakMode = NSLineBreakByWordWrapping;
|
boldJetsamView.lineBreakMode = NSLineBreakByWordWrapping;
|
||||||
boldJetsamView.numberOfLines = 0;
|
boldJetsamView.numberOfLines = 0;
|
||||||
[scrollView addSubview:boldJetsamView];
|
[scrollView addSubview:boldJetsamView];
|
||||||
[boldJetsamView setFont:[UIFont boldSystemFontOfSize:20]];
|
[boldJetsamView setFont:[UIFont boldSystemFontOfSize:20]];
|
||||||
|
|
||||||
UILabel *jetsamView = [[UILabel alloc] initWithFrame:CGRectMake(20.0, boldJetsamView.frame.origin.y + boldJetsamView.frame.size.height, width - 40, 30.0)];
|
UILabel *jetsamView = [[UILabel alloc] initWithFrame:CGRectMake(4.0, boldJetsamView.frame.origin.y + boldJetsamView.frame.size.height, width - 40, 30.0)];
|
||||||
jetsamView.text = @"Even though PojavLauncher only allocates 1/4 of the system's total memory, jetsam can still kill the game. A solution is described on the PojavLauncher website (iOS > Wiki > Going further > overb0arding)";
|
jetsamView.text = @"Even though PojavLauncher only allocates 1/4 of the system's total memory, jetsam can still kill the game. A solution is described on the PojavLauncher website (iOS > Wiki > Going further > overb0arding)";
|
||||||
jetsamView.lineBreakMode = NSLineBreakByWordWrapping;
|
jetsamView.lineBreakMode = NSLineBreakByWordWrapping;
|
||||||
jetsamView.numberOfLines = 0;
|
jetsamView.numberOfLines = 0;
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ void loadPreferences() {
|
|||||||
setDefaultValueForPref(@"vertype_oldbeta", @NO);
|
setDefaultValueForPref(@"vertype_oldbeta", @NO);
|
||||||
setDefaultValueForPref(@"time_longPressTrigger", @(400));
|
setDefaultValueForPref(@"time_longPressTrigger", @(400));
|
||||||
setDefaultValueForPref(@"default_ctrl", @"default.json");
|
setDefaultValueForPref(@"default_ctrl", @"default.json");
|
||||||
|
setDefaultValueForPref(@"game_directory", @"default");
|
||||||
setDefaultValueForPref(@"java_args", @"");
|
setDefaultValueForPref(@"java_args", @"");
|
||||||
setDefaultValueForPref(@"allocated_memory", [NSNumber numberWithFloat:roundf(([[NSProcessInfo processInfo] physicalMemory] / 1048576) * 0.30)]);
|
setDefaultValueForPref(@"allocated_memory", [NSNumber numberWithFloat:roundf(([[NSProcessInfo processInfo] physicalMemory] / 1048576) * 0.30)]);
|
||||||
setDefaultValueForPref(@"java_home", @"");
|
setDefaultValueForPref(@"java_home", @"");
|
||||||
|
|||||||
@@ -10,8 +10,9 @@
|
|||||||
#define JARGS 3
|
#define JARGS 3
|
||||||
#define REND 4
|
#define REND 4
|
||||||
#define JHOME 5
|
#define JHOME 5
|
||||||
#define NOSHADERCONV 6
|
#define GDIRECTORY 6
|
||||||
#define RESETWARN 7
|
#define NOSHADERCONV 7
|
||||||
|
#define RESETWARN 8
|
||||||
|
|
||||||
@interface LauncherPreferencesViewController () <UIPickerViewDataSource, UIPickerViewDelegate, UIPopoverPresentationControllerDelegate> {
|
@interface LauncherPreferencesViewController () <UIPickerViewDataSource, UIPickerViewDelegate, UIPopoverPresentationControllerDelegate> {
|
||||||
}
|
}
|
||||||
@@ -178,6 +179,30 @@ UISwitch *noshaderconvSwitch;
|
|||||||
jhomeTextField.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
|
jhomeTextField.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
|
||||||
[scrollView addSubview:jhomeTextField];
|
[scrollView addSubview:jhomeTextField];
|
||||||
|
|
||||||
|
if ([getPreference(@"option_warn") boolValue] == YES) {
|
||||||
|
UIAlertController *preferenceWarn = [UIAlertController alertControllerWithTitle:@"Restart required" message:@"Some options in this menu will require that you restart the launcher for them to take effect."preferredStyle:UIAlertControllerStyleAlert];
|
||||||
|
UIAlertAction *ok = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleCancel handler:nil];
|
||||||
|
[self presentViewController:preferenceWarn animated:YES completion:nil];
|
||||||
|
[preferenceWarn addAction:ok];
|
||||||
|
setPreference(@"option_warn", @NO);
|
||||||
|
}
|
||||||
|
|
||||||
|
UILabel *gdirTextView = [[UILabel alloc] initWithFrame:CGRectMake(4.0, currY+=40.0, 0.0, 0.0)];
|
||||||
|
gdirTextView.text = @"Game directory";
|
||||||
|
gdirTextView.numberOfLines = 0;
|
||||||
|
[gdirTextView sizeToFit];
|
||||||
|
[scrollView addSubview:gdirTextView];
|
||||||
|
|
||||||
|
UITextField *gdirTextField = [[UITextField alloc] initWithFrame:CGRectMake(buttonSizeSlider.frame.origin.x + 3, currY, width - jargsTextView.bounds.size.width - 8.0, 30)];
|
||||||
|
[gdirTextField addTarget:jhomeTextField action:@selector(resignFirstResponder) forControlEvents:UIControlEventEditingDidEndOnExit];
|
||||||
|
gdirTextField.tag = 104;
|
||||||
|
gdirTextField.delegate = self;
|
||||||
|
gdirTextField.placeholder = @"Custom game directory...";
|
||||||
|
gdirTextField.text = (NSString *) getPreference(@"game_directory");
|
||||||
|
gdirTextField.contentVerticalAlignment = UIControlContentVerticalAlignmentTop;
|
||||||
|
gdirTextField.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
|
||||||
|
[scrollView addSubview:gdirTextField];
|
||||||
|
|
||||||
if ([getPreference(@"option_warn") boolValue] == YES) {
|
if ([getPreference(@"option_warn") boolValue] == YES) {
|
||||||
UIAlertController *preferenceWarn = [UIAlertController alertControllerWithTitle:@"Restart required" message:@"Some options in this menu will require that you restart the launcher for them to take effect."preferredStyle:UIAlertControllerStyleAlert];
|
UIAlertController *preferenceWarn = [UIAlertController alertControllerWithTitle:@"Restart required" message:@"Some options in this menu will require that you restart the launcher for them to take effect."preferredStyle:UIAlertControllerStyleAlert];
|
||||||
UIAlertAction *ok = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleCancel handler:nil];
|
UIAlertAction *ok = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleCancel handler:nil];
|
||||||
@@ -193,7 +218,7 @@ UISwitch *noshaderconvSwitch;
|
|||||||
[scrollView addSubview:noshaderconvTextView];
|
[scrollView addSubview:noshaderconvTextView];
|
||||||
|
|
||||||
noshaderconvSwitch = [[UISwitch alloc] initWithFrame:CGRectMake(width - 58.0, currY, 50.0, 30)];
|
noshaderconvSwitch = [[UISwitch alloc] initWithFrame:CGRectMake(width - 58.0, currY, 50.0, 30)];
|
||||||
noshaderconvSwitch.tag = 104;
|
noshaderconvSwitch.tag = 105;
|
||||||
[noshaderconvSwitch setOn:[getPreference(@"disable_gl4es_shaderconv") boolValue] animated:NO];
|
[noshaderconvSwitch setOn:[getPreference(@"disable_gl4es_shaderconv") boolValue] animated:NO];
|
||||||
[noshaderconvSwitch addTarget:self action:@selector(switchChanged:) forControlEvents:UIControlEventValueChanged];
|
[noshaderconvSwitch addTarget:self action:@selector(switchChanged:) forControlEvents:UIControlEventValueChanged];
|
||||||
[scrollView addSubview:noshaderconvSwitch];
|
[scrollView addSubview:noshaderconvSwitch];
|
||||||
@@ -205,7 +230,7 @@ UISwitch *noshaderconvSwitch;
|
|||||||
[scrollView addSubview:resetWarnTextView];
|
[scrollView addSubview:resetWarnTextView];
|
||||||
|
|
||||||
UISwitch *resetWarnSwitch = [[UISwitch alloc] initWithFrame:CGRectMake(width - 58.0, currY, 50.0, 30)];
|
UISwitch *resetWarnSwitch = [[UISwitch alloc] initWithFrame:CGRectMake(width - 58.0, currY, 50.0, 30)];
|
||||||
resetWarnSwitch.tag = 105;
|
resetWarnSwitch.tag = 106;
|
||||||
[resetWarnSwitch setOn:NO animated:NO];
|
[resetWarnSwitch setOn:NO animated:NO];
|
||||||
[resetWarnSwitch addTarget:self action:@selector(switchChanged:) forControlEvents:UIControlEventValueChanged];
|
[resetWarnSwitch addTarget:self action:@selector(switchChanged:) forControlEvents:UIControlEventValueChanged];
|
||||||
[scrollView addSubview:resetWarnSwitch];
|
[scrollView addSubview:resetWarnSwitch];
|
||||||
@@ -223,14 +248,16 @@ UISwitch *noshaderconvSwitch;
|
|||||||
handler:^(__kindof UIAction * _Nonnull action) {[self helpAlertOpt:JARGS];}];
|
handler:^(__kindof UIAction * _Nonnull action) {[self helpAlertOpt:JARGS];}];
|
||||||
UIAction *option5 = [UIAction actionWithTitle:@"Renderer" image:[[UIImage systemImageNamed:@"cpu"] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate] identifier:nil
|
UIAction *option5 = [UIAction actionWithTitle:@"Renderer" image:[[UIImage systemImageNamed:@"cpu"] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate] identifier:nil
|
||||||
handler:^(__kindof UIAction * _Nonnull action) {[self helpAlertOpt:REND];}];
|
handler:^(__kindof UIAction * _Nonnull action) {[self helpAlertOpt:REND];}];
|
||||||
UIAction *option6 = [UIAction actionWithTitle:@"Java home" image:[[UIImage systemImageNamed:@"folder"] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate] identifier:nil
|
UIAction *option6 = [UIAction actionWithTitle:@"Java home" image:[[UIImage systemImageNamed:@"cube"] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate] identifier:nil
|
||||||
handler:^(__kindof UIAction * _Nonnull action) {[self helpAlertOpt:JHOME];}];
|
handler:^(__kindof UIAction * _Nonnull action) {[self helpAlertOpt:JHOME];}];
|
||||||
UIAction *option7 = [UIAction actionWithTitle:@"Disable shaderconv" image:[[UIImage systemImageNamed:@"circle.lefthalf.fill"] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate] identifier:nil
|
UIAction *option7 = [UIAction actionWithTitle:@"Game directory" image:[[UIImage systemImageNamed:@"folder"] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate] identifier:nil
|
||||||
|
handler:^(__kindof UIAction * _Nonnull action) {[self helpAlertOpt:GDIRECTORY];}];
|
||||||
|
UIAction *option8 = [UIAction actionWithTitle:@"Disable shaderconv" image:[[UIImage systemImageNamed:@"circle.lefthalf.fill"] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate] identifier:nil
|
||||||
handler:^(__kindof UIAction * _Nonnull action) {[self helpAlertOpt:NOSHADERCONV];}];
|
handler:^(__kindof UIAction * _Nonnull action) {[self helpAlertOpt:NOSHADERCONV];}];
|
||||||
UIAction *option8 = [UIAction actionWithTitle:@"Reset warnings" image:[[UIImage systemImageNamed:@"exclamationmark.triangle"] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate] identifier:nil
|
UIAction *option9 = [UIAction actionWithTitle:@"Reset warnings" image:[[UIImage systemImageNamed:@"exclamationmark.triangle"] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate] identifier:nil
|
||||||
handler:^(__kindof UIAction * _Nonnull action) {[self helpAlertOpt:RESETWARN];}];
|
handler:^(__kindof UIAction * _Nonnull action) {[self helpAlertOpt:RESETWARN];}];
|
||||||
UIMenu *menu = [UIMenu menuWithTitle:@"" image:nil identifier:nil
|
UIMenu *menu = [UIMenu menuWithTitle:@"" image:nil identifier:nil
|
||||||
options:UIMenuOptionsDisplayInline children:@[option1, option2, option3, option4, option5, option6, option7, option8]];
|
options:UIMenuOptionsDisplayInline children:@[option1, option2, option3, option4, option5, option6, option7, option8, option9]];
|
||||||
self.navigationItem.rightBarButtonItem.action = nil;
|
self.navigationItem.rightBarButtonItem.action = nil;
|
||||||
self.navigationItem.rightBarButtonItem.primaryAction = nil;
|
self.navigationItem.rightBarButtonItem.primaryAction = nil;
|
||||||
self.navigationItem.rightBarButtonItem.menu = menu;
|
self.navigationItem.rightBarButtonItem.menu = menu;
|
||||||
@@ -263,6 +290,8 @@ UISwitch *noshaderconvSwitch;
|
|||||||
[javaAlert addAction:ok];
|
[javaAlert addAction:ok];
|
||||||
setPreference(@"java_warn", @NO);
|
setPreference(@"java_warn", @NO);
|
||||||
}
|
}
|
||||||
|
} else if (textField.tag == 104) {
|
||||||
|
setPreference(@"game_directory", textField.text);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -277,6 +306,7 @@ UISwitch *noshaderconvSwitch;
|
|||||||
UIAlertAction *jargs = [UIAlertAction actionWithTitle:@"Java arguments" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {[self helpAlertOpt:JARGS];}];
|
UIAlertAction *jargs = [UIAlertAction actionWithTitle:@"Java arguments" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {[self helpAlertOpt:JARGS];}];
|
||||||
UIAlertAction *renderer = [UIAlertAction actionWithTitle:@"Renderer" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {[self helpAlertOpt:REND];}];
|
UIAlertAction *renderer = [UIAlertAction actionWithTitle:@"Renderer" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {[self helpAlertOpt:REND];}];
|
||||||
UIAlertAction *jhome = [UIAlertAction actionWithTitle:@"Java home" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {[self helpAlertOpt:JHOME];}];
|
UIAlertAction *jhome = [UIAlertAction actionWithTitle:@"Java home" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {[self helpAlertOpt:JHOME];}];
|
||||||
|
UIAlertAction *gdirectory = [UIAlertAction actionWithTitle:@"Game directory" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {[self helpAlertOpt:GDIRECTORY];}];
|
||||||
UIAlertAction *noshaderconv = [UIAlertAction actionWithTitle:@"Disable shaderconv" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {[self helpAlertOpt:NOSHADERCONV];}];
|
UIAlertAction *noshaderconv = [UIAlertAction actionWithTitle:@"Disable shaderconv" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {[self helpAlertOpt:NOSHADERCONV];}];
|
||||||
UIAlertAction *resetwarn = [UIAlertAction actionWithTitle:@"Reset warnings" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {[self helpAlertOpt:RESETWARN];}];
|
UIAlertAction *resetwarn = [UIAlertAction actionWithTitle:@"Reset warnings" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {[self helpAlertOpt:RESETWARN];}];
|
||||||
UIAlertAction *cancel = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:nil];
|
UIAlertAction *cancel = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:nil];
|
||||||
@@ -288,6 +318,7 @@ UISwitch *noshaderconvSwitch;
|
|||||||
[helpAlert addAction:jargs];
|
[helpAlert addAction:jargs];
|
||||||
[helpAlert addAction:renderer];
|
[helpAlert addAction:renderer];
|
||||||
[helpAlert addAction:jhome];
|
[helpAlert addAction:jhome];
|
||||||
|
[helpAlert addAction:gdirectory];
|
||||||
[helpAlert addAction:noshaderconv];
|
[helpAlert addAction:noshaderconv];
|
||||||
[helpAlert addAction:resetwarn];
|
[helpAlert addAction:resetwarn];
|
||||||
[helpAlert addAction:cancel];
|
[helpAlert addAction:cancel];
|
||||||
@@ -315,6 +346,9 @@ UISwitch *noshaderconvSwitch;
|
|||||||
} else if(setting == JHOME) {
|
} else if(setting == JHOME) {
|
||||||
title = @"Java home";
|
title = @"Java home";
|
||||||
message = @"This option allows you to change the Java executable directory. Choosing '/usr/lib/jvm/java-16-openjdk' may allow you to play 1.17, however older versions and most versions of modded Minecraft, as well as the mod installer, will not work. This option also requires a restart of the launcher to take effect.";
|
message = @"This option allows you to change the Java executable directory. Choosing '/usr/lib/jvm/java-16-openjdk' may allow you to play 1.17, however older versions and most versions of modded Minecraft, as well as the mod installer, will not work. This option also requires a restart of the launcher to take effect.";
|
||||||
|
} else if(setting == GDIRECTORY) {
|
||||||
|
title = @"Game directory";
|
||||||
|
message = @"This option allows you to change where your Minecraft settings and saves are stored in a MultiMC like fashion. Useful for when you want to have multiple mod loaders instaldo not want to delete/move mods around to switch. This option also requires a restart of the launcher to take effect.";
|
||||||
} else if(setting == NOSHADERCONV) {
|
} else if(setting == NOSHADERCONV) {
|
||||||
title = @"Disable shaderconv";
|
title = @"Disable shaderconv";
|
||||||
message = @"This option allows you to disable the shader converter inside gl4es 1.1.5 in order to let ANGLE processes them directly. This option is experimental and should only be enabled when playing Minecraft 1.17 or above.";
|
message = @"This option allows you to disable the shader converter inside gl4es 1.1.5 in order to let ANGLE processes them directly. This option is experimental and should only be enabled when playing Minecraft 1.17 or above.";
|
||||||
@@ -358,7 +392,7 @@ UISwitch *noshaderconvSwitch;
|
|||||||
|
|
||||||
- (void)switchChanged:(UISwitch *)sender {
|
- (void)switchChanged:(UISwitch *)sender {
|
||||||
switch (sender.tag) {
|
switch (sender.tag) {
|
||||||
case 104:
|
case 105:
|
||||||
if (![rendTextField.text containsString:@"115"] && sender.isOn) {
|
if (![rendTextField.text containsString:@"115"] && sender.isOn) {
|
||||||
setPreference(@"disable_gl4es_shaderconv", @NO);
|
setPreference(@"disable_gl4es_shaderconv", @NO);
|
||||||
UIAlertController *resetWarn = [UIAlertController alertControllerWithTitle:@"Unavailable with the current renderer." message:@"This switch requires GL4ES 1.1.5 to function." preferredStyle:UIAlertControllerStyleActionSheet];
|
UIAlertController *resetWarn = [UIAlertController alertControllerWithTitle:@"Unavailable with the current renderer." message:@"This switch requires GL4ES 1.1.5 to function." preferredStyle:UIAlertControllerStyleActionSheet];
|
||||||
@@ -371,7 +405,7 @@ UISwitch *noshaderconvSwitch;
|
|||||||
setPreference(@"disable_gl4es_shaderconv", @(sender.isOn));
|
setPreference(@"disable_gl4es_shaderconv", @(sender.isOn));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 105:
|
case 106:
|
||||||
setPreference(@"mem_warn", @YES);
|
setPreference(@"mem_warn", @YES);
|
||||||
setPreference(@"option_warn", @YES);
|
setPreference(@"option_warn", @YES);
|
||||||
setPreference(@"local_warn", @YES);
|
setPreference(@"local_warn", @YES);
|
||||||
|
|||||||
Reference in new issue
Block a user