diff options
author | PikalaxALT <pikalaxalt@gmail.com> | 2021-11-06 10:56:38 -0400 |
---|---|---|
committer | PikalaxALT <pikalaxalt@gmail.com> | 2021-11-06 10:57:37 -0400 |
commit | 344a645b5a977bc277b9eb8c0a03496047b01a49 (patch) | |
tree | 9b7f964818d6b1ed914165b4c47f879c6aa6d71e | |
parent | ff506c5734f72bd1f48e87422f2a9fcd35c2bb7e (diff) |
Fix areawindow png
-rw-r--r-- | Makefile | 3 | ||||
-rw-r--r-- | files/data/.gitignore | 2 | ||||
-rw-r--r-- | files/data/dp_areawindow.png | bin | 249 -> 224 bytes | |||
-rw-r--r-- | graphics_rules.mk | 6 | ||||
-rw-r--r-- | tools/nitrogfx/gfx.c | 14 | ||||
-rw-r--r-- | tools/nitrogfx/gfx.h | 4 | ||||
-rw-r--r-- | tools/nitrogfx/main.c | 7 | ||||
-rw-r--r-- | tools/nitrogfx/options.h | 1 |
8 files changed, 27 insertions, 10 deletions
@@ -257,12 +257,15 @@ $(CLOBBER_SIZE_VERSION101_NCGR_FILES): GFX_FLAGS = -clobbersize -version101 $(VERSION101_SOPC_8BPP_NCGR_FILES): GFX_FLAGS = -version101 -sopc -bitdepth 8 $(VERSION101_SOPC_NCGR_FILES): GFX_FLAGS = -version101 -sopc $(SCANNED_NCGR_FILES): GFX_FLAGS = -scanned +$(NOBYTEORDER_NCGR_FILES): GFX_FLAGS = -nobyteorder +$(NOBYTEORDER_WRONGSIZE_NCGR_FILES): GFX_FLAGS = -nobyteorder -wrongsize $(IR_NCLR_FILES): GFX_FLAGS = -ir $(4BPP_NCLR_FILES): GFX_FLAGS = -bitdepth 4 $(8BPP_NSCR_FILES): GFX_FLAGS = -bitdepth 8 $(8BPP_COMP10_NOPAD_NCLR_PNG_FILES): GFX_FLAGS = -bitdepth 8 -nopad -comp 10 $(8BPP_COMP10_NOPAD_NCLR_PAL_FILES): GFX_FLAGS = -bitdepth 8 -nopad -comp 10 +$(NCPR_NCLR_FILES): GFX_FLAGS = -ncpr %.NCGR: %.png $(GFX) $< $@ $(GFX_FLAGS) diff --git a/files/data/.gitignore b/files/data/.gitignore index e405595a..af81751d 100644 --- a/files/data/.gitignore +++ b/files/data/.gitignore @@ -1,2 +1,4 @@ cell0.NCGR cell0.NCLR +dp_areawindow.NCGR +dp_areawindow.NCLR diff --git a/files/data/dp_areawindow.png b/files/data/dp_areawindow.png Binary files differindex ab2b74c8..a4514abd 100644 --- a/files/data/dp_areawindow.png +++ b/files/data/dp_areawindow.png diff --git a/graphics_rules.mk b/graphics_rules.mk index 5bad9e5e..74327449 100644 --- a/graphics_rules.mk +++ b/graphics_rules.mk @@ -1,4 +1,3 @@ -#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 @@ -122,7 +121,7 @@ CLOBBER_SIZE_VERSION101_NCGR_FILES := files/graphic/bag_gra/narc_0002.NCGR \ files/poketool/icongra/poke_icon/narc_0000.NCLR \ files/resource/eng/trial/trial/narc_0000.NCLR \ files/resource/eng/trial/trial/narc_0003.NCLR \ - files/resource/eng/trial/trial/narc_0006.NCLR \ + files/resource/eng/trial/trial/narc_0006.NCLR 8BPP_NSCR_FILES := files/demo/title/titledemo/narc_0000.NSCR @@ -157,6 +156,9 @@ 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 +NCPR_NCLR_FILES := files/data/dp_areawindow.NCLR +NOBYTEORDER_WRONGSIZE_NCGR_FILES := files/data/dp_areawindow.NCGR + VERSION101_SOPC_8BPP_NCGR_FILES := files/demo/title/titledemo/narc_0001.NCGR \ files/demo/title/titledemo/narc_0003.NCGR diff --git a/tools/nitrogfx/gfx.c b/tools/nitrogfx/gfx.c index ee7e0d6f..43e8f83c 100644 --- a/tools/nitrogfx/gfx.c +++ b/tools/nitrogfx/gfx.c @@ -433,7 +433,9 @@ 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, bool version101, bool sopc, bool scanned, uint32_t key) +void WriteNtrImage(char *path, int numTiles, int bitDepth, int metatileWidth, int metatileHeight, struct Image *image, + bool invertColors, bool clobberSize, bool byteOrder, bool version101, bool sopc, bool scanned, + uint32_t key, bool wrongSize) { FILE *fp = fopen(path, "wb"); @@ -499,15 +501,15 @@ void WriteNtrImage(char *path, int numTiles, int bitDepth, int metatileWidth, in } } - WriteGenericNtrHeader(fp, "RGCN", bufferSize + (sopc ? 0x30 : 0x20), byteOrder, version101, sopc ? 2 : 1); + WriteGenericNtrHeader(fp, "RGCN", bufferSize + (sopc ? 0x30 : 0x20) + (wrongSize ? -8 : 0), byteOrder, version101, sopc ? 2 : 1); 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 }; - charHeader[4] = (bufferSize + 0x20) & 0xFF; - charHeader[5] = ((bufferSize + 0x20) >> 8) & 0xFF; - charHeader[6] = ((bufferSize + 0x20) >> 16) & 0xFF; - charHeader[7] = ((bufferSize + 0x20) >> 24) & 0xFF; + charHeader[4] = (bufferSize + 0x20 + (wrongSize ? -8 : 0)) & 0xFF; + charHeader[5] = ((bufferSize + 0x20 + (wrongSize ? -8 : 0)) >> 8) & 0xFF; + charHeader[6] = ((bufferSize + 0x20 + (wrongSize ? -8 : 0)) >> 16) & 0xFF; + charHeader[7] = ((bufferSize + 0x20 + (wrongSize ? -8 : 0)) >> 24) & 0xFF; if (!clobberSize) { diff --git a/tools/nitrogfx/gfx.h b/tools/nitrogfx/gfx.h index d0e6521a..389aec41 100644 --- a/tools/nitrogfx/gfx.h +++ b/tools/nitrogfx/gfx.h @@ -32,7 +32,9 @@ struct Image { void ReadImage(char *path, int tilesWidth, int bitDepth, int metatileWidth, int metatileHeight, struct Image *image, bool invertColors); uint32_t 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, bool version101, bool sopc, bool scanned, uint32_t key); +void WriteNtrImage(char *path, int numTiles, int bitDepth, int metatileWidth, int metatileHeight, struct Image *image, + bool invertColors, bool clobberSize, bool byteOrder, bool version101, bool sopc, bool scanned, + uint32_t key, bool wrongSize); void FreeImage(struct Image *image); void ReadGbaPalette(char *path, struct Palette *palette); void ReadNtrPalette(char *path, struct Palette *palette, int bitdepth, int palIndex); diff --git a/tools/nitrogfx/main.c b/tools/nitrogfx/main.c index b2d3352a..b52aa48b 100644 --- a/tools/nitrogfx/main.c +++ b/tools/nitrogfx/main.c @@ -116,7 +116,9 @@ void ConvertPngToNtr(char *inputPath, char *outputPath, struct PngToNtrOptions * free(string); } - WriteNtrImage(outputPath, options->numTiles, image.bitDepth, options->metatileWidth, options->metatileHeight, &image, !image.hasPalette, options->clobberSize, options->byteOrder, options->version101, options->sopc, options->scanned, key); + WriteNtrImage(outputPath, options->numTiles, image.bitDepth, options->metatileWidth, options->metatileHeight, + &image, !image.hasPalette, options->clobberSize, options->byteOrder, options->version101, + options->sopc, options->scanned, key, options->wrongSize); FreeImage(&image); } @@ -442,6 +444,9 @@ void HandlePngToNtrCommand(char *inputPath, char *outputPath, int argc, char **a { options.scanned = true; } + else if (strcmp(option, "-wrongsize") == 0) { + options.wrongSize = true; + } else { FATAL_ERROR("Unrecognized option \"%s\".\n", option); diff --git a/tools/nitrogfx/options.h b/tools/nitrogfx/options.h index 66e9895d..e6721766 100644 --- a/tools/nitrogfx/options.h +++ b/tools/nitrogfx/options.h @@ -32,6 +32,7 @@ struct PngToNtrOptions { bool version101; bool sopc; bool scanned; + bool wrongSize; }; struct Attr0 { |