From 7762fa4d5454be7be0e89b09986f31bbdff79a83 Mon Sep 17 00:00:00 2001 From: red031000 Date: Fri, 10 Jul 2020 17:25:12 +0100 Subject: [PATCH] bit of work on graphics, mostly setup --- Makefile | 17 +++++++++++++++++ files/data/.gitignore | 2 ++ files/data/cell0.NCGR | Bin 8240 -> 0 bytes files/data/cell0.NCLR | Bin 552 -> 0 bytes files/data/cell0.png | Bin 0 -> 572 bytes files/graphic/bag_gra/.gitignore | 6 ++++++ files/graphic/bag_gra/narc_0002.NCGR | Bin 16432 -> 0 bytes files/graphic/bag_gra/narc_0002.png | Bin 0 -> 2024 bytes files/graphic/bag_gra/narc_0003.NCLR | Bin 552 -> 0 bytes files/graphic/bag_gra/narc_0003.pal | 19 +++++++++++++++++++ files/graphic/bag_gra/narc_0006.NCGR | Bin 304 -> 0 bytes files/graphic/bag_gra/narc_0006.png | Bin 0 -> 188 bytes files/graphic/bag_gra/narc_0034.NCGR | Bin 16432 -> 0 bytes files/graphic/bag_gra/narc_0034.png | Bin 0 -> 2048 bytes files/graphic/bag_gra/narc_0035.NCLR | Bin 552 -> 0 bytes filesystem.mk | 7 +++++++ graphics_rules.mk | 17 +++++++++++++++++ tools/nitrogfx/gfx.c | 6 +++--- tools/nitrogfx/gfx.h | 2 +- tools/nitrogfx/main.c | 7 ++++++- tools/nitrogfx/options.h | 1 + tools/nitrogfx/util.c | 7 ++++++- tools/nitrogfx/util.h | 2 +- 23 files changed, 86 insertions(+), 7 deletions(-) create mode 100644 files/data/.gitignore delete mode 100644 files/data/cell0.NCGR delete mode 100644 files/data/cell0.NCLR create mode 100644 files/data/cell0.png create mode 100644 files/graphic/bag_gra/.gitignore delete mode 100644 files/graphic/bag_gra/narc_0002.NCGR create mode 100644 files/graphic/bag_gra/narc_0002.png delete mode 100644 files/graphic/bag_gra/narc_0003.NCLR create mode 100644 files/graphic/bag_gra/narc_0003.pal delete mode 100644 files/graphic/bag_gra/narc_0006.NCGR create mode 100644 files/graphic/bag_gra/narc_0006.png delete mode 100644 files/graphic/bag_gra/narc_0034.NCGR create mode 100644 files/graphic/bag_gra/narc_0034.png delete mode 100644 files/graphic/bag_gra/narc_0035.NCLR create mode 100644 graphics_rules.mk diff --git a/Makefile b/Makefile index 9b8b430e4..2e7fe1a7e 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,7 @@ # Makefile to build Pokemon Diamond image include config.mk +include graphics_rules.mk HOSTCC = $(CC) HOSTCXX = $(CXX) @@ -156,6 +157,7 @@ clean: mostlyclean clean-fs clean-fs: $(RM) $(filter %.narc %.arc,$(HOSTFS_FILES)) + $(RM) $(NCGR_CLEAN_LIST) $(NCLR_CLEAN_LIST) find . \( -iname '*.1bpp' -o -iname '*.4bpp' -o -iname '*.8bpp' -o -iname '*.gbapal' -o -iname '*.lz' \) -exec $(RM) {} + mostlyclean: tidy @@ -240,6 +242,21 @@ PADDED_LZ_FILES := $(addsuffix .lz,$(wildcard \ $(PADDED_LZ_FILES): %.lz: % $(NTRCOMP) -l2 -s -A4 -o $@ $< +%.NCGR: %.png + $(GFX) $< $@ + +$(CLOBBER_SIZE_NCGR_FILES): %.NCGR: %.png + $(GFX) $< $@ -clobbersize + +$(CLOBBER_SIZE_VERSION101_NCGR_FILES): %.NCGR: %.png + $(GFX) $< $@ -clobbersize -version101 + +%.NCLR: %.png + $(GFX) $< $@ + +%.NCLR: %.pal + $(GFX) $< $@ + %.png: ; %.pal: ; diff --git a/files/data/.gitignore b/files/data/.gitignore new file mode 100644 index 000000000..e405595ae --- /dev/null +++ b/files/data/.gitignore @@ -0,0 +1,2 @@ +cell0.NCGR +cell0.NCLR diff --git a/files/data/cell0.NCGR b/files/data/cell0.NCGR deleted file mode 100644 index 76a112b3a8db704f9844596b2e1eaa2b0f03631e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 8240 zcmdUzTW;Gh5Jl<70^+}Z3SNN$Z$L!^v|s(m{@2pd<;d-Jsc)L z-hRFQdH)-Bmm!3gunTWLf4>guzsnARxn!FA;r&(Gms5B-oo=^2Ro2E84CR70&X`S4 zryc8dOYxQFK&PXnODCJQHrX=qPJOf*50QX&;$mz_;R`I#>28;yYuv1%pCU0vv~Y5d zbmmaJTkbdeW`)m*QxopInc7ROxu0>(+ibQ|>y7%I2i0L(z20dnyC<7B!6SQqlR&R` zTB*a;eas{<{vM}_co#D-`~D;S9r^4?bH3Z8^D%+nTxEabjLYIiB_E-KUu9(+4XtTT z+El}B;OWQ1ISl9XZJOuG+PH$DT+qfDv+4P~XWf1&zS7*lu|c9Z-L$pImWg-jqt$qb z1hf+uV?zqWKWT&3yW3?9owTfR4BCYzGNOf(d!)n9z!8WaCILu35>tTsUqIR%*($2NPkB@2hyDHHtBp!;5S#<-#Fv4xKYVR=-^jb z8An5Fnv*uwa2t5~@i>KXnr_paDr@5khH^n0XUwM4bY$IeDZbL&$gx49INh|h$(D(C z>Z8?ohy=6~7h^*T#6M}H*1OwfjGeTsaSYmpCNiRhlY6AY&*a=~?Q7)JcTb6vs$3hq zo9wOLICdUdx_Qf5vu@|1n~!%ts&!X4+dcWC0^6V?fycrnjbhi-V}?$N)mL)fhJ8Nz v$M^U!-;vKT9>-lLt)Af8t+6pKizmUsEi$Z^c`UVcP$SJBt!{53|7YSKUCllu diff --git a/files/data/cell0.NCLR b/files/data/cell0.NCLR deleted file mode 100644 index 680c004b0fec8e11c3b10e3115bff19fca55dfd3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 552 zcmWIYarXQFkAYExiGe|Yfsr93#3w)k$Yy4M0W5(fhFNUOZs=d;@;+CmG>*id|HB_+X7LMu(A=Fk)pC;kCd9C}k5+Y82WEQ?Cv`t)XJ z*1Pj&<^A59_vS)8dcOJi*s*usXY6Hmj9vKP!{}S6H&I?<)YdL&d(EpKsjP0XYDKc5 zl2v=g*n8`(KE`Cdk4aTy#)^ZZf2~w;XTlafl2!83BxRsYR>%Poc+p5{@XHxDo zrBroUs8yt@K;)$=N?prqSych{>*Ho~V_C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+*-Gd~#@>%~eYMxjPS8c`Ly5EbLtHWD0{j zD!NQUNrtb3_}?3P1(p5y-Rp;}@83Tg(6c`OKX)_a&o5ZTDTFQG|Nq zNb&uD-~T^&{eMK5a1VpzA_f6|*!n-YhrPc3Pda)q&%u6x=HP#hwQufjk7WJd=YQY-KY(3*|NnrAIk4I1 zf1m#k=6^r_|9_7EOS3Eff39T%?XLfm4M4U4*#ujlggQ59bp{P-cCJasa1&Q|hf3N%haU=y?9jBFV!(ac$BH&{~-oIu>io0eYkOu?)86)3AFS7DE2`ykeGdFXaFA=K6mOnUKc# zlpp{1(I?f~Fd;Z0ZY`Q1&|6hIcu>Ajl zuMqVHk7eMw`uYEU{C}VPKR^DD{C}VSeg6L+@c-Z5|965%emeoO{77(qf(t=)Lihf^ zU$Fm=|Dq%h7W0DtthfmF{Qf`E@jWrb*KT~svHx#m@A^M1il1RmL~t6J7ZJEx5jUS4 z76wA(+>8HDV(;HYAcXyYVeJ14Pd2Q`wHIOk-|GYJmbe4<|NZcpzyI$a-~V@*|4-`~ TFaZzA|M&Ud=YRcQ&Hw)$cd^1_ diff --git a/files/graphic/bag_gra/narc_0002.png b/files/graphic/bag_gra/narc_0002.png new file mode 100644 index 0000000000000000000000000000000000000000..9152a7e1c6dcae6e92f171c326a4504d881668cb GIT binary patch literal 2024 zcmVP)IXSdJK~hpu|NsAUb91DFIqubJ=CoSHq(O^wIdfVu5J~3{00001 zbW%=J06^y0W&i*OW=TXrRCt{2o6Tz*M-;&Krkjn@Ln*X}tOdo#N^*>$GQ%1wr5 z7PH|s!>CvXJ66#!fNn02^1v1V7)JmJ08aZryKbIsHmn0Yj{=Zu$0{9;nguqEbC@Ln zM>sYHSmiwcV4hDHP(M}xpb1={WB{OC6kMS2DAsNq7?uxM#!jia{G#5^0Fx-w9*zuS zkM^+()8I4Ma1NetKw}30^fNe^0p|!aZQ3|Tm?>s(IG||I^BQc9fL3^*zGWX^*GIH} z`gpX{JT3UZ=7WP>I(Cco52M_9eAow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{Nay`dRgQTzrlCRWr06nT>Dhu4@p(iFhi6-JX1BVi*SEPVw?e?{_rfJ`aqaJ zWblhLp?w_X4{J2RC(-^eiwUL#{*cPx^_##S(s%(V@Q1ZDe$@;7VI{*Bi%5U?;+Ob) z(jVmiUob%KU$}k9{R=;Z^oLihy$Sw+^@mGp;xl3W;S#K$H$?S^UvZ7UA*erGLW>v^ z)E}@5O}!dje?UOh#-i&F6i_o)BkK=8Yg8l>g8IYPG{wB2{(#qPi3w5t0fhSEjZJV}`HQF?fW003jO5k3F_ diff --git a/files/graphic/bag_gra/narc_0003.pal b/files/graphic/bag_gra/narc_0003.pal new file mode 100644 index 000000000..45483a1e6 --- /dev/null +++ b/files/graphic/bag_gra/narc_0003.pal @@ -0,0 +1,19 @@ +JASC-PAL +0100 +16 +189 238 205 +238 164 106 +238 115 106 +230 90 90 +197 82 65 +156 57 57 +180 65 65 +82 82 82 +255 255 255 +115 115 115 +164 131 57 +238 213 106 +230 180 90 +197 164 65 +139 115 57 +115 90 49 diff --git a/files/graphic/bag_gra/narc_0006.NCGR b/files/graphic/bag_gra/narc_0006.NCGR deleted file mode 100644 index 3517cd0116f835d9a93f7c4fe333e5f672858fff..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 304 zcma)!K@LDL6hx;ufTg8`0|*XKX%ki!z5iJ-qX-LPlKFo!ef?o{^ST(*7$Ap17$#RT zuT%bWQg+Gd?9SpTLUPY|`Obgid4b;6#!?qo~_itQB H=;Ik1!($HV diff --git a/files/graphic/bag_gra/narc_0006.png b/files/graphic/bag_gra/narc_0006.png new file mode 100644 index 0000000000000000000000000000000000000000..a9982600fa20d3d56ce122b0b5a629efb23d059f GIT binary patch literal 188 zcmeAS@N?(olHy`uVBq!ia0vp^0zj<5!VDx|E`RzTNErn9gt%V4`VPnzDE=?d{huKS zB#a+epM3NMsDiO1$S;_|;n|HeAjitn#W6%;YI4E>Hkkw-af!p6#|qj`T52DVP?O+c zEje27wt)FzSOE712j7%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D1dVB z+CQbsg4O_N4TR+RywCqbp64OWZ##U!nbv+BL=gAnc@{jcK%TFl58QR1D5d-I46gS) zSd-u`AXJL{=Y~6ZEQ3=^ZoxP>HjJ3|MT_V*MAISbUe@koZz4T>zxVo=l@^e z{NKfJR=#m?K2cocobnVCwsFuR`UvO$;=S{K=|4SYaqSrkNB%g*L-9a+#QKkKAK^Rf z{{zS38yd%%iy+Sby$NSLhBc!(od1jA{NE)W3I}*3{D{Z-HlJ~DL)Uxz;c0LDOQ!$M Q{J+2c|6iQ{d&TwtKNrT#IRF3v diff --git a/files/graphic/bag_gra/narc_0034.png b/files/graphic/bag_gra/narc_0034.png new file mode 100644 index 0000000000000000000000000000000000000000..ba296b4c51395d38170f9d32fb7ca99249c6a260 GIT binary patch literal 2048 zcmaJ?eK^y5AO3E`koip}79^s&n zmm+D7Rf=kwB`;}Sszve^R!L%(vF35E=k)LM&*#3c&wbtheD3?YKEHW;xna~dssjKp z?mxTI*3cOMBv3-FF&^WW>uX@`?RkLuVD{N;<+0hsV^e{F0ve@+MB-8?G#YJnbu}?D zv64xeeQ|7x8z`uxWF?Xk1AoH0Ph;1-h*LB#U*J3?iUI(g>h4N8kW})icz^WJLBsab zLtD(=#yL)QNDc%>ozeeT9@#K{c>{jKXO0k!C~&<^Aoit%L|J+vZ77a}_&y zc|b?qvO76$>pJE3OpjuZp(M4ep}r@uG$na?f#}%r_Wm7rp{Yn=i6^fTseSBQ;qHSm z6IL3XKD9ZwxiI6lLMg%u-BrX@VlKm&>U(4;85?zDTv7V)c;f0RA&Z78lA z4$=n2fqa$P}kmzqb+%f5z8{yf7g z|9F`Pmmqw}t;K9V5o7pJhzgJ<-xHi$bXQgZMoD}7FH^~BPW0|eMqOL`5WEFyOc3Dx z8W#7ZE!>v#^DZ$TuZzuY*Bf!GL(7|G%oCsPE&vDmpIo-vE~|Nxz+?-86;M`4z>8N7%A%MlQ7~J)FQ9fH%s{ zen&>3{J3Nni&5NhzBQtd@+xMoI1(p?KIKPVf?m4rsuP!f!f-V*2wGVk=K@FL@ zdm^4W9CBKzFWh`7^hIfYCN4S;q3^JXZt&}_CFXQ67mrFvTv7Lt4N&LR#r-1MwHQxkt+ALEnrx=_KLT;KhB)hdp0 z4Nb+lcXRBiZqI7gLixmU)2EeqUKbp-l_q0yY$|R4@Xk78D_Q=|&ENM9*PrYRT@#+} z+XgQ^9JB~w`N2N*Gy)xY*n5*sVn~}}u6EB1M4N%68Yx5gC&7bw<5@M>Ul3R$AxR`h zYjESx-F`8lWf7PAX#EO*{hwgFxsR@19`lc5L=E?@}~s~4zX*>t+GEc z9MWTpB4I~LHT#!3?z<&5X} zG#T^np(JCz!n?|t?f7x|*zIf)zEXsr(U;yKyG}v4qys>ymNs`iHPdw(cIJA&i}bjNyc=dJ&#A1sS(uWhk937Tp7T#E?gZ3qn1qM0fcPj(zmc5V*c$K z6+8oN<`jAJj`gsY_;q#|We1jwZ`*q~l2P|T^g{T)&RxlO^jB@YXjfeb2Eb}wNx zyYNYo*eR&RMs)!lte-AJUDFtspOpe%J7)r%fU49Umxl>{N+X?6U@;8xTqmLXFT*rc zVsmZ*P1j#j3%=hmxRgxP>NG?HBh@eH0G~Vu&{#O|7h&P0#Hh7B^to0(7P7=w zG{fbBuU6sk(#ZGX#S`GBO$GDWsvY<^%g)EyBuYB@uo$;Wf}1jh?+ScmD9J^itMlkW zN>3{GcQRm9+i1y{YEQLf{4L7mbq?B>$dx`SlNIyqEDL4lwyM{PaF=KWr@mH7H)xZg vz7C^LChSEjZJV}`HQF?fW003jO5k3F_ diff --git a/filesystem.mk b/filesystem.mk index 180845ac4..013d64a92 100644 --- a/filesystem.mk +++ b/filesystem.mk @@ -794,6 +794,13 @@ files/wazaeffect/effectclact/wecellanm.narc: \ files/wazaeffect/effectclact/wecellanm/narc_0013.NANR.lz \ files/wazaeffect/effectclact/wecellanm/narc_0007.NANR.lz +files/graphic/bag_gra.narc: \ + files/graphic/bag_gra/narc_0002.NCGR \ + files/graphic/bag_gra/narc_0003.NCLR \ + files/graphic/bag_gra/narc_0006.NCGR \ + files/graphic/bag_gra/narc_0034.NCGR \ + files/graphic/bag_gra/narc_0034.NCLR + files/graphic/box.narc: \ files/graphic/box/narc_0022.NANR.lz \ files/graphic/box/narc_0036.NSCR.lz \ diff --git a/graphics_rules.mk b/graphics_rules.mk new file mode 100644 index 000000000..0ad43bf24 --- /dev/null +++ b/graphics_rules.mk @@ -0,0 +1,17 @@ +#todo data/dp_areawindow.NCGR (weirdness with size) +#todo data/graphic/bag_gra/narc_0007.NCGR (SOPC section) (width 32, palette narc_0003.NCLR) + +CLOBBER_SIZE_NCGR_FILES := files/data/cell0.NCGR + +CLOBBER_SIZE_VERSION101_NCGR_FILES := files/graphic/bag_gra/narc_0002.NCGR \ + files/graphic/bag_gra/narc_0006.NCGR \ + files/graphic/bag_gra/narc_0034.NCGR + +NCGR_CLEAN_LIST := files/data/cell0.NCGR \ + files/graphic/bag_gra/narc_0002.NCGR \ + files/graphic/bag_gra/narc_0006.NCGR \ + files/graphic/bag_gra/narc_0034.NCGR + +NCLR_CLEAN_LIST := files/data/cell0.NCLR \ + files/graphic/bag_gra/narc_0003.NCLR \ + files/graphic/bag_gra/narc_0034.NCLR diff --git a/tools/nitrogfx/gfx.c b/tools/nitrogfx/gfx.c index 3315e00ec..a80d341b7 100644 --- a/tools/nitrogfx/gfx.c +++ b/tools/nitrogfx/gfx.c @@ -359,7 +359,7 @@ 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) +void WriteNtrImage(char *path, int numTiles, int bitDepth, int metatileWidth, int metatileHeight, struct Image *image, bool invertColors, bool clobberSize, bool byteOrder, bool version101) { FILE *fp = fopen(path, "wb"); @@ -407,7 +407,7 @@ void WriteNtrImage(char *path, int numTiles, int bitDepth, int metatileWidth, in break; } - WriteGenericNtrHeader(fp, "RGCN", bufferSize + 0x20, byteOrder); + WriteGenericNtrHeader(fp, "RGCN", bufferSize + 0x20, byteOrder, version101); 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 }; @@ -545,7 +545,7 @@ void WriteNtrPalette(char *path, struct Palette *palette, bool ncpr) uint32_t extSize = size + (ncpr ? 0x10 : 0x18); //NCLR header - WriteGenericNtrHeader(fp, (ncpr ? "RPCN" : "RLCN"), extSize, !ncpr); + WriteGenericNtrHeader(fp, (ncpr ? "RPCN" : "RLCN"), extSize, !ncpr, false); unsigned char palHeader[0x18] = { diff --git a/tools/nitrogfx/gfx.h b/tools/nitrogfx/gfx.h index da56c5c51..1b0973362 100644 --- a/tools/nitrogfx/gfx.h +++ b/tools/nitrogfx/gfx.h @@ -31,7 +31,7 @@ struct Image { void ReadImage(char *path, int tilesWidth, int bitDepth, int metatileWidth, int metatileHeight, struct Image *image, bool invertColors); void ReadNtrImage(char *path, int tilesWidth, int bitDepth, int metatileWidth, int metatileHeight, struct Image *image, bool invertColors); void WriteImage(char *path, int numTiles, int bitDepth, int metatileWidth, int metatileHeight, struct Image *image, bool invertColors); -void WriteNtrImage(char *path, int numTiles, int bitDepth, int metatileWidth, int metatileHeight, struct Image *image, bool invertColors, bool clobberSize, bool byteOrder); +void WriteNtrImage(char *path, int numTiles, int bitDepth, int metatileWidth, int metatileHeight, struct Image *image, bool invertColors, bool clobberSize, bool byteOrder, bool version101); void FreeImage(struct Image *image); void ReadGbaPalette(char *path, struct Palette *palette); void ReadNtrPalette(char *path, struct Palette *palette); diff --git a/tools/nitrogfx/main.c b/tools/nitrogfx/main.c index 2f5b2735e..076e70761 100644 --- a/tools/nitrogfx/main.c +++ b/tools/nitrogfx/main.c @@ -88,7 +88,7 @@ void ConvertPngToNtr(char *inputPath, char *outputPath, struct PngToNtrOptions * ReadPng(inputPath, &image); - WriteNtrImage(outputPath, options->numTiles, options->bitDepth, options->metatileWidth, options->metatileHeight, &image, !image.hasPalette, options->clobberSize, options->byteOrder); + WriteNtrImage(outputPath, options->numTiles, options->bitDepth, options->metatileWidth, options->metatileHeight, &image, !image.hasPalette, options->clobberSize, options->byteOrder, options->version101); FreeImage(&image); } @@ -320,6 +320,7 @@ void HandlePngToNtrCommand(char *inputPath, char *outputPath, int argc, char **a options.metatileHeight = 1; options.clobberSize = false; options.byteOrder = true; + options.version101 = false; for (int i = 3; i < argc; i++) { @@ -385,6 +386,10 @@ void HandlePngToNtrCommand(char *inputPath, char *outputPath, int argc, char **a { options.byteOrder = false; } + else if (strcmp(option, "-version101") == 0) + { + options.version101 = true; + } else { FATAL_ERROR("Unrecognized option \"%s\".\n", option); diff --git a/tools/nitrogfx/options.h b/tools/nitrogfx/options.h index 8376348ff..77006f21f 100644 --- a/tools/nitrogfx/options.h +++ b/tools/nitrogfx/options.h @@ -28,6 +28,7 @@ struct PngToNtrOptions { int metatileHeight; bool clobberSize; bool byteOrder; + bool version101; }; diff --git a/tools/nitrogfx/util.c b/tools/nitrogfx/util.c index 73a128a1a..304a23195 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) { diff --git a/tools/nitrogfx/util.h b/tools/nitrogfx/util.h index f181b66e2..bb1cd4ad9 100644 --- a/tools/nitrogfx/util.h +++ b/tools/nitrogfx/util.h @@ -11,6 +11,6 @@ char *GetFileExtension(char *path); unsigned char *ReadWholeFile(char *path, int *size); unsigned char *ReadWholeFileZeroPadded(char *path, int *size, int padAmount); void WriteWholeFile(char *path, void *buffer, int bufferSize); -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); #endif // UTIL_H