-
Notifications
You must be signed in to change notification settings - Fork 81
How to extract graphics
Graphics are stored in the ROM under the 2bpp binary format. It encodes images in 4 nuances of grey (a palette is then applied at runtime to color them). This repository contains a tool to convert from and to the 2bpp file format.
- First let’s find a bank that contains graphic data (for instance using this bank map, or by picking a bank randomly).
- Attempt to convert the whole binary bank to PNG, and see if we recognize sprites in the resulting picture. For this you can use the
gfx.py
tool provided in this repository.
-
Take a binary bank you want to look at from bin/banks (dumped from the original rom). For instance the bank 2F.
-
Copy it somewhere, and rename it with a
.2bpp
file extention -
Run
gfx.py
to convert it to png:tools/gfx.py png bank_2F_BC000.bin.2bpp
-
Look at the resulting
bank_2F_BC000.bin.png
.If you recognize pictures and sprites in the resulting png picture, congratulation, you found a gfx data bank! On the opposite, if it all looks garbled, this is probably a code bank, or a bank that contains other data (like dungeon maps, or ennemies stats).
- Move the png file into the
src/gfx
directory. - Edit the
main.asm
file, and edit the reference of the binary bank to point to bank compiled from the graphics instead.
section "bank47",romx,bank[$2F]
- incbin "../bin/banks/bank_2F_B8000.bin
+ incbin "gfx/bank_2F.2bpp"
At compile-time, the file src/gfx/bank_2F.png
will be compiled back to a 2bpp file, and included into the ROM.
Once this is done, you can even start splitting this large PNG file into some smaller fragments, sprite-per-sprite (have a look at src/gfx
to see some already extracted sprites).