Skip to content

Commit

Permalink
Workaround: ignore jna and stub new function
Browse files Browse the repository at this point in the history
Fix a check on replacing JNA, add a missing function.
These are sufficient for 1.21-pre1 for now as it's requiring LWJGL
3.3.3, which will be updated later.
  • Loading branch information
khanhduytran0 committed May 31, 2024
1 parent b2aa432 commit 879f852
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
3 changes: 3 additions & 0 deletions JavaApp/src/main/java/org/lwjgl/glfw/GLFW.java
Original file line number Diff line number Diff line change
Expand Up @@ -1007,6 +1007,9 @@ public static void glfwGetWindowSize(long window, IntBuffer width, IntBuffer hei
if (height != null) height.put(internalGetWindow(window).height);
}

public static void glfwSetWindowSizeLimits(@NativeType("GLFWwindow *") long window, int minwidth, int minheight, int maxwidth, int maxheight) {
}

public static void glfwSetWindowPos(long window, int x, int y) {
internalGetWindow(window).x = x;
internalGetWindow(window).y = y;
Expand Down
7 changes: 5 additions & 2 deletions Natives/MinecraftResourceUtils.m
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,11 @@ + (void)tweakVersionJson:(NSMutableDictionary *)json {
if ([library[@"name"] hasPrefix:@"net.java.dev.jna:jna:"]) {
// Special handling for LabyMod 1.8.9 and Forge 1.12.2(?)
// we have libjnidispatch 5.13.0 in Frameworks directory
if (!(version[0].intValue < 5 || version[1].intValue < 13 || version[2].intValue < 1)) {
NSLog(@"[MCDL] Warning: JNA version required by %@ is %@ > 5.13.0, compatibility might be broken.", json[@"id"], versionStr);
char bundledVer[4] = {5, 13, 0, 0};
char requiredVer[4] = {(char)version[0].intValue, (char)version[1].intValue, (char)version[2].intValue, 0};
if (*(uint32_t *)requiredVer > *(uint32_t*)bundledVer) {
NSLog(@"[MCDL] Warning: JNA version required by %@ is %@ > 5.13.0, skipping JNA replacement.", json[@"id"], versionStr);
continue;
}
library[@"name"] = @"net.java.dev.jna:jna:5.13.0";
library[@"downloads"][@"artifact"][@"path"] = @"net/java/dev/jna/jna/5.13.0/jna-5.13.0.jar";
Expand Down

0 comments on commit 879f852

Please sign in to comment.