pret / poketcg

Disassembly of Pokémon TCG
262 stars 91 forks source link

Bgmap #140

Closed ElectroDeoxys closed 12 months ago

ElectroDeoxys commented 1 year ago

Added a tool so that we can convert the CGB tilemaps from tilemap + attributes format to the interleaved format that should be included in the ROM. These intermediate files are distinguished by their .bgmap file extension, and are built from the .bin files that have the tile+attribute pair bytes, for ease of use in tools such as Tilemap Studio. As a consequence, the dimensions of these tilemaps have to be added as files and are not hardcoded inside the .asm code.

dannye commented 1 year ago

The entirety of src/data/maps/permissions/gb/ and src/data/maps/permissions/cgb/ are identical so I say we take this opportunity to create just a single src/data/maps/permissions/ and INCBIN each permissions file twice.

dannye commented 1 year ago

We could also combine all the duplicate/identical *.dimensions files. Not immediately sure of the best folder organization for that though. (Probably just src/data/maps/dimensions/)

dannye commented 1 year ago

All the .lz.match files in src/data/maps/tiles/gb/ are .bin.lz.match but in src/data/maps/tiles/cgb/ they are all .bgmap.lz.match. I assume they are all supposed to be .bgmap.lz.match?

ElectroDeoxys commented 12 months ago

The entirety of src/data/maps/permissions/gb/ and src/data/maps/permissions/cgb/ are identical so I say we take this opportunity to create just a single src/data/maps/permissions/ and INCBIN each permissions file twice.

Yep that makes a lot of sense, and it matches. Actually it's important that they are the same for both systems because then you could run into problems if you saved in one system and tried to run in another where the permission is different, so a way to enforce that is to include it twice.

We could also combine all the duplicate/identical *.dimensions files. Not immediately sure of the best folder organization for that though. (Probably just src/data/maps/dimensions/)

Also makes sense to consolidate, mmmh. I'll play around with the Makefile to see if I can pull that off, instead of deriving the dimensions path through the tool.

All the .lz.match files in src/data/maps/tiles/gb/ are .bin.lz.match but in src/data/maps/tiles/cgb/ they are all .bgmap.lz.match. I assume they are all supposed to be .bgmap.lz.match?

My thought process is that .bgmap is only an intermediary file with the tiles and attributes interleaved, but GB tilemaps don't have attributes, so they can be compressed right away. It wouldn't make sense to have a .bgmap for those cases where attributes don't exist.

dannye commented 12 months ago

My thought process is that .bgmap is only an intermediary file with the tiles and attributes interleaved, but GB tilemaps don't have attributes, so they can be compressed right away. It wouldn't make sense to have a .bgmap for those cases where attributes don't exist.

Ahh. That makes sense. It's a tiny bummer that when I compare the gb/ and cgb/ folders in Beyond Compare, the different extensions means I can't easily cross-check, but that's not the end of the world.