Skip to content

About

Toward a native PC port of Deep Fear (Sega Saturn, 1998) by static recompilation, built on saturnkit. BYOA: documentation and tools only.

Topics

Resources

Stars

2 stars

Watchers

1 watching

Forks

Latest commit

 

History

26 Commits

Folders and files

Repository files navigation

pc-deepfear

Toward a native PC port of Deep Fear (Sega Saturn, 1998, System Sacom / Sega), the survival horror set in an underwater naval base, in the manner of the first Resident Evil games: pre-rendered rooms, 3D characters, fixed cameras, and more than an hour of movies over two discs. It was released only on the Saturn and never re-released. The goal is the game running natively on PC: without slowdown, at the speed it was made for, with instant loading, and sharper where the hardware allows it.

This repository documents the discs, their formats and their code, and grows the tooling for the port. It is the second port built on saturnkit, the game-agnostic toolkit for Saturn reverse engineering that grew out of pc-virtualhydlide; Deep Fear is where saturnkit meets SGL and GCC's code for the first time. saturnkit is taken here as a submodule: clone with --recursive, or run git submodule update --init.

BYOA — Bring Your Own Assets

This repository contains documentation and tools only. No game data, no executables, no assets. You need your own original discs. The work is done on the European release, MK-81804 (V1.001, 1998-07-13), two discs, as Redump-style .cue/.bin sets in iso/.

Layout

docs/            disc, format and code analysis, and the plan
tools/           Deep Fear-specific data and tools: names-1st.tsv, recomp.py, run.py, oracle.py
saturnkit/       game-agnostic Saturn toolkit (submodule)
iso/, build/     your discs and everything derived from them (ignored by git)

Tools

The Python tools need only Python 3.8+ and no dependencies. Building the recompiled C++ needs CMake, Ninja, clang and SDL3 (MSYS2's mingw64, found at C:\msys64\mingw64\bin). The oracle needs RetroArch with the Beetle Saturn core. Run from the repository root.

D1="iso/Deep Fear (Europe) (Disc 1).cue"
D2="iso/Deep Fear (Europe) (Disc 2).cue"

# the discs: IP.BIN, the ISO 9660 volume, the tracks; extract them
python -m saturnkit.disc "$D1" --info
python -m saturnkit.disc "$D1" --list
python -m saturnkit.disc "$D1" --extract build/extract/disc1
python -m saturnkit.disc "$D2" --extract build/extract/disc2
python -m saturnkit.disc "$D1" --audio build/audio/disc1

# the code: where the program loads, a function, who builds an address
EXE=build/extract/disc1/1ST.BIN
python -m saturnkit.sh2 $EXE --find-base
python -m saturnkit.sh2 $EXE --base 06004000 --at 0603B784 --count 60   # slInitSystem
python -m saturnkit.sh2 $EXE --base 06004000 --refs 25FE0080:25FE0090   # the SCU DSP
python -m saturnkit.hw 25FE0080 06000250

# functions and code/data; the SCU DSP's program (the ADX decoder)
python -m saturnkit.recomp.discover $EXE --base 06004000 --report
python -m saturnkit.scudsp $EXE --base 06004000 --at 0605AB94 --count 204

# both discs' programs to C++, built with clang (MSYS2) and checked against the interpreter
python tools/recomp.py --build --test

# run it on saturnkit's runtime: headless with the pad script (the title, New Game,
# the opening movie skipped, the first room), pictures at chosen VBlanks, the CD
# block's commands, the video memories and registers
python tools/run.py -- --shot 600,1500,2400
python tools/run.py -- --dump 2400
python tools/run.py -- --trace
python tools/run.py --play                 # a window, the keyboard or a gamepad

# the oracle: Beetle Saturn in RetroArch, pressed and photographed from here
python tools/oracle.py --at 36:START,39:START,60:START,66:shot    # to the first room
python tools/oracle.py --disc 2 --at 30:shot

Status

Session 1: the survey. Two discs that differ only in their movies and one byte of the program; a single program, 1ST.BIN, compiled with GCC on SGL, paced by SGL at 25 frames a second on a European Saturn at best; the SCU DSP in use; the sound all ADX through Sega's driver; the formats read at a glance and nothing compressed; Beetle Saturn driven to the first room. Static recompilation looks simpler than Virtual Hydlide's (one program instead of fifteen), with new work for saturnkit: GCC's switches, the SCU DSP, SGL's timing, two discs (docs/06-attack-plan.md).

Session 2: the code map, the recompiler, the first run. saturnkit's function discovery learned GCC's and SGL's code (1 250 of the 1 252 functions Ghidra finds); the program is C++ that passes its self-test; on saturnkit's runtime, which gained the SCU DSP (Deep Fear's ADX decoder), the game boots, shows its title and plays its attract movie with sound. After New Game the loading stalls on the CD block.

Session 3: the first room. Three faults in saturnkit's runtime that only SGL met (the CD block's Play under GFS_SGL's streams, the division unit's shadow registers that SGL's camera reads, the SH-2 DMAC's 16-byte transfers) found and fixed; the game now loads, plays its opening movie and reaches the ERS Room, with the player, his gauges and the room's name as on Beetle, and he walks. Next: docs/07-next-session.md.

Documentation

Licence

MIT — see LICENSE. Deep Fear is © 1998 Sega; this project contains none of it.

About

Toward a native PC port of Deep Fear (Sega Saturn, 1998) by static recompilation, built on saturnkit. BYOA: documentation and tools only.

Topics

Resources

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages