riidefi / mkw

Decompilation of Mario Kart Wii
306 stars 32 forks source link

Clean up disassembler #95

Open riptl opened 3 years ago

riptl commented 3 years ago

The current disassembler routine is a hack. It starts by invoking Capstone, which doesn't support the complete Gekko instruction set. Capstone is going to abort on undefined instructions. We fall back to custom disassembler extensions for the rest.

Ideally, we'd want to use only one disassembler. Options:

  1. Add paired-singles support to Capstone
  2. Drop Capstone and build a custom pure-Python disassembler
riptl commented 3 years ago

I did some research into Capstone / LLVM. Capstone uses LLVM's TableGen sources to auto-generate .inc C sources. The tooling is here: https://github.com/aquynh/capstone/tree/next/suite/synctools Upstream LLVM is missing paired-single support, but I found a fork that has it:

I couldn't get code-generation to work regardless using llvm-tblgen-12. I've reached out to DarkKirb to see if they are available to help out. I'll leave this until then.

cc @riidefi any ideas? Could you take a look?