Parse bank capacities

This commit is contained in:
ISSOtm
2022-03-12 14:02:13 +01:00
committed by Eldred Habert
parent f29c5d81ec
commit 76bb950be5
2 changed files with 25 additions and 2 deletions

View File

@@ -161,7 +161,7 @@ Implies
Set a maximum number of tiles that can be placed in each VRAM bank. Set a maximum number of tiles that can be placed in each VRAM bank.
.Ar nb_tiles .Ar nb_tiles
should be one or two numbers between 0 and 256, separated by a comma; if the latter is omitted, it defaults to 0. should be one or two numbers between 0 and 256, separated by a comma; if the latter is omitted, it defaults to 0.
Setting either number to 0 prevents any tiles froom being output in that bank. Setting either number to 0 prevents any tiles from being output in that bank.
.Pp .Pp
If more tiles are generated than can fit in the two banks combined, If more tiles are generated than can fit in the two banks combined,
.Nm .Nm

View File

@@ -307,7 +307,30 @@ int main(int argc, char *argv[]) {
options.allowDedup = true; options.allowDedup = true;
break; break;
case 'N': case 'N':
options.maxNbTiles = {0, 0}; // TODO options.maxNbTiles[0] = parseNumber(arg, "Number of tiles in bank 0", 256);
if (options.maxNbTiles[0] > 256) {
error("Bank 0 cannot contain more than 256 tiles");
}
if (*arg == '\0') {
options.maxNbTiles[1] = 0;
break;
}
skipWhitespace(arg);
if (*arg != ',') {
error("Bank capacity must be one or two comma-separated numbers, not \"%s\"",
musl_optarg);
break;
}
skipWhitespace(arg);
options.maxNbTiles[1] = parseNumber(arg, "Number of tiles in bank 1", 256);
if (options.maxNbTiles[1] > 256) {
error("Bank 1 cannot contain more than 256 tiles");
}
if (*arg != '\0') {
error("Bank capacity must be one or two comma-separated numbers, not \"%s\"",
musl_optarg);
break;
}
break; break;
case 'n': case 'n':
options.nbPalettes = 0; // TODO options.nbPalettes = 0; // TODO