Decompilation of Castlevania: Symphony of the Night (PSX+Saturn)
Go to file
bismurphy 027b108922
Adjust func_8011A4D0 to improve readability and symbol (#1124)
While tracking the calling of the weapon functions, I made a neat
discovery.

func_8011A4D0 is a crucial function at the heart of the game's engine.
For every entity which is created by its ID, this function assigns the
PfnEntityUpdate function which will run each frame for that entity.

If the ID is E0-EC, or F0-FC, it reads a function from a pointer to
call. It turns out that the array we were indexing into before is not a
real array, because of course it does not have elements below E0. When
you take the minimum offsets into consideration, it turns out that these
arrays are located precisely where the two weapons (in the player's two
hands) are located in memory.

Because D_8017A000 and D_8017D000 are Weapon objects, we can't index
into them as an array, so I had to do a bit of an ugly cast to a
`PfnEntityUpdate*`, unfortunately I don't know a way to do this under
our 80-character limit.

Neat to discover fake symbols and clean them up, as well as to make it
obvious that these two lines are dealing directly with the weapon
functions.
2024-05-13 09:37:35 +01:00
.github/workflows Fix CI progress report for pspeu 2024-04-21 02:29:16 +01:00
.vscode Custom debugging module (#108) 2023-08-10 18:55:24 +01:00
bin Add TT_000 overlay from PSP (#1113) 2024-04-21 02:18:10 +01:00
cmake Texture render support (#934) 2024-01-01 23:31:56 +00:00
config Completes w_051 (#1122) 2024-05-12 18:31:16 +01:00
disks Change how game assets are managed 2023-02-21 23:25:31 +00:00
docs Import 5D6C4 data (#845) 2023-12-14 08:45:07 -08:00
include Completes w_051 (#1122) 2024-05-12 18:31:16 +01:00
src Adjust func_8011A4D0 to improve readability and symbol (#1124) 2024-05-13 09:37:35 +01:00
tools Use PSP platform to disassemble PSP overlays (#1118) 2024-05-06 19:35:28 +01:00
.clang-format Disallow formatter to make some undesiderable changes 2023-07-05 22:50:18 +01:00
.gitignore Add TT_000 overlay from PSP (#1113) 2024-04-21 02:18:10 +01:00
.gitmodules Extract memory card icons (#166) 2023-12-11 23:12:13 -08:00
CMakeLists.txt Migrate rodata to functions for dra (#1084) 2024-02-25 17:44:11 +00:00
CNAME Create CNAME 2022-10-18 23:52:54 +01:00
CONTRIBUTING.md Update CONTRIBUTING.md (#721) 2023-10-31 20:34:50 +00:00
diff_settings.py More TT_000 PSP functions matching (#1115) 2024-04-23 20:06:05 +01:00
Dockerfile Update maspsx (#1100) 2024-03-15 14:04:57 -07:00
go.work Purge ASPATCH 2023-06-17 12:30:42 +01:00
Makefile Completes w_051 (#1122) 2024-05-12 18:31:16 +01:00
Makefile.psp.mk Improve permuter behaviour with the PSP build (#1117) 2024-05-04 10:06:37 +01:00
Makefile.psx.mk Add TT_000 from the HD version (#1111) 2024-04-04 22:28:57 +01:00
Makefile.saturn.mk Rewrite Saturn make rules (#660) 2023-10-03 21:42:08 +01:00
README.md Add TT_000 overlay from PSP (#1113) 2024-04-21 02:18:10 +01:00
weapon0.ld Enhance Makefile for WEAPON0.BIN (#466) 2023-08-14 02:03:54 +01:00
weapon1.ld Enhance Makefile for WEAPON0.BIN (#466) 2023-08-14 02:03:54 +01:00

Castlevania: Symphony of the Night Decompilation

A work-in-progress decompilation of Castlevania Symphony of the Night for Sony PlayStation 1, Sony PlayStation Portable and Sega Saturn. It aims to recreate the source code from the existing binaries using static and/or dynamic analysis. The code compiles byte-for-byte to the same binaries of the game, effectively being a matching decompilation.

It currently supports the following versions of the game:

  • us the reference build with the serial number SLUS-00067
  • hd an unreleased PS1 Japanese build found in Castlevania: Dracula X Chronicles game data
  • pspeu European build from Castlevania: Dracula X Chronicles
  • saturn the port created by an external development team

This repo does not include any assets or assembly code necessary for compiling the binaries. A prior copy of the game is required to extract the required assets.

Bins decomp progress

File name Code coverage Decomp functions Description
SLUS_000.67 code coverage SLUS_000.67 decompiled functions Shared libraries
DRA.BIN code coverage DRA.BIN decompiled functions Game engine
BIN/RIC.BIN code coverage RIC.BIN decompiled functions Playable Richter
BIN/WEAPON0.BIN code coverage WEAPON0.BIN decompiled functions Equippables
ST/CEN/CEN.BIN code coverage CEN.BIN decompiled functions Center
ST/DRE/DRE.BIN code coverage DRE.BIN decompiled functions Nightmare
ST/MAD/MAD.BIN code coverage MAD.BIN decompiled functions Debug Room
ST/NO3/NO3.BIN code coverage NO3.BIN decompiled functions Entrance (first visit)
ST/NP3/NP3.BIN code coverage NP3.BIN decompiled functions Entrance
ST/NZ0/NZ0.BIN code coverage NZ0.BIN decompiled functions Alchemy Laboratory
ST/SEL/SEL.BIN code coverage SEL.BIN decompiled functions Title screen
ST/ST0/ST0.BIN code coverage ST0.BIN decompiled functions Final Stage: Bloodlines
ST/WRP/WRP.BIN code coverage WRP.BIN decompiled functions Warp Room
ST/RWRP/RWRP.BIN code coverage RWRP.BIN decompiled functions Warp Room (reverse)
SERVANT/TT_000.BIN code coverage TT_000.BIN decompiled functions Bat Familiar

Code coverage means how many bytes of code have been successfully converted from assembly into C code, while decomp function is how many functions have been successfully decompiled.

Decompiling a game is a mastodontic task. If you have some basic programming skills, please join us in this journey. Any contribution will be very appreciated!

Join to our Discord server

Special thanks

This project is possible thanks to the hard work of tools provided by the Decompilation community:

  • mips2c from @matt-kempster to decompile MIPS assembly into C. This has proven to be more accurate than Hexrays IDA and Ghidra.
  • splat from @ethteck to disassemble code and extract data with a symbol map. This tool provides the fundamentals of the SOTN decomp.
  • asm-differ from @simonlindholm to know how the decompiled code compares to the original binary.
  • decomp-permuter from @simonlindholm to pick different versions of the same code that better matches the original binary.
  • maspsx by @mkst to replicate the customized assembler used in the official PSX SDK.
  • decomp.me by @ethteck, @nanaian and @mkst to provide a collaborative decompilation site to share and contribute to work-in-progress decompiled functions.
  • frogress by @ethteck to store and retrieve progression data.
  • esa-new by @mkst as an inspiration on how to set-up a PS1 decompilation project.
  • oot as an inspiration of what it is possible to achieve with a complete decompiled video game.