Skip to content

About

Every RuneScape Web Client for the Modern Browser

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

38 Commits

Folders and files

Repository files navigation

rs-lazarus

Decompiles and Deobfuscates RuneScape client JARs into strict TypeScript projects that run in the browser.

What it does

  • Reads the client JAR, plus an optional loader JAR whose shared classes replace stub versions in the main one, and parses every class file.
  • Inlines jsr/ret subroutines and gives each separately named local variable its own slot.
  • Lifts stack bytecode into a typed IR, telling boolean, byte, short, char and int apart from how values are used.
  • Removes obfuscation:
    • Jagex's catch (RuntimeException) error-reporting wrappers
    • ZKM flow flags and opaque predicates, including those that check dummy parameters
    • unused dummy parameters and write-only fields
    • methods nothing calls: later clients' obfuscator keeps the original of most methods beside the copy it gives a dummy parameter (more than half of 742's methods). Natives, JNI callbacks, reflection targets and JDK overrides stay.
    • XOR/NOT-obfuscated integer arithmetic and bitwise-operator wrapper methods
    • encoded string literals
  • Moves statics that the obfuscator scattered into unrelated classes back to the class they belong to.
  • Follows the applet's destroy() callback and inlines groups of single-use static helpers that only clear references. Shutdown keeps the original field writes in order, and helpers exposed through reflection or JNI keep their declarations.
  • Simplifies the IR: folds constant branches, merges blocks, collapses StringBuffer chains into string concatenation, folds array initializers and post-increments, and removes the temporaries the lifter introduced.
  • Rebuilds control flow as if/while/for/switch/try with labeled break/continue, falling back to a $pc switch loop only for irreducible regions.
  • Applies the mapping file (packages, classes, fields, methods, parameters, locals) and carries names across override groups. Packaged JVM classes keep their original paths and member names. Unmapped obfuscated names get Fernflower-style defaults (class_1, method_1, var1, arg0).
  • Makes a method async only if it can actually block (sleep, I/O, wait), following calls and overrides.
  • Orders static initialization: static {} blocks where import order allows, a lazy $clinit() elsewhere, and static and instance initializers moved to their declarations where that is safe.
  • Folds overloaded constructors into one constructor with default or optional parameters, and drops unused trailing parameters.
  • Infers non-null types and readonly fields, and leaves out default values for fields that every constructor assigns.
  • Detects generic containers (linked lists, hash tables, caches), gives them type parameters and removes the casts where they are used.
  • Uses number instead of bigint for long math whose result fits in 32 bits.
  • Optimizes hot code: removes array bounds checks that can never fail, reads loop-invariant fields once before the loop and keeps array elements in locals inside loops.
  • Emits strict TypeScript:
    • exact int/long semantics (| 0, Math.imul, BigInt.asIntN)
    • typed array-access helpers
    • separate import type and value imports
    • locals declared at first use, with defaults only where needed
    • no-op statements and unused locals removed
    • class members in a fixed order: statics first, then fields, the constructor and methods, each sorted by access, with readonly fields before mutable ones
  • Swaps JDK and native classes (java.*, jaggl, jagdx, jaclib, jagtheora, ...) for the TypeScript runtime and copies in only the runtime modules the client uses.
  • Compiles the C WASM kernels the client needs with zig cc (software and hardware 3D, bzip2, inflate, Whirlpool, Theora, MIDI synth), optionally with an Opus-encoded SoundFont baked in.
  • Writes the boot code, reflection and JNI tables, tsconfig.json, package.json and client.html, bundles and minifies the client into dist/client.js, and deletes stale files left by earlier runs.

Usage

Requirements

  • Rust 1.95 or newer (the workspace uses edition 2024)
  • Bun, on PATH or named by the BUN environment variable, to bundle the client
  • zig, to compile the WASM kernels. It is found through --zig, the ZIG environment variable, PATH, or the Python ziglang package.
  • the runtime's packages, installed with bun install in std/
  • ffmpeg, only when using --soundfont

Build

cargo build --release

The binary is target/release/lazarus.

Decompile a client

lazarus decompile path/to/client.jar -o out/client

This writes dist/, including jav_config.ws. If a launcher config sits beside the JAR, Lazarus copies it verbatim. Use --jav-config path/to/jav_config.ws when it lives elsewhere. This preserves the site's values, including parameters the client looks up by a name calculated at runtime.

With just a JAR, Lazarus finds fixed names passed to Applet.getParameter and supplies starter values for familiar settings. Other detected names appear as commented # param=name= lines. Set your world's values in the generated config before bundling.

For a client included in this repository, run the command in its revision README from that folder. It uses the local JAR and mapping and writes to the matching folder under out/, such as out/rs2/225/ or out/rs2/beta/186/. The 530 HD command also includes the loader overlay. Client folders · 530 build command

Option Meaning
-o, --out <dir> where to write the TypeScript project (required)
-m, --mapping <file> mapping file (.tsv) with names for classes, members, parameters and locals
--jav-config <file> original launcher config to copy (default: jav_config.ws beside the input JAR, if present)
--rev <label> revision label used in provenance comments, e.g. 647
--overlay <jar> loader JAR whose matching classes replace stub versions in the main JAR
--zig <path> the zig compiler for the WASM kernels
--std-path <path> path from the output directory to std/ (default ../../std)
--no-unscatter leave scattered statics where the obfuscator put them
--soundfont <file.sf2> SoundFont to Opus-encode and bake into the MIDI synth
--ffmpeg <path> the ffmpeg used to encode --soundfont
--built <YYYY-MM-DD> when the client was built, for its notices (default: the jar's newest entry)

The output directory holds src/ (the client and the runtime modules it uses), wasm/, dist/client.js, dist/jav_config.ws, tools/ (the bundler, so bun install && bun run build rebuilds dist/ there), client.html, README.md, tsconfig.json and package.json. The client reads the jav_config.ws served next to the page. The page's query string can override its values. Each output's README lists the parameters. To type-check it with the runtime's TypeScript, after installing its own packages (@webgpu/types for a client with the GPU driver):

(cd out/rs2/647 && bun install)
node std/node_modules/typescript/bin/tsc --noEmit -p out/rs2/647

In the browser console, window.lazarusRenderWorker shows the active OpenGL or DirectX worker and its completed frame count. It reads off when the client draws without a dedicated render worker.

Add a revision

Create clients/<game>/<revision>/ and put the game JAR there as client.jar. The game is rs2 for RuneScape 2, osrs for Old School RuneScape and rs3 for RuneScape 3. A beta client goes in its game's beta folder: clients/rs2/beta/<revision>/, and likewise clients/osrs/beta/ and clients/rs3/beta/. Include loader.jar if the client needs a loader overlay, and jav_config.ws if you have its launcher settings. Place the revision's mapping beside the JAR as mapping.tsv, or generate one from the new folder with init-mapping.

../../../target/release/lazarus init-mapping client.jar -o mapping.tsv

Other commands

# Report bytecode features and the JDK/native APIs that JARs use (--json for machine-readable
# output, --show-apis for the full list of referenced external methods and fields)
lazarus audit path/to/client.jar [more.jar ...]

# Show which scattered statics would move and where, without decompiling
# (--overlay and -m as for decompile; --verbose lists individual moves, up to --limit, default 40)
lazarus analyze-statics clients/rs2/647/client.jar -m clients/rs2/647/mapping.tsv --verbose

About

Every RuneScape Web Client for the Modern Browser

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages