changeset 2408:60e119262c67

Option index re-ordering cleanup work.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 13 Jan 2020 21:21:25 +0200
parents c5a32812dd97
children 1f26fd82735a
files tools/64vw.c tools/data2inc.c tools/dumpmod.c tools/fanalyze.c tools/fontconv.c tools/gfxconv.c tools/mod2wav.c tools/packed.c tools/ppl.c tools/xm2jss.c
diffstat 10 files changed, 316 insertions(+), 298 deletions(-) [+]
line wrap: on
line diff
--- a/tools/64vw.c	Mon Jan 13 21:16:57 2020 +0200
+++ b/tools/64vw.c	Mon Jan 13 21:21:25 2020 +0200
@@ -34,17 +34,18 @@
 
 static const DMOptArg optList[] =
 {
-    { 0, '?', "help",       "Show this help", OPT_NONE },
-    { 1, 'v', "verbose",    "Be more verbose", OPT_NONE },
-    { 2,   0, "fs",         "Fullscreen", OPT_NONE },
-    { 3, 'S', "scale",      "Scale image by factor (1-10)", OPT_ARGREQ },
-    { 4, 'f', "format",     "Force input format (see --formats)", OPT_ARGREQ },
-    { 5, 'F', "formats",    "List supported input formats", OPT_NONE },
-    { 6, 'i', "info",       "Print information only (no display)", OPT_NONE },
-    { 7, 'l', "list",       "List files that were recognized (implies -i)", OPT_NONE },
-    { 8, 'P', "probe",      "Probe only (do not attempt to decode the image)", OPT_NONE },
-    { 9,   0, "char-rom",   "Set character ROM file to be used.", OPT_ARGREQ },
-    {10, 'p', "palette" ,   "Set C64 palette to be used (see -p list).", OPT_ARGREQ },
+    {  0, '?', "help"            , "Show this help", OPT_NONE },
+    {  2, 'v', "verbose"         , "Be more verbose", OPT_NONE },
+
+    { 10,   0, "fs"              , "Fullscreen", OPT_NONE },
+    { 12, 'S', "scale"           , "Scale image by factor (1-10)", OPT_ARGREQ },
+    { 14, 'f', "format"          , "Force input format (see --formats)", OPT_ARGREQ },
+    { 16, 'F', "formats"         , "List supported input formats", OPT_NONE },
+    { 18, 'i', "info"            , "Print information only (no display)", OPT_NONE },
+    { 20, 'l', "list"            , "List files that were recognized (implies -i)", OPT_NONE },
+    { 22, 'P', "probe"           , "Probe only (do not attempt to decode the image)", OPT_NONE },
+    { 24,   0, "char-rom"        , "Set character ROM file to be used.", OPT_ARGREQ },
+    { 26, 'p', "palette"         , "Set C64 palette to be used (see -p list).", OPT_ARGREQ },
 };
 
 const int optListN = sizeof(optList) / sizeof(optList[0]);
@@ -90,15 +91,15 @@
             exit(0);
             break;
 
-        case 1:
+        case 2:
             dmVerbosity++;
             break;
 
-        case 2:
+        case 10:
             optVFlags |= SDL_WINDOW_FULLSCREEN_DESKTOP;
             break;
 
-        case 3:
+        case 12:
             {
                 float factor;
                 if (sscanf(optArg, "%f", &factor) == 1)
@@ -119,7 +120,7 @@
             }
             break;
 
-        case 4:
+        case 14:
             optForcedFormat = -1;
             for (int i = 0; i < ndmC64ImageFormats; i++)
             {
@@ -139,32 +140,34 @@
             }
             break;
 
-        case 5:
+        case 16:
             argShowC64Formats(stdout, FALSE);
             exit(0);
             break;
 
-        case 7:
+        case 20:
+            // NOTICE! This fallthrough is intentional for -l option!
+            // Take care if reordering the option indices.
             optListOnly = TRUE;
             // Fallthrough
 
-        case 6:
+        case 18:
             if (dmVerbosity < 1)
                 dmVerbosity = 1;
             optInfoOnly = TRUE;
             break;
 
-        case 8:
+        case 22:
             if (dmVerbosity < 1)
                 dmVerbosity = 1;
             optProbeOnly = TRUE;
             break;
 
-        case 9:
+        case 24:
             optCharROMFilename = optArg;
             break;
 
-        case 10:
+        case 26:
             return argHandleC64PaletteOption(optArg, &optC64Palette, &optC64PaletteFile);
 
         default:
