From cc5a1e59920fe0ed975af40aa49b7870832323af Mon Sep 17 00:00:00 2001 From: red031000 Date: Sat, 6 Jun 2020 23:58:19 +0100 Subject: palette conversion --- tools/nitrogfx/util.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'tools/nitrogfx/util.c') diff --git a/tools/nitrogfx/util.c b/tools/nitrogfx/util.c index 87abeb31..8fec7d72 100644 --- a/tools/nitrogfx/util.c +++ b/tools/nitrogfx/util.c @@ -4,6 +4,7 @@ #include #include #include +#include #include #include #include "global.h" @@ -122,3 +123,32 @@ void WriteWholeFile(char *path, void *buffer, int bufferSize) fclose(fp); } + +void WriteGenericNtrHeader(FILE* fp, const char* magicNumber, uint32_t size) +{ + //magic number + fputs(magicNumber, fp); + + //byte order + fputc(0xFF, fp); + fputc(0xFE, fp); + + //version + fputc(0x00, fp); + fputc(0x01, fp); + + //size + size += 0x10; //add header size + fputc(size & 0xFF, fp); + fputc((size >> 8) & 0xFF, fp); + fputc((size >> 16) & 0xFF, fp); + fputc((size >> 24) & 0xFF, fp); + + //header size + fputc(0x10, fp); + fputc(0x00, fp); + + //sections + fputc(0x01, fp); + fputc(0x00, fp); +} \ No newline at end of file -- cgit v1.2.3