diff options
author | Cleverking2003 <30466983+Cleverking2003@users.noreply.github.com> | 2020-07-12 08:50:43 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-12 08:50:43 +0300 |
commit | 19823b0d54000c5eade4039cf27d3e70e740f012 (patch) | |
tree | d7b1264b2bc90ef7bbcd7aef1a103a47b14db1e5 /tools/nitrogfx/util.c | |
parent | b92b498be29cb7db1e30a9eac8113388e0a95369 (diff) | |
parent | f76e211631b6b86ce7000c16acc5368d78b14f42 (diff) |
Merge pull request #229 from red031000/master
bit of work on graphics, mostly setup
Diffstat (limited to 'tools/nitrogfx/util.c')
-rw-r--r-- | tools/nitrogfx/util.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/tools/nitrogfx/util.c b/tools/nitrogfx/util.c index 73a128a1..7dc4ca89 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, uint16_t sectionCount) { 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) { @@ -144,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); } |