mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 10:12:06 +00:00
Implement (stub) handling for all options
This commit is contained in:
@@ -79,7 +79,7 @@ void Options::verbosePrint(char const *fmt, ...) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Short options
|
// Short options
|
||||||
static char const *optstring = "Aa:Cc:Dd:Ffhmo:Pp:Tt:uVvx:";
|
static char const *optstring = "Aa:b:Cc:Dd:FfhL:mN:n:o:Pp:s:Tt:U:uVvx:Z";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Equivalent long options
|
* Equivalent long options
|
||||||
@@ -93,33 +93,39 @@ static char const *optstring = "Aa:Cc:Dd:Ffhmo:Pp:Tt:uVvx:";
|
|||||||
*/
|
*/
|
||||||
static struct option const longopts[] = {
|
static struct option const longopts[] = {
|
||||||
{"output-attr-map", no_argument, NULL, 'A'},
|
{"output-attr-map", no_argument, NULL, 'A'},
|
||||||
{"attr-map", required_argument, NULL, 'a'},
|
{"attr-map", required_argument, NULL, 'a'},
|
||||||
{"color-curve", no_argument, NULL, 'C'},
|
{"base-tiles", required_argument, NULL, 'b'},
|
||||||
|
{"color-curve", no_argument, NULL, 'C'},
|
||||||
{"colors", required_argument, NULL, 'c'},
|
{"colors", required_argument, NULL, 'c'},
|
||||||
{"debug", no_argument, NULL, 'D'},
|
{"debug", no_argument, NULL, 'D'}, // Ignored
|
||||||
{"depth", required_argument, NULL, 'd'},
|
{"depth", required_argument, NULL, 'd'},
|
||||||
{"fix", no_argument, NULL, 'f'},
|
{"fix", no_argument, NULL, 'f'},
|
||||||
{"fix-and-save", no_argument, NULL, 'F'},
|
{"fix-and-save", no_argument, NULL, 'F'}, // Deprecated
|
||||||
{"horizontal", no_argument, NULL, 'h'},
|
{"horizontal", no_argument, NULL, 'h'}, // Deprecated
|
||||||
{"mirror-tiles", no_argument, NULL, 'm'},
|
{"slice", required_argument, NULL, 'L'},
|
||||||
|
{"mirror-tiles", no_argument, NULL, 'm'},
|
||||||
|
{"nb-tiles", required_argument, NULL, 'N'},
|
||||||
|
{"nb-palettes", required_argument, NULL, 'n'},
|
||||||
{"output", required_argument, NULL, 'o'},
|
{"output", required_argument, NULL, 'o'},
|
||||||
{"output-palette", no_argument, NULL, 'P'},
|
{"output-palette", no_argument, NULL, 'P'},
|
||||||
{"palette", required_argument, NULL, 'p'},
|
{"palette", required_argument, NULL, 'p'},
|
||||||
{"output-tilemap", no_argument, NULL, 'T'},
|
{"output-tilemap", no_argument, NULL, 'T'},
|
||||||
{"tilemap", required_argument, NULL, 't'},
|
{"tilemap", required_argument, NULL, 't'},
|
||||||
|
{"unit-size", required_argument, NULL, 'U'},
|
||||||
{"unique-tiles", no_argument, NULL, 'u'},
|
{"unique-tiles", no_argument, NULL, 'u'},
|
||||||
{"version", no_argument, NULL, 'V'},
|
{"version", no_argument, NULL, 'V'},
|
||||||
{"verbose", no_argument, NULL, 'v'},
|
{"verbose", no_argument, NULL, 'v'},
|
||||||
{"trim-end", required_argument, NULL, 'x'},
|
{"trim-end", required_argument, NULL, 'x'},
|
||||||
{NULL, no_argument, NULL, 0 }
|
{"columns", no_argument, NULL, 'Z'},
|
||||||
|
{NULL, no_argument, NULL, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
static void printUsage(void) {
|
static void printUsage(void) {
|
||||||
fputs("Usage: rgbgfx [-CcDhmuVv] [-f | -F] [-a <attr_map> | -A] [-d <depth>]\n"
|
fputs("Usage: rgbgfx [-CfmuVZ] [-v [-v ...]] [-a <attr_map> | -A] [-b base_ids]\n"
|
||||||
" [-o <out_file>] [-p <pal_file> | -P] [-t <tile_map> | -T]\n"
|
" [-c color_spec] [-d <depth>] [-L slice] [-N nb_tiles] [-n nb_pals]\n"
|
||||||
" [-x <tiles>] <file>\n"
|
" [-o <out_file>] [-p <pal_file> | -P] [-s nb_colors] [-t <tile_map> | -T]\n"
|
||||||
|
" [-U unit_size] [-x <tiles>] <file>\n"
|
||||||
"Useful options:\n"
|
"Useful options:\n"
|
||||||
" -f, --fix make the input image an indexed PNG\n"
|
|
||||||
" -m, --mirror-tiles optimize out mirrored tiles\n"
|
" -m, --mirror-tiles optimize out mirrored tiles\n"
|
||||||
" -o, --output <path> set the output binary file\n"
|
" -o, --output <path> set the output binary file\n"
|
||||||
" -t, --tilemap <path> set the output tilemap file\n"
|
" -t, --tilemap <path> set the output tilemap file\n"
|
||||||
@@ -181,12 +187,18 @@ int main(int argc, char *argv[]) {
|
|||||||
autoAttrmap = false;
|
autoAttrmap = false;
|
||||||
options.attrmap = musl_optarg;
|
options.attrmap = musl_optarg;
|
||||||
break;
|
break;
|
||||||
|
case 'b':
|
||||||
|
options.baseTileIDs = {0, 0}; // TODO
|
||||||
|
break;
|
||||||
case 'C':
|
case 'C':
|
||||||
options.useColorCurve = true;
|
options.useColorCurve = true;
|
||||||
break;
|
break;
|
||||||
case 'c':
|
case 'c':
|
||||||
parsePaletteSpec(musl_optarg);
|
parsePaletteSpec(musl_optarg);
|
||||||
break;
|
break;
|
||||||
|
case 'D':
|
||||||
|
warning("Ignoring retired option `-D`");
|
||||||
|
break;
|
||||||
case 'd':
|
case 'd':
|
||||||
if (parseDecimalArg(options.bitDepth) && options.bitDepth != 1
|
if (parseDecimalArg(options.bitDepth) && options.bitDepth != 1
|
||||||
&& options.bitDepth != 2) {
|
&& options.bitDepth != 2) {
|
||||||
@@ -194,14 +206,14 @@ int main(int argc, char *argv[]) {
|
|||||||
options.bitDepth = 2;
|
options.bitDepth = 2;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case 'F':
|
||||||
|
warning("`-F` is now deprecated, and behaves like `-f`");
|
||||||
|
[[fallthrough]];
|
||||||
case 'f':
|
case 'f':
|
||||||
options.fixInput = true;
|
options.fixInput = true;
|
||||||
break;
|
break;
|
||||||
case 'h':
|
case 'L':
|
||||||
warning("`-h` is deprecated, use `-Z` instead");
|
options.inputSlice = {0, 0, 0, 0}; // TODO
|
||||||
[[fallthrough]];
|
|
||||||
case 'Z':
|
|
||||||
options.columnMajor = true;
|
|
||||||
break;
|
break;
|
||||||
case 'm':
|
case 'm':
|
||||||
options.allowMirroring = true;
|
options.allowMirroring = true;
|
||||||
@@ -209,6 +221,12 @@ int main(int argc, char *argv[]) {
|
|||||||
case 'u':
|
case 'u':
|
||||||
options.allowDedup = true;
|
options.allowDedup = true;
|
||||||
break;
|
break;
|
||||||
|
case 'N':
|
||||||
|
options.maxNbTiles = {0, 0}; // TODO
|
||||||
|
break;
|
||||||
|
case 'n':
|
||||||
|
options.nbPalettes = 0; // TODO
|
||||||
|
break;
|
||||||
case 'o':
|
case 'o':
|
||||||
options.output = musl_optarg;
|
options.output = musl_optarg;
|
||||||
break;
|
break;
|
||||||
@@ -219,6 +237,9 @@ int main(int argc, char *argv[]) {
|
|||||||
autoPalettes = false;
|
autoPalettes = false;
|
||||||
options.palettes = musl_optarg;
|
options.palettes = musl_optarg;
|
||||||
break;
|
break;
|
||||||
|
case 's':
|
||||||
|
options.nbColorsPerPal = 0; // TODO
|
||||||
|
break;
|
||||||
case 'T':
|
case 'T':
|
||||||
autoTilemap = true;
|
autoTilemap = true;
|
||||||
break;
|
break;
|
||||||
@@ -235,9 +256,11 @@ int main(int argc, char *argv[]) {
|
|||||||
case 'x':
|
case 'x':
|
||||||
parseDecimalArg(options.trim);
|
parseDecimalArg(options.trim);
|
||||||
break;
|
break;
|
||||||
case 'D':
|
case 'h':
|
||||||
case 'F':
|
warning("`-h` is deprecated, use `-Z` instead");
|
||||||
warning("Ignoring option '%c'", musl_optopt);
|
[[fallthrough]];
|
||||||
|
case 'Z':
|
||||||
|
options.columnMajor = true;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
printUsage();
|
printUsage();
|
||||||
|
|||||||
Reference in New Issue
Block a user