From bff0b3f13e457be91470c3f3b09f18c257dc6bf7 Mon Sep 17 00:00:00 2001 From: Sten Laane <21343173+StenAL@users.noreply.github.com> Date: Sat, 9 Nov 2024 11:52:32 +0200 Subject: [PATCH] Client: More miscellaneous deobfuscation --- client/src/main/java/agolf/GameApplet.java | 9 +-- .../agolf/lobby/LobbyDualPlayerPanel.java | 18 +++--- .../src/main/java/agolf/lobby/LobbyPanel.java | 4 +- .../java/com/aapeli/client/IPanel_Sub40.java | 24 ++++---- .../java/com/aapeli/client/ImageManager.java | 57 ++++++++++--------- .../java/com/aapeli/client/ImageResource.java | 14 ++--- .../java/com/aapeli/client/ImageTracker.java | 42 +++++++------- 7 files changed, 85 insertions(+), 83 deletions(-) diff --git a/client/src/main/java/agolf/GameApplet.java b/client/src/main/java/agolf/GameApplet.java index 0300995b..2d05f6df 100644 --- a/client/src/main/java/agolf/GameApplet.java +++ b/client/src/main/java/agolf/GameApplet.java @@ -210,7 +210,7 @@ protected void setGameState(int activePanel, int lobbyId, int lobbyExtra) { } } - this.gameContainer.lobbyPanel.method395(); + this.gameContainer.lobbyPanel.init(); this.addToContent(this.gameContainer.lobbyPanel); } @@ -230,11 +230,12 @@ protected void setGameState(int activePanel, int lobbyId, int lobbyExtra) { } } - protected void setGameSettings(boolean emailUnconfirmed, int var2, boolean useBadWordFilter, boolean var4) { + protected void setGameSettings( + boolean emailUnconfirmed, int playerElevationLevel, boolean useBadWordFilter, boolean disableGuestChat) { this.syncUnknownBool = new SynchronizedBool(emailUnconfirmed); - this.syncPlayerAccessLevel = new SynchronizedInteger(var2); + this.syncPlayerAccessLevel = new SynchronizedInteger(playerElevationLevel); this.gameContainer.badWordFilter = useBadWordFilter ? new BadWordFilter(super.textManager) : null; - this.disableGuestChat = var4; + this.disableGuestChat = disableGuestChat; } protected void trackTestLogin(String username, String password) { diff --git a/client/src/main/java/agolf/lobby/LobbyDualPlayerPanel.java b/client/src/main/java/agolf/lobby/LobbyDualPlayerPanel.java index 7e8db152..0628821a 100644 --- a/client/src/main/java/agolf/lobby/LobbyDualPlayerPanel.java +++ b/client/src/main/java/agolf/lobby/LobbyDualPlayerPanel.java @@ -373,7 +373,7 @@ public void actionPerformed(ActionEvent evt) { /*if(isUsingCustomServer) { this.trackCategory = this.choicerTrackCategory.getSelectedIndex(); }*/ - this.update(1); + this.setState(1); this.gameContainer.lobbyPanel.writeData("challenge\t" + this.opponentName + "\t" @@ -399,7 +399,7 @@ public void actionPerformed(ActionEvent evt) { } else if (evtSource == this.buttonCancel) { synchronized (synchronizedObject) { if (this.currentState == 1) { - this.update(0); + this.setState(0); this.gameContainer.lobbyPanel.writeData("cancel\t" + this.opponentName); return; } @@ -442,7 +442,7 @@ protected boolean handlePacket(String[] args) { /*if(isUsingCustomServer) { this.trackCategory = Integer.parseInt(args[11]); }*/ - this.update(2); + this.setState(2); } if (this.checkboxBeep.getState()) { @@ -453,7 +453,7 @@ protected boolean handlePacket(String[] args) { } else if (args[1].equals("cancel")) { synchronized (synchronizedObject) { if (this.currentState == 2) { - this.update(0); + this.setState(0); return true; } @@ -465,7 +465,7 @@ protected boolean handlePacket(String[] args) { return true; } - this.update(0); + this.setState(0); } if (args[2].equals("nouser")) { @@ -496,7 +496,7 @@ protected boolean handlePacket(String[] args) { return true; } - this.update(0); + this.setState(0); } this.extraText = this.gameContainer.textManager.getGame("LobbyReal_ChallengedLeft"); @@ -507,7 +507,7 @@ protected boolean handlePacket(String[] args) { } } - protected void update(int state) { + protected void setState(int state) { this.extraText = null; if (state == this.currentState) { this.repaint(); @@ -600,7 +600,7 @@ private void create() { private void accept() { synchronized (synchronizedObject) { if (this.currentState == 2) { - this.update(-1); + this.setState(-1); this.gameContainer.lobbyPanel.writeData("accept\t" + this.opponentName); return; } @@ -610,7 +610,7 @@ private void accept() { private void refuse() { synchronized (synchronizedObject) { if (this.currentState == 2) { - this.update(0); + this.setState(0); this.gameContainer.lobbyPanel.writeData("cfail\t" + this.opponentName + "\trefuse"); return; } diff --git a/client/src/main/java/agolf/lobby/LobbyPanel.java b/client/src/main/java/agolf/lobby/LobbyPanel.java index e7f8eeb4..36bbcc2c 100644 --- a/client/src/main/java/agolf/lobby/LobbyPanel.java +++ b/client/src/main/java/agolf/lobby/LobbyPanel.java @@ -124,13 +124,13 @@ public void selectLobby(int lobbyId, int lobbyExtra) { this.setVisible(true); } - public void method395() { + public void init() { if (this.activeLobby == 1) { this.lobbySinglePlayerPanel.requestTrackSetList(); } if (this.activeLobby == 2) { - this.lobbyDualPlayerPanel.update(0); + this.lobbyDualPlayerPanel.setState(0); this.lobbyDualPlayerPanel.allowChallenges(); } diff --git a/client/src/main/java/com/aapeli/client/IPanel_Sub40.java b/client/src/main/java/com/aapeli/client/IPanel_Sub40.java index c7364f0c..94932cc7 100644 --- a/client/src/main/java/com/aapeli/client/IPanel_Sub40.java +++ b/client/src/main/java/com/aapeli/client/IPanel_Sub40.java @@ -36,31 +36,31 @@ protected IPanel_Sub40(AApplet var1, Frame_Sub3_Sub1 var2, int var3, int var4) { this.setSharedBackground(var1.imageManager, "tf-background.gif", 0, 0); } - public void update(Graphics var1) { - this.drawBackground(var1); - var1.setFont(aFont3209); + public void update(Graphics g) { + this.drawBackground(g); + g.setFont(aFont3209); if (this.aHtmlText3214 == null) { - String var2 = null; + String text = null; if (this.anInt3212 == 0) { if (this.anInt3213 == 1) { - var2 = "WS_ScoreNotSaved"; + text = "WS_ScoreNotSaved"; } else if (this.anInt3213 == 2) { - var2 = "WM_StatsNotSaved"; + text = "WM_StatsNotSaved"; } } else if (this.anInt3212 == 1) { if (this.anInt3213 == 1) { - var2 = "RS_PersonalRecord"; + text = "RS_PersonalRecord"; } else if (this.anInt3213 == 2) { - var2 = "RM_FirstRanking"; + text = "RM_FirstRanking"; } } - var2 = this.anAApplet3210.textManager.getShared("GameFin_" + var2); - this.aHtmlText3214 = new HtmlText(var1, 410, var2); + text = this.anAApplet3210.textManager.getShared("GameFin_" + text); + this.aHtmlText3214 = new HtmlText(g, 410, text); } - var1.setColor(aColor3206); - this.aHtmlText3214.print(var1, 20, 45); + g.setColor(aColor3206); + this.aHtmlText3214.print(g, 20, 45); } public void actionPerformed(ActionEvent var1) { diff --git a/client/src/main/java/com/aapeli/client/ImageManager.java b/client/src/main/java/com/aapeli/client/ImageManager.java index 59cc3824..c605aef1 100644 --- a/client/src/main/java/com/aapeli/client/ImageManager.java +++ b/client/src/main/java/com/aapeli/client/ImageManager.java @@ -90,7 +90,7 @@ public void unDefineImage(String var1) { } public void startLoadingImages() { - this.imageTracker.method1626(); + this.imageTracker.loadImages(); } public boolean isLoadingFinished() { @@ -127,16 +127,16 @@ public Image getImage(String var1) { return this.imageTracker.getNImage(this.getAlias(var1)); } - public boolean isDefined(String var1) { - return this.imageTracker.containsNImage(this.getAlias(var1)); + public boolean isDefined(String imageAlias) { + return this.imageTracker.containsNImage(this.getAlias(imageAlias)); } public Image getIfAvailable(String var1) { return this.imageTracker.getNImageFromTable(this.getAlias(var1)); } - public Image getEvenNotLoaded(String var1) { - return this.imageTracker.method1629(this.getAlias(var1)); + public Image getEvenNotLoaded(String imageAlias) { + return this.imageTracker.getImage(this.getAlias(imageAlias)); } public Image getShared(String var1) { @@ -223,50 +223,51 @@ public Image createImage(int[] var1, int var2, int var3, Component var4) { return var5; } - public Image[] separateImages(Image var1, int var2) { - return this.separateImages(var1, var2, 1)[0]; + public Image[] separateImages(Image image, int length) { + return this.separateImages(image, length, 1)[0]; } - public Image[][] separateImages(Image var1, int var2, int var3) { + public Image[][] separateImages(Image image, int length, int rows) { if (this.isDebug) { - System.out.println("ImageManager.separateImages(...," + var2 + "," + var3 + ")"); + System.out.println("ImageManager.separateImages(...," + length + "," + rows + ")"); } - int var4 = this.getWidth(var1); - int var5 = this.getHeight(var1); - int var6 = var4 / var2; - int var7 = var5 / var3; - if (this.isDebug && (var4 % var2 > 0 || var5 % var3 > 0)) { + int width = this.getWidth(image); + int height = this.getHeight(image); + int aspectRatio = width / length; + int rowHeight = height / rows; + if (this.isDebug && (width % length > 0 || height % rows > 0)) { System.out.println("ImageManager.separateImages(...," - + var2 + + length + "," - + var3 + + rows + "): Warning! Source image can not be divided to " - + var2 + + length + "*" - + var3 + + rows + " blocks"); Thread.dumpStack(); } - int[] var8 = this.getPixels(var1, var4, var5); - Image[][] var10 = new Image[var3][var2]; + int[] pixels = this.getPixels(image, width, height); + Image[][] images = new Image[rows][length]; - for (int var11 = 0; var11 < var3; ++var11) { - for (int var12 = 0; var12 < var2; ++var12) { - int[] var9 = new int[var6 * var7]; + for (int row = 0; row < rows; ++row) { + for (int col = 0; col < length; ++col) { + int[] var9 = new int[aspectRatio * rowHeight]; - for (int var13 = 0; var13 < var7; ++var13) { - for (int var14 = 0; var14 < var6; ++var14) { - var9[var13 * var6 + var14] = var8[var11 * var4 * var7 + var13 * var4 + var12 * var6 + var14]; + for (int var13 = 0; var13 < rowHeight; ++var13) { + for (int var14 = 0; var14 < aspectRatio; ++var14) { + var9[var13 * aspectRatio + var14] = + pixels[row * width * rowHeight + var13 * width + col * aspectRatio + var14]; } } - var10[var11][var12] = this.createImage(var9, var6, var7); + images[row][col] = this.createImage(var9, aspectRatio, rowHeight); } } - return var10; + return images; } public Image getAlphaMultipliedImage(Image var1, double var2) { diff --git a/client/src/main/java/com/aapeli/client/ImageResource.java b/client/src/main/java/com/aapeli/client/ImageResource.java index 0f3c8546..684efcb2 100644 --- a/client/src/main/java/com/aapeli/client/ImageResource.java +++ b/client/src/main/java/com/aapeli/client/ImageResource.java @@ -5,14 +5,14 @@ class ImageResource { private String aString1404; - private Image anImage1405; + private Image image; private int anInt1406; private final ImageTracker aImageTracker_1407; - protected ImageResource(ImageTracker var1, String var2, Image var3) { + protected ImageResource(ImageTracker var1, String var2, Image image) { this.aImageTracker_1407 = var1; this.aString1404 = var2; - this.anImage1405 = var3; + this.image = image; this.anInt1406 = 0; } @@ -20,8 +20,8 @@ protected String method1648() { return this.aString1404; } - protected Image method1649() { - return this.anImage1405; + protected Image getImage() { + return this.image; } protected void method1650() { @@ -33,8 +33,8 @@ protected boolean method1651() { } protected void method1652() { - this.anImage1405.flush(); - this.anImage1405 = null; + this.image.flush(); + this.image = null; this.aString1404 = null; } } diff --git a/client/src/main/java/com/aapeli/client/ImageTracker.java b/client/src/main/java/com/aapeli/client/ImageTracker.java index 35de88e6..f57a3db2 100644 --- a/client/src/main/java/com/aapeli/client/ImageTracker.java +++ b/client/src/main/java/com/aapeli/client/ImageTracker.java @@ -68,7 +68,7 @@ protected void method1625(String var1, Image var2) { } } - protected synchronized void method1626() { + protected synchronized void loadImages() { if (this.aThread1401 == null) { if (!this.imageResourceTable.isEmpty()) { if (!this.aBoolean1402) { @@ -87,8 +87,8 @@ protected Image getNImageFromTable(String key) { return this.getImageFromTable("N\t" + key); } - protected Image method1629(String var1) { - return this.getImage("N\t" + var1, true); + protected Image getImage(String imageAlias) { + return this.getImage("N\t" + imageAlias, true); } protected Image method1630(String var1) { @@ -103,8 +103,8 @@ protected Image method1632(String var1) { return this.getImageFromTable("C\t" + var1); } - protected boolean containsNImage(String var1) { - return this.containsResource("N\t" + var1); + protected boolean containsNImage(String imageAlias) { + return this.containsResource("N\t" + imageAlias); } protected boolean containsSImage(String var1) { @@ -169,31 +169,31 @@ protected void method1640(AApplet var1) { this.anAApplet1400 = var1; } - private Image getImage(String var1, boolean var2) { - Image var3; - ImageResource var4; + private Image getImage(String imageAlias, boolean getEvenIfNotLoaded) { + Image image; + ImageResource imageResource; synchronized (this) { - var3 = this.getImageFromTable(var1); - if (var3 != null) { - return var3; + image = this.getImageFromTable(imageAlias); + if (image != null) { + return image; } - var4 = this.getImageResource(var1); - if (var4 == null) { + imageResource = this.getImageResource(imageAlias); + if (imageResource == null) { return null; } } - this.method1626(); - if (var2) { - return var4.method1649(); + this.loadImages(); + if (getEvenIfNotLoaded) { + return imageResource.getImage(); } else { do { Tools.sleep(100L); - var3 = this.imageTable.get(var1); - } while (var3 == null); + image = this.imageTable.get(imageAlias); + } while (image == null); - return var3; + return image; } } @@ -202,7 +202,7 @@ private Image getImageFromTable(String key) { if (image != null) { return image; } else { - this.method1626(); + this.loadImages(); return null; } } @@ -232,7 +232,7 @@ private boolean method1645() { } String imageAlias = var1.method1648(); - Image imageToLoad = var1.method1649(); + Image imageToLoad = var1.getImage(); var1.method1650(); if (this.anAApplet1400 != null) { this.anAApplet1400.printSUD("ImageTracker: Start loading image \"" + imageAlias + "\"");