Skip to content

Commit

Permalink
force gl compat
Browse files Browse the repository at this point in the history
  • Loading branch information
rfresh2 committed Aug 22, 2024
1 parent 4110500 commit 27b0e73
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 2 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/1.12.2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,5 +63,5 @@ jobs:
regex: .*forge.*
mc-runtime-test: lexforge
java: 8
xvfb: true
headlessmc-command: --jvm -Djava.awt.headless=true
xvfb: false
headlessmc-command: -lwjgl --jvm -Djava.awt.headless=true
22 changes: 22 additions & 0 deletions src/main/java/xaeroplus/mixin/client/MixinPixelBuffers.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package xaeroplus.mixin.client;

import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import xaero.map.graphics.PixelBuffers;

@Mixin(value = PixelBuffers.class, remap = false)
public class MixinPixelBuffers {

@Shadow private static int buffersType;

@Inject(method = "<clinit>", at = @At("HEAD"), cancellable = true)
private static void disableBuffersCheckDuringCITest(final CallbackInfo ci) {
if (System.getenv("XP_CI_TEST") != null) {
ci.cancel();
buffersType = 0;
}
}
}
25 changes: 25 additions & 0 deletions src/main/java/xaeroplus/mixin/client/MixinRegionTexture.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package xaeroplus.mixin.client;

import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
import xaero.map.graphics.PixelBuffers;
import xaero.map.region.texture.RegionTexture;

import java.nio.ByteBuffer;

@Mixin(value = RegionTexture.class, remap = false)
public class MixinRegionTexture {

@Redirect(method = "writeToUnpackPBO", at = @At(
value = "INVOKE",
target = "Lxaero/map/graphics/PixelBuffers;glMapBuffer(IIJLjava/nio/ByteBuffer;)Ljava/nio/ByteBuffer;"
))
public ByteBuffer redirectGlMapBuffer(final int target, final int access, final long length, final ByteBuffer buffer) {
ByteBuffer result = PixelBuffers.glMapBuffer(target, access, length, buffer);
if (result == null && System.getenv("XP_CI_TEST") != null) {
return ByteBuffer.allocate((int) length);
}
return buffer;
}
}
2 changes: 2 additions & 0 deletions src/main/resources/mixins.xaeroplus.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,10 @@
"MixinMinimapModSettings",
"MixinMinimapRenderer",
"MixinMisc",
"MixinPixelBuffers",
"MixinRadarRenderContext",
"MixinRadarRenderProvider",
"MixinRegionTexture",
"MixinSupportXaeroMinimap",
"MixinSupportXaeroWorldmap",
"MixinWaypoint",
Expand Down

0 comments on commit 27b0e73

Please sign in to comment.