From 369fa7d00def83f50a12305dbe750f075604bbdc Mon Sep 17 00:00:00 2001 From: red031000 Date: Thu, 6 Nov 2025 07:13:36 +0000 Subject: [PATCH] bugfix --- tools/nitrogfx/gfx.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tools/nitrogfx/gfx.c b/tools/nitrogfx/gfx.c index 0e620d3c7..1303113d8 100644 --- a/tools/nitrogfx/gfx.c +++ b/tools/nitrogfx/gfx.c @@ -798,11 +798,6 @@ void ApplyCellsToImage(char *cellFilePath, struct Image *image, bool toPNG, bool { cellHeight = options->cells[i]->maxY - options->cells[i]->minY; cellWidth = options->cells[i]->maxX - options->cells[i]->minX; - if (snap) - { - cellHeight = SnapToTile(cellHeight); - cellWidth = SnapToTile(cellWidth); - } cellInfo[i].minX = options->cells[i]->minX; cellInfo[i].minY = options->cells[i]->minY; } @@ -847,6 +842,11 @@ void ApplyCellsToImage(char *cellFilePath, struct Image *image, bool toPNG, bool cellInfo[i].minX = minX; cellInfo[i].minY = minY; } + if (snap) + { + cellHeight = SnapToTile(cellHeight); + cellWidth = SnapToTile(cellWidth); + } outputHeight += cellHeight + 1; if (outputWidth < cellWidth) @@ -1592,7 +1592,7 @@ void ReadNtrCell_LABL(unsigned char * restrict data, unsigned int blockOffset, u { FATAL_ERROR("corrupted LABL block\n"); } - unsigned long slen = strnlen((char *)data + offset, blockSize - offset); + unsigned long slen = strnlen((char *)data + offset, (blockOffset + blockSize) - offset); options->labels[i] = malloc(slen + 1); strncpy(options->labels[i], (char *)data + offset, slen + 1); }