--- a/tools/data2inc.c	Mon Jan 13 21:16:57 2020 +0200
+++ b/tools/data2inc.c	Mon Jan 13 21:21:25 2020 +0200
@@ -53,17 +53,18 @@
 
 static const DMOptArg optList[] =
 {
-    {  0, '?', "help",           "Show this help", OPT_NONE },
-    {  1, 'n', "name",           "Set object name", OPT_ARGREQ },
-    {  2, 't', "type",           "Set datatype (unsigned char/byte)", OPT_ARGREQ },
-    {  3, 'f', "format",         "Set output format (see list below)", OPT_ARGREQ },
-    {  4, 'a', "add-line",       "Add this line to start of file", OPT_ARGREQ },
-    {  5, 'l', "line-items",     "Set number of items per line", OPT_ARGREQ },
-    {  6, 'x', "hexadecimal",    "Use hexadecimal output", OPT_NONE },
-    {  7, 'q', "quiet",          "Do not add comments", OPT_NONE },
-    {  8, 'N', "no-formatting",  "Disable additional output formatting", OPT_NONE },
-    {  9, 'i', "indentation",    "Set indentation (negative value = tab)", OPT_ARGREQ },
-    { 10, 'e', "extra-data",     "Add object end labels and size in asm output", OPT_NONE },
+    {  0, '?', "help"            , "Show this help", OPT_NONE },
+
+    { 10, 'n', "name"            , "Set object name", OPT_ARGREQ },
+    { 12, 't', "type"            , "Set datatype (unsigned char/byte)", OPT_ARGREQ },
+    { 14, 'f', "format"          , "Set output format (see list below)", OPT_ARGREQ },
+    { 16, 'a', "add-line"        , "Add this line to start of file", OPT_ARGREQ },
+    { 18, 'l', "line-items"      , "Set number of items per line", OPT_ARGREQ },
+    { 20, 'x', "hexadecimal"     , "Use hexadecimal output", OPT_NONE },
+    { 22, 'q', "quiet"           , "Do not add comments", OPT_NONE },
+    { 24, 'N', "no-formatting"   , "Disable additional output formatting", OPT_NONE },
+    { 26, 'i', "indentation"     , "Set indentation (negative value = tab)", OPT_ARGREQ },
+    { 28, 'e', "extra-data"      , "Add object end labels and size in asm output", OPT_NONE },
 };
 
 static const int optListN = sizeof(optList) / sizeof(optList[0]);
@@ -118,15 +119,15 @@
             exit(0);
             break;
 
-        case 1:
+        case 10:
             optObjName = optArg;
             break;
 
-        case 2:
+        case 12:
             optDataType = optArg;
             break;
 
-        case 3:
+        case 14:
             for (int i = 0; i < ndmFormatList; i++)
             {
                 const DMOutputFormat *fmt = &dmFormatList[i];
@@ -140,11 +141,11 @@
                 optArg);
             return FALSE;
 
-        case 4:
+        case 16:
             optAddLine = optArg;
             break;
 
-        case 5:
+        case 18:
             optLineLen = atoi(optArg);
             if (optLineLen < 1)
             {
@@ -154,24 +155,23 @@
             }
             break;
 
-
-        case 6:
+        case 20:
             optHexMode = TRUE;
             break;
 
-        case 7:
+        case 22:
             optQuiet = TRUE;
             break;
 
-        case 8:
+        case 24:
             optFormatting = FALSE;
             break;
 
-        case 9:
+        case 26:
             optIndentation = atoi(optArg);
             break;
 
-        case 10:
+        case 28:
             optExtraData = TRUE;
             break;
 
@@ -423,7 +423,7 @@
     int res;
 
     // Initialize
-    dmInitProg("data2inc", "Data to include converter", "0.7", NULL, NULL);
+    dmInitProg("data2inc", "Data to include file converter", "0.7", NULL, NULL);
     dmVerbosity = 0;
 
     // Parse arguments
--- a/tools/dumpmod.c	Mon Jan 13 21:16:57 2020 +0200
+++ b/tools/dumpmod.c	Mon Jan 13 21:21:25 2020 +0200
@@ -22,14 +22,15 @@
 
 static const DMOptArg optList[] =
 {
-    { 0, '?', "help",            "Show this help and exit", OPT_NONE },
-    { 1, 'p', "patterns",        "View patterns", OPT_NONE },
-    { 2, 'i', "instruments",     "View instruments", OPT_NONE },
-    { 3, 'e', "extinstruments",  "View extended instruments", OPT_NONE },
-    { 4, 'g', "general",         "General information", OPT_NONE },
-    { 5, 'v', "verbose",         "Be more verbose", OPT_NONE },
-    { 6, 'd', "dump",            "Dump mode", OPT_NONE },
-    { 7, 'a', "all",             "Dump all information (pat, ext, gen, inst)", OPT_NONE },
+    {  0, '?', "help"            , "Show this help", OPT_NONE },
+    {  2, 'v', "verbose"         , "Be more verbose", OPT_NONE },
+
+    { 10, 'p', "patterns"        , "View patterns", OPT_NONE },
+    { 12, 'i', "instruments"     , "View instruments", OPT_NONE },
+    { 14, 'e', "extinstruments"  , "View extended instruments", OPT_NONE },
+    { 16, 'g', "general"         , "General information", OPT_NONE },
+    { 18, 'd', "dump"            , "Dump mode", OPT_NONE },
+    { 20, 'a', "all"             , "Dump all information (pat, ext, gen, inst)", OPT_NONE },
 };
 
 const int optListN = sizeof(optList) / sizeof(optList[0]);
@@ -53,31 +54,31 @@
             exit(0);
             break;
 
-        case 1:
+        case 2:
+            dmVerbosity++;
+            break;
+
+        case 10:
             optViewPatterns = TRUE;
             break;
 
-        case 2:
+        case 12:
             optViewInstruments = TRUE;
             break;
 
-        case 3:
+        case 14:
             optViewExtInstruments = TRUE;
             break;
 
-        case 4:
+        case 16:
             optViewGeneralInfo = TRUE;
             break;
 
-        case 5:
-            dmVerbosity++;
-            break;
-
-        case 6:
+        case 18:
             optDump = TRUE;
             break;
 
-        case 7:
+        case 20:
             optViewPatterns = TRUE;
             optViewInstruments = TRUE;
             optViewGeneralInfo = TRUE;
