EDIT/UPDATE:
Am I right in assuming NCGR data must be read in blocks of at least 128 bytes per cell, so any cell of size 0 will have unused NCGR data up to 128 bytes (so an 8x8 cell would have 96 unused bytes, an 8x16 cell would have 64 unused bytes)?
When I organized tile dumps by hand, it was obvious that certain "blank" tiles were discarded. However, I don't understand how those tiles are marked in NCER data. Now while I'm aware Tinke can display and export the sprites just fine, for coding practice and just out of curiosity, I'm trying to write a batch sprite compiler - like, a program that will read through a directory of dumped data and create the files all at once. I thought I finally got a rudimentary code working - I tested on two slightly different sprites with acceptable results - but when I got to an NCGR that had unused tiles, it fell apart.
For example, consider Driscoll's portrait from Front Mission DS. The tile count according to the NCER file is 78 tiles, but the NCGR file has 80 tiles (8px by 8px). In the attached image, you can see a 32x16 section of solid pink tiles. Those aren't used in the image, and from what I can tell in the NCER file they're not even covered up by other tiles - if that was the case, then the NCER data would still have an 80 tile count, not 78. If you're wondering how I came up with the NCER's tile count, I added up all the cell bank sizes (e.g., 4x4 + 2x1 + 4x8).
The unused tiles are in the NCGR file from 0x02F0 to 0x032F.
Driscoll.NCER (cell bank data):
4B 42 45 43 A0 00 00 00 05 00 01 00 18 00 00 00
02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
06 00 1A 08 00 00 00 00 3F 00 4F 00 00 00 00 00
01 00 10 08 24 00 00 00 27 00 2F 00 08 00 20 00
01 00 13 08 2A 00 00 00 27 00 3F 00 08 00 30 00
00 00 00 08 30 00 00 00 00 00 00 00 00 00 00 00
00 00 00 08 30 00 00 00 00 00 00 00 00 00 00 00
28 00 00 40 00 00 08 80 00 80 01 00 40 40 10 80
03 00 48 40 30 00 05 00 28 80 30 80 06 00 00 80
10 C0 08 00 20 40 08 80 10 00 30 40 08 80 12 00
The underlined part is where I expected the blank tiles to be. If I read and programmed right, that should be a 16x8 section. I know the blank tiles don't belong to the next section because the next section fits perfectly into the image. I arranged the tiles by hand even, just to be sure it wasn't a coding error. Both my program and my manual attempt yielded the same result - except manually I could tell the tiles weren't used.
I'm sure there's something I overlooked while trying to read up on NCER formatting, but not sure what I missed, so I'm hoping someone here sees this and can point out my error.
Am I right in assuming NCGR data must be read in blocks of at least 128 bytes per cell, so any cell of size 0 will have unused NCGR data up to 128 bytes (so an 8x8 cell would have 96 unused bytes, an 8x16 cell would have 64 unused bytes)?
When I organized tile dumps by hand, it was obvious that certain "blank" tiles were discarded. However, I don't understand how those tiles are marked in NCER data. Now while I'm aware Tinke can display and export the sprites just fine, for coding practice and just out of curiosity, I'm trying to write a batch sprite compiler - like, a program that will read through a directory of dumped data and create the files all at once. I thought I finally got a rudimentary code working - I tested on two slightly different sprites with acceptable results - but when I got to an NCGR that had unused tiles, it fell apart.
For example, consider Driscoll's portrait from Front Mission DS. The tile count according to the NCER file is 78 tiles, but the NCGR file has 80 tiles (8px by 8px). In the attached image, you can see a 32x16 section of solid pink tiles. Those aren't used in the image, and from what I can tell in the NCER file they're not even covered up by other tiles - if that was the case, then the NCER data would still have an 80 tile count, not 78. If you're wondering how I came up with the NCER's tile count, I added up all the cell bank sizes (e.g., 4x4 + 2x1 + 4x8).
The unused tiles are in the NCGR file from 0x02F0 to 0x032F.
Driscoll.NCER (cell bank data):
4B 42 45 43 A0 00 00 00 05 00 01 00 18 00 00 00
02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
06 00 1A 08 00 00 00 00 3F 00 4F 00 00 00 00 00
01 00 10 08 24 00 00 00 27 00 2F 00 08 00 20 00
01 00 13 08 2A 00 00 00 27 00 3F 00 08 00 30 00
00 00 00 08 30 00 00 00 00 00 00 00 00 00 00 00
00 00 00 08 30 00 00 00 00 00 00 00 00 00 00 00
28 00 00 40 00 00 08 80 00 80 01 00 40 40 10 80
03 00 48 40 30 00 05 00 28 80 30 80 06 00 00 80
10 C0 08 00 20 40 08 80 10 00 30 40 08 80 12 00
The underlined part is where I expected the blank tiles to be. If I read and programmed right, that should be a 16x8 section. I know the blank tiles don't belong to the next section because the next section fits perfectly into the image. I arranged the tiles by hand even, just to be sure it wasn't a coding error. Both my program and my manual attempt yielded the same result - except manually I could tell the tiles weren't used.
I'm sure there's something I overlooked while trying to read up on NCER formatting, but not sure what I missed, so I'm hoping someone here sees this and can point out my error.
Last edited by Theou Aegis,