Need help dumping all of Battle Garegga assets

Started by mrkotfw, December 09, 2017, 01:00:48 AM

Previous topic - Next topic

mrkotfw

Hello all, I'm trying to see if I can dump all the assets from Battle Garegga.

I see in https://github.com/mamedev/mame/blob/master/src/mame/drivers/toaplan2.cpp:


ROM_LOAD( "rom4.bin",  0x000000, 0x200000, CRC(b333d81f) SHA1(5481465f1304334fd55798be2f44324c57c2dbcb) )
ROM_LOAD( "rom3.bin",  0x200000, 0x200000, CRC(51b9ebfb) SHA1(30e0c326f5175aa436df8dba08f6f4e08130b92f) )
ROM_LOAD( "rom2.bin",  0x400000, 0x200000, CRC(b330e5e2) SHA1(5d48e9d56f99d093b6390e0af1609fd796df2d35) )
ROM_LOAD( "rom1.bin",  0x600000, 0x200000, CRC(7eafdd70) SHA1(7c8da8e86c3f9491719b1d7d5d285568d7614f38) )


So I did:

(cat rom4.bin rom3.bin rom2.bin rom1.bin) > graphics.bin


I then wrote a small Python script to word swap from big to little endian:

I've extracted the palette via MAME: save palette.bin,0x4000000,0x1000

And wrote a script:


# Load palette
# https://stackoverflow.com/questions/2442576/how-does-one-convert-16-bit-rgb565-to-24-bit-rgb888
rgb555_palette = []
rgb888_palette = []
with open("palette.bin", "rb") as fp:
    fp.seek(0, 2)
    size = fp.tell()
    fp.seek(0, 0)
    while fp.tell() < size:
        raw = struct.unpack("H", fp.read(2))[0]

        rgb555 = (((raw & 0xFF) << 8) | (raw >> 8))
        rgb555_palette.append(rgb555)

        r5 = rgb555 & 0x1F
        g5 = (rgb555 >> 5) & 0x1F
        b5 = (rgb555 >> 10) & 0x1F

        r8 = (r5 * 527 + 23) >> 6;
        g8 = (g5 * 527 + 23) >> 6;
        b8 = (b5 * 527 + 23) >> 6;

        # rgb888 = ((b8 << 16) | (g8 << 8) | r8)
        rgb888 = (r8, g8, b8)
        rgb888_palette.append(rgb888)