Skip to content
nolffanPublic

About

Contract J.A.C.K. source code

Topics

Resources

Stars

18 stars

Watchers

2 watching

Forks

Latest commit

 

History

479 Commits

Folders and files

Repository files navigation

cjacksrc

Contract J.A.C.K. (Monolith, 2003), built from source.

Monolith never released Contract J.A.C.K.'s source, as it did for No One Lives Forever 2. This project reconstructs it: the game code from NOLF2's source release (Contract J.A.C.K. was built from the same tree, C:\proj\to2\source\Game\, as its binaries' strings show), and the engine from the LithTech Jupiter engine source (the 2006 distribution of the same engine line, built with the same compiler), each brought to what the retail binaries are, function by function. As for nolfsrc and nolf2src, the aim is two builds:

  • legacy: Contract J.A.C.K. (Europe) at its last update, 1.1, rebuilt so that it compiles back to the retail binaries byte for byte, as far as that can be done -- with the compiler Monolith used, Visual C++ .NET 2003 (13.10.3077), under Wine;
  • modern: the same source with fixes and new features (CJACKSRC_MODERN).

Compiling back to the retail bytes means compiling the retail game's bugs as well; their fixes go behind CJACKSRC_MODERN, into the modern build only, so the legacy build keeps matching the retail one.

The main menu Two gangsters in suits in a room: "Shut your hole before I shovel dirt in it, Marvin." A gunfight in an apartment, seen over a submachine gun A blue car in a garage, seen over a submachine gun Malta: ruins with broken columns, seen over a pistol A cut-scene: Dimitri, with an eye patch: "Bravo. You've passed the test." Soldiers in a snowy yard at night; the screen edges are red because the player is hit A snowy dock at night with a crane, seen over a submachine gun

The modern build at 3840x2160.

Where it stands

Every binary of the game is built from source: the engine (Lithtech.exe, server.dll, SndDrv.dll, ltmsg.dll), the GameSpy services (GameSpy.dll), the launcher and the dedicated server (ContractJack.exe, ContractJackServer.exe), and the game itself (CShell.dll, Object.lto, ClientFx.fxd, CRes.dll, SRes.dll). The game plays, in single player and with a client joining the dedicated server.

Every function of the retail binaries is written, and most compile to the retail bytes exactly (the table below). What is left is mostly the compiler's choices rather than the game's logic:

  • near functions do what the retail ones do, but differ in register allocation, instruction order or layout;
  • unplaced functions (all in the engine) are ours with no retail counterpart to pair with: duplicate copies, start-up code and fragments;
  • Lithtech.exe's icons and cursors don't yet match the retail resources.

The modern build's changes -- widescreen, window and borderless modes, frame rates up to unlimited, controllers through XInput, Bink on FFmpeg, the speech's MP3 decoded in SndDrv.dll, and fixes for the retail bugs in docs/RETAIL_BUGS.md -- are listed in docs/MODERN.md. The release needs only the player's two discs: the free 1.1 update's data ships with it (assets/). docs/PLAN.md has the history, package by package.

Documentation

Progress

How much of each binary compiles to exactly the bytes of the retail game, function by function, and how the scoring works: progress/README.md.

Building

Needs docker, the submodules (git submodule update --init): ext/toolchains/ (the compilers), ext/tools/ (the reconstruction tools) and ext/lithtools/ (whose lithrez packs the 1.1 update's data, assets/rez/, into cjacksrc.rez); and, for make modern, ext/ffmpeg (FFmpeg n8.1.3, which the modern build's Bink player is built on, by build/ext.sh). And bring your own discs: your images of the two European discs (redump's Contract J.A.C.K. (Europe) (Disc 1), redump ID 69798, and (Disc 2), redump ID 69799, or any correct copy of them) and your copy of the free English 1.1 update, contractjack_update_en_10_11.exe, in isos/ (hard links are good) or in CJACKSRC_ISOS=<directory>. make retail, which every build runs, installs the retail game from them into out/retail/ once (docs/BUILDING.md, "What you need").

make            # out/cjack-legacy-release/: what is built so far, with the retail data
make progress   # score the build against the retail binaries
make NODISCS=1  # the same binaries without the discs (as CI builds), and the public archive
make help       # everything else

The repository holds no game data of the discs. It holds two sets of retail files, unchanged (assets/README.md): the free 1.1 update's data (assets/rez/), and the art that the retail launcher and dedicated server are compiled with (assets/art/), so that a build without the discs makes the same binaries.

Each build also makes two archives of its game directory (build/package.sh): out/<name>-private.tar.gz, with the retail game's data, for your own machines, and out/<name>-public.tar.gz, without the discs' data, to give to other people (it carries only the free 1.1 update's, as cjacksrc.rez: assets/README.md). The public one carries scripts that copy the rest out of the player's own images of both discs (European or USA; a plain .iso, a raw .bin/.cue or a .zip of one), checking every file they write (build/mkinstall.py):

cjack-modern-release/linux-install.sh disc1.zip disc2.zip    # Linux
cjack-modern-release/mac-install.command disc1.zip disc2.zip # a Mac, for CrossOver

On Windows, drop the two images onto windows-install.bat. Each script also finds them in the game directory or the one above it by itself (double-click mac-install.command in Finder), and can be run again. sha256sum -c SHA256SUMS in the game directory checks the install.

To upgrade, unpack the new release over your installed game (the same build, legacy or modern): put the files of its directory into your game's directory, e.g. tar xzf <archive> --strip-components=1 -C <game directory>. Do not run the installer again: the release replaces all of our files, and the files from your discs, your saved games and your settings stay.

Both archives also carry the scripts that start the game (build/game-scripts/): linux-run.sh (starts the game under Wine, in a prefix of its own; the legacy build's launcher gets the registry values the retail installer wrote) and linux-server.sh (a dedicated server, headless under xvfb-run without a display); each prints its usage with --help. On Windows, start ContractJack.exe.

In modern builds, ContractJack.exe (and linux-run.sh) starts the game immediately using the launcher's saved settings and arguments, skips the first-run detail prompt, and waits until Lithtech.exe exits. Open ContractJackLauncher.exe for the interactive launcher. Under Wine, use the same prefix as linux-run.sh (~/.wine-cjack by default). Legacy builds keep their original launcher behavior.

The modern build plays the intro movies with its own binkw32.dll, built on FFmpeg, and decodes the characters' speech (MP3) in its own SndDrv.dll, so it needs no codec (MODERN.md X-1, EN-50). The legacy build is the retail game's: it plays the movies with RAD's Bink, which stalls under some Wine setups, so linux-run.sh turns them off (+DisableMovies 1); and under Wine its speech needs Fraunhofer's MP3 codec, since Wine's own (winemp3.acm) plays the streamed lines as a drone of their first samples. linux-run.sh installs it into the legacy build's prefix the first time (winetricks l3codecx); with another Wine prefix or a CrossOver bottle, run WINEPREFIX=<its folder> winetricks l3codecx once. Windows has it already.

Credits

This project uses the work of others:

  • Monolith Productions, for Contract J.A.C.K. and for the source code of No One Lives Forever 2 (version 1.3), from which src/Game/ starts; and, with LithTech, Inc. (later Touchdown Entertainment), for the LithTech Jupiter engine, from which src/Engine/ starts (docs/LICENSE_NOTES.md).
  • nolfsrc and nolf2src, the same project for the two No One Lives Forever games: the method, the tools, the Bink player, and many of the modern build's designs.
  • GameSpy Industries / IGN Entertainment, for the GameSpy SDK, which IGN released in 2011 under a BSD licence. GameSpy.dll is built on it.
  • FFmpeg (https://ffmpeg.org), on which the modern build's Bink player is built.
  • Wine, which runs the game on Linux.
  • redump.org, for the verified disc images that the install scripts check.

About

Contract J.A.C.K. source code

Topics

Resources

Stars

18 stars

Watchers

2 watching

Forks

Releases

Contributors

Languages