Reverse Engineering "War Universe"

Source code: 3r4y/waruniverse

I played DarkOrbit for a bit after clicking an ad. When a friend asked for a War Universe bot in 2025, the game looked like a clone to me. Its Windows client gave me a chance to get better at reversing Java.

I kept the client, the C++ source and the recordings. The notebook is gone, so I used the 2025 archive for the source and binary examples below.

The ZIP file with an EXE extension

WarUniverse.1.233.0.exe has a Windows executable at the front and a ZIP archive with Java classes at the end. The manifest names the entry point:

Main-Class: com.spaiowenta.wu.lwjgl3.Lwjgl3Launcher

I reran the JADX 1.5.3 copy from my archive on Lwjgl3Launcher.class. This is what it recovered from the launcher:

lwjgl3ApplicationConfiguration.setTitle("WarUniverse");
lwjgl3ApplicationConfiguration.setWindowedMode(1280, 720);
lwjgl3ApplicationConfiguration.setWindowSizeLimits(400, 200, 9999, 9999);

The title matches the recordings, down to the missing space. The long variable name is JADX's; the values are in the class file. A few lines later:

lwjgl3ApplicationConfiguration.useVsync(true);
lwjgl3ApplicationConfiguration.setIdleFPS(60);

setIdleFPS(60) sets the idle rate. It doesn't cap the frame rate during a fight.

The launcher's method b has its bytecode at file offset 0x0a9c in the uncompressed class. The left column is the decimal bytecode index.

14  2a        aload_0
15  11 05 00  sipush 1280
18  11 02 d0  sipush 720
21  b6 00 2e  invokevirtual #46

The b6 at bytecode index 21 is at file offset 0x0ab1. Its operand 0x2e is constant-pool index 46, which resolves to com/badlogic/gdx/backends/lwjgl3/Lwjgl3ApplicationConfiguration.setWindowedMode:(II)V. Both dimensions are in the two sipush instructions.

The class Windows lost

The EXE contains 5,994 .class entries. My extracted folder had 4,293. Four entries from the archive make the difference easier to see:

aQ.class    Aq.class    AQ.class    aq.class

All four names fit in the ZIP; only one survived in my Windows folder. Explorer called the result aQ.class. Its internal name was aq, and its bytes matched aq.class in the ZIP. Case collisions account for all 1,701 missing entries.

One name, two JNI calls

ReadStringField in src/jni/jni_manager.cpp is where the pilot's name becomes a C++ string. The code copies the bytes before releasing the JNI buffer. Here is the part that deals with those bytes:

const auto name = static_cast<jstring>(str_obj);
const char* bytes = env->GetStringUTFChars(name, nullptr);
std::string result = bytes == nullptr ? "" : bytes;
if (bytes != nullptr) {
  env->ReleaseStringUTFChars(name, bytes);
}

The 334,848-byte UniversalHookX Release x64.dll in my archive has SHA-256 prefix 49c2405b4a537001. The left column in the native listings is an RVA in that DLL.

3a126  48 8b 0f              mov  rcx, [rdi]
3a129  4c 8b 89 48 05 00 00  mov  r9, [rcx+0x548]
3a130  45 33 c0              xor  r8d, r8d
3a133  48 8b d6              mov  rdx, rsi
3a136  48 8b cf              mov  rcx, rdi
3a139  41 ff d1              call r9
3a13c  4c 8b f0              mov  r14, rax

The instruction at 0x3a126 reads the JNI interface table from [rdi]. The next load uses 0x548 / 8 = 169, the slot for GetStringUTFChars. Under the Win64 calling convention, rcx holds env, rdx the Java string, and r8 is null because I didn't request the isCopy flag.

The returned pointer goes into r14. After the null check, that pointer becomes the third argument of the next JNI call:

3a17c  48 8b 07              mov  rax, [rdi]
3a17f  4c 8b 88 50 05 00 00  mov  r9, [rax+0x550]
3a186  4d 8b c6              mov  r8, r14
3a189  48 8b d6              mov  rdx, rsi
3a18c  48 8b cf              mov  rcx, rdi
3a18f  41 ff d1              call r9

0x550 / 8 = 170 is ReleaseStringUTFChars. The string in rsi and bytes in r14 are the same ones from the first call. JNI calls this encoding modified UTF-8; the ASCII names in the capture don't say how the overlay handled other names.

The load at RVA 0x3a129 is at file offset 0x39529: .text starts at RVA 0x1000 and file offset 0x400, so 0x400 + (0x3a129 - 0x1000) = 0x39529. Its preferred virtual address is 0x18003a129. 0x548 is a byte displacement inside the JNI table. The JVM fills in the function address at runtime.

The client running behind a console showing shield, drone, name, colour and health-bar updates.

The console capture shows a null drone array and still prints pilot names. I couldn't find those exact log strings in the DLL above, so I don't use this frame to identify the build.

An early test with the console beside the client.

Seven ship cards

I started with UniversalHookX for the ImGui window. ShipData is the record I added for each card.

War Universe overlay showing seven ship cards, the local ship outlined in green and the start button idle.

The green YOU card is mine. Two cards say PLAYER, four say NPC. The two Hyper|Jenta cards share a name and have different world coordinates. Here is the declaration from src/jni/jni_manager.hpp, with the comments left out:

