Skip to content

Commit 114b894

Browse files
authored
Add issues (#567)
* xrandr crash * `!` at the end of a folder name * corrupted mmc-pack.json * support different languages for mmc-pack.json * fix locked jars false positive --------- Co-authored-by: maskers <[email protected]>
1 parent 9e35e64 commit 114b894

File tree

1 file changed

+43
-1
lines changed

1 file changed

+43
-1
lines changed

src/handlers/event/analyze_logs/issues.rs

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ pub async fn find(log: &str, data: &Data) -> Result<Vec<(String, String)>> {
3737
linux_openal,
3838
flatpak_crash,
3939
spark_macos,
40+
xrandr,
41+
folder_name,
42+
corrupted_instance,
4043
];
4144

4245
let mut res: Vec<(String, String)> = issues.iter().filter_map(|issue| issue(log)).collect();
@@ -328,7 +331,7 @@ fn locked_jar(log: &str) -> Issue {
328331
.to_string(),
329332
);
330333

331-
let found = log.contains("Couldn't extract native jar");
334+
let found = log.contains("Couldn't extract native jar") && !log.contains("(missing)\n");
332335
found.then_some(issue)
333336
}
334337

@@ -470,3 +473,42 @@ fn spark_macos(log: &str) -> Issue {
470473
let found = log.contains("~StubRoutines::SafeFetch32");
471474
found.then_some(issue)
472475
}
476+
477+
fn xrandr(log: &str) -> Issue {
478+
let issue = (
479+
"Missing xrandr".to_string(),
480+
"This crash is caused by not having xrandr installed on Linux on Minecraft versions that use LWJGL 2."
481+
.to_string(),
482+
);
483+
484+
let found = log.contains("at org.lwjgl.opengl.LinuxDisplay.getAvailableDisplayModes");
485+
found.then_some(issue)
486+
}
487+
488+
fn folder_name(log: &str) -> Issue {
489+
let issue = (
490+
"`!` in folder name".to_string(),
491+
"Having a `!` in any folder is known to cause issues. If it's in your instance name, make sure to rename the actual instance folder, **not** the instance name in Prism."
492+
.to_string(),
493+
);
494+
495+
let found = Regex::new(r"Minecraft folder is:\n.*!/")
496+
.unwrap()
497+
.is_match(log);
498+
499+
found.then_some(issue)
500+
}
501+
502+
fn corrupted_instance(log: &str) -> Issue {
503+
let issue = (
504+
"Corrupted instance files".to_string(),
505+
"Your instance's `mmc-pack.json` appears to be corrupted. Make a new instance and copy over your data between `.minecraft` folders. To prevent this in the future, ensure your system has sufficient disk space and avoid forcefully shutting down your PC."
506+
.to_string(),
507+
);
508+
509+
let found = Regex::new(r"mmc-pack.json.*illegal value")
510+
.unwrap()
511+
.is_match(log);
512+
513+
found.then_some(issue)
514+
}

0 commit comments

Comments
 (0)