A decompilation of Super Smash Bros Melee brought to you by a bunch of clever folks.
Go to file
eperdew e88fcc1b14
Some checks failed
build / Make (GENERATE_MAP=1) (push) Has been cancelled
build / Ninja (diff, GALE01) (push) Has been cancelled
build / Ninja (link, GALE01) (push) Has been cancelled
build / Issues (push) Has been cancelled
build / Nix (push) Has been cancelled
build / Generate pages (push) Has been cancelled
build / Deploy to GitHub Pages (push) Has been cancelled
publish-packages / Publish package (build-linux) (push) Has been cancelled
publish-packages / Publish package (check-issues) (push) Has been cancelled
publish-packages / Publish package (gen-pages) (push) Has been cancelled
Decompile some camera functions (#1484)
* Match Camera_80029124

* Match Camera_800293E0

* Remove Camera_800293E0 comment

* Partial match on Camera_80029C88

* Partially match Camera_8002A28C

* Remove duplicate decompilation

* Decent progress on Camera_8002A28C

* Couple of small functions

* More progress in camera.c

Couple of other small functions

Decent progress on Camera_8002A28C

Remove duplicate decompilation
2024-10-21 22:00:53 -04:00
.cargo Rewrite and improve issues.sh (#756) 2023-03-19 10:26:42 -04:00
.github Fix data progress badge (#1470) 2024-09-26 01:14:42 +00:00
.idea Migrate gx to C (#554) 2022-09-12 20:21:27 -04:00
.nix Bump dtk to v1.0.0 and objdiff-cli to v2.2.0 (#1475) 2024-09-29 16:27:32 -04:00
.vscode Fix issues with objalloc (#1386) 2024-05-23 13:29:51 -04:00
asm Link ft_0819 (#1481) 2024-10-12 07:12:12 +00:00
config/GALE01 Link ft_0819 (#1481) 2024-10-12 07:12:12 +00:00
docs Remove reference to Trello in docs (#1418) 2024-08-10 18:54:08 +00:00
extern/dolphin Match all 8-byte functions (#1464) 2024-09-24 19:42:49 -04:00
orig/GALE01/sys Add most symbols from GALE01.map to GALE01/symbols.txt (#1075) 2024-01-18 00:10:26 +00:00
reqs Create script for finding easy functions (#1462) 2024-09-23 16:51:56 +00:00
src Decompile some camera functions (#1484) 2024-10-21 22:00:53 -04:00
tools Match all 16-byte functions (#1473) 2024-09-28 03:53:20 +00:00
.clang-format Match all 20-byte functions (#1474) 2024-09-29 12:06:38 -04:00
.dockerignore Publish packages for building Melee and generating documentation (#752) 2023-03-06 08:59:07 -05:00
.editorconfig Match 25.66% of ft_0C31 (8.13 KB) (#1141) 2024-01-28 02:00:27 +00:00
.flake8 Fix pyright complaints and run black (#12) 2024-02-29 11:21:44 -07:00
.gitattributes Create initial decomp-toolkit skeleton 2024-01-16 22:35:33 -05:00
.gitignore Merge remote-tracking branch 'dtk-template/main' into wip/dtk-template 2024-09-17 11:23:55 -04:00
.pre-commit-config.yaml Decomp work on itfoxblaster.s (#1427) 2024-08-12 17:57:54 -04:00
.rustfmt.toml Use .L_ prefix for unnamed local labels (#771) 2023-04-13 12:47:58 -04:00
Cargo.lock Match 47.99% of lbcollision (20.96 KB) (#1200) 2024-02-11 15:30:34 -05:00
Cargo.toml Create scratches.txt and melee-scratch-tracker (#1199) 2024-02-10 17:31:04 -05:00
compile_flags.txt TObj mostly matched, GXSetTexCoordGen2 match, and various GX type cleanup/additions (#1184) 2024-02-02 13:27:22 -05:00
configure.py Link ft_0819 (#1481) 2024-10-12 07:12:12 +00:00
default.nix Support Nix environment (#1335) 2024-02-27 21:45:17 -05:00
Doxyfile Add description, variable names, and enums to some GX functions (#856) 2023-05-19 07:46:23 -04:00
ldscript.lcf Clean up debug.c nonsense (#1063) 2024-01-15 17:00:41 +00:00
Makefile Match Dolphin's hio based on changes from Dec 2001 SDK (#1437) 2024-08-17 15:56:05 -04:00
obj_files.mk Link ft_0819 (#1481) 2024-10-12 07:12:12 +00:00
shell.nix Support Nix environment (#1335) 2024-02-27 21:45:17 -05:00
ssbm.us.1.2.sha1 refactor melee to use BUILD dir 2020-07-31 17:34:31 -04:00

Super Smash Bros Melee
Build Status Code Progress Data Progress Linked Progress Discord Badge

This repo contains a WIP decompilation of Super Smash Bros Melee (US).

Tip

The DOL this repository builds can be shifted! Meaning you are able to now add and remove code as you see fit, for modding or research purposes.

It builds main.dol:

Version Game ID SHA-1
1.02 GALE01 08e0bf20134dfcb260699671004527b2d6bb1a45

Dependencies

Windows:

On Windows, it's highly recommended to use native tooling. WSL or msys2 are not required. When running under WSL, objdiff is unable to get filesystem notifications for automatic rebuilds.

  • Install Python and add it to %PATH%.
  • Download ninja and add it to %PATH%.
    • Quick install via pip: pip install ninja

macOS:

  • Install ninja:
    brew install ninja
    
  • Install wine-crossover:
    brew install --cask --no-quarantine gcenx/wine/wine-crossover
    

After OS upgrades, if macOS complains about Wine Crossover.app being unverified, you can unquarantine it using:

sudo xattr -rd com.apple.quarantine '/Applications/Wine Crossover.app'

Linux:

  • Install ninja.
  • For non-x86(_64) platforms: Install wine from your package manager.
    • For x86(_64), WiBo, a minimal 32-bit Windows binary wrapper, will be automatically downloaded and used.

Building

  • Clone the repository:
    git clone https://github.com/doldecomp/melee.git --depth=1
    
  • Using Dolphin Emulator, find your ISO and click Properties. Go to the Filesystem tab, right-click Disc - GALE01 and select Extract System Data. Choose orig/GALE01 of this repository.
    • To save space, only main.dol (and .gitkeep) are necessary. Other files can be deleted.
  • Configure:
    python configure.py
    
  • Build:
    ninja
    

Tooling

We use Python for our command line tooling. It is recommended that you use a virtual environment.

  1. Create a virtual environment.
    python -m venv --upgrade-deps '.venv'
    
  2. You'll need to activate it whenever you open a new shell.
    • Windows:
      .venv/Scripts/Activate.ps1
      
    • Linux/macOS:
      . .venv/bin/activate
      
  3. After that, you can install or update our packages with:
    pip install -r reqs/decomp.txt
    
  4. Now you can run decomp.py to decomp a function using m2c. Pass it -h to see all the options.
    python tools/decomp.py my_function_name
    

Modding

Coming soon.

Containers

Coming soon.

Building with Make (legacy)

See Building with Make.

Diffing

Once the initial build succeeds, an objdiff.json should exist in the project root.

Download the latest release from encounter/objdiff. Under project settings, set Project directory. The configuration should be loaded automatically.

Select an object from the left sidebar to begin diffing. Changes to the project will rebuild automatically: changes to source files, headers, configure.py, splits.txt or symbols.txt.

Tip

It's recommended that you enable the Relax relocation diffs option under Diff Options.

Contributing

Contributions are welcome! If you're new to decomp, check out our Getting Started guide. Before opening a pull request, please read our contributing guidelines. If you're new to Git and don't know how to create a pull request, we encourage you to create an issue with your decomp.me link and a maintainer will add your code to the repository.

We're also happy to answer any questions in the #melee channel on Discord.

Gamecube/Wii Decompilation Discord

FAQ

How is the codebase structured?

The code in src is divided into several modules, the main one being melee, which is the game code.

melee

The main game code is divided into several two-letter folders, which were left behind by HAL in assert messages and game data on the original disc.

Short Full Notes
cm Camera
db Debug
ef Effect Visual effects.
ft Fighter The player characters.
gm Game The main game loop.
gr Ground Stages and other levels.
if Interface User interface.
it Items
lb Library Utility functions that are often thin wrappers around dolphin or baselib code.
mn Menu
mp Map Related to stages and contains things like mpcoll (map collisions).
pl Player As in users.
sc Scene Menu, versus mode, single-player, etc. The game mode.
ty Toy Trophies.
un Unknown This isn't an actual folder in the original code.
vi Visual Cutscenes, etc.

melee/ft/chara

HAL also used two-letter abbreviations for each fighter.

Short Full Canonical English
Bo Zako1 Boy Male wire frame
Ca Captain Captain Falcon
Ch Crazy Hand
Cl Child Link Young Link
Co Common Shared code
Dk Donkey Kong
Dr Dr. Mario
Fc Falco
Fe Fire Emblem Roy
Fx Fox
Gk Giga Koopa Giga Bowser
Gl Zako Girl Female wire frame
Gn Ganondorf
Gw Mr. Game & Watch
Kb Kirby
Kp Koopa Bowser
Lg Luigi
Lk Link
Mh Master Hand
Mr Mario
Ms Mars Marth
Mt Mewtwo
Nn Nana
Ns Ness
Pc Pichu
Pe Peach
Pk Pikachu
Pp Popo
Pr Purin Jigglypuff
Sb Sandbag
Sk Seak Sheik
Ss Samus
Ys Yoshi
Zd Zelda

1 Zako (雑魚) is Japanese for "trash mob" in video games, literally "small fish."

sysdolphin/baselib

HAL's core internal library.

Class Full
AObj Animation
CObj Camera
DObj Draw/Display
FObj Frame
GObj Global/Game
JObj Joint
LObj Light
MObj Material
PObj Polygon
TObj Texture
RObj Reference
SObj Scene
WObj World

dolphin

The Dolphin SDK.

MetroTRK

The Metrowerks Target Resident Kernel.

MSL

The Metrowerks Standard Library.

Runtime

The Gekko hardware runtime.

What can be done after decompiling Melee?

Note that this project's purpose is to only match the ASM with C code. This is entirely for research and archival purposes. After this is created, you essentially have a C project that can be compiled into Melee, but it won't be portable (aka you can't compile it to run on a normal computer).

So creating mods would be a lot easier as C code is much easier to consume than ASM. However, there are additional projects that could be undertaken once this is complete, but those technical endeavours are out-of-scope for this repo.

Do we know how the compiler works?

  • Kind of. We dont have its source though.

How do we get the compiler to pick a certain register allocation?

Considering we don't have the source for the compiler, this is kind of "anything goes" territory. Unfortunately register allocation is an NP-hard problem which means there are all types of heuristics you can use to select registers, some of which can be confused by things as silly as variable names.

One option is to attempt to automatically permute the source code to get the correct register allocation.