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 8e3a0ec
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 52 deletions.
12 changes: 8 additions & 4 deletions client/src/main/java/client.java
Original file line number Diff line number Diff line change
Expand Up @@ -3637,11 +3637,15 @@ 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
7 changes: 6 additions & 1 deletion client/src/main/java/jagex2/client/GameShell.java
Original file line number Diff line number Diff line change
Expand Up @@ -565,8 +565,13 @@ protected void refresh() {
}

@OriginalMember(owner = "client!a", name = "b", descriptor = "(B)Ljava/awt/Component;")
@Override
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
50 changes: 13 additions & 37 deletions client/src/main/java/sign/signlink.java
Original file line number Diff line number Diff line change
Expand Up @@ -142,52 +142,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

0 comments on commit 8e3a0ec

Please sign in to comment.