summaryrefslogtreecommitdiff
path: root/tools/nitrogfx/gfx.c
diff options
context:
space:
mode:
authorThomas <doodrabbit@hotmail.com>2021-12-17 20:57:03 -0500
committerGitHub <noreply@github.com>2021-12-17 20:57:03 -0500
commitaf67eaffa7ab1a347a6f0e59ed7f1e107749d15a (patch)
treeb9f90f7b047b3dc5a411dbf65117bf07b237a37d /tools/nitrogfx/gfx.c
parent3ab18655ca1311019212b3a2a9dbe32e5fbee55d (diff)
parent44cd7753b5dde323d1e8274b2dc8a5599729e83f (diff)
Merge pull request #463 from PikalaxALT/pikalax_workHEADmaster
Real-match math_util.c
Diffstat (limited to 'tools/nitrogfx/gfx.c')
-rw-r--r--tools/nitrogfx/gfx.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/tools/nitrogfx/gfx.c b/tools/nitrogfx/gfx.c
index ee7e0d6f..43e8f83c 100644
--- a/tools/nitrogfx/gfx.c
+++ b/tools/nitrogfx/gfx.c
@@ -433,7 +433,9 @@ void WriteImage(char *path, int numTiles, int bitDepth, int metatileWidth, int m
free(buffer);
}
-void WriteNtrImage(char *path, int numTiles, int bitDepth, int metatileWidth, int metatileHeight, struct Image *image, bool invertColors, bool clobberSize, bool byteOrder, bool version101, bool sopc, bool scanned, uint32_t key)
+void WriteNtrImage(char *path, int numTiles, int bitDepth, int metatileWidth, int metatileHeight, struct Image *image,
+ bool invertColors, bool clobberSize, bool byteOrder, bool version101, bool sopc, bool scanned,
+ uint32_t key, bool wrongSize)
{
FILE *fp = fopen(path, "wb");
@@ -499,15 +501,15 @@ void WriteNtrImage(char *path, int numTiles, int bitDepth, int metatileWidth, in
}
}
- WriteGenericNtrHeader(fp, "RGCN", bufferSize + (sopc ? 0x30 : 0x20), byteOrder, version101, sopc ? 2 : 1);
+ WriteGenericNtrHeader(fp, "RGCN", bufferSize + (sopc ? 0x30 : 0x20) + (wrongSize ? -8 : 0), byteOrder, version101, sopc ? 2 : 1);
unsigned char charHeader[0x20] = { 0x52, 0x41, 0x48, 0x43, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00 };
- charHeader[4] = (bufferSize + 0x20) & 0xFF;
- charHeader[5] = ((bufferSize + 0x20) >> 8) & 0xFF;
- charHeader[6] = ((bufferSize + 0x20) >> 16) & 0xFF;
- charHeader[7] = ((bufferSize + 0x20) >> 24) & 0xFF;
+ charHeader[4] = (bufferSize + 0x20 + (wrongSize ? -8 : 0)) & 0xFF;
+ charHeader[5] = ((bufferSize + 0x20 + (wrongSize ? -8 : 0)) >> 8) & 0xFF;
+ charHeader[6] = ((bufferSize + 0x20 + (wrongSize ? -8 : 0)) >> 16) & 0xFF;
+ charHeader[7] = ((bufferSize + 0x20 + (wrongSize ? -8 : 0)) >> 24) & 0xFF;
if (!clobberSize)
{