Mercurial > hg > dmlib
diff tools/lib64util.c @ 2242:65a2c2e99c81
Move listing of C64 formats function to argShowC64Formats in lib64util.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Sat, 15 Jun 2019 07:55:26 +0300 |
parents | e2c6af0c9431 |
children | b26e37e7cbe6 |
line wrap: on
line diff
--- a/tools/lib64util.c Sat Jun 15 07:54:39 2019 +0300 +++ b/tools/lib64util.c Sat Jun 15 07:55:26 2019 +0300 @@ -114,6 +114,43 @@ } +void argShowC64Formats(FILE *fp, const BOOL rw) +{ + fprintf(fp, + "Available C64 bitmap formats (-f <frmt>):\n" + " frmt %s| Type | Description\n" + "------%s+-----------------+-------------------------------------\n", + rw ? "| RW " : "", + rw ? "+----" : "" + ); + + for (int i = 0; i < ndmC64ImageFormats; i++) + { + const DMC64ImageFormat *fmt = dmC64ImageFormatsSorted[i]; + char buf[64]; + + fprintf(fp, "%-6s", + fmt->fext); + + if (rw) + { + fprintf(fp, "| %c%c ", + (fmt->flags & DM_FMT_RD) ? 'R' : ' ', + (fmt->flags & DM_FMT_WR) ? 'W' : ' ' + ); + } + + fprintf(fp, + "| %-15s | %s%s\n", + dmC64GetImageTypeString(buf, sizeof(buf), fmt->format->type, FALSE), + fmt->name, + fmt->flags & DM_FMT_BROKEN ? " [BROKEN]" : ""); + } + + fprintf(fp, "%d formats supported.\n", ndmC64ImageFormats); +} + + BOOL argHandleC64PaletteOption(char *optArg, DMC64Palette **ppal, char **palFile) { if (strcasecmp(optArg, "help") == 0 ||