xan1242 / YGOFM-BGEx

Yu-Gi-Oh! Forbidden Memories Background Image Extractor
MIT License
3 stars 0 forks source link
extractor image konami mod mod-tool picture playstation ps1 psx sony texture yu-gi-oh yugioh

Yu-Gi-Oh! Forbidden Memories Background Image Extractor

This is a utility designed to extract background images out of the game in DDS format.

Currently it only supports version SLUS-01411.

Currently it can only extract the basic background images found during the campaign mode.

TODO list

How to use

How does it work

LBA calculation

The magic can be found within the calclba function.

The game stores its data in LBAs, meaning each data block is aligned to 0x800 bytes.

Backgrounds in WA_MRG.MRG start at LBA 0x21D5 for the US version of the game and may vary across regions.

These LBAs are hardcoded during compile time in the game executable, so it will differ per each region/variant of the game.

The function responsible for calculating LBAs for these background images can be found at offset 0x8002DF2C of the game executable.

Keep in mind that due to the odd way of calculating LBAs there are repeated images despite having different indicies.

Image conversion

Most of these images are stored in 256 color paletized format, with some being 16 colors.

PS1 palette is in RGB555 format, with the 15th bit being the "special transparency bit".

The tool converts them to a raw DDS ARGB image without any data loss.