patters-match / gba-emu-compilation-builders

Python 3 scripts to build emulator + ROM compilations for various emulators for Gameboy Advance. Cross-platform replacements for the original 32bit Windows-only tools.
8 stars 2 forks source link

Autoscroll scale value from SuperDAT does not match header output from OG build tool #1

Closed patters-match closed 2 years ago

patters-match commented 2 years ago

All other SuperDAT values are preserved in the emulator's ROM header, but the scale value is transformed by SNESAdvance.exe. This is not described in technotes.txt. For instance:

Game SuperDAT hex SuperDAT dec output hex output dec scaling factor
Super Mario World 0x0A 10 0x19 25 x 2.50
Chrono Trigger 0x05 5 0x0C 12 x 2.40
Gradius III 0x32 50 0x80 128 x 2.56
Castlevania - Dracula X 0x1E 30 0x4C 76 x 2.53
Secret of Mana 0x64 100 0x100 256 x 2.56
Super Metroid 0x32 50 0x80 128 x 2.56

My script follows the spec and writes the value from the SuperDAT, but I can see that the behaviour of the official builder gives more optimal display results. These bytes are the only divergence between my script and the original Win32 builder.

patters-match commented 2 years ago

Ok. As the numbers grow larger the scaling factor trends towards 2.56 which resembles a power of 2, not 2.5. The easiest way to get x2.56 without floating point numbers is to multiply by 256 (0x100) and then divide by 100 (0x64). This yields precisely the observed results.

scale = int((scale * 0x100) / 0x64)