Skip to content

Commit

Permalink
Deobfuscate some client code
Browse files Browse the repository at this point in the history
This is in preparation of getting sound to work. No functional changes
intended.
  • Loading branch information
StenAL committed Apr 28, 2023
1 parent dc8b995 commit 16aaac1
Show file tree
Hide file tree
Showing 7 changed files with 62 additions and 68 deletions.
2 changes: 1 addition & 1 deletion client/src/main/java/agolf/Conn.java
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ else if (args[0].equals("status")) {
this.gameContainer.lobbyPanel.handlePacket(args);
}
else if (args[0].equals("game")) {
this.gameContainer.gamePanel.method333(args);
this.gameContainer.gamePanel.handlePacket(args);
}
}

Expand Down
19 changes: 11 additions & 8 deletions client/src/main/java/agolf/GameApplet.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@
import com.aapeli.client.*;
import org.moparforia.client.Launcher;

import java.applet.Applet;
import java.applet.AudioClip;
import java.awt.*;
import java.net.URL;

public class GameApplet extends AApplet {

Expand Down Expand Up @@ -47,8 +50,8 @@ public void textsLoadedNotify(TextManager var1) {
this.gameContainer.textManager = var1;
}

public void defineSounds(SoundManager var1) {
this.gameContainer.soundManager = var1;
public void defineSounds(SoundManager soundManager) {
this.gameContainer.soundManager = soundManager;
}

public void defineImages(ImageManager imageManager, String var2) {
Expand All @@ -70,9 +73,9 @@ public void defineImages(ImageManager imageManager, String var2) {
imageManager.defineSharedImage("bigtext.gif"); // TODO
imageManager.defineSharedImage("tf-background.gif"); // TODO

for (int var3 = 0; var3 < GameBackgroundCanvas.trackAdvertSize; ++var3) {
if (this.gameContainer.adverts[var3] != null) {
imageManager.defineImage("ad" + var3, this.gameContainer.adverts[var3]);
for (int i = 0; i < GameBackgroundCanvas.trackAdvertSize; ++i) {
if (this.gameContainer.adverts[i] != null) {
imageManager.defineImage("ad" + i, this.gameContainer.adverts[i]);
}
}

Expand Down Expand Up @@ -275,12 +278,12 @@ private boolean isValidSite() {
}

private boolean containsDomain(String host, String domain, String[] tld) {
for (int var4 = 0; var4 < tld.length; ++var4) {
if (host.equals(domain + "." + tld[var4])) {
for (int i = 0; i < tld.length; ++i) {
if (host.equals(domain + "." + tld[i])) {
return true;
}

if (host.endsWith("." + domain + "." + tld[var4])) {
if (host.endsWith("." + domain + "." + tld[i])) {
return true;
}
}
Expand Down
4 changes: 2 additions & 2 deletions client/src/main/java/agolf/game/GamePanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public void update(Graphics var1) {
var1.fillRect(0, 0, this.width, this.height);
}

public void method333(String[] args) {
public void handlePacket(String[] args) {
if (args[1].equals("gameinfo")) {
String gameName = args[2];
boolean passworded = args[3].equals("t");
Expand Down Expand Up @@ -136,7 +136,7 @@ public void method333(String[] args) {
this.gameChatPanel.addMessage(this.gameContainer.textManager.getGame("GameChat_GameSettings", settings));
}

}if (args[1].equals("scoringmulti")) {
} else if (args[1].equals("scoringmulti")) {
int len = args.length - 2;
int[] var3 = new int[len];

Expand Down
10 changes: 5 additions & 5 deletions client/src/main/java/agolf/game/GamePlayerInfoPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -390,13 +390,13 @@ protected boolean canShoot(int playerNumber) {
return playerNumber == this.currentPlayerId;
}

protected void method363(int var1, boolean var2) {
protected void method363(int playerId, boolean isStrokeEnd) {
if (this.anInt385 == 0) {
int var3 = !var2 ? this.anIntArray397[this.anInt386] : 1;
this.trackStrokes[var1][this.anInt386].get_upd(var3);
this.playersId[var1].get_upd(var3);
int var3 = !isStrokeEnd ? this.anIntArray397[this.anInt386] : 1;
this.trackStrokes[playerId][this.anInt386].get_upd(var3);
this.playersId[playerId].get_upd(var3);
} else {
this.trackStrokes[var1][this.anInt386].get_upd();
this.trackStrokes[playerId][this.anInt386].get_upd();
}

this.repaint();
Expand Down
7 changes: 2 additions & 5 deletions client/src/main/java/agolf/game/GameTrackInfoPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -204,11 +204,8 @@ else if (evtSource == this.buttonBack) {
this.gameContainer.gamePanel.method345(this.currentTrack);
this.method390(false);
this.repaint();
} else {
if (evtSource == this.buttonR) {
this.gameContainer.gamePanel.method336();
}

} else if (evtSource == this.buttonR) {
this.gameContainer.gamePanel.method336();
}
}
}
Expand Down
84 changes: 41 additions & 43 deletions client/src/main/java/com/aapeli/applet/AApplet.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,9 @@
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.LayoutManager;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.net.URL;
import java.util.Optional;

public abstract class AApplet extends Applet implements Runnable, ActionListener, QuickTimerListener {

Expand Down Expand Up @@ -290,8 +288,8 @@ public void update(Graphics var1) {
}

public void run() {
long var1 = System.currentTimeMillis();
this.setLayout((LayoutManager) null);
long startTime = System.currentTimeMillis();
this.setLayout(null);
this.loadingPanel = new LoadingPanel(this);
this.loadingPanel.setBounds(0, 0, this.appletWidth, this.appletHeight);
this.add(this.loadingPanel);
Expand All @@ -307,17 +305,17 @@ public void run() {
this.loadingPanel.setBackground(this.getBackground());
this.callJavaScriptJSON("{\"loading\":\"started\"}");
if (this.endState == 0 && !this.destroyed) {
int var4 = (int) (System.currentTimeMillis() - var1);
boolean var5 = false;
String var6 = this.param.getParameter("startupdebug");
if (var6 != null && Tools.getBoolean(var6)) {
var5 = true;
int var4 = (int) (System.currentTimeMillis() - startTime);
boolean startupDebug = false;
String startupDebugParameter = this.param.getParameter("startupdebug");
if (startupDebugParameter != null && Tools.getBoolean(startupDebugParameter)) {
startupDebug = true;
this.printSUD("StartUp Debug enabled!");
}

AdCanvas var16 = AdCanvas.method211(this, this.param);
if (var16 != null) {
if (var5) {
if (startupDebug) {
this.printSUD("Loading ad-image...");
}

Expand All @@ -333,29 +331,29 @@ public void run() {
}

this.loadingPanel.method466(var16, Tools.getBoolean(this.param.getParameter("ad_clicktocontinue")));
if (var5) {
if (startupDebug) {
this.printSUD("...done");
}
} else if (var5) {
} else if (startupDebug) {
this.printSUD("No ad-image");
}

int var7 = (int) (System.currentTimeMillis() - var1);
if (var5) {
int var7 = (int) (System.currentTimeMillis() - startTime);
if (startupDebug) {
this.printSUD("Creating text manager");
}

this.loadingPanel.method467(0.5D);
this.textManager = new TextManager(this.param, true, this.isDebug());
this.loadingPanel.method462(this.param, this.textManager);
if (var5) {
if (startupDebug) {
this.printSUD("Loading texts...");
}

this.textManager.waitLoadingFinished();
this.textsLoadedNotify(this.textManager);
if (!this.destroyed) {
if (var5) {
if (startupDebug) {
this.printSUD("...done");
}

Expand All @@ -364,40 +362,40 @@ public void run() {
var8 = " " + this.textManager.getShared("Loader_AdClickNote");
}

int var9 = (int) (System.currentTimeMillis() - var1);
if (System.currentTimeMillis() < var1 + 3000L) {
int var9 = (int) (System.currentTimeMillis() - startTime);
if (System.currentTimeMillis() < startTime + 3000L) {
this.loadingPanel.method468(2.0D);
}

this.callJavaScriptJSON("{\"loading\":\"inprogress\"}");
if (var5) {
if (startupDebug) {
this.printSUD("Creating sound manager");
}

this.loadingPanel.setLoadingMessage(this.textManager.getShared("Loader_LoadingGfxSfx") + (var8 != null ? var8 : ""));
this.soundManager = new SoundManager(this, false, this.isDebug());
if (var5) {
this.soundManager = new SoundManager(this, true, this.isDebug());
if (startupDebug) {
this.soundManager.enableSUD(this);
}

this.loadingPanel.method465(0.15D);
if (var5) {
if (startupDebug) {
this.printSUD("Defining sounds...");
}

this.defineSounds(this.soundManager);
if (!this.destroyed) {
int var10 = (int) (System.currentTimeMillis() - var1);
if (var5) {
int var10 = (int) (System.currentTimeMillis() - startTime);
if (startupDebug) {
this.printSUD("...done");
}

if (var5) {
if (startupDebug) {
this.printSUD("Creating image manager");
}

this.imageManager = new ImageManager(this, this.isDebug());
if (var5) {
if (startupDebug) {
this.imageManager.enableSUD(this);
}

Expand All @@ -406,7 +404,7 @@ public void run() {
this.defineImages(this.imageManager, this.param.getSiteName());
if (!this.destroyed) {
this.imageManager.startLoadingImages();
if (var5) {
if (startupDebug) {
this.printSUD("Loading images...");
}

Expand All @@ -419,50 +417,50 @@ public void run() {
this.loadingPanel.method467(0.7D + this.imageManager.getImageLoadProgress() * 0.15D);
}

int var11 = (int) (System.currentTimeMillis() - var1);
if (var5) {
int var11 = (int) (System.currentTimeMillis() - startTime);
if (startupDebug) {
this.printSUD("...done");
}

if (var5) {
if (startupDebug) {
this.printSUD("Creating images...");
}

this.loadingPanel.method465(0.05D);
this.createImages();
if (var5) {
if (startupDebug) {
this.printSUD("...done");
}

if (var5) {
if (startupDebug) {
this.printSUD("Defining secondary images");
}

this.defineSecImages(this.imageManager, this.param.getSiteName());
if (!this.destroyed) {
this.imageManager.startLoadingImages();
this.soundManager.startLoading();
if (System.currentTimeMillis() < var1 + 7000L) {
if (System.currentTimeMillis() < startTime + 7000L) {
this.loadingPanel.method468(2.0D);
}

if (!this.destroyed) {
int var12 = (int) (System.currentTimeMillis() - var1);
if (var5) {
int var12 = (int) (System.currentTimeMillis() - startTime);
if (startupDebug) {
this.printSUD("Connecting to server...");
}

this.loadingPanel.setLoadingMessage(this.textManager.getShared("Message_Connecting") + (var8 != null ? var8 : ""));
this.loadingPanel.method467(1.0D);
this.connectToServer();
if (var5) {
if (startupDebug) {
this.printSUD("...done");
}

if (this.endState == 0) {
int var13 = (int) (System.currentTimeMillis() - var1);
int var13 = (int) (System.currentTimeMillis() - startTime);
this.aBoolean2557 = true;
if (var5) {
if (startupDebug) {
this.printSUD("Waiting loader screen to finish...");
}

Expand All @@ -480,8 +478,8 @@ public void run() {
Tools.sleep(50L);
} while (!var14.method471());

int var15 = (int) (System.currentTimeMillis() - var1);
if (var5) {
int var15 = (int) (System.currentTimeMillis() - startTime);
if (startupDebug) {
this.printSUD("...done");
}

Expand All @@ -493,7 +491,7 @@ public void run() {
this.loadingPanel.destroy();
this.loadingPanel = null;
if (!this.destroyed) {
if (var5) {
if (startupDebug) {
this.printSUD("Adding applet content...");
}

Expand All @@ -505,11 +503,11 @@ public void run() {

this.contentPanel.setVisible(false);
this.add(this.contentPanel);
if (var5) {
if (startupDebug) {
this.printSUD("...done");
}

if (var5) {
if (startupDebug) {
this.printSUD("Moving control to game itself");
}

Expand Down
4 changes: 0 additions & 4 deletions editor/src/main/java/org/moparforia/editor/SpriteManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,7 @@
import java.awt.*;
import java.awt.image.MemoryImageSource;
import java.awt.image.PixelGrabber;
import java.io.File;

/**
* Mainly just LEECHEDDDDDDDD da source from the client, rofl hacker plaregiser!1!!!1!11!cos2pi!!
*/
public class SpriteManager {

JFrame frame;
Expand Down

0 comments on commit 16aaac1

Please sign in to comment.