From 0663e04fa81ba4b3061d14a9ebdd3d2b4fe6600c Mon Sep 17 00:00:00 2001 From: Ian C Date: Fri, 14 Sep 2018 14:06:27 +0000 Subject: Some fixes to 16x16 mode. --- snesgfx.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/snesgfx.c b/snesgfx.c index 8e0de8a..d41350d 100644 --- a/snesgfx.c +++ b/snesgfx.c @@ -110,7 +110,7 @@ static void Convert4Colour16x16(png_bytep *data, unsigned char *mem; size_t size; - size = width / 16 * height / 16 * 512; + size = ((width / 16 * height / 16) / 8 + 1) * 512; if (!size) { @@ -137,7 +137,7 @@ static void Convert4Colour16x16(png_bytep *data, int offset; int f; - offset = (tile / 16) * 512 + (tile % 16) * 32; + offset = (tile / 8) * 512 + (tile % 8) * 32; GetPlanes(x, y, plane_left, 2, 16, data, width, height); GetPlanes(x + 8, y, plane_right, 2, 16, data, width, height); @@ -211,7 +211,7 @@ static void Convert16Colour16x16(png_bytep *data, unsigned char *mem; size_t size; - size = width / 16 * height / 16 * 1024; + size = ((width / 16 * height / 16) / 8 + 1) * 1024; if (!size) { @@ -238,7 +238,7 @@ static void Convert16Colour16x16(png_bytep *data, int offset; int f; - offset = (tile / 16) * 1024 + (tile % 16) * 64; + offset = (tile / 8) * 1024 + (tile % 8) * 64; GetPlanes(x, y, plane_left, 4, 16, data, width, height); GetPlanes(x + 8, y, plane_right, 4, 16, data, width, height); -- cgit v1.2.3