Software:Castlevania: Symphony of the Night
| Developer | Konami (KCET) |
|---|---|
| Publisher | Konami |
| Engine | proprietary |
| Uses | Library:Psy-Q SDK |
| Platforms | Platform:PlayStation (1997), Sega Saturn (1998, JP), PSP (2007, in Castlevania: The Dracula X Chronicles), later re-releases |
| Versions | US SLUS-00067 (reference build of the decompilation); JP; EU; Saturn; PSP EU |
| Website | https://github.com/Xeeynamo/sotn-decomp |
| On this wiki | Facts · Code · Notes · Topics |
Side-scrolling action RPG by Konami (1997, Platform:PlayStation; later Sega Saturn and PSP ports). The PlayStation version keeps almost no game code in its boot executable: SLUS_000.67 holds the Library:Psy-Q SDK libraries and the engine's global variables, DRA.BIN is the engine loaded at 0x800A0000, and every stage, boss, player character, familiar and weapon is an overlay loaded to a fixed address. A matching decompilation (sotn-decomp) documents the US build exactly.
Overview
The PlayStation game is split into many independently loaded files. Most reverse-engineering work starts from three facts: engine globals sit at fixed addresses in the boot executable's BSS, the engine is always resident at 0x800A0000, and stage code is loaded to 0x80180000 and talks to the engine through one table of function pointers (g_api). The decompilation project sotn-decomp covers the US PlayStation build (byte matching) plus the PSP (EU), Saturn and an unreleased Japanese PlayStation build found in the PSP data (hd).
Builds
- US PlayStation, SLUS-00067 - the reference build: Build:Castlevania: Symphony of the Night/US SLUS-00067 (PlayStation, retail CD). The 994-line
config/symbols.us.txt(boot executable and library names, 925 added to the build's symbol map from commit d12b397f36) was imported into it. The decompilation'sconfig/check.us.shalists the SHA-1 of every file it rebuilds (boot EXE, DRA.BIN, RIC.BIN, every stage, boss, familiar and weapon overlay). - hd: unreleased Japanese PlayStation build shipped inside Castlevania: The Dracula X Chronicles (PSP).
- pspeu: the PSP port in The Dracula X Chronicles, European release, built with Metrowerks CodeWarrior (mwcc) for the Allegrex CPU.
- saturn: the Sega Saturn port (SH-2, GCC 2.7 Cygnus toolchain).
Architecture overview
RAM layout of the US PlayStation build (from the decompilation's link addresses):
| Address | Contents | File |
|---|---|---|
0x80010000 |
boot code: Library:Psy-Q SDK libraries, a short main |
SLUS_000.67
|
0x8003BDEC-~0x80099000 |
engine globals (BSS of the boot EXE): game state, g_api, entities, player status |
(zero-filled) |
0x800A0000 |
engine: game loop, Alucard, menus, HUD, save manager, CD and sound code | DRA.BIN
|
0x8013C000 |
player overlay for Richter mode | BIN/RIC.BIN
|
0x80170000 |
familiar (servant) overlay | SERVANT/TT_00x.BIN
|
0x8017A000, 0x8017D000 |
the two equipped-weapon overlays | BIN/WEAPON0.BIN, BIN/WEAPON1.BIN
|
0x80180000 |
stage or boss overlay | ST/<ID>/<ID>.BIN (e.g. ST/NO0/NO0.BIN), with graphics in F_<ID>.BIN
|
0x801E0000 |
castle map bitmap | F_MAP.BIN
|
0x801E8000 |
demo input buffer | |
0x801EA000 |
save data buffer |
Boot. main in the boot EXE resets callbacks, sets a heap at 0x801F0000, initialises LIBCD, reads \DRA.BIN;1 to 0x800A0000 and \F_MAP.BIN;1 to 0x801E0000, then calls the function pointer stored in the first word of DRA.BIN (MainGame). Before using the CD it tries sim:c:\bin\dra.bin, a development-kit host path.
Engine API. DRA.BIN starts with that entry pointer followed by a 0x140-byte table (g_ApiInit) that the engine copies to g_api at 0x8003C774. Overlays never call DRA.BIN directly; they load a function pointer from g_api and call it. The first 0x40 bytes of g_api are a copy of the loaded stage overlay's header (Overlay, 16 words: Update, HitDetection, UpdateRoomPosition, InitRoomEntities, rooms, sprite banks, palettes, layouts, tile layers, graphics banks, UpdateStageEntities...); the rest are engine services (FreePrimitives, AllocPrimitives, CheckCollision, PlaySfx, DealDamage, AddToInventory...) and pointers to the equipment, accessory, relic and enemy definition tables.
Entities. All actors are 0xBC-byte Entity records in one array of 256 at 0x800733D8 (g_Entities). Slots are reserved by role: 0 is the player, 0x40-0xFF belong to the stage. Each entity has an update function pointer at +0x28 and a step/sub-step state machine at +0x2C/+0x2E. Positions are 16.16 fixed point; the high half is the pixel coordinate.
Stages. g_StageId (0x800974A0) selects the stage; bit 0x20 marks the inverted castle (RNO0 = NO0 | 0x20). Rooms are described by 8-byte RoomHeader records (tile bounds left, top, right, bottom and four load indices).
Identification
- Disc root contains
SYSTEM.CNF,SLUS_000.67(US) andDRA.BIN, with directoriesBIN,ST,BOSS,SERVANT,VABand streams such asOPN_WS.STR. - The boot EXE contains the strings
\DRA.BIN;1,\F_MAP.BIN;1andsim:c:\bin\dra.bin.
Recovery recipes
- Calls from an overlay: a load from
0x8003C7B4and above followed byjalris a call to an engine service; the offset from0x8003C774is the slot of theGameApistructure (+0x40FreePrimitives, +0x44AllocPrimitives, +0x48CheckCollision...). Apply theGameApitype to0x8003C774and the decompiler names them. - Disassembling a stage: load
ST/<ID>/<ID>.BINat0x80180000; its first 0x40 bytes are theOverlayheader (pointers into the same file), soUpdateandInitRoomEntitiesare the first and fourth words. - Watching game state:
g_Statusat0x80097964holds HP (0x80097BA0), max HP, hearts (0x80097BA8), MP (0x80097BB0), level (0x80097BE8) and gold (0x80097BF0) in the US build.
Code & repositories
- https://github.com/Xeeynamo/sotn-decomp @
8a42c0036e0609a1d0fda3cd8d10251bf86a82c0· license: AGPL-3.0
Matching decompilation of Castlevania: Symphony of the Night (AGPL-3.0) for the US PlayStation build SLUS-00067, with work on the PSP (EU), Saturn and an unreleased Japanese PlayStation build. Useful without building: config/splat.us.*.yaml gives every file's load address and section split, config/symbols.us*.txt the global and library symbol addresses, config/check.us.sha the SHA-1 of every original file, include/game.h the Entity, Overlay, GameApi, PlayerStatus and room structures with offsets. No game assets or assembly are in the repository.
Tested on: Read at commit 8a42c00 (2026-10-17): configuration, headers and src/main, src/dra; not built (needs the game disc). · checked 2026-10-17; last activity 2026-10-17
Pitfalls
- Stage, boss and Richter overlay addresses overlap other overlays. The decompilation keeps one splat configuration and one symbol file per overlay (
config/splat.us.<overlay>.yaml,config/symbols.us.<overlay>.txt); stage symbols are only valid while that stage is loaded. - Names in the decompilation are reconstructed by its contributors;
func_/D_names mean unnamed. The PSP and Saturn versions have different layouts for some structures and extraGameApientries. - Unverified: DRA.BIN is larger than the space before
0x8013C000; its file data from offset0x9B6A0(sound banksvb_0tovb_3in the splat configuration) maps to0x8013B6A0and beyond, over the overlay areas. They are presumably uploaded to sound RAM at boot and then overwritten by overlays. Test: set a write watchpoint on0x80180000after boot and check that the SPU transfer from DRA's sound data has already happened.
Open questions
- What the unnamed
g_apislots (func_800EA5E4,func_80118894...) do. - Whether the JP and EU PlayStation builds keep the same global addresses as US (the decompilation targets US only). Test: compare the boot code of
SLPM_860.23(JP) withSLUS_000.67.