-
Notifications
You must be signed in to change notification settings - Fork 861
修复了macos arm64版本可能导致的lwjgl natives匹配错误 #5990
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -132,7 +132,8 @@ public static Version patchNative(DefaultGameRepository repository, | |
|
|
||
| if (arch == Architecture.ARM64 && (os == OperatingSystem.MACOS || os == OperatingSystem.WINDOWS) | ||
| && gameVersionNumber != null | ||
| && gameVersionNumber.compareTo("1.19") >= 0) | ||
| && gameVersionNumber.compareTo("1.19") >= 0 | ||
| && !hasLegacyLwjglNatives(version)) | ||
| return version; | ||
|
|
||
| Map<String, Library> replacements = getNatives(javaVersion.getPlatform()); | ||
|
|
@@ -148,12 +149,23 @@ public static Version patchNative(DefaultGameRepository repository, | |
| continue; | ||
|
|
||
| if (library.isNative()) { | ||
| Library replacement = replacements.getOrDefault(library.getName() + ":natives", NONEXISTENT_LIBRARY); | ||
| String nativeKey = library.getName() + ":natives"; | ||
| String matchedKey = nativeKey; | ||
| Library replacement = replacements.getOrDefault(nativeKey, NONEXISTENT_LIBRARY); | ||
| if (replacement == NONEXISTENT_LIBRARY) { | ||
| String classifier = library.getClassifier(); | ||
| if (classifier != null) { | ||
| String classifierKey = library.getName() + ":" + classifier; | ||
| replacement = replacements.getOrDefault(classifierKey, NONEXISTENT_LIBRARY); | ||
| matchedKey = classifierKey; | ||
| } | ||
| } | ||
|
|
||
| if (replacement == NONEXISTENT_LIBRARY) { | ||
| LOG.warning("No alternative native library " + library.getName() + ":natives provided for platform " + javaVersion.getPlatform()); | ||
| newLibraries.add(library); | ||
| } else if (replacement != null) { | ||
| LOG.info("Replace " + library.getName() + ":natives with " + replacement.getName()); | ||
| LOG.info("Replace " + matchedKey + " with " + replacement.getName()); | ||
| newLibraries.add(replacement); | ||
| } | ||
| } else { | ||
|
|
@@ -280,6 +292,27 @@ public static SupportStatus checkSupportedStatus(GameVersionNumber gameVersion, | |
| return SupportStatus.UNTESTED; | ||
| } | ||
|
|
||
| private static boolean hasLegacyLwjglNatives(Version version) { | ||
| for (Library lib : version.getLibraries()) { | ||
| if (!lib.appliesToCurrentEnvironment()) continue; | ||
| if (!"org.lwjgl".equals(lib.getGroupId())) continue; | ||
| if (!lib.isNative()) continue; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Useful? React with 👍 / 👎.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 通过multiMC程序打包的整合包, 在经过HMCL导入后,目前可见的legacy classifier仅遇到过
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 示例json: |
||
|
|
||
| String classifier = lib.getClassifier(); | ||
| if (classifier == null) { | ||
| return true; | ||
| } | ||
|
|
||
| String c = classifier.toLowerCase(Locale.ROOT); | ||
| boolean arm64Like = c.contains("arm64") || c.contains("aarch64"); | ||
| if (!arm64Like) { | ||
| // e.g. natives-macos / natives-windows | ||
| return true; | ||
| } | ||
| } | ||
| return false; | ||
| } | ||
|
|
||
| public enum SupportStatus { | ||
| OFFICIAL_SUPPORTED, | ||
| LAUNCHER_SUPPORTED, | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.