summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorred031000 <rubenru09@aol.com>2020-07-12 16:20:07 +0100
committerred031000 <rubenru09@aol.com>2020-07-12 16:20:31 +0100
commit5f114f5c8413da73f21c9adbfd0165921314e275 (patch)
tree70a79ace9af7370187b10533195a7f908cddaf43
parent19823b0d54000c5eade4039cf27d3e70e740f012 (diff)
nitrogfx: fix size calculation
-rw-r--r--tools/nitrogfx/gfx.c23
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);
}