shithub: rgbds

Download patch

ref: 943d631701e61bdea952502f522f1133f5946a17
parent: d2f9cc7e8c378e07f9077d5d74d6069479cae50c
author: ISSOtm <[email protected]>
date: Sat Mar 12 12:19:54 EST 2022

Implement max palette count

--- a/src/gfx/convert.cpp
+++ b/src/gfx/convert.cpp
@@ -937,6 +937,11 @@
 		}
 	}
 
+	if (palettes.size() > options.nbPalettes) {
+		// If the palette generation is wrong, other (dependee) operations are likely to be nonsensical, so fatal-error outright
+		fatal("Generated %zu palettes, over the maximum of %" PRIu8, palettes.size(), options.nbPalettes);
+	}
+
 	if (!options.palettes.empty()) {
 		outputPalettes(palettes);
 	}
--- a/src/gfx/main.cpp
+++ b/src/gfx/main.cpp
@@ -333,7 +333,7 @@
 			}
 			break;
 		case 'n':
-			options.nbPalettes = 0; // TODO
+			options.nbPalettes = parseNumber(arg, "Number of palettes", 8);
 			break;
 		case 'o':
 			options.output = musl_optarg;