Merge pull request #1 from NotAHero04/v3_openjdk

Fixes for newer Minecraft versions
This commit is contained in:
The Judge 2022-10-21 13:29:18 -07:00 committed by GitHub
commit aeee804ddc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 43 additions and 7 deletions

View File

@ -11,7 +11,6 @@ jar {
//baseName = project.name //baseName = project.name
baseName = "lwjgl-glfw-classes" baseName = "lwjgl-glfw-classes"
destinationDirectory.set(file("../app_pojavlauncher/src/main/assets/components/lwjgl3/")) destinationDirectory.set(file("../app_pojavlauncher/src/main/assets/components/lwjgl3/"))
// Auto update the version with a timestamp so the project jar gets updated by Pojav // Auto update the version with a timestamp so the project jar gets updated by Pojav
File versionFile = file("../app_pojavlauncher/src/main/assets/components/lwjgl3/version") File versionFile = file("../app_pojavlauncher/src/main/assets/components/lwjgl3/version")
versionFile.write(String.valueOf(new Date().getTime())) versionFile.write(String.valueOf(new Date().getTime()))

View File

@ -199,8 +199,45 @@ public class GLFWImage extends Struct implements NativeResource {
public static GLFWImage.Buffer createSafe(long address, int capacity) { public static GLFWImage.Buffer createSafe(long address, int capacity) {
return address == NULL ? null : wrap(Buffer.class, address, capacity); return address == NULL ? null : wrap(Buffer.class, address, capacity);
} }
/**
* Returns a new {@code GLFWImage} instance allocated on the specified {@link MemoryStack}.
*
* @param stack the stack from which to allocate
*/
public static GLFWImage malloc(MemoryStack stack) {
return wrap(GLFWImage.class, stack.nmalloc(ALIGNOF, SIZEOF));
}
// ----------------------------------- /**
* Returns a new {@code GLFWImage} instance allocated on the specified {@link MemoryStack} and initializes all its bits to zero.
*
* @param stack the stack from which to allocate
*/
public static GLFWImage calloc(MemoryStack stack) {
return wrap(GLFWImage.class, stack.ncalloc(ALIGNOF, 1, SIZEOF));
}
/**
* Returns a new {@link GLFWImage.Buffer} instance allocated on the specified {@link MemoryStack}.
*
* @param stack the stack from which to allocate
* @param capacity the buffer capacity
*/
public static GLFWImage.Buffer malloc(int capacity, MemoryStack stack) {
return wrap(Buffer.class, stack.nmalloc(ALIGNOF, capacity * SIZEOF), capacity);
}
/**
* Returns a new {@link GLFWImage.Buffer} instance allocated on the specified {@link MemoryStack} and initializes all its bits to zero.
*
* @param stack the stack from which to allocate
* @param capacity the buffer capacity
*/
public static GLFWImage.Buffer calloc(int capacity, MemoryStack stack) {
return wrap(Buffer.class, stack.ncalloc(ALIGNOF, capacity, SIZEOF), capacity);
}
// mallocStack() and callocStack() will be removed in 3.4.0. Keeping them here for compatibility.
/** Returns a new {@code GLFWImage} instance allocated on the thread-local {@link MemoryStack}. */ /** Returns a new {@code GLFWImage} instance allocated on the thread-local {@link MemoryStack}. */
public static GLFWImage mallocStack() { public static GLFWImage mallocStack() {
@ -218,7 +255,7 @@ public class GLFWImage extends Struct implements NativeResource {
* @param stack the stack from which to allocate * @param stack the stack from which to allocate
*/ */
public static GLFWImage mallocStack(MemoryStack stack) { public static GLFWImage mallocStack(MemoryStack stack) {
return wrap(GLFWImage.class, stack.nmalloc(ALIGNOF, SIZEOF)); return malloc(stack);
} }
/** /**
@ -227,7 +264,7 @@ public class GLFWImage extends Struct implements NativeResource {
* @param stack the stack from which to allocate * @param stack the stack from which to allocate
*/ */
public static GLFWImage callocStack(MemoryStack stack) { public static GLFWImage callocStack(MemoryStack stack) {
return wrap(GLFWImage.class, stack.ncalloc(ALIGNOF, 1, SIZEOF)); return calloc(stack);
} }
/** /**
@ -255,7 +292,7 @@ public class GLFWImage extends Struct implements NativeResource {
* @param capacity the buffer capacity * @param capacity the buffer capacity
*/ */
public static GLFWImage.Buffer mallocStack(int capacity, MemoryStack stack) { public static GLFWImage.Buffer mallocStack(int capacity, MemoryStack stack) {
return wrap(Buffer.class, stack.nmalloc(ALIGNOF, capacity * SIZEOF), capacity); return malloc(capacity, stack);
} }
/** /**
@ -265,7 +302,7 @@ public class GLFWImage extends Struct implements NativeResource {
* @param capacity the buffer capacity * @param capacity the buffer capacity
*/ */
public static GLFWImage.Buffer callocStack(int capacity, MemoryStack stack) { public static GLFWImage.Buffer callocStack(int capacity, MemoryStack stack) {
return wrap(Buffer.class, stack.ncalloc(ALIGNOF, capacity, SIZEOF), capacity); return calloc(capacity, stack);
} }
// ----------------------------------- // -----------------------------------
@ -364,4 +401,4 @@ public class GLFWImage extends Struct implements NativeResource {
} }
} }