From 10a63f7038b338e30322c9de2e038ecb3927aafb Mon Sep 17 00:00:00 2001 From: LAX1DUDE Date: Wed, 10 Aug 2022 19:21:54 -0700 Subject: [PATCH] TODO: need to auto detect ANGLE bug --- .../java/net/minecraft/client/Minecraft.java | 6 +----- .../java/net/minecraft/src/EnumOptions.java | 2 +- .../net/minecraft/src/EnumOptionsHelper.java | 6 ------ .../java/net/minecraft/src/GameSettings.java | 12 ----------- .../net/minecraft/src/GuiVideoSettings.java | 2 +- .../adapter/DetectAnisotropicGlitch.java | 21 +++++++++++++++++++ .../adapter/EaglerAdapterImpl2.java | 8 +++---- 7 files changed, 27 insertions(+), 30 deletions(-) create mode 100644 src/teavm/java/net/lax1dude/eaglercraft/adapter/DetectAnisotropicGlitch.java diff --git a/src/main/java/net/minecraft/client/Minecraft.java b/src/main/java/net/minecraft/client/Minecraft.java index b7e54a5..350f1f8 100644 --- a/src/main/java/net/minecraft/client/Minecraft.java +++ b/src/main/java/net/minecraft/client/Minecraft.java @@ -322,9 +322,7 @@ public class Minecraft implements Runnable { int var4 = var2.getScaledHeight(); this.voiceOverlay.setResolution(var3, var4); - //if (this.serverName != null) { - // this.displayGuiScreen(new GuiConnecting(new GuiMainMenu(), this, this.serverName, this.serverPort)); - //} else { + EaglerAdapter.anisotropicPatch(EaglerAdapter.glNeedsAnisotropicFix()); EaglerProfile.loadFromStorage(); @@ -1153,8 +1151,6 @@ public class Minecraft implements Runnable { if (this.rightClickDelayTimer > 0) { --this.rightClickDelayTimer; } - - EaglerAdapter.anisotropicPatch(this.gameSettings.patchAnisotropic); this.mcProfiler.startSection("stats"); this.mcProfiler.endStartSection("gui"); diff --git a/src/main/java/net/minecraft/src/EnumOptions.java b/src/main/java/net/minecraft/src/EnumOptions.java index e7ee9e4..f058bf6 100644 --- a/src/main/java/net/minecraft/src/EnumOptions.java +++ b/src/main/java/net/minecraft/src/EnumOptions.java @@ -7,7 +7,7 @@ public enum EnumOptions { AMBIENT_OCCLUSION("options.ao", false, false), GUI_SCALE("options.guiScale", false, false), RENDER_CLOUDS("options.renderClouds", false, true), PARTICLES("options.particles", false, false), CHAT_VISIBILITY("options.chat.visibility", false, false), CHAT_COLOR("options.chat.color", false, true), CHAT_LINKS("options.chat.links", false, true), CHAT_OPACITY("options.chat.opacity", true, false), CHAT_LINKS_PROMPT("options.chat.links.prompt", false, true), USE_SERVER_TEXTURES("options.serverTextures", false, true), SNOOPER_ENABLED("options.snooper", false, true), USE_FULLSCREEN("options.fullscreen", false, true), - PATCH_ANGLE("options.patchAnisotropic", false, true), ENABLE_FOG("options.fog", false, true), SHOW_CAPE("options.showCape", false, true), ANTIALIASING("options.framebufferAntialias", false, false), CHAT_SCALE("options.chat.scale", true, false), CHAT_WIDTH("options.chat.width", true, false), + ENABLE_FOG("options.fog", false, true), SHOW_CAPE("options.showCape", false, true), ANTIALIASING("options.framebufferAntialias", false, false), CHAT_SCALE("options.chat.scale", true, false), CHAT_WIDTH("options.chat.width", true, false), CHAT_HEIGHT_FOCUSED("options.chat.height.focused", true, false), CHAT_HEIGHT_UNFOCUSED("options.chat.height.unfocused", true, false), CHUNK_UPDATES("options.chunkUpdates", false, false); private final boolean enumFloat; diff --git a/src/main/java/net/minecraft/src/EnumOptionsHelper.java b/src/main/java/net/minecraft/src/EnumOptionsHelper.java index 95f18e0..8e60a67 100644 --- a/src/main/java/net/minecraft/src/EnumOptionsHelper.java +++ b/src/main/java/net/minecraft/src/EnumOptionsHelper.java @@ -64,12 +64,6 @@ class EnumOptionsHelper { ; } - try { - enumOptionsMappingHelperArray[EnumOptions.PATCH_ANGLE.ordinal()] = 12; - } catch (NoSuchFieldError var3) { - ; - } - try { enumOptionsMappingHelperArray[EnumOptions.SHOW_CAPE.ordinal()] = 13; } catch (NoSuchFieldError var2) { diff --git a/src/main/java/net/minecraft/src/GameSettings.java b/src/main/java/net/minecraft/src/GameSettings.java index d7c2576..2ebf006 100644 --- a/src/main/java/net/minecraft/src/GameSettings.java +++ b/src/main/java/net/minecraft/src/GameSettings.java @@ -62,7 +62,6 @@ public class GameSettings { public boolean showCape = true; public boolean touchscreen = false; public int antialiasMode = 1; - public boolean patchAnisotropic = false; public int overrideWidth = 0; public int overrideHeight = 0; public boolean heldItemTooltips = true; @@ -163,7 +162,6 @@ public class GameSettings { this.particleSetting = 0; this.language = "en_US"; this.mc = par1Minecraft; - this.patchAnisotropic = EaglerAdapter.isWindows(); this.loadOptions(); } @@ -358,11 +356,6 @@ public class GameSettings { } } - if (par1EnumOptions == EnumOptions.PATCH_ANGLE) { - this.patchAnisotropic = !this.patchAnisotropic; - this.mc.renderGlobal.loadRenderers(); - } - this.saveOptions(); } @@ -413,9 +406,6 @@ public class GameSettings { case 11: return this.fullScreen; - case 12: - return this.patchAnisotropic; - case 13: return this.showCape; @@ -523,7 +513,6 @@ public class GameSettings { if(yee.hasKey("chatHeightUnfocused")) this.chatHeightUnfocused = yee.getFloat("chatHeightUnfocused"); if(yee.hasKey("chatScale")) this.chatScale = yee.getFloat("chatScale"); if(yee.hasKey("chatWidth")) this.chatWidth = yee.getFloat("chatWidth"); - if(yee.hasKey("patchAnisotropic")) this.patchAnisotropic = yee.getBoolean("patchAnisotropic"); if(yee.hasKey("showCoordinates")) this.showCoordinates = yee.getBoolean("showCoordinates"); if(yee.hasKey("showSkinJacket")) showSkinJacket = yee.getBoolean("showSkinJacket"); if(yee.hasKey("showSkinHat")) showSkinHat = yee.getBoolean("showSkinHat"); @@ -598,7 +587,6 @@ public class GameSettings { yee.setFloat("chatHeightUnfocused", this.chatHeightUnfocused); yee.setFloat("chatScale", this.chatScale); yee.setFloat("chatWidth", this.chatWidth); - yee.setBoolean("patchAnisotropic", this.patchAnisotropic); yee.setBoolean("showCoordinates", this.showCoordinates); yee.setBoolean("showSkinJacket", showSkinJacket); yee.setBoolean("showSkinHat", showSkinHat); diff --git a/src/main/java/net/minecraft/src/GuiVideoSettings.java b/src/main/java/net/minecraft/src/GuiVideoSettings.java index 77e62b8..ec53e7d 100644 --- a/src/main/java/net/minecraft/src/GuiVideoSettings.java +++ b/src/main/java/net/minecraft/src/GuiVideoSettings.java @@ -17,7 +17,7 @@ public class GuiVideoSettings extends GuiScreen { /** An array of all of EnumOption's video options. */ private static EnumOptions[] videoOptions = new EnumOptions[] { EnumOptions.GRAPHICS, EnumOptions.RENDER_DISTANCE, EnumOptions.AMBIENT_OCCLUSION, EnumOptions.FRAMERATE_LIMIT, EnumOptions.ANAGLYPH, EnumOptions.VIEW_BOBBING, - EnumOptions.GUI_SCALE, EnumOptions.GAMMA, EnumOptions.RENDER_CLOUDS, EnumOptions.ENABLE_FOG, EnumOptions.PARTICLES, EnumOptions.PATCH_ANGLE, EnumOptions.CHUNK_UPDATES }; + EnumOptions.GUI_SCALE, EnumOptions.GAMMA, EnumOptions.RENDER_CLOUDS, EnumOptions.ENABLE_FOG, EnumOptions.PARTICLES, EnumOptions.CHUNK_UPDATES }; public GuiVideoSettings(GuiScreen par1GuiScreen, GameSettings par2GameSettings) { this.parentGuiScreen = par1GuiScreen; diff --git a/src/teavm/java/net/lax1dude/eaglercraft/adapter/DetectAnisotropicGlitch.java b/src/teavm/java/net/lax1dude/eaglercraft/adapter/DetectAnisotropicGlitch.java new file mode 100644 index 0000000..a68a12a --- /dev/null +++ b/src/teavm/java/net/lax1dude/eaglercraft/adapter/DetectAnisotropicGlitch.java @@ -0,0 +1,21 @@ +package net.lax1dude.eaglercraft.adapter; + +import static net.lax1dude.eaglercraft.adapter.teavm.WebGL2RenderingContext.*; + +import org.teavm.jso.browser.Window; +import org.teavm.jso.dom.html.HTMLCanvasElement; + +import net.lax1dude.eaglercraft.adapter.teavm.WebGL2RenderingContext; + +public class DetectAnisotropicGlitch { + + public static boolean detectGlitch() { + //HTMLCanvasElement cvs = (HTMLCanvasElement) Window.current().getDocument().createElement("canvas"); + //WebGL2RenderingContext ctx = (WebGL2RenderingContext) cvs.getContext("webgl2"); + + + + return EaglerAdapterImpl2.isWindows(); //TODO + } + +} diff --git a/src/teavm/java/net/lax1dude/eaglercraft/adapter/EaglerAdapterImpl2.java b/src/teavm/java/net/lax1dude/eaglercraft/adapter/EaglerAdapterImpl2.java index cdf6e01..ee6e718 100644 --- a/src/teavm/java/net/lax1dude/eaglercraft/adapter/EaglerAdapterImpl2.java +++ b/src/teavm/java/net/lax1dude/eaglercraft/adapter/EaglerAdapterImpl2.java @@ -1,7 +1,6 @@ package net.lax1dude.eaglercraft.adapter; import static net.lax1dude.eaglercraft.adapter.teavm.WebGL2RenderingContext.*; -import static org.teavm.jso.webgl.WebGLRenderingContext.*; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; @@ -108,10 +107,6 @@ public class EaglerAdapterImpl2 { public static final boolean _wisWebGL() { return true; } - private static boolean isAnisotropicPatched = false; - public static final boolean _wisAnisotropicPatched() { - return isAnisotropicPatched; - } public static final String _wgetShaderHeader() { return "#version 300 es"; } @@ -966,6 +961,9 @@ public class EaglerAdapterImpl2 { public static final boolean isWindows() { return getNavString("platform").toLowerCase().contains("win"); } + public static final boolean glNeedsAnisotropicFix() { + return DetectAnisotropicGlitch.detectGlitch(); + } private static HTMLCanvasElement imageLoadCanvas = null; private static CanvasRenderingContext2D imageLoadContext = null;