Commit Graph

1 Commits

Author SHA1 Message Date
Luciano Ciccariello
d17df87e1a
Add tool to automatically perform symbols cross referencing (#413)
I wanted to make this tool for a long time. Given the fact HD recently
became more dense into DRA, people who are willing to contribute to that
overlay should not have the burden of manually cross-referencing symbols
as I have been doing for the past weeks. Instead of creating a tutorial
I created a tool that cross-reference symbols between functions. The two
functions can be either between two different revisions of the game or
between two overlays. The latter is especially important to finally
remove all the duplicate functions.

I also took the opportunity to add some unit tests (finally!) in
`tools/tests` instead of creating the dedicated folder `tools/symbols`
with tools and test in it. Let me know if `tools/tests` is a pattern we
want to keep following for any future tool that needs to be tested.

I also added an assembly parser written in Python. As for today it lives
in `tools/symbols.py`. It is barebone but it can parse the majority of
assembly lines. I also added tests around it in case we want to expand
it or extract the parser into its own utility. I've been thinking to
ideally use it for a V2 of `find_duplicates.py` if we find the current
tool to be limiting.

### Demo

```
sotn-decomp$ ./tools/symbols.py cross asm/us/dra/nonmatchings/71830/func_80112BB0.s asm/hd/dra/nonmatchings/71830/func_80112BB0.s
D_80139824 = 0x801393F0;
D_800ACF7C = 0x800AD040;
D_800ACF7E = 0x800AD042;
D_80138FC8 = 0x80138B94;
D_80138FCA = 0x80138B96;
```

these symbols can be automatically copy&pasted into `symbols.hd.dra.txt`
or the relevant symbol list.
2023-07-31 12:14:57 -07:00