summaryrefslogtreecommitdiff
path: root/tools/nitrogfx/gfx.c
diff options
context:
space:
mode:
authorred031000 <rubenru09@aol.com>2020-07-11 21:50:56 +0100
committerred031000 <rubenru09@aol.com>2020-07-11 21:50:56 +0100
commitf76e211631b6b86ce7000c16acc5368d78b14f42 (patch)
treea3e8a0b527d8798518249964df372f47da5560a8 /tools/nitrogfx/gfx.c
parentd038e60ba5baee009a0b76466cf362ae7747d48f (diff)
bit of title work, maths is still wrong
Diffstat (limited to 'tools/nitrogfx/gfx.c')
-rw-r--r--tools/nitrogfx/gfx.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/tools/nitrogfx/gfx.c b/tools/nitrogfx/gfx.c
index 7bbc7ddf..c62a25f8 100644
--- a/tools/nitrogfx/gfx.c
+++ b/tools/nitrogfx/gfx.c
@@ -419,11 +419,14 @@ void WriteNtrImage(char *path, int numTiles, int bitDepth, int metatileWidth, in
if (!clobberSize)
{
- charHeader[8] = numTiles & 0xFF;
- charHeader[9] = (numTiles >> 8) & 0xFF;
-
- charHeader[10] = tileSize & 0xFF;
- charHeader[11] = (tileSize >> 8) & 0xFF;
+ //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
}
else
{
@@ -449,8 +452,8 @@ 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] = numTiles & 0xFF;
- sopcBuffer[15] = (numTiles >> 8) & 0xFF;
+ sopcBuffer[14] = (bufferSize / (256 * bitDepth)) & 0xFF;
+ sopcBuffer[15] = ((bufferSize / (256 * bitDepth)) >> 8) & 0xFF;
fwrite(sopcBuffer, 1, 0x10, fp);
}