Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I'm putting this up as a draft so those interested can try it out and bugs in the setup can be fixed. This is Ghidra project generation for the Saturn port. This automatically defines functions and data types without having to do it manually. This could be extended for PSX but I'm not sure there's any reason to do so.
Usage:
A project will be generated in tools/ghidra/out/sotn.gpr. Press Analyze in the GUI to disassemble the functions.
The way this works is:
tools/ghidra/symbols
uses a C parser to collect function definitions from the C files, and addresses from the map files, and emitstools/ghidra/out/symbols.json
tools/ghidra/create-project.py
runs several other Ghidra scripts:The python scripts are based on stuff from the rec2 project.
Right now this is hardcoded to load 0.BIN, GAME.PRG, T_BAT.PRG and STAGE_02.PRG to their respective locations. It could be extended in the future to load differently. Right now I don't parse data so that doesn't get automatically defined yet.
This doesn't work well in WSL since Ghidra locks a project to the user that created it or something like that, so you can't generate in WSL then open in Windows. Also if you open the project in WSL some of the GUI windows are blank.
I'm probably going to make this a submodule in the final PR.