Skip to content

About

Patcher for Sega Rally 2 (PC, 1999). Makes the game run nicely on modern hardware - with online support to boot!

Resources

Stars

21 stars

Watchers

0 watching

Forks

Latest commit

 

History

335 Commits

Folders and files

Repository files navigation

SR2 Patcher logo

SR2 Patcher

Gets SEGA RALLY 2 (PC, 1999) running properly on a modern system. Install it from your disc images, press a button, and it plays: no crashes, no invisible text, no dead controller, no disc in the drive.

You also get the picture at your monitor's size and shape, the soundtrack from files, an XInput pad you can rebind in-game, and online play with no port forwarding. Windows 10 and 11, Wine and Proton.

Lancia Stratos on a coastal stage at 32:9

Work in progress. The game plays start to finish on all five releases, but this is a hobby project poking at a 27-year-old binary and things will turn up. Reporting a bug says what helps.

Quick start  ·  Virus warnings  ·  Disc images  ·  Patches  ·  Widescreen  ·  Controls

Internet play  ·  Music  ·  Builds  ·  Terminal  ·  Bugs  ·  Known issues

Quick start

Download sr2-patcher-*-win.zip from the latest release, unzip it anywhere and run sr2-patcher.exe; the _internal folder beside it has to stay. If SmartScreen or a virus scanner objects, see Virus warnings.

On Linux, or on Windows without the exe, take -python.zip from the same page:

  1. Install Python 3.8 or newer from python.org, ticking Add python.exe to PATH on the installer's first page. On Linux, see From a terminal.
  2. Unzip it somewhere of its own; MGNetWk.dll has to stay in the net folder beside the script.
  3. Run it. Double-click sr2-patcher.py, or py sr2-patcher.py from a terminal in its folder.

If the script on Windows cannot download dgVoodoo 2 (CERTIFICATE_VERIFY_FAILED), run py -m pip install certifi once.

The patcher window, showing its numbered sections

Work through the numbered sections in order:

  1. GAME FOLDER - where the game is, or an empty folder to put it in. An install of your own has to be unmodified; if yours is refused, see Builds.
  2. INSTALL - disc 1's .cue in Install disc, disc 2's in Play disc, then Install game and Rip soundtrack. Skip it if the game is already in the folder. See Disc images and Music.
  3. PATCHES - all applied; the ⓘ beside each says what it does. Press Apply patches.
  4. ADD-ONS - on Windows dgVoodoo 2 is ticked and downloaded on Apply. See Add-ons.

Then run SEGA RALLY 2.exe from that folder. Restore original puts the game back.

Virus warnings

The exe is signed with a Certum open-source code signing certificate (Properties → Digital Signatures). SmartScreen can still warn until it has built up a reputation: More info → Run anyway.

Scanners can still flag it, since a program that edits other programs is what they look for. A detection ending in !ml, such as Defender's Trojan:Win32/Wacatac.B!ml, is a machine-learning guess, not a match for anything known. To allow it in Defender: Windows Security → Virus & threat protection → Protection history → the entry → Allow.

Every release is built on GitHub from this repository.

Disc images

The patcher reads the images itself: nothing to mount, no virtual drive. You need both discs: the game is on the first, the music on the second.

  • Install disc - a .cue with its .bin beside it, an .iso, a folder you have already copied the disc to, or its data1.cab. The .cue is the small text file, not the .bin.
  • Play disc - a .cue with its .bin files. An .iso will not do here: it drops the audio tracks, and those are the music.

The game takes about 550 MB and the soundtrack about as much again.

If you have the discs, not images

Image them once:

  • Windows - ImgBurn in Read mode, with the output set to BIN/CUE rather than ISO.

  • Linux - cdrdao, then its own toc2cue:

    cdrdao read-cd --driver generic-mmc-raw --datafile sr2-disc2.bin \
        sr2-disc2.toc /dev/sr0
    toc2cue sr2-disc2.toc sr2-disc2.cue

What the patches do

