# Wing Commander source reconstruction and SDL2 port

This project recreates the source of **Wing Commander** as shipped in *Wing
Commander: The Kilrathi Saga* (1996). The rebuilt `WC1.EXE` matches the
original byte for byte.

It also provides a native port for Windows, Linux, and macOS that plays the
Kilrathi Saga and FM Towns versions, the original DOS release (in part), and
Super Wing Commander for the Mac and its demo.

No original game data or Sega CD voice recordings are included.

Players and modders are invited to discuss wc1-re in the `#wc1-re` channel of
the [Wing Commander Dev Discord](https://discord.gg/p8aKxvWKq).

If you find this project useful, you can [support its development through
GitHub Sponsors](https://github.com/sponsors/neuromancer).

## Supported releases

- *Wing Commander: The Kilrathi Saga* (1996), with Secret Missions 1 and 2
- *Wing Commander I: 35th Anniversary Edition*, from GOG and Steam: both its
  Kilrathi Saga and DOS versions
- *Wing Commander* for DOS (1990), with Secret Missions 1 and 2 and the German
  fan translation, in part: some DOS-only data and behaviour may not work yet
- *Wing Commander* for the FM Towns
- Secret Missions 1.5, the fans' port of *Super Wing Commander*'s Covert
  Missions
- *Super Wing Commander* for the Mac, and its demo
- The Sega CD voice recordings, for voiced dialogue and radio messages

## Screenshots

With the enhanced renderer and, in *Wing Commander*, the double-resolution
HUD text.

<h3 align="center">Wing Commander: The Kilrathi Saga</h3>

| [![A Wing Commander cockpit in combat, with Spirit on the radio](screenshots/wc1-cockpit-combat.png)](screenshots/wc1-cockpit-combat.png) | [![A Kilrathi taunt over the radio, in the double-resolution font](screenshots/wc1-kilrathi-taunt.png)](screenshots/wc1-kilrathi-taunt.png) | [![The chase camera behind the player's fighter, in the original letterbox](screenshots/wc1-chase-camera.png)](screenshots/wc1-chase-camera.png) |
| --- | --- | --- |

<h3 align="center">Super Wing Commander (Mac)</h3>

| [![A Super Wing Commander cockpit with a Salthi in the sights](screenshots/swc-cockpit.png)](screenshots/swc-cockpit.png) | [![A Super Wing Commander dogfight seen from the chase camera](screenshots/swc-chase-camera.png)](screenshots/swc-chase-camera.png) |
| --- | --- |

<h3 align="center">Launcher</h3>

<p align="center">
  <a href="screenshots/launcher-joystick.png"><img src="screenshots/launcher-joystick.png" width="600" alt="The launcher's Joystick tab, showing what each gamepad control does"></a>
</p>

## Download and play

Get the package for your platform from
[GitHub Releases](https://github.com/neuromancer/wc1-re/releases):

- **macOS 15 or later:** open the `.dmg` for Apple Silicon (`arm64`) or Intel
  (`x86_64`) and drag **Wing Commander** into **Applications**.
- **Windows:** run the `-setup.exe` installer.
- **Steam Deck / Linux:** install the `.flatpak` with
  `flatpak install --user ./downloaded.flatpak`, then add **Wing Commander** to
  Steam as a non-Steam game.
- **Portable ZIPs** for Windows, macOS and Linux: extract and run.

Game data is not included. Open the app, pick a detected installation or use
**Add path…** to select the game's folder (a Steam or GOG copy's main folder,
or any folder containing `GAMEDAT`), then select **Start WC1**.

- **Secret Missions:** **Start SM1** and **Start SM2** appear when the
  expansions are installed, and can carry a pilot over from a saved game. For
  Secret Missions 1.5, put `CAMP.015`, `MODULE.015`, `BRIEFING.015` and
  `TITL15.VGA` in `GAMEDAT` and select **Start SM1.5**. It saves its games in
  `GAMEDAT/COVERT.WLD`; to go on with one saved in SM2's file, copy that file
  to `COVERT.WLD`.
- **Languages:** **Español**, **Français** and **Japanese (FM Towns)** are in
  the launcher's **Language** menu. A DOS installation patched with the German
  fan translation plays in German.
- **Music and sound:** the Kilrathi Saga's digital music and effects, or the
  DOS ones on an AdLib or a Roland MT-32. For the MT-32, select a folder with
  your own ROM files under **MT-32 ROMs…**.
- **FM Towns:** copy `WC.EXP` and the whole `GAMEDAT` folder from the CD into a
  writable folder. For CD music, put the disc's CUE sheet beside `WC.EXP` as
  `TOWNS.CUE`.
- **Sega CD voices:** put the recordings in `Data/Voice` beside `GAMEDAT`.
- **Super Wing Commander:** copy the Mac CD's files to a folder, keeping their
  resource forks (MacBinary copies also work), and select it. For the demo,
  unzip the
  [Mac demo](https://archive.org/details/super-wing-commander-demo-1.0.2-mac)
  and select its `SuperWing DEMO` folder.
- **Autosave:** the game saves to slot 8 when a campaign starts or loads and
  after each mission you survive; turn it off under **Gameplay**.

## Improvements

- A resizable window, fullscreen, aspect-correct 4:3 presentation, and
  screenshots.
- Gamepads, flight sticks, the Steam Deck and the Steam Controller, with
  rumble, gyro aiming and WCAT-style four-button controls; the launcher shows
  every binding, changes them, and calibrates the joystick.
- Fixes to the 1996 release, such as correctly scaled planets, static on
  knocked-out cockpit displays and landing on the *Tiger's Claw* from any
  direction; see the
  [Original bugs](https://neuromancer.github.io/wc1-re/original_bugs.html).
- Sound effects balanced against the music and panned with the camera, and the
  mouse wheel on the throttle.
- A game speed choice: **Normal** (the Kilrathi Saga's 20 FPS), **Slow**
  (16 FPS), or `[` and `]` in flight.
- Optional extras: an enhanced renderer that draws ships at full resolution and
  the HUD's text at double resolution, in Trov's double-resolution cockpit font
  for English, German, Spanish and French; Smooth spaceflight; EGA colours; the
  restored startup intro; a cockpitless view; and a cheat mode.

## Controls

| Shortcut | Action |
| --- | --- |
| `Cmd+Enter` (macOS), `Alt+Enter` (Windows, Linux) | Toggle fullscreen |
| `Cmd+S` (macOS), `Alt+S` (Windows, Linux) | Save a screenshot: to the Desktop on macOS, else to *Wing Commander Screenshots* in Pictures |
| `Cmd+Q` (macOS) | Quit the game |
| `Ctrl+S` / `Ctrl+M` (spaceflight) | Toggle sound effects / music |
| `Esc` (spaceflight) | Pause; any key resumes |
| `[` / `]` (spaceflight) | Slow the game down / speed it up |
| Mouse wheel (spaceflight) | Change speed |
| Gamepad Start / Back (spaceflight) | Pause / cycle the views |
| `J` (main menu, barracks), `Ctrl+J` (spaceflight) | Calibrate the joystick |

The launcher's **Joystick** and **Keyboard and mouse** tabs show every binding
and change them. In the **Custom** control mode, any gamepad or flight stick
input can take any flight action. The **Steam Deck** mode follows the layout
from [#32](https://github.com/neuromancer/wc1-re/issues/32), with the rear
buttons mirroring the D-pad. The **Steam Controller** mode shares it, with the
right pad for yaw and pitch, A for the next target, and the grips mirroring the
left pad's ← and →; without Steam, the game reads the controller itself.
**Mouse turning speed** makes a stick turn no
faster than the mouse usually does, instead of a little above the ship's
rated speed at full push. **Gyro aiming** turns the ship as far as the
controller turns, on top of the sticks, when the game reads a controller with a
gyroscope itself: the Steam Deck, the Steam Controller, or a PlayStation or
Switch controller.

As in the original, a mission ends only by landing on the *Tiger's Claw*,
ejecting, or dying; quit from the barracks menu.

## Command line

| Option | Effect |
| --- | --- |
| `--gui` | Open the launcher first |
| `--fullscreen`, `--windowed` | Display mode |
| `--campaign=sm1`, `sm2`, `sm15` | Start a Secret Missions campaign |
| `--language=es`, `fr`, `ja` | Spanish, French or Japanese (FM Towns) text |
| `--music=` and `--sound=` with `default`, `adlib` or `mt32` | Music and sound effects |
| `--mt32-roms=DIR`, `--mt32-model=ID`, `--mt32-check` | MT-32 ROM folder and set, and a report of what the folder holds |
| `--flight-fps=N` | Spaceflight frame rate, 8 to 32 |
| `--enhanced`, `--hires-hud`, `--interpolate` | Enhanced renderer, double-resolution HUD text, Smooth spaceflight |
| `--joystick-mode=original`, `4button-2axis`, `4button-4axis`, `custom`, `steam-deck`, `steam-controller` | Joystick layout |
| `--joystick-mouse-turning` | A stick turns at the mouse's speed |
| `--gyro-aiming` | A controller's gyroscope turns the ship |

## Build from source

```sh
git submodule update --init --recursive
make -j modern-gui
```

This needs Python 3.10+, a C/C++ compiler, the SDL2 and LZO2 development
packages, CMake, Rust, and a C++20 compiler; the game is written to
`out-modern/`. `make -j` rebuilds the original `WC1.EXE`.

On Debian and Ubuntu, the packages are:

```sh
sudo apt install build-essential cmake python3 pkg-config libsdl2-dev \
    liblzo2-dev libfontconfig1-dev libdbus-1-dev      # make modern-gui
sudo apt install clang lld libclang-dev ninja-build   # make (WC1.EXE)
```

## Acknowledgements

Special thanks to:

- [Origin Systems](https://en.wikipedia.org/wiki/Origin_Systems)
  who created *Wing Commander* and developed its *Kilrathi Saga* port;
- [Electronic Arts](https://www.ea.com/) for publishing *Wing Commander: The
  Kilrathi Saga*;
- [GOG](https://www.gog.com/en/game/wing_commander_1_2) for keeping *Wing
  Commander 1 + 2* readily available;
- AllTinker for the [W.C.A.T. overhaul](https://alltinker.itch.io/wcat), whose
  fixes and analysis of the DOS release have been valuable references;
- the [WCDX project](https://github.com/Bekenn/wcdx) for its pioneering
  compatibility work on the *Kilrathi Saga* release;
- L@Zar0 and darkpadawan for the Spanish translation v1.1; its
  [original terms](translations/upstream/Leeme.txt) specify GPLv3 with an additional
  no-charge condition. [Provenance](translations/provenance.json) records the import;
- WingLoader v0.91 for the initial associations between dialogue and recording filenames;
- [Greg14](https://www.wcnews.com/chatzone/members/greg14.11738/) for the French
  translation, adapted with permission; [provenance](translations/fr/provenance.json);
- Aaron Giles for the [DREAMM emulator](https://dreamm.aarongiles.com/), used
  to run and study the original release, and
  [ymfm](https://github.com/aaronsgiles/ymfm), which powers the SDL2 port's
  AdLib emulation;
- the [Munt project](https://github.com/munt/munt), whose libmt32emu
  (LGPL-2.1 or later) emulates the Roland MT-32 and CM-32L;
- Trov for the [double-resolution cockpit font](third_party/double-resolution-cockpit-font/README.md)
  (CC BY 4.0) that the hi-res HUD shows cockpit text in; and
- DaisenryakuFan for providing very advanced source reconstructions for the DOS
  releases of several *Wing Commander* titles.

## License

See [LICENSE](LICENSE). OpenAI Codex and Anthropic Claude were used during the
reconstruction.
