Mordax

Software Developer

View My GitHub Profile

Reverse-engineering an ancient Java applet

This week I was aiming to work on the actual code base of FPL and adding a new feature - a Save manager to backup and restore files. As I mentioned last time, the application is built on Electron, using Typescript and leveraging the use of React to deliver component-based modules.

Setting up FPL was very pleasant - it was primarily built by obelisk, the main mechanic on the Flashpoint team. I will keep mentioning the fact that I am an abused Windows developer until the end of time - FPL was primarily made for Windows so the development environment was much more favourable.

Some issues that arose:


Side Tracking from the Save Manager

The internal documentation is still a Work in Progress. So, a lot of inferring and questioning needed to be done.

As I was resolving build issues, I would take a break and resume doing some curation. I haven’t mentioned all my curations (since Pebble’s Quarry, I’ve also resurrected Postopia adventure and was working with an FPL colleague to restore more of them). I also tried to resurrect Waffle boy’s mountain adventure, famously lost in our community. I managed to partially recreate the missing XML (that loads the separate Flash SWFs properly) to play the first level, but beyond that I couldn’t resolve it.

So, I decided to curate an old Java applet game from freearcade.com that I used to play back in the day. It was a game called Vertigo, from 1999, made by Andrew Gower of RuneScape fame. I mistakenly assumed that it would be as easy as the few that I did after my first one.

Issue:

Get Vertigo to work on Flashpoint since it no longer works on the browser.

Problems (If you want the solution, scroll down):

The middle number (45) indicated the version. Here’s a table of JDK versions and their respective major versions:

Java Version Major Version
1.1 45
1.2 46
1.3 47
1.4 48
5 49
6 50
7 51
8 52
9 53
10 54
11 55

Clearly this game was made with one of the earliest possible JDKs - 1.1.

Solution:

Instead, Strawrat started at that very first problem all the way back at the beginning -

java.lang.ClassFormatError: Name index 0 in LocalVariableTable has bad constant type in class file vertigo

Here’s how they did it:



Demonstration on how to delete the malformed table

Apparently LocalVariableTable in the class file was broken and needed to be deleted - it’s considered optional, similar to LineNumberTable.

This answer was so beyond my expertise that I knew I would have never figured it out on my own.

I’m very greatful to the FPL community for their expertise and wizard-like reverse-engineering.

You can see the game in FPL 6.0 or download it here!