Every patch is applied; none has a trade-off - widescreen stays 4:3 until you pick a size, the gamepad patch keeps the keyboard. To leave one out, use the terminal. What each changes, down to the byte, is in docs/NOTES.md.

  • No disc required - every mode plays with nothing in the drive.
  • Skip the start-up checks - a 1999 video card, a 640x480 16-bit display mode, a 16-bit desktop and, on the Australian release, Windows 9x. Nothing today passes them.
  • Crash fixes - on start-up, on the logo screen, and on the way out of the replay gallery.
  • Fix the picture after ALT+TAB - it comes back instead of staying black.
  • Fix the device scan - the white window on start, from the game reading every USB device on the machine.
  • Windowed and borderless - ALT+ENTER switches, on whichever monitor the window is on. Stock it took the whole screen at 640x480.
  • Text and panel fixes - the menu text, the name you type, the team list and the chat were all invisible, and the team room's panels came out black with dgVoodoo 2.
  • Fix the HUD over the scenery - the tachometer no longer blanks the lake behind it on Mountain.
  • Sound fixes - the three volume sliders now match each other, and start at 6 rather than full.
  • No registry - settings sit beside the game, so the folder can be copied anywhere.
  • Native widescreen - the game renders at your screen's size and shape instead of 640x480 stretched. See Widescreen.
  • Music from files - the soundtrack plays from the folder instead of the disc. See Music.
  • XInput gamepad support - a modern pad works everywhere, the driving and menu controls rebindable in-game, with rumble on crashes and landings. See Controls.
  • Internet play - online, direct IP and LAN in place of DirectPlay; no port forwarding needed. See Internet play.
  • Loading screens - the stage card is held for three seconds; today's machines load it faster than you can read it.

Add-ons

dgVoodoo 2 is dege's DirectDraw on Direct3D 11. Windows' own DirectDraw stops at 2048 a side and is slow and erratic with this game on some machines. It is on by default on Windows and off under Wine and Proton, which do not need it.

Widescreen

Desert stage in a Celica ST-205 at 32:9

Time Attack name entry at 16:9, its tiled background carried out to the edges Jungle stage in a Peugeot 306 Maxi at 16:9

Options → Graphic Settings gains an Aspect Ratio row - 4:3, 16:10, 16:9, 21:9, 32:9 - and a Resolution row listing that shape's sizes, up to 7680x2160. The picture changes at the next screen.

A wide screen shows more at the sides rather than stretching the middle. The menus and the HUD keep their shape in the centre; the title and mode select stay 4:3, with the picture blurred behind them to fill the sides.

Two-player split screen follows the same size:

Two-player split screen at 16:9

On Windows the list stops at 2048 a side without the dgVoodoo 2 add-on.

Controls

An XInput pad works as it is: stick to steer, triggers for the pedals, Start to pause, and in the menus A to choose and B to go back. The pad rumbles when the car hits something or lands a jump. The driving and menu controls can be rebound for both players, keyboard and pad, under Options → Device Settings, which also sets the stick deadzone and the vibration strength, or turns the rumble off.

Options menu with Device Settings selected

The less obvious ones:

Where What Pad Keyboard (2P)
Car select The other colour of the Stratos, Corolla, Impreza, Lancer Evo VI or ST185 Hold LB while choosing Hold Page Up while choosing
Name entry Erase the last letter X Backspace
Name entry Jump to END Start -
Replay Next / previous camera RB / LB Up / Down (S / X)
Replay Turn the revolving camera; driver's or rear view; the side camera's side Left stick Left / Right (Z / C)
Replay Zoom the revolving camera RT / LT Page Up / Page Down
Replay Meter on / off Y Insert / Delete (T / G)
Replay Switch the screen (2 PLAYER BATTLE, the winner) or the car watched (multiplayer) X TAB
Replay Pause Start Enter (Space)

The settings are saved as plain text in SR2.CFG beside the game; delete the file for the defaults.

Device Settings page listing each control's key and pad binding The game's prompts for the keyboard and for the pad, side by side

Internet play

Multiplayer connection screen offering INTERNET, DIRECT IP and LAN

Important

Everyone in a team needs patcher 0.8.0 or later. Older builds cannot join or be joined: update to play.

The connection screen offers three rows in place of IPX, TCP/IP, modem and serial:

  • INTERNET - every open team, listed as the screen opens; SEARCH asks again. No port forwarding on either side.
  • DIRECT IP - CREATE hosts on UDP 47626, which the host forwards; the team room's status line shows the host's local and public address. SEARCH asks for the host's address, or address:port, and lists the team.
  • LAN - the local network, searched as the screen opens.