--- a/tools/fanalyze.c	Mon Jan 13 21:16:57 2020 +0200
+++ b/tools/fanalyze.c	Mon Jan 13 21:21:25 2020 +0200
@@ -164,12 +164,13 @@
  */
 static const DMOptArg optList[] =
 {
-    {  0, '?', "help",        "Show this help", OPT_NONE },
-    {  1, 'v', "verbose",     "Be more verbose", OPT_NONE },
-    {  2, 'g', "grep",        "Binary grep <val>[,<val2>...][:<le|be>[8|16|32]]", OPT_ARGREQ },
-    {  3, 'o', "offset",      "Show data in offset <offs>[,<offs2>...][:<le|be>[8|16|32][d|x]]", OPT_ARGREQ },
-    {  4, 'm', "match",       "Find matching sequences minimum of <n> bytes long", OPT_NONE },
-    {  5, 'n', "minmatch",    "Minimum match sequence length", OPT_ARGREQ },
+    {  0, '?', "help"            , "Show this help", OPT_NONE },
+    {  2, 'v', "verbose"         , "Be more verbose", OPT_NONE },
+
+    { 10, 'g', "grep"            , "Binary grep <val>[,<val2>...][:<le|be>[8|16|32]]", OPT_ARGREQ },
+    { 12, 'o', "offset"          , "Show data in offset <offs>[,<offs2>...][:<le|be>[8|16|32][d|x]]", OPT_ARGREQ },
+    { 14, 'm', "match"           , "Find matching sequences minimum of <n> bytes long", OPT_NONE },
+    { 16, 'n', "minmatch"        , "Minimum match sequence length", OPT_ARGREQ },
 };
 
 static const int optListN = sizeof(optList) / sizeof(optList[0]);
