bit of title work, maths is still wrong

This commit is contained in:
red031000 2020-07-11 21:50:56 +01:00
parent d038e60ba5
commit f76e211631
No known key found for this signature in database
GPG Key ID: A3C87CFF2DC536C2
12 changed files with 31 additions and 7 deletions

View File

@ -251,6 +251,9 @@ $(CLOBBER_SIZE_NCGR_FILES): %.NCGR: %.png
$(CLOBBER_SIZE_VERSION101_NCGR_FILES): %.NCGR: %.png
$(GFX) $< $@ -clobbersize -version101
$(VERSION101_SOPC_8BPP_NCGR_FILES): %.NCGR: %.png
$(GFX) $< $@ -version101 -sopc -bitdepth 8
%.NCLR: %.png
$(GFX) $< $@

4
files/demo/title/titledemo/.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
narc_0001.NCGR
narc_0001.NCLR
narc_0003.NCGR
narc_0003.NCLR

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

View File

@ -2219,6 +2219,12 @@ files/data/namein.narc: \
files/data/namein/narc_0013.NCER.lz \
files/data/namein/narc_0007.NSCR.lz
files/demo/title/titledemo.narc: \
files/demo/title/titledemo/narc_0001.NCGR \
files/demo/title/titledemo/narc_0001.NCLR \
files/demo/title/titledemo/narc_0003.NCGR \
files/demo/title/titledemo/narc_0003.NCLR
.PHONY: filesystem
filesystem: $(HOSTFS_FILES)

View File

@ -1,5 +1,6 @@
#todo data/dp_areawindow.NCGR (weirdness with size)
#todo data/graphic/bag_gra/narc_0007.NCGR (SOPC section) (width 32, palette narc_0003.NCLR)
#todo data/demo/title/titledemo/narc_0007.NCGR (weidness with size, needs investigating)
CLOBBER_SIZE_NCGR_FILES := files/data/cell0.NCGR
@ -81,7 +82,12 @@ IR_NCLR_FILES := files/itemtool/itemdata/item_icon/narc_0028.NCLR \
files/itemtool/itemdata/item_icon/narc_0111.NCLR \
files/itemtool/itemdata/item_icon/narc_0114.NCLR
VERSION101_SOPC_8BPP_NCGR_FILES := files/demo/title/titledemo/narc_0001.NCGR \
files/demo/title/titledemo/narc_0003.NCGR
NCGR_CLEAN_LIST := files/data/cell0.NCGR \
files/demo/title/titledemo/narc_0001.NCGR \
files/demo/title/titledemo/narc_0003.NCGR \
files/graphic/bag_gra/narc_0002.NCGR \
files/graphic/bag_gra/narc_0006.NCGR \
files/graphic/bag_gra/narc_0034.NCGR \
@ -131,6 +137,8 @@ NCGR_CLEAN_LIST := files/data/cell0.NCGR \
NCLR_CLEAN_LIST := files/data/cell0.NCLR \
files/demo/title/titledemo/narc_0001.NCLR \
files/demo/title/titledemo/narc_0003.NCLR \
files/graphic/bag_gra/narc_0003.NCLR \
files/graphic/bag_gra/narc_0034.NCLR \
files/itemtool/itemdata/item_icon/narc_0002.NCLR \

View File

@ -419,11 +419,14 @@ void WriteNtrImage(char *path, int numTiles, int bitDepth, int metatileWidth, in
if (!clobberSize)
{
charHeader[8] = numTiles & 0xFF;
charHeader[9] = (numTiles >> 8) & 0xFF;
//charHeader[8] = numTiles & 0xFF;
//charHeader[9] = (numTiles >> 8) & 0xFF;
charHeader[8] = (bufferSize / (256 * bitDepth)) & 0xFF;
charHeader[9] = ((bufferSize / (256 * bitDepth)) >> 8) & 0xFF;
charHeader[10] = tileSize & 0xFF;
charHeader[11] = (tileSize >> 8) & 0xFF;
//charHeader[10] = tileSize & 0xFF;
//charHeader[11] = (tileSize >> 8) & 0xFF;
charHeader[10] = 0x20; //todo figure out if this changes
}
else
{
@ -449,8 +452,8 @@ void WriteNtrImage(char *path, int numTiles, int bitDepth, int metatileWidth, in
if (sopc)
{
unsigned char sopcBuffer[0x10] = { 0x53, 0x4F, 0x50, 0x43, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00 };
sopcBuffer[14] = numTiles & 0xFF;
sopcBuffer[15] = (numTiles >> 8) & 0xFF;
sopcBuffer[14] = (bufferSize / (256 * bitDepth)) & 0xFF;
sopcBuffer[15] = ((bufferSize / (256 * bitDepth)) >> 8) & 0xFF;
fwrite(sopcBuffer, 1, 0x10, fp);
}

View File

@ -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, options->version101, options->sopc);
WriteNtrImage(outputPath, options->numTiles, image.bitDepth, options->metatileWidth, options->metatileHeight, &image, !image.hasPalette, options->clobberSize, options->byteOrder, options->version101, options->sopc);
FreeImage(&image);
}