summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorYamaArashi <shadow962@live.com>2016-06-17 21:02:07 -0700
committerYamaArashi <shadow962@live.com>2016-06-17 21:02:07 -0700
commit4c97f5ad0f8354edde2b79b6289ee21e3606df45 (patch)
tree40dad0e9ab539a8e4c9557006c01a44bbe4afb10 /tools
parent1c57bf698b941c43087f947ace42f8fe5bf8f654 (diff)
support 1 to 256 colors in palettes
Diffstat (limited to 'tools')
-rw-r--r--tools/gbagfx/jasc_pal.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/tools/gbagfx/jasc_pal.c b/tools/gbagfx/jasc_pal.c
index 02b6ed915..d003b7649 100644
--- a/tools/gbagfx/jasc_pal.c
+++ b/tools/gbagfx/jasc_pal.c
@@ -13,7 +13,7 @@
// "0100\r\n" (version; seems to always be "0100")
// "<NUMBER_OF_COLORS>\r\n" (number of colors in decimal)
//
-// 16 or 256 times (depending on above line):
+// <NUMBER_OF_COLORS> times:
// "<RED> <GREEN> <BLUE>\r\n" (color entry)
//
// Each color component is a decimal number from 0 to 255.
@@ -82,8 +82,8 @@ void ReadJascPalette(char *path, struct Palette *palette)
if (!ParseNumber(line, NULL, 10, &palette->numColors))
FATAL_ERROR("Failed to parse number of colors.\n");
- if (palette->numColors != 16 && palette->numColors != 256)
- FATAL_ERROR("%d is an invalid number of colors. The number of colors must be 16 or 256.\n", palette->numColors);
+ if (palette->numColors < 1 || palette->numColors > 256)
+ FATAL_ERROR("%d is an invalid number of colors. The number of colors must be in the range [1, 256].\n", palette->numColors);
for (int i = 0; i < palette->numColors; i++) {
ReadJascPaletteLine(fp, line);