Skip to content
This repository was archived by the owner on May 18, 2025. It is now read-only.

Commit 7d8203b

Browse files
committed
Fix[JNA]: use bitshift for packing version number
When using a char array, a non-zero patch version will break the check. Changed it to bitshift.
1 parent 6aacf3a commit 7d8203b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Natives/MinecraftResourceUtils.m

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,9 @@ + (void)tweakVersionJson:(NSMutableDictionary *)json {
8383
if ([library[@"name"] hasPrefix:@"net.java.dev.jna:jna:"]) {
8484
// Special handling for LabyMod 1.8.9 and Forge 1.12.2(?)
8585
// we have libjnidispatch 5.13.0 in Frameworks directory
86-
char bundledVer[4] = {5, 13, 0, 0};
87-
char requiredVer[4] = {(char)version[0].intValue, (char)version[1].intValue, (char)version[2].intValue, 0};
88-
if (*(uint32_t *)requiredVer > *(uint32_t*)bundledVer) {
86+
uint32_t bundledVer = 5 << 16 | 13 << 8 | 0;
87+
uint32_t requiredVer = (char)version[0].intValue << 16 | (char)version[1].intValue << 8 | (char)version[2].intValue;
88+
if (requiredVer > bundledVer) {
8989
NSLog(@"[MCDL] Warning: JNA version required by %@ is %@ > 5.13.0, skipping JNA replacement.", json[@"id"], versionStr);
9090
continue;
9191
}

0 commit comments

Comments
 (0)