From c7a9d4a6bd53ed7d61731770f2f10e8b9fd435f9 Mon Sep 17 00:00:00 2001 From: Fuwn Date: Thu, 12 Feb 2026 22:33:32 -0800 Subject: Initial commit --- NET/worlds/console/Window.java | 195 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 195 insertions(+) create mode 100644 NET/worlds/console/Window.java (limited to 'NET/worlds/console/Window.java') diff --git a/NET/worlds/console/Window.java b/NET/worlds/console/Window.java new file mode 100644 index 0000000..04d61c2 --- /dev/null +++ b/NET/worlds/console/Window.java @@ -0,0 +1,195 @@ +package NET.worlds.console; + +import NET.worlds.scape.Camera; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.Point; +import java.awt.TextArea; + +public class Window { + private static Window activeWindow; + private int hWndGamma; + private int hWndFrame; + private static int hInstGamma; + private static int hWndFrameStatic; + public static final int NORMAL = 0; + public static final int MINIMIZED = 1; + public static final int MAXIMIZED = 2; + private int windowInstancePtr; + + public Window(String frameTitle, Point loc, Dimension dim, Camera cam, boolean interceptEvents) throws WindowNotFoundException { + nativeInit(); + if (hWndFrameStatic != 0) { + this.hWndFrame = hWndFrameStatic; + } else { + this.hWndFrame = findWindow(frameTitle); + } + + if (this.hWndFrame != 0) { + this.hWndGamma = findOrMakeChildWindow(this.hWndFrame, loc.x, loc.y, dim.width, dim.height); + } + + if (this.hWndGamma == 0) { + throw new WindowNotFoundException("No such window"); + } else { + if (hWndFrameStatic == 0) { + hWndFrameStatic = this.hWndFrame; + } + + hInstGamma = this.install(interceptEvents); + this.maybeResize(dim.width, dim.height); + if (interceptEvents) { + activeWindow = this; + } + } + } + + public void hookChatLine(Component chatLine) throws WindowNotFoundException { + assert activeWindow == this; + + Dimension dim = chatLine.getSize(); + + try { + Point loc = chatLine.getLocationOnScreen(); + int hwndChatLine = findChildWindow(hWndFrameStatic, loc.x, loc.y, dim.width, dim.height); + if (hwndChatLine != 0) { + setChatLine(hwndChatLine); + return; + } + } catch (Exception var5) { + } + + throw new WindowNotFoundException(); + } + + private static native void setChatLine(int var0); + + public static native int getVoiceChatWParam(); + + public static native int getVoiceChatLParam(); + + public static native void resetVoiceChatMsg(); + + public static native void doMicrosoftVMHacks(); + + public static native boolean usingMicrosoftVMHacks(); + + public static native boolean getActivated(); + + public static native boolean isActivated(); + + public static native int getGammaProcessID(); + + public native void dispose(); + + public static Window getMainWindow() { + return activeWindow; + } + + public native int getHwnd(); + + public void hideNativeWindow() { + if (this.hWndGamma != 0) { + this.nativeHideChildWindow(this.hWndGamma); + } + } + + public void showNativeWindow() { + if (this.hWndGamma != 0) { + this.nativeShowChildWindow(this.hWndGamma); + } + } + + native void nativeHideChildWindow(int var1); + + native void nativeShowChildWindow(int var1); + + public static int getHWnd() { + return activeWindow == null ? 0 : activeWindow.hWndGamma; + } + + public static int getHInst() { + return hInstGamma; + } + + public native void maybeResize(int var1, int var2); + + public native void setDeltaMode(boolean var1); + + public static native int getAndResetUserActionCount(); + + public native boolean getDeltaMode(); + + public static native void makeJavaReleaseCapture(); + + public native void reShape(int var1, int var2, int var3, int var4); + + public native int fullWidth(); + + public native int fullHeight(); + + public static native int findWindow(String var0); + + public static native int getFrameWindow(); + + public static native void hideCursor(); + + public static native int[] getHiddenCursorDelta(); + + public static native void setCursor(int var0); + + public static native int getWindowState(int var0); + + public static native void setWindowState(int var0, int var1); + + public static native void setForegroundWindow(int var0); + + public static native void setVideoMode(int var0, int var1, int var2); + + public static native void nativeInit(); + + private native int install(boolean var1); + + static synchronized int findChildWindow(int hWndParent, int x, int y, int w, int h) { + return nativeFindChildWindow(hWndParent, x, y, w, h); + } + + static synchronized int findOrMakeChildWindow(int hWndParent, int x, int y, int w, int h) { + return nativeFindOrMakeChildWindow(hWndParent, x, y, w, h); + } + + public static boolean isLastLineVisible(int hwnd, TextArea ta) { + Dimension s = ta.getSize(); + return nativeIsLastLineVisible(hwnd, s.width, s.height) != 0; + } + + private static native int nativeIsLastLineVisible(int var0, int var1, int var2); + + private static native int nativeFindChildWindow(int var0, int var1, int var2, int var3, int var4); + + private static native int nativeFindOrMakeChildWindow(int var0, int var1, int var2, int var3, int var4); + + public static int playVideoClip(Component c, String name) { + Point p = c.getLocationOnScreen(); + Dimension s = c.getSize(); + return playVideoClip(name, findChildWindow(activeWindow.hWndFrame, p.x, p.y, s.width, s.height)); + } + + public static native boolean isVideoPlaying(int var0); + + private static native int playVideoClip(String var0, int var1); + + public static native void hookWinAPIs(String var0); + + public static native int getWindowWidth(int var0); + + public static native int getWindowHeight(int var0); + + public static native void allowFGJavaPalette(boolean var0); + + public static int getFrameHandle() { + return hWndFrameStatic; + } + + public static native int getSystemMetrics(int var0); +} -- cgit v1.2.3