A decompilation of Super Smash Bros Melee brought to you by a bunch of clever folks.
Go to file
2024-01-29 05:55:55 +00:00
.cargo Rewrite and improve issues.sh (#756) 2023-03-19 10:26:42 -04:00
.github Remove dadosod subtree (#1127) 2024-01-26 10:52:07 +00:00
.idea Migrate gx to C (#554) 2022-09-12 20:21:27 -04:00
.vscode Cleanup OS layout based on other projects, match some functions (#1055) 2024-01-12 20:18:19 +00:00
asm Re-link if (#1150) 2024-01-29 05:55:55 +00:00
config/GALE01 Re-link if (#1150) 2024-01-29 05:55:55 +00:00
docs Partially match ftCo_CaptureWaitKirby (#985) 2023-10-10 05:17:57 +00:00
orig/GALE01/sys Add most symbols from GALE01.map to GALE01/symbols.txt (#1075) 2024-01-18 00:10:26 +00:00
src Re-link if (#1150) 2024-01-29 05:55:55 +00:00
tools Re-link if (#1150) 2024-01-29 05:55:55 +00:00
.clang-format Match ftCo_HammerKneeBend (332 bytes) (#1031) 2023-11-21 15:45:57 +00: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 Partially match all of ftLk_SpecialN (#842) 2023-05-12 12:10:44 +00:00
.gitattributes Create initial decomp-toolkit skeleton 2024-01-16 22:35:33 -05:00
.gitignore Re-link ftPeach (#1143) 2024-01-28 12:12:27 +00:00
.rustfmt.toml Use .L_ prefix for unnamed local labels (#771) 2023-04-13 12:47:58 -04:00
Cargo.lock Update dolphin/thp symbols (#1135) 2024-01-27 14:13:51 +00:00
Cargo.toml Remove deprecated rust tools (#1128) 2024-01-26 10:57:36 +00:00
compile_flags.txt Remove remaining usages of WIP (#1136) 2024-01-27 17:48:11 +00:00
configure.py Re-link if (#1150) 2024-01-29 05:55:55 +00: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 Run IWYU and deprecate WIP (#1109) 2024-01-25 12:14:17 +00:00
obj_files.mk Re-link if (#1150) 2024-01-29 05:55:55 +00:00
requirements.in Manage m2c and asm-differ via pip (#1142) 2024-01-28 06:04:40 -05:00
requirements.txt Manage m2c and asm-differ via pip (#1142) 2024-01-28 06:04:40 -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

GC/Wii Decompilation build-melee publish-packages publish-pages

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

Note

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 the following DOL:

v1.02 - main.dol: sha1: 08e0bf20134dfcb260699671004527b2d6bb1a45

Building

Windows

The easiest way to get set up is with scoop. You will also need our compilers (linked below).

  1. Open a PowerShell window (Win+X). You do not need admin privileges.
  2. Install scoop, git, python, mingw, and cmake. You can skip these if you already have git, python (3.9+), bash, gcc, make, and cmake in your PATH.
    Set-ExecutionPolicy RemoteSigned -Scope CurrentUser # Optional: Needed to run a remote script the first time
    irm get.scoop.sh | iex
    scoop install git python mingw cmake
    
  3. Clone the repository and change directory into it.
    cd ~/Documents # Or wherever you want to put Melee
    git clone 'https://github.com/doldecomp/melee.git'
    cd melee
    
  4. Download our compilers zip archive and rename the GC subfolder to mwcc_compiler, and place it in /tools. You can do this manually, or use the following PowerShell snippet (from inside your melee directory):
    & scoop install megatools
    $url = 'https://mega.nz/file/BU43wKxT#rVC11Rl7DPxfSn7V9Iu--8E7m7gc1gsJWtfVBbfmKwQ'
    $zip = [System.IO.Path]::GetTempFileName() -replace '\.[^.]+$','.zip'
    & megatools dl --no-progress --path "$zip" "$url"
    
    $dir = New-Item -ItemType Directory `
        -Path (Join-Path $env:Temp 'MELEE_COMPILERS')
    
    Expand-Archive -Path $zip -DestinationPath $dir
    
    $path = Get-ChildItem -Path $dir.FullName | `
            Select-Object -ExpandProperty FullName
    Copy-Item -Path $path -Destination "tools/mwcc_compiler" -Recurse
    
    Remove-Item -Force $zip
    Remove-Item -Recurse -Force $dir
    
    # Optional: Uninstall megatools
    & scoop uninstall megatools
    
  5. Run make using bash to build the project:
    bash -c 'make -j"$NUMBER_OF_PROCESSORS" GENERATE_MAP=1'
    
  6. Optional: Install a Python virtual environment. If you want to use the Python tooling we have in /tools, you can create a venv. This tooling is not required to build the project, but you'll need it if you want to use asm-differ, m2ctx, etc.
    python -m venv --upgrade-deps 'venv'
    
    • You'll need to activate it whenever you open a new shell.
      venv/Scripts/Activate.ps1
      
    • After that, you can install or update our packages with:
      pip install -r 'requirements.txt' --use-pep517
      
    • Now you can run m2ctx to get a context to use with decomp.me. The following command will add it to your clipboard automatically; you can run with --help to see all the options:
      python tools/m2ctx/m2ctx.py -px
      
  7. Check out our Getting Started guide!

Linux

Requirements

  • devkitPro
  • python3 (pacman -S python3)
  • gcc (pacman -S gcc)

Instructions

  1. Download MELEE_COMPILERS.zip and extract the GC compilers to tools/mwcc_compiler/.
  2. Run the make command:
    make -j$(nproc) GENERATE_MAP=1
    

You can refer to our Dockerfile to see how our CI builds on Ubuntu.

Containers

We offer containerized Linux and Windows build environments, which you can run through podman or docker on any supported platform, including macOS.

melee_path="$PWD"
make_flags='GENERATE_MAP=1'
build_target="$melee_path/build"

docker run --rm \
  --user "$(id -u):$(id -g)" \
  --volume "$melee_path:/input:ro" \
  --volume "$build_target:/output" \
  --env MAKE_FLAGS="$make_flags" \
  ghcr.io/doldecomp/melee/build-linux:latest

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

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.