Up to four players. The team room, the chat, the car and course selection and the race are the game's own. How it works is in docs/NETWORK.md.

Music

The soundtrack is thirteen audio tracks on the play disc, which is why a stock install is silent without it in the drive. Rip soundtrack copies them into a music folder beside the game and the Music from files patch plays them from there. Any release's disc 2 will do: they all carry the same recording.

Builds

The patcher knows these releases and tells them apart by itself:

Release Disc
European EI-1183-1
American 40924-0919
Australian MK-85078-40
Japanese (Sega) HCJ-0145
Japanese (DigiCube, MediaKite) DWRPD-00081

Before writing anything the patcher checks every file it knows. If one does not match, nothing is touched and a line names it - usually a modified or half-patched install; install afresh from the disc.

Each patched file gets a .bak beside it, which Restore original puts back. Patching twice is the same as patching once.

From a terminal

Everything the window does, without the window:

python3 sr2-patcher.py --install "Sega Rally 2 (Disc 1).cue" ~/games/sr2 English
python3 sr2-patcher.py --rip "Sega Rally 2 (Disc 2).cue" ~/games/sr2
python3 sr2-patcher.py --patch ~/games/sr2
python3 sr2-patcher.py --restore ~/games/sr2

--patch applies every patch. A leading minus leaves one out, as in --patch ~/games/sr2 -music; the table in docs/NOTES.md has the names. --patch ~/games/sr2 logs turns on the logging for a bug report.

On Linux the terminal commands need nothing extra; the window needs Tk:

sudo apt install python3-tk        # Debian, Ubuntu, Mint
sudo dnf install python3-tkinter   # Fedora
sudo pacman -S tk                  # Arch

Under Wine or Proton the patched folder runs as it is.

Reporting a bug

Open an issue with the release (the window names it), Windows or Wine/Proton, and what you were doing just before.

Most bugs need the game's own log to be found. Under DIAGNOSTICS in the patcher, tick the boxes you are asked for and press Apply patches. Reproduce the bug, then attach the logs folder from beside SEGA RALLY 2.exe. For anything online, tick Network log on every machine and send each one's folder.

For a disc image of a release the patcher does not know, or anything that does not fit an issue: pairo@segaonline.net.

Known issues

  • Windows: stutter on laptops with two graphics cards. The game stutters or skips frames every few seconds, on either screen and with either card. Seen with AMD integrated and NVIDIA at 60 Hz. No workaround yet; with a report, name both cards, the resolution and the refresh rate.
  • Half of the team room black. Rare, usually after an ALT+TAB: the team room comes back half black or garbled. Seen on Linux and on Windows.
  • The tachometer needle during the countdown. Now and then it is drawn off its pivot until the race starts.
  • Stuck leaving the Network menu. Backing out the moment it opens can leave the game in the transition. Give the menu a second.

Planned

In no particular order:

  • Fleshing out the online functionality - this one's a long term goal, but something I am interested in.
  • A faster update rate with more players online - the game sends each car's position less often the more players there are: ten times a second with two, about half that with four.
  • Full detail in split screen - the game draws the scenery less far and the cars at a lower level of detail there.

Working on the patcher

docs/ covers how the game works and how the patches are made.

AI disclaimer

LLMs are part of the toolchain here: much of the assembly and the documentation was written with one. The reverse engineering was not. The addresses and the behaviour each patch relies on come from tracing and debugging the running game with pefile, capstone, unshield, Unicorn, Wine's debug channels and WinDbg, and the LLM writes to that brief. The scope, the disc dumps, the testing and the debugging are human. The patcher edits the game's own files and adds its code beside them; it is not a reimplementation of the game.

Every change is read line by line before it goes in, and every patch is played on all five releases before it ships. Offsets and bytes are verified against the originals before anything is written, and the patcher refuses any file that is not an unmodified build it has tables for.

Credits and licence

Successor to v-on-patcher. The logo and icon are the work of SirRockEmSockEm. The DigiCube and MediaKite support is by chmcl95. The game is SEGA's. LICENSE (MIT) covers the patcher, its tools and its documentation, not the game or the bytes quoted from it.

About

Patcher for Sega Rally 2 (PC, 1999). Makes the game run nicely on modern hardware - with online support to boot!

Resources

Stars

21 stars

Watchers

0 watching

Forks

Releases

Contributors

Languages