Bug fix: Fabric 1.17+ crash at startup(fixes #304)

Microsoft account now set accountType to msa.
Minor change in custom control view controller.
This commit is contained in:
Duy Tran Khanh committed 2022-02-05 16:47:04 +07:00
1 parent d607cf346f
commit e5018cc094
4 files changed
+29 -17

No files matched your search

@@ -1,5 +1,6 @@
package net.kdt.pojavlaunch;
import java.io.File;
import java.net.*;
/**
@@ -16,5 +17,10 @@ public class PojavClassLoader extends URLClassLoader {
@Override
public void addURL(URL url) {
super.addURL(url);
try {
System.setProperty("java.class.path", System.getProperty("java.class.path") + ":" + new File(url.toURI()).getAbsolutePath());
} catch (URISyntaxException e) {
e.printStackTrace();
}
}
}
@@ -193,7 +193,7 @@ public final class Tools
varArgMap.put("game_assets", Tools.ASSETS_PATH);
varArgMap.put("game_directory", gameDir.getAbsolutePath());
varArgMap.put("user_properties", "{}");
varArgMap.put("user_type", /* profile.isMicrosoft ? "msa" : */ "mojang"); // FIXME: handle MS auth
varArgMap.put("user_type", profile.isMicrosoft ? "msa" : "mojang");
varArgMap.put("version_name", versionName);
varArgMap.put("version_type", versionInfo.type);
+16 -15
View File
@@ -90,6 +90,7 @@ NSMutableArray *keyCodeMap, *keyValueMap;
longpressGesture.minimumPressDuration = 0.5;
[self.offsetView addGestureRecognizer:longpressGesture];
self.currentFileName = [getPreference(@"default_ctrl") stringByDeletingPathExtension];
[self initKeyCodeMap];
[self loadControlFile:[NSString stringWithFormat:@"%s/%@", getenv("POJAV_PATH_CONTROL"), getPreference(@"default_ctrl")]];
}
@@ -106,23 +107,23 @@ NSMutableArray *keyCodeMap, *keyValueMap;
if (cc_error) {
NSLog(@"Error: could not read %@: %@", controlFilePath, cc_error.localizedDescription);
showDialog(self, @"Error", [NSString stringWithFormat:@"Could not read %@: %@", controlFilePath, cc_error.localizedDescription]);
} else {
NSData* cc_objc_data = [cc_data dataUsingEncoding:NSUTF8StringEncoding];
self.cc_dictionary = [NSJSONSerialization JSONObjectWithData:cc_objc_data options:NSJSONReadingMutableContainers error:&cc_error];
if (cc_error) {
showDialog(self, @"Error parsing JSON", cc_error.localizedDescription);
} else {
loadControlObject(self.offsetView, self.cc_dictionary, ^void(ControlButton* button) {
[button addGestureRecognizer:[[UITapGestureRecognizer alloc]
initWithTarget:self action:@selector(showControlPopover:)]];
[button addGestureRecognizer:[[UIPanGestureRecognizer alloc]
initWithTarget:self action:@selector(onTouch:)]];
});
}
return;
}
[self initKeyCodeMap];
}
NSData* cc_objc_data = [cc_data dataUsingEncoding:NSUTF8StringEncoding];
self.cc_dictionary = [NSJSONSerialization JSONObjectWithData:cc_objc_data options:NSJSONReadingMutableContainers error:&cc_error];
if (cc_error) {
showDialog(self, @"Error parsing JSON", cc_error.localizedDescription);
return;
}
loadControlObject(self.offsetView, self.cc_dictionary, ^void(ControlButton* button) {
[button addGestureRecognizer:[[UITapGestureRecognizer alloc]
initWithTarget:self action:@selector(showControlPopover:)]];
[button addGestureRecognizer:[[UIPanGestureRecognizer alloc]
initWithTarget:self action:@selector(onTouch:)]];
});
}
- (void)showControlPopover:(UIGestureRecognizer *)sender {
self.currentGesture = sender;
+6 -1
View File
@@ -552,12 +552,17 @@ int launchJVM(int argc, char *argv[]) {
DIR *d;
struct dirent *dir;
d = opendir(java_libs_path);
int cplen = 0;
int cplen = -2;
if (d) {
// cplen += sprintf(classpath + cplen, "-Xbootclasspath/a:");
while ((dir = readdir(d)) != NULL) {
if (cplen < 0) {
++cplen;
continue;
}
cplen += sprintf(classpath + cplen, "%s/%s:", java_libs_path, dir->d_name);
}
classpath[cplen-1] = '\0';
closedir(d);
}
debug("[Pre-init] Classpath generated: %s", classpath);