diff options
-rw-r--r-- | tools/nitrogfx/gfx.c | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/tools/nitrogfx/gfx.c b/tools/nitrogfx/gfx.c index c62a25f8..4e529490 100644 --- a/tools/nitrogfx/gfx.c +++ b/tools/nitrogfx/gfx.c @@ -419,14 +419,11 @@ void WriteNtrImage(char *path, int numTiles, int bitDepth, int metatileWidth, in if (!clobberSize) { - //charHeader[8] = numTiles & 0xFF; - //charHeader[9] = (numTiles >> 8) & 0xFF; - charHeader[8] = (bufferSize / (256 * bitDepth)) & 0xFF; - charHeader[9] = ((bufferSize / (256 * bitDepth)) >> 8) & 0xFF; - - //charHeader[10] = tileSize & 0xFF; - //charHeader[11] = (tileSize >> 8) & 0xFF; - charHeader[10] = 0x20; //todo figure out if this changes + charHeader[8] = tilesHeight & 0xFF; + charHeader[9] = (tilesHeight >> 8) & 0xFF; + + charHeader[10] = tilesWidth & 0xFF; + charHeader[11] = (tilesWidth >> 8) & 0xFF; } else { @@ -451,9 +448,13 @@ void WriteNtrImage(char *path, int numTiles, int bitDepth, int metatileWidth, in if (sopc) { - unsigned char sopcBuffer[0x10] = { 0x53, 0x4F, 0x50, 0x43, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00 }; - sopcBuffer[14] = (bufferSize / (256 * bitDepth)) & 0xFF; - sopcBuffer[15] = ((bufferSize / (256 * bitDepth)) >> 8) & 0xFF; + unsigned char sopcBuffer[0x10] = { 0x53, 0x4F, 0x50, 0x43, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; + + sopcBuffer[12] = tilesWidth & 0xFF; + sopcBuffer[13] = (tilesWidth >> 8) & 0xFF; + + sopcBuffer[14] = tilesHeight & 0xFF; + sopcBuffer[15] = (tilesHeight >> 8) & 0xFF; fwrite(sopcBuffer, 1, 0x10, fp); } |