From 7762fa4d5454be7be0e89b09986f31bbdff79a83 Mon Sep 17 00:00:00 2001 From: red031000 Date: Fri, 10 Jul 2020 17:25:12 +0100 Subject: bit of work on graphics, mostly setup --- tools/nitrogfx/util.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'tools/nitrogfx/util.c') diff --git a/tools/nitrogfx/util.c b/tools/nitrogfx/util.c index 73a128a1..304a2319 100644 --- a/tools/nitrogfx/util.c +++ b/tools/nitrogfx/util.c @@ -124,13 +124,18 @@ void WriteWholeFile(char *path, void *buffer, int bufferSize) fclose(fp); } -void WriteGenericNtrHeader(FILE* fp, const char* magicNumber, uint32_t size, bool byteorder) +void WriteGenericNtrHeader(FILE* fp, const char* magicNumber, uint32_t size, bool byteorder, bool version101) { unsigned char header[0x10] = { 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFE, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x01, 0x00 }; //magic number memcpy(header, magicNumber, 4); + if (version101) + { + header[6] = 0x01; + } + //byte order if (!byteorder) { -- cgit v1.2.3 From d038e60ba5baee009a0b76466cf362ae7747d48f Mon Sep 17 00:00:00 2001 From: red031000 Date: Sat, 11 Jul 2020 16:13:04 +0100 Subject: add sopc support to ncgr --- tools/nitrogfx/util.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'tools/nitrogfx/util.c') diff --git a/tools/nitrogfx/util.c b/tools/nitrogfx/util.c index 304a2319..7dc4ca89 100644 --- a/tools/nitrogfx/util.c +++ b/tools/nitrogfx/util.c @@ -124,7 +124,7 @@ void WriteWholeFile(char *path, void *buffer, int bufferSize) fclose(fp); } -void WriteGenericNtrHeader(FILE* fp, const char* magicNumber, uint32_t size, bool byteorder, bool version101) +void WriteGenericNtrHeader(FILE* fp, const char* magicNumber, uint32_t size, bool byteorder, bool version101, uint16_t sectionCount) { unsigned char header[0x10] = { 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFE, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x01, 0x00 }; @@ -149,5 +149,9 @@ void WriteGenericNtrHeader(FILE* fp, const char* magicNumber, uint32_t size, boo header[10] = (size >> 16) & 0xFF; header[11] = (size >> 24) & 0xFF; + //section count + header[14] = sectionCount & 0xFF; + header[15] = (sectionCount >> 8) & 0xFF; + fwrite(header, 1, 0x10, fp); } -- cgit v1.2.3