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 a59076b
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 29 deletions.
13 changes: 10 additions & 3 deletions client/src/main/java/client.java
Original file line number Diff line number Diff line change
Expand Up @@ -1232,35 +1232,42 @@ public static void main(@OriginalArg(0) String[] args) {
try {
System.out.println("RS2 user client - release #" + signlink.clientversion);

System.out.println("1");
if (args.length > 0) {
nodeId = Integer.parseInt(args[0]);
} else {
nodeId = 10;
}

System.out.println("1");
if (args.length > 1) {
portOffset = Integer.parseInt(args[1]);
} else {
portOffset = 0;
}

System.out.println("1");
if (args.length > 2 && args[2].equals("lowmem")) {
setLowMemory();
} else {
setHighMemory();
}

System.out.println("1");
members = args.length <= 3 || !args[3].equals("free");

System.out.println("1");
String vendor = System.getProperties().getProperty("java.vendor");
if (vendor.toLowerCase().indexOf("sun") != -1 || vendor.toLowerCase().indexOf("apple") != -1) {
signlink.sunjava = true;
}

signlink.startpriv(InetAddress.getByName("w1.225.2004scape.org"));
System.out.println("1");
// signlink.startpriv(InetAddress.getByName("w1.225.2004scape.org"));

@Pc(82) client c = new client();
c.initApplication(789, 532);
System.out.println("bye");
// @Pc(82) client c = new client();
// c.initApplication(789, 532);
} catch (@Pc(89) Exception _ex) {
}
}
Expand Down
6 changes: 5 additions & 1 deletion client/src/main/java/jagex2/client/GameShell.java
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,16 @@ public class GameShell extends Applet implements Runnable, MouseListener, MouseM

@OriginalMember(owner = "client!a", name = "a", descriptor = "(III)V")
protected final void initApplication(@OriginalArg(1) int width, @OriginalArg(0) int height) {
System.out.println("1");
this.screenWidth = width;
this.screenHeight = height;
// this.setPreferredSize(new Dimension(this.screenWidth, this.screenHeight));
System.out.println("1");
this.frame = new ViewBox(this, this.screenWidth, this.screenHeight);
System.out.println("1");
this.graphics = this.getBaseComponent().getGraphics();
System.out.println("1");
this.drawArea = new PixMap(this.getBaseComponent(), this.screenWidth, this.screenHeight);
System.out.println("1");
this.startThread(this, 1);
}

Expand Down
19 changes: 10 additions & 9 deletions client/src/main/java/jagex2/client/ViewBox.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,17 @@ public ViewBox(@OriginalArg(2) GameShell shell, @OriginalArg(3) int width, @Orig
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
21 changes: 5 additions & 16 deletions client/src/main/java/sign/signlink.java
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,11 @@ public static void startpriv(@OriginalArg(0) InetAddress address) {
public static String findcachedir() {
@Pc(50) String[] paths = new String[] {
// prioritize home directories
System.getProperty("user.home"),
// 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",
"c:/windows/", "c:/winnt/", "d:/windows/", "d:/winnt/", "e:/windows/", "e:/winnt/", "f:/windows/", "f:/winnt/", "c:/", "~/",
// fall back to temporary cache directories (RAM or browser cache)
"/tmp", ""
};
Expand All @@ -161,10 +161,6 @@ public static String findcachedir() {
@Pc(59) String path = paths[i];
@Pc(67) File file;

if (path == null) {
continue;
}

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

Expand All @@ -173,17 +169,10 @@ public static String findcachedir() {
}
}

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

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) {
}
}
Expand Down

0 comments on commit a59076b

Please sign in to comment.