aboutsummaryrefslogtreecommitdiff
path: root/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/util
diff options
context:
space:
mode:
Diffstat (limited to 'loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/util')
-rw-r--r--loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/util/cursor/CursorReader.java95
-rw-r--r--loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/util/cursor/EnumCursor.java79
-rw-r--r--loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/util/cursor/Foundation.java33
-rw-r--r--loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/util/cursor/GLCursors.java232
-rw-r--r--loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/util/cursor/User32.java67
-rw-r--r--loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/util/cursor/X11.java37
6 files changed, 543 insertions, 0 deletions
diff --git a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/util/cursor/CursorReader.java b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/util/cursor/CursorReader.java
new file mode 100644
index 00000000..34c40964
--- /dev/null
+++ b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/util/cursor/CursorReader.java
@@ -0,0 +1,95 @@
+/*
+ * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod
+ * Copyright (C) 2021 cyoung06
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+package kr.syeyoung.dungeonsguide.launcher.util.cursor;
+
+import com.google.common.io.LittleEndianDataInputStream;
+import com.twelvemonkeys.imageio.plugins.bmp.CURImageReader;
+import lombok.Data;
+
+import javax.imageio.ImageIO;
+import javax.imageio.stream.ImageInputStream;
+import java.awt.image.BufferedImage;
+import java.io.BufferedInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.List;
+
+public class CursorReader {
+ public static List<CursorData> readFromInputStream(InputStream inputStream) throws IOException {
+ LittleEndianDataInputStream dataInputStream = new LittleEndianDataInputStream(new BufferedInputStream(inputStream));
+ dataInputStream.mark(Integer.MAX_VALUE);
+
+
+ int magicValue = dataInputStream.readUnsignedShort();
+ if (magicValue != 0) throw new RuntimeException("Invalid Cursor file");
+ int type = dataInputStream.readUnsignedShort();
+ if (type != 2) throw new RuntimeException("not cursor");
+ int size = dataInputStream.readShort();
+
+ List<CursorData> directoryList = new ArrayList<>();
+ for (int i = 0; i < size; i++) {
+
+ CursorData directory = new CursorData();
+ directory.setWidth((short) dataInputStream.readUnsignedByte());
+ directory.setHeight((short) dataInputStream.readUnsignedByte());
+ directory.setColorCnt((short) dataInputStream.readUnsignedByte());
+ directory.setMagicValue(dataInputStream.readByte());
+ directory.setXHotSpot(dataInputStream.readShort());
+ directory.setYHotSpot(dataInputStream.readShort());
+ directory.setSizeBitmap(dataInputStream.readInt() & 0x00000000ffffffffL);
+ directory.setOffset(dataInputStream.readInt() & 0x00000000ffffffffL);
+
+ directoryList.add(directory);
+ }
+ dataInputStream.reset();
+
+ try (ImageInputStream imageInputStream = ImageIO.createImageInputStream(dataInputStream)) {
+ CURImageReader imageReader = new CURImageReader();
+ imageReader.setInput(imageInputStream);
+
+ for (int i = 0; i < directoryList.size(); i++) {
+ directoryList.get(i).setBufferedImage(imageReader.read(i));
+ }
+ }
+ inputStream.close();
+
+ return directoryList;
+ }
+
+ private static void setIntLittleEndian(byte[] bytes, int index, int value) {
+ byte[] ins = new byte[] {
+ (byte) ((value >> 24)& 0xFF), (byte) ((value >> 16)& 0xFF), (byte) ((value >> 8)& 0xFF), (byte) (value & 0xFF)
+ };
+ bytes[index+3] = ins[0];
+ bytes[index+2] = ins[1];
+ bytes[index+1] = ins[2];
+ bytes[index] = ins[3];
+ }
+
+
+ @Data
+ public static class CursorData {
+ private short width, height, colorCnt, magicValue;
+ private int xHotSpot, yHotSpot;
+ private long sizeBitmap;
+ private long offset;
+ private BufferedImage bufferedImage;
+ }
+}
diff --git a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/util/cursor/EnumCursor.java b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/util/cursor/EnumCursor.java
new file mode 100644
index 00000000..8bea67b9
--- /dev/null
+++ b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/util/cursor/EnumCursor.java
@@ -0,0 +1,79 @@
+/*
+ * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod
+ * Copyright (C) 2021 cyoung06
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+package kr.syeyoung.dungeonsguide.launcher.util.cursor;
+
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+
+@AllArgsConstructor
+@Getter
+public enum EnumCursor {
+ /** there are these hidden cursors for macos
+ * [NSCursor _windowResizeEastCursor]
+ * [NSCursor _windowResizeWestCursor]
+ * [NSCursor _windowResizeEastWestCursor]
+ * [NSCursor _windowResizeNorthCursor]
+ * [NSCursor _windowResizeSouthCursor]
+ * [NSCursor _windowResizeNorthSouthCursor]
+ * [NSCursor _windowResizeNorthEastCursor]
+ * [NSCursor _windowResizeNorthWestCursor]
+ * [NSCursor _windowResizeSouthEastCursor]
+ * [NSCursor _windowResizeSouthWestCursor]
+ * [NSCursor _windowResizeNorthEastSouthWestCursor]
+ * [NSCursor _windowResizeNorthWestSouthEastCursor]
+ * https://stackoverflow.com/questions/10733228/native-osx-lion-resize-cursor-for-custom-nswindow-or-nsview
+ */
+ DEFAULT(32512,68,"arrowCursor","arrowCursor.cur"),
+ POINTING_HAND(32649,60,"pointingHandCursor", "pointingHandCursor.cur"),
+ OPEN_HAND(32646,58,"openHandCursor","openHandCursor.cur"),
+ CLOSED_HAND(32646,52,"closedHandCursor","closedHandCursor.cur"),
+ BEAM_CURSOR(32513, 152, "IBeamCursor", "IBeamCursor.cur"),
+
+ MOVE_BAR_LEFT(32644, 70,"resizeLeftCursor", "resizeLeftCursor.cur"),
+ MOVE_BAR_RIGHT(32644, 96,"resizeRightCursor", "resizeRightCursor.cur"),
+ MOVE_BAR_LEFT_RIGHT(32644, 108, "resizeLeftRightCursor", "resizeLeftRightCursor.cur"),
+ MOVE_BAR_UP(32645,138,"resizeUpCursor", "resizeUpCursor.cur"),
+ MOVE_BAR_DOWN(32645,16,"resizeDownCursor", "resizeDownCursor.cur"),
+ MOVE_BAR_UP_DOWN(32645,116,"resizeUpDownCursor", "resizeUpDownCursor.cur"),
+
+ RESIZE_LEFT(32644, 70,"_windowResizeWestCursor", "resizeLeftCursor.cur"),
+ RESIZE_RIGHT(32644, 96,"_windowResizeEastCursor", "resizeRightCursor.cur"),
+ RESIZE_LEFT_RIGHT(32644, 108, "_windowResizeEastWestCursor", "resizeLeftRightCursor.cur"),
+ RESIZE_UP(32645,138,"_windowResizeNorthCursor", "resizeUpCursor.cur"),
+ RESIZE_DOWN(32645,16,"_windowResizeSouthCursor", "resizeDownCursor.cur"),
+ RESIZE_UP_DOWN(32645,116,"_windowResizeNorthSouthCursor", "resizeUpDownCursor.cur"),
+
+
+ RESIZE_TL(32642, 134, "_windowResizeNorthWestCursor", "resizeNW.cur"),
+ RESIZE_DR(32642, 14, "_windowResizeSouthEastCursor", "resizeSE.cur"),
+ RESIZE_TLDR(32642, 14, "_windowResizeNorthWestSouthEastCursor", "resizeNWSE.cur"),
+ RESIZE_TR(32643, 136, "_windowResizeNorthEastCursor", "resizeNE.cur"),
+ RESIZE_DL(32643, 12, "_windowResizeSouthWestCursor", "resizeSW.cur"),
+ RESIZE_TRDL(32643, 12, "_windowResizeNorthEastSouthWestCursor", "resizeNESW.cur"),
+ CROSS(32515, 34,"crosshairCursor", "crosshairCursor.cur"),
+ NOT_ALLOWED(32648, -1,"operationNotAllowedCursor", "operationNotAllowedCursor.cur"),
+ TEST(-1, -1, null, "testnonexistant.cur");
+
+
+ private int windows;
+ private int linux;
+ private String macos;
+ private String altFileName;
+}
diff --git a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/util/cursor/Foundation.java b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/util/cursor/Foundation.java
new file mode 100644
index 00000000..2a44e4ad
--- /dev/null
+++ b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/util/cursor/Foundation.java
@@ -0,0 +1,33 @@
+/*
+ * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod
+ * Copyright (C) 2021 cyoung06
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+package kr.syeyoung.dungeonsguide.launcher.util.cursor;
+
+import com.sun.jna.Library;
+import com.sun.jna.Native;
+import com.sun.jna.Pointer;
+
+
+public interface Foundation extends Library {
+ Foundation INSTANCE = (Foundation) Native.loadLibrary("Foundation",
+ Foundation.class);
+
+ Pointer objc_getClass(String className);
+ Pointer sel_registerName(String selectorName);
+ Pointer objc_msgSend(Pointer receiver, Pointer selector, Object... args);
+}
diff --git a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/util/cursor/GLCursors.java b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/util/cursor/GLCursors.java
new file mode 100644
index 00000000..b0e10351
--- /dev/null
+++ b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/util/cursor/GLCursors.java
@@ -0,0 +1,232 @@
+/*
+ * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod
+ * Copyright (C) 2021 cyoung06
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+package kr.syeyoung.dungeonsguide.launcher.util.cursor;
+
+
+import com.google.common.base.Throwables;
+import com.sun.jna.Native;
+import com.sun.jna.Pointer;
+import net.minecraft.client.Minecraft;
+import net.minecraft.util.MathHelper;
+import net.minecraft.util.ResourceLocation;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+import org.lwjgl.BufferUtils;
+import org.lwjgl.LWJGLException;
+import org.lwjgl.LWJGLUtil;
+import org.lwjgl.input.Cursor;
+import sun.misc.Unsafe;
+
+import java.awt.image.BufferedImage;
+import java.lang.reflect.Array;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.InvocationTargetException;
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+import java.nio.IntBuffer;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+
+@SuppressWarnings("unsafe")
+public class GLCursors {
+
+ static Logger logger = LogManager.getLogger("DG-GlCursors");
+
+ @SuppressWarnings("unsafe")
+ static boolean verbose = false;
+
+ private static Unsafe unsafe;
+ private static Class cursorElement;
+ private static Constructor constructor;
+ private static Field cursorField;
+
+ private static Map<EnumCursor, Cursor> enumCursorCursorMap = new HashMap<>();
+
+
+ static {
+ try {
+ Field f = Unsafe.class.getDeclaredField("theUnsafe");
+ f.setAccessible(true);
+ unsafe = (Unsafe) f.get(null);
+ cursorElement = Class.forName("org.lwjgl.input.Cursor$CursorElement");
+ constructor = cursorElement.getDeclaredConstructor(Object.class, long.class, long.class);
+ constructor.setAccessible(true);
+ cursorField = Cursor.class.getDeclaredField("cursors");
+ cursorField.setAccessible(true);
+ } catch (NoSuchFieldException | IllegalAccessException | ClassNotFoundException | NoSuchMethodException e) {
+ e.printStackTrace();
+ }
+ }
+
+ public static void setupCursors() {
+ if (enumCursorCursorMap.size() != 0) return;
+ int platform = LWJGLUtil.getPlatform();
+ for (EnumCursor value : EnumCursor.values()) {
+ Cursor c = null;
+ try {
+ switch(platform) {
+ case LWJGLUtil.PLATFORM_WINDOWS:
+ if (value.getWindows() != -1)
+ c = createCursorWindows(value.getWindows());
+ break;
+ case LWJGLUtil.PLATFORM_LINUX:
+ if (value.getLinux() != -1)
+ c = createCursorLinux(value.getLinux());
+ break;
+ case LWJGLUtil.PLATFORM_MACOSX:
+ if (value.getMacos() != null)
+ c = createCursorMac(value.getMacos());
+ break;
+ }
+ } catch (Throwable e) {
+ if(verbose) logger.error("Error occurred while loading cursor: {}", value);
+ e.printStackTrace();
+ }
+ try {
+ if (c == null) {
+ int hotspotX = 0, hotspotY = 0;
+ BufferedImage bufferedImage = null;
+ int minC = Cursor.getMinCursorSize(), maxC = Cursor.getMaxCursorSize();
+ try {
+ ResourceLocation cursorInfo = new ResourceLocation("dungeons_guide_loader:cursors/"+value.getAltFileName());
+ List<CursorReader.CursorData> cursorDataList = CursorReader.readFromInputStream(Minecraft.getMinecraft().getResourceManager().getResource(cursorInfo).getInputStream());
+ List<CursorReader.CursorData> cursorDataList2 = cursorDataList.stream()
+ .filter(cdata -> cdata.getBufferedImage() != null)
+ .filter(cdata -> minC <= cdata.getHeight() && cdata.getHeight() <= maxC && minC <= cdata.getWidth() && cdata.getWidth() <= maxC)
+ .sorted(Comparator.comparingInt(CursorReader.CursorData::getWidth)).collect(Collectors.toList());
+
+ CursorReader.CursorData cursorData =
+ cursorDataList2.size() == 0 ? cursorDataList.get(0) : cursorDataList2.get(0);
+ if(verbose) logger.info(cursorData);
+ bufferedImage = cursorData.getBufferedImage();
+ hotspotX = cursorData.getXHotSpot();
+ hotspotY = cursorData.getYHotSpot();
+ } catch (Throwable t) {
+ if(verbose) logger.error("loading cursor failed with message, {}", String.valueOf(Throwables.getRootCause(t)));
+ }
+
+
+ int width = bufferedImage == null ? 16 : bufferedImage.getWidth();
+ int height = bufferedImage == null ? 16 : bufferedImage.getHeight();
+ int effWidth = MathHelper.clamp_int(width, Cursor.getMinCursorSize(), Cursor.getMaxCursorSize());
+ int effHeight = MathHelper.clamp_int(height, Cursor.getMinCursorSize(), Cursor.getMaxCursorSize());
+ int length = effHeight * effWidth;
+ IntBuffer intBuffer = BufferUtils.createIntBuffer(length);
+ for (int i = 0; i < length; i++) {
+ int x = i % effWidth;
+ int y = i / effWidth;
+ if (bufferedImage == null) {
+ intBuffer.put(0xFFFFFFFF);
+ } else if (x >= width || y >= height) {
+ intBuffer.put(0);
+ } else {
+ intBuffer.put(bufferedImage.getRGB(x, height - y - 1));
+ }
+ }
+ intBuffer.flip();
+ c = new Cursor(effWidth, effHeight, hotspotX, height - hotspotY - 1,1,intBuffer, null);
+ }
+ } catch (Throwable e) {
+ if(verbose) logger.error("Error occurred while loading cursor from resource: "+value);
+ e.printStackTrace();
+ }
+ if (c != null) {
+ try {
+ Object arr = cursorField.get(c);
+ Object cursor = Array.get(arr, 0);
+ for (Field declaredField : cursor.getClass().getDeclaredFields()) {
+ declaredField.setAccessible(true);
+ Object obj = declaredField.get(cursor);
+ if(verbose) logger.info(declaredField.getName()+": "+obj+" - "+(obj instanceof ByteBuffer));
+ if (obj instanceof ByteBuffer) {
+ ByteBuffer b = (ByteBuffer) declaredField.get(cursor);
+ StringBuilder sb = new StringBuilder("Contents: ");
+ for (int i = 0; i < b.limit(); i++) {
+ sb.append(Integer.toHexString(b.get(i) & 0xFF)).append(" ");
+ }
+ if(verbose) logger.info(sb.toString());
+ }
+ }
+ } catch (IllegalAccessException e) {
+ e.printStackTrace();
+ }
+
+ enumCursorCursorMap.put(value, c);
+ }
+ }
+ }
+
+ public static Cursor getCursor(EnumCursor enumCursor) {
+ return enumCursorCursorMap.get(enumCursor);
+ }
+
+ private static Cursor createCursorWindows(int cursor) throws LWJGLException, InstantiationException, InvocationTargetException, IllegalAccessException {
+ User32 user32 = User32.INSTANCE;
+ Pointer hIcon = user32
+ .LoadCursorW(Pointer.NULL, cursor);
+ long ptrVal = Pointer.nativeValue(hIcon);
+ ByteBuffer handle = BufferUtils.createByteBuffer(Native.POINTER_SIZE); // Why does it have to be direct? well it crashes without it.
+ if (handle.order() == ByteOrder.LITTLE_ENDIAN) {
+ for (int i = 0; i < Native.POINTER_SIZE; i++) {
+ byte value = (byte) ((ptrVal >> i * 8) & 0xFF);
+ handle.put(value);
+ }
+ } else {
+ for (int i = Native.POINTER_SIZE; i >= 0; i++) {
+ byte value = (byte) ((ptrVal >> i * 8) & 0xFF);
+ handle.put(value);
+ }
+ }
+ handle.position(0);
+ return createCursor(handle);
+ }
+ private static Cursor createCursorLinux(int cursor) throws LWJGLException, InstantiationException, InvocationTargetException, IllegalAccessException {
+ X11.Display display = X11.INSTANCE.XOpenDisplay(null);
+ Pointer fontCursor = X11.INSTANCE.XCreateFontCursor(display, cursor);
+ long iconPtr = Pointer.nativeValue(fontCursor);
+
+ return createCursor(iconPtr);
+ }
+ private static Cursor createCursorMac(String cursor) throws LWJGLException, InstantiationException, InvocationTargetException, IllegalAccessException {
+ // trust me, it's horrible.
+ Foundation foundation = Foundation.INSTANCE;
+ Pointer nsCursor = foundation.objc_getClass("NSCursor");
+ Pointer selector = foundation.sel_registerName(cursor);
+ Pointer thePointer = foundation.objc_msgSend(nsCursor, selector);
+ long iconPtr = Pointer.nativeValue(thePointer);
+
+ return createCursor(iconPtr);
+ }
+
+
+ private static Cursor createCursor(Object handle) throws IllegalAccessException, InvocationTargetException, InstantiationException {
+ // Yes. I had no way.
+ Cursor ADANGEROUSOBJECT = (Cursor) unsafe.allocateInstance(Cursor.class);
+ Object cursorElement = constructor.newInstance(handle, 0, LWJGLUtil.getPlatform() == LWJGLUtil.PLATFORM_LINUX ? -1 : System.currentTimeMillis());
+ Object array = Array.newInstance(GLCursors.cursorElement, 1);
+ Array.set(array, 0, cursorElement);
+ cursorField.set(ADANGEROUSOBJECT, array);
+ return ADANGEROUSOBJECT;
+ }
+}
diff --git a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/util/cursor/User32.java b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/util/cursor/User32.java
new file mode 100644
index 00000000..4dffc35f
--- /dev/null
+++ b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/util/cursor/User32.java
@@ -0,0 +1,67 @@
+/*
+ * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod
+ * Copyright (C) 2021 cyoung06
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+package kr.syeyoung.dungeonsguide.launcher.util.cursor;
+
+import com.sun.jna.Library;
+import com.sun.jna.Native;
+import com.sun.jna.Pointer;
+
+public interface User32 extends Library {
+
+ public static User32 INSTANCE = (User32) Native
+ .loadLibrary("User32", User32.class);
+
+ /** @see #LoadCursorW(Pointer, int) */
+ public static final int IDC_ARROW = 32512;
+ /** @see #LoadCursorW(Pointer, int) */
+ public static final int IDC_IBEAM = 32513;
+ /** @see #LoadCursorW(Pointer, int) */
+ public static final int IDC_WAIT = 32514;
+ /** @see #LoadCursorW(Pointer, int) */
+ public static final int IDC_CROSS = 32515;
+ /** @see #LoadCursorW(Pointer, int) */
+ public static final int IDC_UPARROW = 32516;
+ /** @see #LoadCursorW(Pointer, int) */
+ public static final int IDC_SIZENWSE = 32642;
+ /** @see #LoadCursorW(Pointer, int) */
+ public static final int IDC_SIZENESW = 32643;
+ /** @see #LoadCursorW(Pointer, int) */
+ public static final int IDC_SIZEWE = 32644;
+ /** @see #LoadCursorW(Pointer, int) */
+ public static final int IDC_SIZENS = 32645;
+ /** @see #LoadCursorW(Pointer, int) */
+ public static final int IDC_SIZEALL = 32646;
+ /** @see #LoadCursorW(Pointer, int) */
+ public static final int IDC_NO = 32648;
+ /** @see #LoadCursorW(Pointer, int) */
+ public static final int IDC_HAND = 32649;
+ /** @see #LoadCursorW(Pointer, int) */
+ public static final int IDC_APPSTARTING = 32650;
+ /** @see #LoadCursorW(Pointer, int) */
+ public static final int IDC_HELP = 32651;
+ /** @see #LoadCursorW(Pointer, int) */
+ public static final int IDC_ICON = 32641;
+ /** @see #LoadCursorW(Pointer, int) */
+ public static final int IDC_SIZE = 32640;
+
+ /** http://msdn.microsoft.com/en-us/library/ms648391(VS.85).aspx */
+ public Pointer LoadCursorW(Pointer hInstance,
+ int lpCursorName);
+
+}
diff --git a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/util/cursor/X11.java b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/util/cursor/X11.java
new file mode 100644
index 00000000..a9a96fef
--- /dev/null
+++ b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/util/cursor/X11.java
@@ -0,0 +1,37 @@
+/*
+ * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod
+ * Copyright (C) 2021 cyoung06
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+package kr.syeyoung.dungeonsguide.launcher.util.cursor;
+
+import com.sun.jna.Library;
+import com.sun.jna.Native;
+import com.sun.jna.Pointer;
+import com.sun.jna.PointerType;
+
+public interface X11 extends Library {
+ X11 INSTANCE = (X11) Native.loadLibrary("X11", X11.class);
+ public Pointer XCreateFontCursor(Display display,
+ int shape);
+ public Display XOpenDisplay(String var1);
+
+ public static class Display extends PointerType {
+ public Display() {
+ }
+ }
+
+}