ref: ad07c9deb9398ed3a7b9279362f38e37ccb40f0d
parent: bf9f99ebf54fe79d4130c464a9524c62acc5de06
author: ISSOtm <eldredhabert0@gmail.com>
date: Sat Mar 5 16:44:07 EST 2022
Implement (stub) handling for all options
--- a/src/gfx/main.cpp
+++ b/src/gfx/main.cpp
@@ -79,7 +79,7 @@
}
// 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
@@ -93,33 +93,39 @@
*/
static struct option const longopts[] = {
{"output-attr-map", no_argument, NULL, 'A'},
- {"attr-map", required_argument, NULL, 'a'},
- {"color-curve", no_argument, NULL, 'C'},
+ {"attr-map", required_argument, NULL, 'a'},
+ {"base-tiles", required_argument, NULL, 'b'},
+ {"color-curve", no_argument, NULL, 'C'},
{"colors", required_argument, NULL, 'c'},
- {"debug", no_argument, NULL, 'D'},
+ {"debug", no_argument, NULL, 'D'}, // Ignored
{"depth", required_argument, NULL, 'd'},
- {"fix", no_argument, NULL, 'f'},
- {"fix-and-save", no_argument, NULL, 'F'},
- {"horizontal", no_argument, NULL, 'h'},
- {"mirror-tiles", no_argument, NULL, 'm'},
+ {"fix", no_argument, NULL, 'f'},
+ {"fix-and-save", no_argument, NULL, 'F'}, // Deprecated
+ {"horizontal", no_argument, NULL, 'h'}, // Deprecated
+ {"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-palette", no_argument, NULL, 'P'},
+ {"output-palette", no_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'},
+ {"unit-size", required_argument, NULL, 'U'},
{"unique-tiles", no_argument, NULL, 'u'},
- {"version", no_argument, NULL, 'V'},
+ {"version", no_argument, NULL, 'V'},
{"verbose", no_argument, NULL, 'v'},
- {"trim-end", required_argument, NULL, 'x'},
- {NULL, no_argument, NULL, 0 }
+ {"trim-end", required_argument, NULL, 'x'},
+ {"columns", no_argument, NULL, 'Z'},
+ {NULL, no_argument, NULL, 0 }
};
static void printUsage(void) {
- fputs("Usage: rgbgfx [-CcDhmuVv] [-f | -F] [-a <attr_map> | -A] [-d <depth>]\n"
- " [-o <out_file>] [-p <pal_file> | -P] [-t <tile_map> | -T]\n"
- " [-x <tiles>] <file>\n"
+ fputs("Usage: rgbgfx [-CfmuVZ] [-v [-v ...]] [-a <attr_map> | -A] [-b base_ids]\n"
+ " [-c color_spec] [-d <depth>] [-L slice] [-N nb_tiles] [-n nb_pals]\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"
- " -f, --fix make the input image an indexed PNG\n"
" -m, --mirror-tiles optimize out mirrored tiles\n"
" -o, --output <path> set the output binary file\n"
" -t, --tilemap <path> set the output tilemap file\n"
@@ -181,6 +187,9 @@
autoAttrmap = false;
options.attrmap = musl_optarg;
break;
+ case 'b':
+ options.baseTileIDs = {0, 0}; // TODO
+ break;
case 'C':
options.useColorCurve = true;
break;
@@ -187,6 +196,9 @@
case 'c':
parsePaletteSpec(musl_optarg);
break;
+ case 'D':
+ warning("Ignoring retired option `-D`");
+ break;
case 'd':
if (parseDecimalArg(options.bitDepth) && options.bitDepth != 1
&& options.bitDepth != 2) {
@@ -194,14 +206,14 @@
options.bitDepth = 2;
}
break;
+ case 'F':
+ warning("`-F` is now deprecated, and behaves like `-f`");
+ [[fallthrough]];
case 'f':
options.fixInput = true;
break;
- case 'h':
- warning("`-h` is deprecated, use `-Z` instead");
- [[fallthrough]];
- case 'Z':
- options.columnMajor = true;
+ case 'L':
+ options.inputSlice = {0, 0, 0, 0}; // TODO
break;
case 'm':
options.allowMirroring = true;
@@ -209,6 +221,12 @@
case 'u':
options.allowDedup = true;
break;
+ case 'N':
+ options.maxNbTiles = {0, 0}; // TODO
+ break;
+ case 'n':
+ options.nbPalettes = 0; // TODO
+ break;
case 'o':
options.output = musl_optarg;
break;
@@ -219,6 +237,9 @@
autoPalettes = false;
options.palettes = musl_optarg;
break;
+ case 's':
+ options.nbColorsPerPal = 0; // TODO
+ break;
case 'T':
autoTilemap = true;
break;
@@ -235,9 +256,11 @@
case 'x':
parseDecimalArg(options.trim);
break;
- case 'D':
- case 'F':
- warning("Ignoring option '%c'", musl_optopt);
+ case 'h':
+ warning("`-h` is deprecated, use `-Z` instead");
+ [[fallthrough]];
+ case 'Z':
+ options.columnMajor = true;
break;
default:
printUsage();