@@ -483,8 +484,6 @@
 
 BOOL argHandleOpt(const int optN, char *optArg, char *currArg)
 {
-    (void) optArg;
-
     switch (optN)
     {
         case 0:
@@ -496,17 +495,17 @@
             dmVerbosity++;
             break;
 
-        case 2:
+        case 10:
             return argParseGrepValue(optArg, FA_GREP) == DMERR_OK;
 
-        case 3:
+        case 12:
             return argParseGrepValue(optArg, FA_OFFSET) == DMERR_OK;
 
-        case 4:
+        case 14:
             setMode = FA_MATCHES;
             break;
 
-        case 5:
+        case 16:
             optMinMatchLen = atoi(optArg);
             if (optMinMatchLen < 2 || optMinMatchLen > 16*1024)
             {
--- a/tools/fontconv.c	Mon Jan 13 21:16:57 2020 +0200
+++ b/tools/fontconv.c	Mon Jan 13 21:21:25 2020 +0200
@@ -24,33 +24,39 @@
 
 static const DMOptArg optList[] =
 {
-    {  0, '?', "help",     "Show this help", OPT_NONE },
-    {  1, 'v', "verbose",  "Be more verbose", OPT_NONE },
-    {  2, 's', "size",     "Set glyph dimensions (-s W:H or -s N) for image->font conversion", OPT_ARGREQ },
+    {  0, '?', "help"            , "Show this help", OPT_NONE },
+    {  2, 'v', "verbose"         , "Be more verbose", OPT_NONE },
+
+    { 10, 's', "size"            , "Set glyph dimensions (-s W:H or -s N) for image->font conversion", OPT_ARGREQ },
 #ifdef DM_GFX_TTF_TEXT
-    {  3, 'c', "color",    "TTF font rendering color (def: 0xFFFFFF)", OPT_ARGREQ },
-    {  4, 'b', "bpp",      "Render font in 8 or 32 bits per pixel (default 32)", OPT_ARGREQ },
+    { 12, 'c', "color"           , "TTF font rendering color (def: 0xFFFFFF)", OPT_ARGREQ },
+    { 14, 'b', "bpp"             , "Render font in 8 or 32 bits per pixel (default 32)", OPT_ARGREQ },
 #endif
 };
 
 const int optListN = sizeof(optList) / sizeof(optList[0]);
 
 
+void argShowHelp()
+{
+    dmPrintBanner(stdout, dmProgName,
+        "[options] <sourcefile.(ttf|fnt|dmf|png)> <outputfile.dmf>");
+
+    dmArgsPrintHelp(stdout, optList, optListN, 0, 80 - 2);
+    printf(
+    "\n"
+    "This utility can be used to convert TSFONT files to bitmap DMFONT (DMF)\n"
+    "files, render TrueType TTF to DMFONT at desired glyph resolution, or\n"
+    "cut a PNG (or JPEG) image to glyphs of desired size.\n");
+}
+
+
 BOOL argHandleOpt(const int optN, char *optArg, char *currArg)
 {
     switch (optN)
     {
         case 0:
-            dmPrintBanner(stdout, dmProgName,
-                "[options] <sourcefile.(ttf|fnt|dmf|png)> <outputfile.dmf>");
-
-            dmArgsPrintHelp(stdout, optList, optListN, 0, 80 - 2);
-            printf(
-            "\n"
-            "This utility can be used to convert TSFONT files to bitmap DMFONT (DMF)\n"
-            "files, render TrueType TTF to DMFONT at desired glyph resolution, or\n"
-            "cut a PNG (or JPEG) image to glyphs of desired size.\n");
-
+            argShowHelp();
             exit(0);
             break;
 
@@ -58,7 +64,7 @@
             dmVerbosity++;
             break;
 
-        case 2:
+        case 10:
             {
                 unsigned int fontW, fontH;
                 char *sep = strchr(optArg, ':');
@@ -103,7 +109,7 @@
             }
             break;
 
-        case 3:
+        case 12:
             {
                 unsigned int colR, colG, colB, colA = 100;
                 if (optArg[0] == '#' || optArg[0] == '$') optArg++;
@@ -125,7 +131,7 @@
             }
             break;
 
-        case 4:
+        case 14:
             if (sscanf(optArg, "%d", &optBPP) != 1)
             {
                 dmErrorMsg("Invalid argument for -b option, '%s'.\n",
--- a/tools/gfxconv.c	Mon Jan 13 21:16:57 2020 +0200
+++ b/tools/gfxconv.c	Mon Jan 13 21:21:25 2020 +0200
@@ -159,26 +159,27 @@
 
 static const DMOptArg optList[] =
 {
-    {  0, '?', "help",          "Show this help", OPT_NONE },
-    { 15, 'v', "verbose",       "Increase verbosity", OPT_NONE },
-    {  3, 'o', "output",        "Output filename", OPT_ARGREQ },
-    {  4, 's', "skip",          "Skip N bytes in input from start (negative value will be offset from input end)", OPT_ARGREQ },
-    {  1, 'i', "informat",      "Set input format (see --formats)", OPT_ARGREQ },
-    {  5, 'f', "format",        "Set output format (see --formats)", OPT_ARGREQ },
-    { 17, 'F', "formats",       "List supported input/output formats", OPT_NONE },
-    {  8, 'q', "sequential",    "Output sequential files (image output only)", OPT_NONE },
-    {  6, 'm', "colormap",      "Set color index mapping (see below for information)", OPT_ARGREQ },
-    {  7, 'n', "numitems",      "How many 'items' to output (default: all)", OPT_ARGREQ },
-    { 11, 'w', "width",         "Item width (number of items per row, min 1)", OPT_ARGREQ },
-    {  9, 'S', "scale",         "Scale output image by specified value(s) (see below)", OPT_ARGREQ },
-    { 12, 'P', "paletted",      "Use indexed/paletted output IF possible.", OPT_NONE },
-    { 13, 'N', "nplanes",       "# of bitplanes (some output formats)", OPT_ARGREQ },
-    { 18, 'B', "bpp",           "Bits per plane (some output formats)", OPT_ARGREQ },
-    { 14, 'I', "interleave",    "Interleaved/planar output (some output formats)", OPT_NONE },
-    { 20, 'C', "compress",      "Use compression -C <0-9>, 0 = disable, default is 9", OPT_ARGREQ },
-    { 16, 'R', "remap",         "Remap output image colors (-R <(#RRGGBB|index):index>[,<..>][+remove] | -R @map.txt[+remove])", OPT_ARGREQ },
-    { 21,   0, "char-rom",      "Set character ROM file to be used.", OPT_ARGREQ },
-    { 22, 'p', "palette" ,      "Set C64 palette to be used (see list with -p help).", OPT_ARGREQ },
+    {  0, '?', "help"            , "Show this help", OPT_NONE },
+    {  2, 'v', "verbose"         , "Be more verbose", OPT_NONE },
+
+    { 10, 'o', "output"          , "Output filename", OPT_ARGREQ },
+    { 12, 's', "skip"            , "Skip N bytes in input from start (negative value will be offset from input end)", OPT_ARGREQ },
+    { 14, 'i', "informat"        , "Set input format (see --formats)", OPT_ARGREQ },
+    { 16, 'f', "format"          , "Set output format (see --formats)", OPT_ARGREQ },
+    { 18, 'F', "formats"         , "List supported input/output formats", OPT_NONE },
+    { 20, 'q', "sequential"      , "Output sequential files (image output only)", OPT_NONE },
+    { 22, 'm', "colormap"        , "Set color index mapping (see below for information)", OPT_ARGREQ },
+    { 24, 'n', "numitems"        , "How many 'items' to output (default: all)", OPT_ARGREQ },
+    { 26, 'w', "width"           , "Item width (number of items per row, min 1)", OPT_ARGREQ },
+    { 28, 'S', "scale"           , "Scale output image by specified value(s) (see below)", OPT_ARGREQ },
+    { 30, 'P', "paletted"        , "Use indexed/paletted output IF possible.", OPT_NONE },
+    { 32, 'N', "nplanes"         , "# of bitplanes (some output formats)", OPT_ARGREQ },
+    { 34, 'B', "bpp"             , "Bits per plane (some output formats)", OPT_ARGREQ },
+    { 36, 'I', "interleave"      , "Interleaved/planar output (some output formats)", OPT_NONE },
+    { 38, 'C', "compress"        , "Use compression -C <0-9>, 0 = disable, default is 9", OPT_ARGREQ },
+    { 40, 'R', "remap"           , "Remap output image colors (-R <(#RRGGBB|index):index>[,<..>][+remove] | -R @map.txt[+remove])", OPT_ARGREQ },
+    { 42,   0, "char-rom"        , "Set character ROM file to be used.", OPT_ARGREQ },
+    { 44, 'p', "palette"         , "Set C64 palette to be used (see list with -p help).", OPT_ARGREQ },
 };
 
 static const int optListN = sizeof(optList) / sizeof(optList[0]);
@@ -681,16 +682,23 @@
             exit(0);
             break;
 
-        case 17:
-            argShowFormats();
-            exit(0);
-            break;
-
-        case 15:
+        case 2:
             dmVerbosity++;
             break;
 
-        case 1:
+        case 10:
+            optOutFilename = optArg;
+            break;
+
+        case 12:
+            if (!dmGetIntVal(optArg, &optInSkip, &optInSkipNeg))
+            {
+                dmErrorMsg("Invalid skip value argument '%s'.\n", optArg);
+                return FALSE;
+            }
+            break;
+
+        case 14:
             {
                 DMConvFormat fmt;
 
@@ -707,19 +715,7 @@
             }
             break;
 
-        case 3:
-            optOutFilename = optArg;
-            break;
-
-        case 4:
-            if (!dmGetIntVal(optArg, &optInSkip, &optInSkipNeg))
-            {
-                dmErrorMsg("Invalid skip value argument '%s'.\n", optArg);
-                return FALSE;
-            }
-            break;
-
-        case 5:
+        case 16:
             {
                 DMConvFormat fmt;
 
@@ -736,15 +732,24 @@
             }
             break;
 
-        case 6:
+        case 18:
+            argShowFormats();
+            exit(0);
+            break;
+
+        case 20:
+            optSequential = TRUE;
+            break;
+
+        case 22:
             {
-                int index, ncolors;
+                int ncolors;
                 if (!dmParseMapOptionString(optArg, optColorMap,
                     &ncolors, D64_NCOLORS, FALSE, "color index option"))
                     return FALSE;
 
                 dmMsg(1, "Set color index mapping: ");
-                for (index = 0; index < ncolors; index++)
+                for (int index = 0; index < ncolors; index++)
                 {
                     dmPrint(1, "[%d:%d]%s",
                         index, optColorMap[index],
@@ -754,7 +759,7 @@
             }
             break;
 
-        case 7:
+        case 24:
             if (!dmGetIntVal(optArg, &tmpUInt, NULL) ||
                 tmpUInt < 1)
             {
@@ -765,11 +770,18 @@
             optItemCount = tmpUInt;
             break;
 
-        case 8:
-            optSequential = TRUE;
+        case 26:
+            if (!dmGetIntVal(optArg, &tmpUInt, NULL) ||
+                tmpUInt < 1 || tmpUInt > 512)
+            {
+                dmErrorMsg("Invalid planed width value '%s' [1 .. 512]\n",
+                    optArg);
+                return FALSE;
+            }
+            optPlanedWidth = tmpUInt;
             break;
 
-        case 9:
+        case 28:
             {
                 BOOL error = FALSE;
                 unsigned int tmpUInt2;
@@ -836,22 +848,11 @@
             }
             break;
 
-        case 11:
-            if (!dmGetIntVal(optArg, &tmpUInt, NULL) ||
-                tmpUInt < 1 || tmpUInt > 512)
-            {
-                dmErrorMsg("Invalid planed width value '%s' [1 .. 512]\n",
-                    optArg);
-                return FALSE;
-            }
-            optPlanedWidth = tmpUInt;
-            break;
-
-        case 12:
+        case 30:
             optUsePalette = TRUE;
             break;
 
-        case 13:
+        case 32:
             if (!dmGetIntVal(optArg, &tmpUInt, NULL) ||
                 tmpUInt < 1 || tmpUInt > 8)
             {
@@ -862,7 +863,7 @@
             optSpec.nplanes = tmpUInt;
             break;
 
-        case 18:
+        case 34:
             if (!dmGetIntVal(optArg, &tmpUInt, NULL) ||
                 tmpUInt < 1 || tmpUInt > 32)
             {
@@ -873,43 +874,22 @@
             optSpec.bpp = tmpUInt;
             break;
 
-        case 14:
+        case 36:
             optSpec.planar = TRUE;
             break;
 
-        case 16:
-            if ((tmpStr = dm_strrcasecmp(optArg, "+remove")) != NULL)
-            {
-                optRemapRemove = TRUE;
-                *tmpStr = 0;
-            }
-
-            if (optArg[0] == '@')
+        case 38:
+            if (!dmGetIntVal(optArg, &tmpUInt, NULL) ||
+                tmpUInt > FCMP_BEST)
             {
-                if (optArg[1] != 0)
-                {
-                    int res;
-                    if ((res = dmParseColorRemapFile(optArg + 1,
-                        optRemapTable, &optNRemapTable, DM_MAX_COLORS)) != DMERR_OK)
-                        return FALSE;
-                }
-                else
-                {
-                    dmErrorMsg("No remap filename given.\n");
-                    return FALSE;
-                }
+                dmErrorMsg("Invalid compression setting '%s' [%d .. %d]\n",
+                    optArg, FCMP_NONE, FCMP_BEST);
+                return FALSE;
             }
-            else
-            {
-                if (!dmParseMapOptionString(optArg, optRemapTable,
-                    &optNRemapTable, DM_MAX_COLORS, TRUE, "color remap option"))
-                    return FALSE;
-            }
-
-            optRemapColors = TRUE;
+            optSpec.compression = tmpUInt;
             break;
 
-        case 19:
+        case 39:
             {
                 int tx0, ty0, tx1, ty1;
                 if (strcasecmp(optArg, "auto") == 0)
@@ -942,22 +922,43 @@
             }
             break;
 
-        case 20:
-            if (!dmGetIntVal(optArg, &tmpUInt, NULL) ||
-                tmpUInt > FCMP_BEST)
+        case 40:
+            if ((tmpStr = dm_strrcasecmp(optArg, "+remove")) != NULL)
+            {
+                optRemapRemove = TRUE;
+                *tmpStr = 0;
+            }
+
+            if (optArg[0] == '@')
             {
-                dmErrorMsg("Invalid compression setting '%s' [%d .. %d]\n",
-                    optArg, FCMP_NONE, FCMP_BEST);
-                return FALSE;
+                if (optArg[1] != 0)
+                {
+                    int res;
+                    if ((res = dmParseColorRemapFile(optArg + 1,
+                        optRemapTable, &optNRemapTable, DM_MAX_COLORS)) != DMERR_OK)
+                        return FALSE;
+                }
+                else
+                {
+                    dmErrorMsg("No remap filename given.\n");
+                    return FALSE;
+                }
             }
-            optSpec.compression = tmpUInt;
+            else
+            {
+                if (!dmParseMapOptionString(optArg, optRemapTable,
+                    &optNRemapTable, DM_MAX_COLORS, TRUE, "color remap option"))
+                    return FALSE;
+            }
+
+            optRemapColors = TRUE;
             break;
 
-        case 21:
+        case 42:
             optCharROMFilename = optArg;
             break;
 
-        case 22:
+        case 44:
             return argHandleC64PaletteOption(optArg, &optC64Palette, &optPaletteFile);
 
         default:
--- a/tools/mod2wav.c	Mon Jan 13 21:16:57 2020 +0200
+++ b/tools/mod2wav.c	Mon Jan 13 21:21:25 2020 +0200
@@ -64,22 +64,30 @@
 
 static const DMOptArg optList[] =
 {
-    {  0, '?', "help",     "Show this help", OPT_NONE },
-    {  2, 'v', "verbose",  "Be more verbose", OPT_NONE },
-    {  3, '1', "16bit",    "16-bit output", OPT_NONE },
-    {  4, '8', "8bit",     "8-bit output", OPT_NONE },
-    {  5, 'm', "mono",     "Mono output", OPT_NONE },
-    {  6, 's', "stereo",   "Stereo output", OPT_NONE },
-    {  7, 'f', "freq",     "Output frequency", OPT_ARGREQ },
-    {  8, 'M', "mute",     "Mute other channels than #", OPT_ARGREQ },
-    {  9, 'o', "order",    "Start from order #", OPT_ARGREQ },
-    { 10, 't', "time",     "Play for # seconds", OPT_ARGREQ },
-//    {10, 'l', "loop",    "Loop for # times", OPT_ARGREQ },
+    {  0, '?', "help"            , "Show this help", OPT_NONE },
+    {  2, 'v', "verbose"         , "Be more verbose", OPT_NONE },
+
+    { 10, '1', "16bit"           , "16-bit output", OPT_NONE },
+    { 12, '8', "8bit"            , "8-bit output", OPT_NONE },
+    { 14, 'm', "mono"            , "Mono output", OPT_NONE },
+    { 16, 's', "stereo"          , "Stereo output", OPT_NONE },
+    { 18, 'f', "freq"            , "Output frequency", OPT_ARGREQ },
+    { 20, 'M', "mute"            , "Mute other channels than #", OPT_ARGREQ },
+    { 22, 'o', "order"           , "Start from order #", OPT_ARGREQ },
+    { 24, 't', "time"            , "Play for # seconds", OPT_ARGREQ },
+//  { 26, 'l', "loop"            , "Loop for # times", OPT_ARGREQ },
 };
 
 const int optListN = sizeof(optList) / sizeof(optList[0]);
 
 
+void argShowHelp()
+{
+    dmPrintBanner(stdout, dmProgName, "[options] [sourcefile] [destfile.wav]");
+    dmArgsPrintHelp(stdout, optList, optListN, 0, 80 - 2);
+}
+
+
 BOOL argHandleOpt(const int optN, char *optArg, char *currArg)
 {
     (void) optArg;
@@ -87,10 +95,7 @@
     switch (optN)
     {
         case 0:
-            dmPrintBanner(stdout, dmProgName,
-                "[options] [sourcefile] [destfile.wav]");
-
-            dmArgsPrintHelp(stdout, optList, optListN, 0, 80 - 2);
+            argShowHelp();
             exit(0);
             break;
 
@@ -98,35 +103,35 @@
             dmVerbosity++;
             break;
 
-        case 3:
+        case 10:
             optOutFormat = JSS_AUDIO_S16;
             break;
 
-        case 4:
+        case 12:
             optOutFormat = JSS_AUDIO_U8;
             break;
 
-        case 5:
+        case 14:
             optOutChannels = JSS_AUDIO_MONO;
             break;
 
-        case 6:
+        case 16:
             optOutChannels = JSS_AUDIO_STEREO;
             break;
 
-        case 7:
+        case 18:
             optOutFreq = atoi(optArg);
             break;
 
-        case 8:
+        case 20:
             optMuteOChannels = atoi(optArg);
             break;
 
-        case 9:
+        case 22:
             optStartOrder = atoi(optArg);
             break;
 
-        case 10:
+        case 24:
             optPlayTime = atoi(optArg);
             optUsePlayTime = TRUE;
             break;
--- a/tools/packed.c	Mon Jan 13 21:16:57 2020 +0200
+++ b/tools/packed.c	Mon Jan 13 21:21:25 2020 +0200
@@ -53,12 +53,13 @@
 
 static const DMOptArg optList[] =
 {
-    {  0, '?', "help",        "Show this help", OPT_NONE },
-    {  1, 'n', "nocompress",  "No compression / decompression", OPT_NONE },
-    {  2, 'C', "level",       "Set zlib compression level 1-9", OPT_ARGREQ },
-    {  3, 'v', "verbose",     "Increase verbosity", OPT_NONE },
-    {  4, 'f', "resflags",    "Set default resource flags (-f 0xff)", OPT_ARGREQ },
-    {  5, 'x', "exclude",     "Exclude name/glob pattern", OPT_ARGREQ },
+    {  0, '?', "help"            , "Show this help", OPT_NONE },
+    {  2, 'v', "verbose"         , "Be more verbose", OPT_NONE },
+
+    {  3, 'n', "nocompress"      , "No compression / decompression", OPT_NONE },
+    {  4, 'C', "level"           , "Set zlib compression level 1-9", OPT_ARGREQ },
+    {  5, 'f', "resflags"        , "Set default resource flags (-f 0xff)", OPT_ARGREQ },
+    {  6, 'x', "exclude"         , "Exclude name/glob pattern", OPT_ARGREQ },
 };
 
 static const int optListN = sizeof(optList) / sizeof(optList[0]);
@@ -102,11 +103,15 @@
             exit(0);
             break;
 
-        case 1:
+        case 2:
+            dmVerbosity++;
+            break;
+
+        case 3:
             optDoCompress = FALSE;
             break;
 
-        case 2:
+        case 4:
             optCompressLevel = atoi(optArg);
             if (optCompressLevel < 1 || optCompressLevel > 9)
             {
@@ -115,11 +120,7 @@
             }
             break;
 
-        case 3:
-            dmVerbosity++;
-            break;
-
-        case 4:
+        case 5:
             {
                 unsigned int tmpUI;
                 if (!dmGetIntVal(optArg, &tmpUI, NULL))
@@ -131,7 +132,7 @@
             }
             break;
 
-        case 5:
+        case 6:
             if (nexcFilenames < SET_MAX_FILES)
             {
                 excFilenames[nexcFilenames++] = optArg;
@@ -648,7 +649,7 @@
     DMPackFile *pack = NULL;
 
     // Parse arguments
-    dmInitProg("packed", "Pack File Editor", "0.7", NULL, NULL);
+    dmInitProg("packed", "TNSP Pack File Editor", "0.7", NULL, NULL);
     dmVerbosity = 0;
 
     if (!dmArgsProcess(argc, argv, optList, optListN,
--- a/tools/ppl.c	Mon Jan 13 21:16:57 2020 +0200
+++ b/tools/ppl.c	Mon Jan 13 21:21:25 2020 +0200
@@ -68,21 +68,22 @@
 
 static const DMOptArg optList[] =
 {
-    {  0, '?', "help",     "Show this help", OPT_NONE },
-    {  1, 'v', "verbose",  "Be more verbose", OPT_NONE },
-    {  2,   0, "fs",       "Fullscreen", OPT_NONE },
-    { 12, 'C', "cli",      "Do not open GUI window", OPT_NONE },
-    {  3, 'w', "window",   "Initial window size/resolution -w 640x480", OPT_ARGREQ },
+    {  0, '?', "help"            , "Show this help", OPT_NONE },
+    {  2, 'v', "verbose"         , "Be more verbose", OPT_NONE },
+
+    { 10,   0, "fs"              , "Fullscreen", OPT_NONE },
+    { 12, 'C', "cli"             , "Do not open GUI window", OPT_NONE },
+    { 14, 'w', "window"          , "Initial window size/resolution -w 640x480", OPT_ARGREQ },
 
-    {  4, '1', "16bit",    "16-bit output", OPT_NONE },
-    {  5, '8', "8bit",     "8-bit output", OPT_NONE },
-    {  6, 'm', "mono",     "Mono output", OPT_NONE },
-    {  7, 's', "stereo",   "Stereo output", OPT_NONE },
-    {  8, 'f', "freq",     "Output frequency", OPT_ARGREQ },
+    { 16, '1', "16bit"           , "16-bit output", OPT_NONE },
+    { 18, '8', "8bit"            , "8-bit output", OPT_NONE },
+    { 20, 'm', "mono"            , "Mono output", OPT_NONE },
+    { 22, 's', "stereo"          , "Stereo output", OPT_NONE },
+    { 24, 'f', "freq"            , "Output frequency", OPT_ARGREQ },
 
-    {  9, 'M', "mute",     "Mute other channels than #", OPT_ARGREQ },
-    { 10, 'o', "order",    "Start from order #", OPT_ARGREQ },
-    { 11, 't', "time",     "Play for # seconds", OPT_ARGREQ },
+    { 28, 'M', "mute"            , "Mute other channels than #", OPT_ARGREQ },
+    { 30, 'o', "order"           , "Start from order #", OPT_ARGREQ },
+    { 32, 't', "time"            , "Play for # seconds", OPT_ARGREQ },
 };
 
 const int optListN = sizeof(optList) / sizeof(optList[0]);
@@ -97,21 +98,26 @@
 
 BOOL argHandleOpt(const int optN, char *optArg, char *currArg)
 {
-    switch (optN) {
+    switch (optN)
+    {
         case 0:
             argShowHelp();
             exit(0);
             break;
 
-        case 1:
+        case 2:
             dmVerbosity++;
             break;
 
-        case 2:
+        case 10:
             eng.optVFlags |= SDL_WINDOW_FULLSCREEN_DESKTOP;
             break;
 
-        case 3:
+        case 12:
+            optUseGUI = FALSE;
+            break;
+
+        case 14:
             {
                 int w, h;
                 if (sscanf(optArg, "%dx%d", &w, &h) == 2)
@@ -132,43 +138,39 @@
             }
             break;
 
-        case 4:
+        case 16:
             optOutFormat = JSS_AUDIO_S16;
             break;
 
-        case 5:
+        case 18:
             optOutFormat = JSS_AUDIO_U8;
             break;
 
-        case 6:
+        case 20:
             optOutChannels = JSS_AUDIO_MONO;
             break;
 
-        case 7:
+        case 22:
             optOutChannels = JSS_AUDIO_STEREO;
             break;
 
-        case 8:
+        case 24:
             optOutFreq = atoi(optArg);
             break;
 
-        case 9:
+        case 28:
             optMuteOChannels = atoi(optArg);
             break;
 
-        case 10:
+        case 30:
             optStartOrder = atoi(optArg);
             break;
 
-        case 11:
+        case 32:
             optPlayTime = atoi(optArg);
             optUsePlayTime = TRUE;
             break;
 
-        case 12:
-            optUseGUI = FALSE;
-            break;
-
         default:
             dmErrorMsg("Unimplemented option argument '%s'.\n", currArg);
             return FALSE;
--- a/tools/xm2jss.c	Mon Jan 13 21:16:57 2020 +0200
+++ b/tools/xm2jss.c	Mon Jan 13 21:21:25 2020 +0200
@@ -47,16 +47,17 @@
 
 static const DMOptArg optList[] =
 {
-    { 0, '?', "help",           "Show this help", OPT_NONE },
-    { 1, 'v', "verbose",        "Be more verbose", OPT_NONE },
-    { 2, 'i', "ignore",         "Ignore errors", OPT_NONE },
-    { 3, 'p', "patterns",       "Pattern storage mode", OPT_ARGREQ },
-    { 4, 'E', "strip-ext-instr","Strip ext. instruments (implies -I -S)", OPT_NONE },
-    { 5, 'I', "strip-instr",    "Strip instruments (implies -S)", OPT_NONE },
-    { 6, 'S', "strip-samples",  "Strip instr. sampledata", OPT_NONE },
-    { 7, '8', "smode8",         "8-bit sample conversion flags", OPT_ARGREQ },
-    { 8, '1', "smode16",        "16-bit sample conversion flags", OPT_ARGREQ },
-    { 9, 'O', "optimize",       "Optimize module", OPT_NONE },
+    {  0, '?', "help"            , "Show this help", OPT_NONE },
+    {  2, 'v', "verbose"         , "Be more verbose", OPT_NONE },
+
+    { 10, 'i', "ignore"          , "Ignore errors", OPT_NONE },
+    { 12, 'p', "patterns"        , "Pattern storage mode", OPT_ARGREQ },
+    { 14, 'E', "strip-ext-instr" , "Strip ext. instruments (implies -I -S)", OPT_NONE },
+    { 16, 'I', "strip-instr"     , "Strip instruments (implies -S)", OPT_NONE },
+    { 18, 'S', "strip-samples"   , "Strip instr. sampledata", OPT_NONE },
+    { 20, '8', "smode8"          , "8-bit sample conversion flags", OPT_ARGREQ },
+    { 22, '1', "smode16"         , "16-bit sample conversion flags", OPT_ARGREQ },
+    { 24, 'O', "optimize"        , "Optimize module", OPT_NONE },
 };
 
 const int optListN = sizeof(optList) / sizeof(optList[0]);
@@ -86,44 +87,43 @@
 
 BOOL argHandleOpt(const int optN, char *optArg, char *currArg)
 {
-    (void) optArg;
-
     switch (optN)
     {
-    case 0:
-        argShowHelp();
-        exit(0);
-        break;
+        case 0:
+            argShowHelp();
+            exit(0);
+            break;
+
 
-    case 1:
-        dmVerbosity++;
-        break;
+        case 2:
+            dmVerbosity++;
+            break;
 
-    case 2:
-        optIgnoreErrors = TRUE;
-        break;
+        case 10:
+            optIgnoreErrors = TRUE;
+            break;
 
-    case 3:
-        optPatternMode = atoi(optArg);
-        if (optPatternMode <= 0 || optPatternMode >= PATMODE_LAST)
-        {
-            dmErrorMsg("Unknown pattern conversion mode %d\n", optPatternMode);
-            return FALSE;
-        }
-        break;
+        case 12:
+            optPatternMode = atoi(optArg);
+            if (optPatternMode <= 0 || optPatternMode >= PATMODE_LAST)
+            {
+                dmErrorMsg("Unknown pattern conversion mode %d\n", optPatternMode);
+                return FALSE;
+            }
+            break;
 
-    case 4: optStripExtInstr = TRUE; break;
-    case 5: optStripInstr = TRUE; break;
-    case 6: optStripSamples = TRUE; break;
+        case 14: optStripExtInstr = TRUE; break;
+        case 16: optStripInstr = TRUE; break;
+        case 18: optStripSamples = TRUE; break;
 
-    case 7: optSampMode8 = atoi(optArg) & JM_SAMPLE_MODE_MASK; break;
-    case 8: optSampMode16 = atoi(optArg) & JM_SAMPLE_MODE_MASK; break;
+        case 20: optSampMode8 = atoi(optArg) & JM_SAMPLE_MODE_MASK; break;
+        case 22: optSampMode16 = atoi(optArg) & JM_SAMPLE_MODE_MASK; break;
 
-    case 9: optOptimize = TRUE; break;
+        case 24: optOptimize = TRUE; break;
 
-    default:
-        dmErrorMsg("Unimplemented option argument '%s'.\n", currArg);
-        return FALSE;
+        default:
+            dmErrorMsg("Unimplemented option argument '%s'.\n", currArg);
+            return FALSE;
     }
 
     return TRUE;