Document pdex.bin
file format and improve conversion script
#24
+419
−61
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 documented the
pdex.bin
file format. It is essentially a stripped-down ELF file consisting of metadata, a program segment and relocation entries.I also rewrote
pdex2elf.py
, which did not actually work with modernpdex.bin
files. I'm late to the Playdate game but I suspect (much) older versions of the SDK produced executable files in a much different format from what is in use currently.The new
pdex2elf.py
script creates well-formed ELF file that can be analyzed by readelf or objdump and decompiled by Ghidra, and it can even be compiled back bypdc
into a bit-for-bit idential copy of the originalpdex.bin
. I tested it with both some of my own WIP games as well as some non-encrypted games from the catalog and they round-tripped perfectly.It is a PowerShell script which I expect to be a bit controversial 😛 but PS is the only shell scripting-like language I'm proficient in so take it for what it is. If you would like to port the functionality to Python or whatever you have my blessing.Update: I've now ported it to Python.