summaryrefslogtreecommitdiff
path: root/tools/nitrogfx/util.c
diff options
context:
space:
mode:
authorred031000 <rubenru09@aol.com>2020-06-06 23:58:19 +0100
committerred031000 <rubenru09@aol.com>2020-06-06 23:58:19 +0100
commitcc5a1e59920fe0ed975af40aa49b7870832323af (patch)
treea6b34a36e80aec07ab65fb488c396828a704dc6d /tools/nitrogfx/util.c
parent760a22318663896b2ebd76d8d3213dcc9e9bcfe5 (diff)
palette conversion
Diffstat (limited to 'tools/nitrogfx/util.c')
-rw-r--r--tools/nitrogfx/util.c30
1 files changed, 30 insertions, 0 deletions
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 <stdlib.h>
#include <string.h>
#include <stdbool.h>
+#include <stdint.h>
#include <errno.h>
#include <limits.h>
#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