Skip to content

Commit

Permalink
fix: Debugging 1.1 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
Pazaz committed Jan 16, 2024
1 parent 3c21655 commit 6cfe3dc
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 63 deletions.
18 changes: 12 additions & 6 deletions client/src/main/java/client.java
Original file line number Diff line number Diff line change
Expand Up @@ -1257,7 +1257,10 @@ public static void main(@OriginalArg(0) String[] args) {
signlink.sunjava = true;
}

signlink.startpriv(InetAddress.getByName("w1.225.2004scape.org"));
System.out.println("sign");
InetAddress addr = InetAddress.getByName("w1.225.2004scape.org");
System.out.println("signpriv");
signlink.startpriv(addr);

@Pc(82) client c = new client();
c.initApplication(789, 532);
Expand Down Expand Up @@ -3635,13 +3638,16 @@ private void drawMinimap() {
}

@OriginalMember(owner = "client!client", name = "b", descriptor = "(B)Ljava/awt/Component;")
@Override
protected Component getBaseComponent() {
if (signlink.mainapp == null) {
return this;
} else {
if (signlink.mainapp != null) {
return signlink.mainapp;
}
}

if (super.frame != null) {
return super.frame;
}

return this;
}

@OriginalMember(owner = "client!client", name = "m", descriptor = "(I)V")
Expand Down
27 changes: 17 additions & 10 deletions client/src/main/java/jagex2/client/GameShell.java
Original file line number Diff line number Diff line change
Expand Up @@ -274,9 +274,10 @@ public final void mousePressed(@OriginalArg(0) MouseEvent e) {
@Pc(2) int x = e.getX();
@Pc(5) int y = e.getY();

Insets insets = this.getInsets();
x -= insets.left;
y -= insets.top;
if (this.frame != null) {
x -= 4;
y -= 24;
}

this.idleCycles = 0;
this.mouseClickX = x;
Expand Down Expand Up @@ -348,9 +349,10 @@ public final void mouseDragged(@OriginalArg(0) MouseEvent e) {
@Pc(2) int x = e.getX();
@Pc(5) int y = e.getY();

Insets insets = this.getInsets();
x -= insets.left;
y -= insets.top;
if (this.frame != null) {
x -= 4;
y -= 24;
}

this.idleCycles = 0;
this.mouseX = x;
Expand All @@ -366,9 +368,10 @@ public final void mouseMoved(@OriginalArg(0) MouseEvent e) {
@Pc(2) int x = e.getX();
@Pc(5) int y = e.getY();

Insets insets = this.getInsets();
x -= insets.left;
y -= insets.top;
if (this.frame != null) {
x -= 4;
y -= 24;
}

this.idleCycles = 0;
this.mouseX = x;
Expand Down Expand Up @@ -566,7 +569,11 @@ protected void refresh() {

@OriginalMember(owner = "client!a", name = "b", descriptor = "(B)Ljava/awt/Component;")
protected Component getBaseComponent() {
return this;
if (this.frame != null) {
return this.frame;
}

return this;
}

@OriginalMember(owner = "client!a", name = "a", descriptor = "(Ljava/lang/Runnable;I)V")
Expand Down
21 changes: 11 additions & 10 deletions client/src/main/java/jagex2/client/ViewBox.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import org.openrs2.deob.annotation.OriginalArg;
import org.openrs2.deob.annotation.OriginalClass;
import org.openrs2.deob.annotation.OriginalMember;
import org.openrs2.deob.annotation.Pc;

import java.awt.*;

Expand All @@ -17,17 +18,17 @@ public ViewBox(@OriginalArg(2) GameShell shell, @OriginalArg(3) int width, @Orig
this.shell = shell;
this.setTitle("Jagex");
this.setResizable(false);

this.setLayout(new BorderLayout());
this.add(shell);
this.pack();

// for compatibility with Java < 1.4
Insets insets = this.getInsets();
this.setSize(width + insets.left + insets.bottom, height + insets.top + insets.bottom);
this.setVisible(true);

this.show();
this.toFront();
this.resize(width + 8, height + 28);
}

@OriginalMember(owner = "client!b", name = "getGraphics", descriptor = "()Ljava/awt/Graphics;")
@Override
public Graphics getGraphics() {
@Pc(2) Graphics g = super.getGraphics();
g.translate(4, 24);
return g;
}

@OriginalMember(owner = "client!b", name = "update", descriptor = "(Ljava/awt/Graphics;)V")
Expand Down
56 changes: 19 additions & 37 deletions client/src/main/java/sign/signlink.java
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,12 @@ public static void startpriv(@OriginalArg(0) InetAddress address) {
urlreq = null;
socketip = address;

System.out.println("sign 5");
@Pc(33) Thread thread = new Thread(new signlink());
thread.setDaemon(true);
thread.start();

System.out.println("sign 6");
while (!active) {
try {
Thread.sleep(50L);
Expand All @@ -142,52 +144,28 @@ public static void startpriv(@OriginalArg(0) InetAddress address) {
}
}


@OriginalMember(owner = "client!sign/signlink", name = "findcachedir", descriptor = "()Ljava/lang/String;")
public static String findcachedir() {
@Pc(50) String[] paths = new String[] {
// prioritize home directories
System.getProperty("user.home"),
// System.getenv("HOME"), System.getenv("HOMEDRIVE") + System.getenv("HOMEPATH"), System.getenv("USERPROFILE"),
// System.getenv("user.home"), "~",
// fall back to OS-specific paths
"c:", "c:/windows", "c:/winnt", "d:/windows", "d:/winnt", "e:/windows", "e:/winnt", "f:/windows", "f:/winnt",
// fall back to temporary cache directories (RAM or browser cache)
"/tmp", ""
};
@Pc(52) String dir = ".lostcity";

for (@Pc(54) int i = 0; i < paths.length; i++) {
@Pc(50) String[] local50 = new String[] { "c:/windows/", "c:/winnt/", "d:/windows/", "d:/winnt/", "e:/windows/", "e:/winnt/", "f:/windows/", "f:/winnt/", "c:/", "~/", "/tmp/", "" };
@Pc(52) String local52 = ".file_store_32";
for (@Pc(54) int local54 = 0; local54 < local50.length; local54++) {
try {
@Pc(59) String path = paths[i];
@Pc(67) File file;

if (path == null) {
continue;
}

if (path.length() > 0) {
file = new File(path);

if (!file.exists()) {
@Pc(59) String local59 = local50[local54];
@Pc(67) File local67;
if (local59.length() > 0) {
local67 = new File(local59);
if (!local67.exists()) {
continue;
}
}

file = new File(path + "/" + dir);
if ((!file.exists() && !file.mkdir()) || !file.canWrite()) {
continue;
local67 = new File(local59 + local52);
if (local67.exists() || local67.mkdir()) {
return local59 + local52 + "/";
}

file = new File(path + "/" + dir + "/" + signlink.clientversion);
if ((!file.exists() && !file.mkdir()) || !file.canWrite()) {
continue;
}

return path + "/" + dir + "/" + signlink.clientversion + "/";
} catch (@Pc(102) Exception ignored) {
} catch (@Pc(102) Exception local102) {
}
}

return null;
}

Expand Down Expand Up @@ -394,11 +372,15 @@ public static void reporterror(@OriginalArg(0) String message) {

@OriginalMember(owner = "client!sign/signlink", name = "run", descriptor = "()V")
public void run() {
System.out.println("sign 1");
active = true;

System.out.println("sign 2");
@Pc(3) String cacheDir = findcachedir();
System.out.println("sign 3");
uid = getuid(cacheDir);

System.out.println("sign 4");
@Pc(8) int threadId = threadliveid;
while (threadliveid == threadId) {
if (socketreq != 0) {
Expand Down

0 comments on commit 6cfe3dc

Please sign in to comment.