struct ShipData {
  int shipId = -1;
  int playerId = -1;
  int shipType = -1;
  int factionId = -1;
  int paramE = -1;
  int paramI = -1;
  float worldX = 0.0f;
  float worldY = 0.0f;
  float screenX = 0.0f;
  float screenY = 0.0f;
  bool isLocalPlayer = false;
  bool isDead = false;
  bool isPlayer = false;
  std::string playerName = "Unknown";
  std::string clanName = "";
  std::string factionName = "Unknown";
  DWORD deathTime = 0;
};

ReadShipData fills a C++ value one member at a time. The cards print worldX and worldY. The debug tab calls the other pair Screen; that label alone doesn't tell me their units. Names and clans come from the wrapper fields xF.F and xF.G. If the nested object is missing, the default name stays Unknown. If the object exists but its name wrapper is missing, the string reader returns an empty name.

The archived header still said isPlayer came from paramE and paramI. The code reads both, but the actual decision uses factionId: 1, 2 or 3 means player. The local flag takes precedence for the YOU label. PLAYER records the overlay's guess; there is no player boolean in the Java getter it used for this decision.

The getter is xD.u:()I. In the exact-case xD.class from the EXE, its code starts at file offset 0x16f8:

 0  2a        aload_0
 1  b4 00 3b  getfield      #59
 4  b4 00 4b  getfield      #75
 7  b6 00 6f  invokevirtual #111
10  c0 00 14  checkcast     #20
13  b6 00 7b  invokevirtual #123
16  ac        ireturn

#59 refers to xD.a:LxF; and #75 to xF.b:Lay;. The last call unboxes the value with Integer.intValue(). The class file gives me an integer; the names Vega, Solar and Orion come from the C++ side.

Counting the cards

The source resolves two methods on a Java ArrayList. This excerpt leaves out the setup checks:

cls_ArrayList = static_cast<jclass>(
    env->NewGlobalRef(env->FindClass("java/util/ArrayList")));
mid_ArrayList_size = env->GetMethodID(cls_ArrayList, "size", "()I");
mid_ArrayList_get =
    env->GetMethodID(cls_ArrayList, "get", "(I)Ljava/lang/Object;");

The lookups resolve size() and get() without calling them. At 0x3ad59 the DLL loads the descriptor "(I)Ljava/lang/Object;" into r9; at 0x3ad67 it loads "get" into r8. The class handle is already in rdx:

3ad6e  48 8b 03              mov  rax, [rbx]
3ad71  48 8b cb              mov  rcx, rbx
3ad74  4c 8b 90 08 01 00 00  mov  r10, [rax+0x108]
3ad7b  41 ff d2              call r10

0x108 / 8 = 33, the JNI slot for GetMethodID. The strings are at RVAs 0x4ae98 and 0x4aeb0. The opaque method ID comes back from the VM in rax. Ships in World: 7 counts the records collected by the overlay. It reads at most the first 50 entries from the client list.

Where Solar came from

Finding Solar in the DLL only tells me the string is there. This load matches the lookup in GetFactionName:

3a594  48 63 4f 0c           movsxd rcx, dword ptr [rdi+0xc]
3a598  8d 41 ff              lea    eax, [rcx-1]
3a59b  83 f8 02              cmp    eax, 2
3a59e  77 0b                 ja     0x3a5ab
3a5a0  4c 8d 35 f1 09 01 00  lea    r14, [rip+0x109f1]
3a5a7  4d 8b 34 ce           mov    r14, [r14+rcx*8]

The unsigned check accepts IDs 1 through 3. The table load still uses the original ID in rcx. 0x3a5a7 + 0x109f1 gives table RVA 0x4af98. Entry 2 holds preferred pointer 0x18004adc0; at file offset 0x4a1c0 the bytes are 53 6f 6c 61 72 00 (Solar).

r14 already holds Unknown from the load at 0x3a2cb. An out-of-range ID jumps past the lookup. The +0xc in the first instruction is the factionId member in my native ShipData record. The Java getter above doesn't use that offset.

The v1.0 recording

The Ships tab is populated before the green START BOT button is pressed. The overlay samples the ship list separately from drawing the menu. Hiding the menu hides the cards; it doesn't pause the snapshot.

The v1.0 Ships tab before and after starting the bot.

The last target on screen

The Attack tab showed both the bot's stored ID and the client's last reported target. The latter stayed on screen after a missing sample. I checked what exactly three seconds meant in the DLL:

3b132  3d b8 0b 00 00  cmp eax, 0xbb8
3b137  76 07           jbe 0x3b140

The subtraction at 0x3b12c gives the elapsed milliseconds. 0xbb8 is 3,000; the unsigned jbe skips the clear at equality. The first missing sample after 3,000 ms clears the display flag.

The v1.3 Attack tab stays open beside the fight.

One wreck, not one per frame

JNI::Update timestamps a dead ship when its ID first enters the history. Seeing the same wreck again doesn't add a row. On the 51st distinct ID, the oldest row and its ID are dropped, so it can appear in the history again. Total Dead Ships counts those rows. It doesn't say who killed the ships.

Fourteen seconds from one fight, with the menu closed.

The recap

71 seconds, from the first console tests to v1.3.

Reading notes

Igor Skochinsky's note on image-relative offsets covers the RVA calculation above. Josh Watson's indirect-call walkthrough follows a register back to its table. In this case the JNI specification already gives the table layout.