diff options
| author | Connor-Colenso <52056774+Connor-Colenso@users.noreply.github.com> | 2023-10-18 17:03:23 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-10-18 18:03:23 +0200 |
| commit | fbdbb388c369fae549cfde3eed38b536f7461d90 (patch) | |
| tree | b46f7fc949d7e4c6e3be910b81ed725e6dc1648e /src/main/java/gtPlusPlus/preloader/keyboard | |
| parent | b670446fdf49991093b485f0aa14050039632775 (diff) | |
| download | GT5-Unofficial-fbdbb388c369fae549cfde3eed38b536f7461d90.tar.gz GT5-Unofficial-fbdbb388c369fae549cfde3eed38b536f7461d90.tar.bz2 GT5-Unofficial-fbdbb388c369fae549cfde3eed38b536f7461d90.zip | |
Cleaning up (#767)
* Kill playerAPI
* Gut more events and compat that is now obsolete
* Remove commented out code
* Remove final modifier from methods
* Make more stuff final
* Remove slow building ring
* Protected -> private in final classes
* More cleaning
* More cleaning v2
* Purging
* Clean DevHelper
* Clean DevHelper 2
* delete DevHelper
* remove useless IFMLLoadingPlugin.MCVersion annotation from @Mod files
* check for obfuscation only once in the IFMLloadingPlugin.injectData
* don't instantiate the static class ASMConfig
* delete unused and empty implementation of IFMLCallHook
* delete empty class
* delete ClassesToTransform class that just holds the class names constants
* delete unused methods and unsless logging in dummymod container
* delete unused transformer ClassTransformer_TT_ThaumicRestorer
* spotless
* Clean
* Clean utils
* Build checkpoint
* Purge
* Stage 2
* Stage 3
* Stage 4
* Stage 5
* Stage 6
* Spotless
* Imports
* Stage idk
* Stage 1
* Fix issue
* Spotless
* Format numbers
---------
Co-authored-by: GTNH-Colen <54497873+GTNH-Colen@users.noreply.github.com>
Co-authored-by: Alexdoru <57050655+Alexdoru@users.noreply.github.com>
Co-authored-by: Connor Colenso <colen@CONNORSPC>
Diffstat (limited to 'src/main/java/gtPlusPlus/preloader/keyboard')
| -rw-r--r-- | src/main/java/gtPlusPlus/preloader/keyboard/BetterKeyboard.java | 131 |
1 files changed, 0 insertions, 131 deletions
diff --git a/src/main/java/gtPlusPlus/preloader/keyboard/BetterKeyboard.java b/src/main/java/gtPlusPlus/preloader/keyboard/BetterKeyboard.java deleted file mode 100644 index 164d1b8b37..0000000000 --- a/src/main/java/gtPlusPlus/preloader/keyboard/BetterKeyboard.java +++ /dev/null @@ -1,131 +0,0 @@ -/* - * Copyright (c) 2002-2008 LWJGL Project All rights reserved. Redistribution and use in source and binary forms, with or - * without modification, are permitted provided that the following conditions are met: * Redistributions of source code - * must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in - * binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. * Neither the name of 'LWJGL' nor the names of - * its contributors may be used to endorse or promote products derived from this software without specific prior written - * permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package gtPlusPlus.preloader.keyboard; - -import java.lang.reflect.Field; -import java.nio.ByteBuffer; -import java.util.HashMap; -import java.util.Map; - -import net.minecraft.client.resources.I18n; - -import org.apache.logging.log4j.Level; -import org.lwjgl.BufferUtils; -import org.lwjgl.input.Keyboard; - -import cpw.mods.fml.relauncher.FMLRelaunchLog; -import gtPlusPlus.core.util.reflect.ReflectionUtils; -import gtPlusPlus.preloader.asm.transformers.ClassTransformer_LWJGL_Keyboard; - -/** - * <br> - * A raw Keyboard interface. This can be used to poll the current state of the keys, or read all the keyboard presses / - * releases since the last read. - * - * @author cix_foo <cix_foo@users.sourceforge.net> - * @author elias_naur <elias_naur@users.sourceforge.net> - * @author Brian Matzon <brian@matzon.dk> - * @version $Revision$ $Id$ - */ -public class BetterKeyboard { - - public static final int KEYBOARD_SIZE = Short.MAX_VALUE; - - private static boolean init = false; - - public static void init() { - if (!init) { - FMLRelaunchLog.log( - "[GT++ ASM] LWJGL Keybinding index out of bounds fix", - Level.INFO, - "Trying to patch out LWJGL internal arrays with larger ones."); - Field aKeyNameSize = ReflectionUtils.getField(Keyboard.class, "keyName"); - Field aKeyMapSize = ReflectionUtils.getField(Keyboard.class, "keyMap"); - Field aKeyDownBuffer = ReflectionUtils.getField(Keyboard.class, "keyDownBuffer"); - String[] aOldKeyNameArray = ReflectionUtils.getFieldValue(aKeyNameSize); - if (aOldKeyNameArray != null && aOldKeyNameArray.length < Short.MAX_VALUE) { - String[] aNewKeyNameArray = new String[Short.MAX_VALUE]; - for (int i = 0; i < aOldKeyNameArray.length; i++) { - aNewKeyNameArray[i] = aOldKeyNameArray[i]; - } - try { - ReflectionUtils.setFinalFieldValue(Keyboard.class, aKeyNameSize.getName(), aNewKeyNameArray); - FMLRelaunchLog.log( - "[GT++ ASM] LWJGL Keybinding index out of bounds fix", - Level.INFO, - "Patched Field: " + aKeyNameSize.getName()); - } catch (Throwable t) { - FMLRelaunchLog.log( - "[GT++ ASM] LWJGL Keybinding index out of bounds fix", - Level.INFO, - "Failed Patching Field: " + aKeyDownBuffer.getName()); - } - } - Map<String, Integer> aOldKeyMapArray = ReflectionUtils.getFieldValue(aKeyMapSize); - if (aOldKeyNameArray != null && aOldKeyMapArray.size() < Short.MAX_VALUE) { - Map<String, Integer> aNewKeyMapArray = new HashMap<String, Integer>(Short.MAX_VALUE); - aNewKeyMapArray.putAll(aOldKeyMapArray); - try { - ReflectionUtils.setFinalFieldValue(Keyboard.class, aKeyMapSize.getName(), aNewKeyMapArray); - FMLRelaunchLog.log( - "[GT++ ASM] LWJGL Keybinding index out of bounds fix", - Level.INFO, - "Patched Field: " + aKeyMapSize.getName()); - } catch (Throwable t) { - FMLRelaunchLog.log( - "[GT++ ASM] LWJGL Keybinding index out of bounds fix", - Level.INFO, - "Failed Patching Field: " + aKeyDownBuffer.getName()); - } - } - ByteBuffer aOldByteBuffer = ReflectionUtils.getFieldValue(aKeyDownBuffer); - if (aOldByteBuffer != null && aOldByteBuffer.capacity() == Keyboard.KEYBOARD_SIZE) { - ByteBuffer aNewByteBuffer = BufferUtils.createByteBuffer(Short.MAX_VALUE); - try { - ReflectionUtils.setFinalFieldValue(Keyboard.class, aKeyDownBuffer.getName(), aNewByteBuffer); - FMLRelaunchLog.log( - "[GT++ ASM] LWJGL Keybinding index out of bounds fix", - Level.INFO, - "Patched Field: " + aKeyDownBuffer.getName()); - } catch (Throwable t) { - FMLRelaunchLog.log( - "[GT++ ASM] LWJGL Keybinding index out of bounds fix", - Level.INFO, - "Failed Patching Field: " + aKeyDownBuffer.getName()); - } - } - init = true; - } - } - - /** - * Gets a key's name - * - * @param key The key - * @return a String with the key's human readable name in it or null if the key is unnamed - */ - public static synchronized String getKeyName(int key) { - return ClassTransformer_LWJGL_Keyboard.getKeyName(key); - } - - /** - * Represents a key or mouse button as a string. Args: key - */ - public static String getKeyDisplayString(int aKeyValue) { - return aKeyValue < 0 ? I18n.format("key.mouseButton", new Object[] { Integer.valueOf(aKeyValue + 101) }) - : getKeyName(aKeyValue); - } -} |
