Skip to content
This repository was archived by the owner on May 15, 2025. It is now read-only.

Commit da4b274

Browse files
committed
fix: Java 1.4 compatibility - apparently getenv was removed for a short while
1 parent cc9129e commit da4b274

4 files changed

Lines changed: 19 additions & 11 deletions

File tree

buildWithoutGradle.bat

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
@echo off
2+
@rem Manual build script for really old JDKs
3+
4+
cd client
5+
if exist build rmdir /s /q build
6+
mkdir build
7+
8+
javac -encoding utf8 -d build -sourcepath src/main/java/ src/main/java/client.java
9+
10+
java -cp build client
11+
12+
cd ..

client/src/main/java/jagex2/client/GameShell.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ public class GameShell extends Applet implements Runnable, MouseListener, MouseM
8787
protected final void initApplication(@OriginalArg(0) int height, @OriginalArg(1) int width) {
8888
this.screenWidth = width;
8989
this.screenHeight = height;
90-
this.setPreferredSize(new Dimension(this.screenWidth, this.screenHeight));
90+
// this.setPreferredSize(new Dimension(this.screenWidth, this.screenHeight));
9191
this.frame = new ViewBox(this.screenHeight, this, this.screenWidth);
9292
this.graphics = this.getBaseComponent().getGraphics();
9393
this.drawArea = new PixMap(this.getBaseComponent(), this.screenWidth, this.screenHeight);

client/src/main/java/jagex2/client/ViewBox.java

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,14 @@ public ViewBox(@OriginalArg(0) int height, @OriginalArg(2) GameShell shell, @Ori
2323
this.add(shell);
2424
this.pack();
2525

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

2831
this.toFront();
2932
}
3033

31-
@OriginalMember(owner = "client!b", name = "getGraphics", descriptor = "()Ljava/awt/Graphics;")
32-
@Override
33-
public Graphics getGraphics() {
34-
@Pc(2) Graphics g = super.getGraphics();
35-
g.translate(4, 24);
36-
return g;
37-
}
38-
3934
@OriginalMember(owner = "client!b", name = "update", descriptor = "(Ljava/awt/Graphics;)V")
4035
@Override
4136
public void update(@OriginalArg(0) Graphics g) {

client/src/main/java/sign/signlink.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,9 @@ public static void startpriv(@OriginalArg(0) InetAddress address) {
146146
public static String findcachedir() {
147147
@Pc(50) String[] paths = new String[] {
148148
// prioritize home directories
149-
System.getenv("HOME"), System.getenv("HOMEDRIVE") + System.getenv("HOMEPATH"), System.getenv("USERPROFILE"),
150-
System.getenv("user.home"), "~",
149+
System.getProperty("user.home"),
150+
// System.getenv("HOME"), System.getenv("HOMEDRIVE") + System.getenv("HOMEPATH"), System.getenv("USERPROFILE"),
151+
// System.getenv("user.home"), "~",
151152
// fall back to OS-specific paths
152153
"c:", "c:/windows", "c:/winnt", "d:/windows", "d:/winnt", "e:/windows", "e:/winnt", "f:/windows", "f:/winnt",
153154
// fall back to temporary cache directories (RAM or browser cache)

0 commit comments

Comments
 (0)