This commit is contained in:
Dethrace Labs 2025-07-09 21:30:19 +12:00
parent 987983439c
commit 216b30e9ae
2 changed files with 92 additions and 33 deletions

View File

@ -16,30 +16,6 @@ Dethrace is an attempt to learn how the 1997 driving/mayhem game [Carmageddon](h
<img width="752" alt="Screenshot 2024-05-27 at 8 44 10AM" src="https://github.com/dethrace-labs/dethrace/assets/1063652/10b3b579-1eb1-4242-8b56-ff062cfff810">
## Background
Watcom debug symbols for an earlier internal build [were discovered](http://1amstudios.com/2014/12/02/carma1-symbols-dumped) named `DETHRSC.SYM` on the [Carmageddon Splat Pack](http://carmageddon.wikia.com/wiki/Carmageddon_Splat_Pack) expansion CD release. The symbols unfortunately did not match any known released executable, meaning they were interesting but not immediately usable to reverse engineer the game.
This is what it looked like from the Watcom debugger - the names of all the methods were present but the code location they were pointing to was junk:
![watcom-debugger](http://1amstudios.com/img/watcom-debugger.jpg)
_CrayzKirk_ from the Carmageddon community picked it up and did a lot of painstaking work manually matching up many functions and data structures in the DOS executable to the debugging symbols.
We are slowly replacing the original assembly code with equivalent C code, function by function.
### Is "dethrace" a typo?
No, well, I don't think so at least. The original files according to the symbol dump were stored in `c:\DETHRACE`, and the symbol file is called `DETHSRC.SYM`. Maybe they removed the "a" to be compatible with [8.3 filenames](https://en.wikipedia.org/wiki/8.3_filename)?
## Game content
Dethrace does not ship with any content. You'll need access to the data from the original game. If you don't have an original CD then you can [buy Carmageddon from GoG.com](https://www.gog.com/game/carmageddon_max_pack).
`dethrace` also supports the various freeware demos:
- [Original Carmageddon demo](https://rr2000.cwaboard.co.uk/R4/PC/carmdemo.zip)
- [Splat Pack demo](https://rr2000.cwaboard.co.uk/R4/PC/splatdem.zip)
- [Splat Pack Xmas demo](https://rr2000.cwaboard.co.uk/R4/PC/Splatpack_christmas_demo.zip)
## Building
### Dependencies
@ -56,12 +32,6 @@ Linux:
apt-get install libsdl2-dev
```
Point Dethrace at the Carmageddon install directory:
```sh
export DETHRACE_ROOT_DIR=/path/to/carmageddon
```
### Clone
Dethrace uses [git submodules](https://git-scm.com/book/en/v2/Git-Tools-Submodules), so we must pull them after the inital clone:
@ -87,25 +57,44 @@ make
## Running the game
Firstly, you need a copy of the [Carmageddon game content](https://github.com/dethrace-labs/dethrace?tab=readme-ov-file#game-content). Extract the zip file if necessary.
Dethrace does not ship with any content. You'll need access to the data from the original game. If you don't have an original CD then you can [buy Carmageddon from GoG.com](https://www.gog.com/game/carmageddon_max_pack).
Dethrace expects to be placed into the top level Carmageddon folder. You know you have the right folder when you see the original `CARMA.EXE` there. If you are on Windows, you must also place `SDL2.dll` in the same folder.
`dethrace` also supports the various freeware demos:
- [Original Carmageddon demo](https://rr2000.cwaboard.co.uk/R4/PC/carmdemo.zip)
- [Splat Pack demo](https://rr2000.cwaboard.co.uk/R4/PC/splatdem.zip)
- [Splat Pack Xmas demo](https://rr2000.cwaboard.co.uk/R4/PC/Splatpack_christmas_demo.zip)
## Configuration
Dethrace generally expects to be placed into the top level Carmageddon folder. You know you have the right folder when you see the original `CARMA.EXE` there. If you are on Windows, you must also place `SDL2.dll` in the same folder.
<img width="638" alt="Screenshot 2024-09-20 at 12 25 05PM" src="https://github.com/user-attachments/assets/fda77818-9007-44fa-9d8d-c311396fd435">
Alternatively, you may configure a different directory by providing a [dethrace.ini file](docs/CONFIGURATION.md).
### CD audio
Dethrace supports the GOG cd audio convention. If there is a `MUSIC` folder in the Carmageddon folder containing files `Track02.ogg`, `Track03.ogg` etc, then Dethrace will use those files in place of the original CD audio functions.
<img width="571" alt="Screenshot 2024-09-30 at 8 31 59AM" src="https://github.com/user-attachments/assets/cec72203-9156-4c2a-a15a-328609e65c68">
## Background
Watcom debug symbols for an earlier internal build [were discovered](http://1amstudios.com/2014/12/02/carma1-symbols-dumped) named `DETHRSC.SYM` on the [Carmageddon Splat Pack](http://carmageddon.wikia.com/wiki/Carmageddon_Splat_Pack) expansion CD release. The symbols unfortunately did not match any known released executable, meaning they were interesting but not immediately usable to reverse engineer the game.
This is what it looked like from the Watcom debugger - the names of all the methods were present but the code location they were pointing to was junk:
![watcom-debugger](http://1amstudios.com/img/watcom-debugger.jpg)
We are slowly replacing the original assembly code with equivalent C code, function by function.
### Is "dethrace" a typo?
No, well, I don't think so at least. The original files according to the symbol dump were stored in `c:\DETHRACE`, and the symbol file is called `DETHSRC.SYM`. Maybe they removed the "a" to be compatible with [8.3 filenames](https://en.wikipedia.org/wiki/8.3_filename)?
## Changelog
[From the beginning until release](docs/CHANGELOG.md)
## Credits
- CrayzKirk (manually matching up functions and data structures in the executable to the debugging symbols)
- CrayzKirk (did the first manual matching up functions and data structures in the DOS executable to the debugging symbols and proved it was possible!)
- The developer at Stainless Software who left an old debugging .SYM file on the Splat Pack CD ;)
## Legal

70
docs/CONFIGURATION.md Normal file
View File

@ -0,0 +1,70 @@
# Configuration
Dethrace looks for a `dethrace.ini` file in the [system preferences directory](https://wiki.libsdl.org/SDL2/SDL_GetPrefPath):
| Platform | Example Path |
|----------|----------------------------------------------------------------------|
| Windows | `C:\Users\bob\AppData\Roaming\dethrace\dethrace.ini` |
| macOS | `/Users/bob/Library/Application Support/dethrace/dethrace.ini` |
| Linux | `/home/bob/.local/share/dethrace/dethrace.ini` |
If this file is not present, dethrace will run with default configuration and attempt to discover the correct Carmageddon directory to use (see below).
## Example dethrace.ini file
```ini
[General]
; Enable original CD check
CdCheck = 0
; Enable original censorship check
GoreCheck = 0
; set to 0 to disable
FPSLimit = 60
; Full screen or window
Windowed = 1
; 3dfx mode (via OpenGL)
Emulate3DFX = 0
; Censored zombie/robots mode
BoringMode = 0
; Play cut scenes on startup and between races
Cutscenes = 0
; "hires" mode is 640x480, otherwise default 320x200
Hires = 1
; Only used in 'demo' mode. Default demo time out is 240s (5 mins)
DemoTimeout = 240
; Which directory in the [Games] section to run
DefaultGame = c1
[Games]
c1 = /opt/carma/c1
c1demo = /opt/carma/c1demo
sp = /opt/carma/splatpack
[Cheats]
EditMode = 0
FreezeTimer = 0
GameCompleted = 0
[Sound]
Enabled = 1
SoundOptionsScreen = 1
VolumeMultiplier = 1
[Network]
AdapterName = ""
```
## Order of precedence for game directory detection:
1. Directory pointed to by DefaultGame
2. First game in the list if at least 1 game dir is specified
3. `DETHRACE_ROOT_DIR` environment variable
4. Current working directory (if `DATA/GENERAL.TXT` exists)
5. `SDL_GetPrefPath` directory