# HG changeset patch # User Matti Hamalainen # Date 1526148106 -10800 # Node ID 3b613fcbf3ff7b2f0bce034d7475d5e8626c0821 # Parent 48823642c4fb75fa7386665b2354152a2b2abdd7 Improve how format read/write capabilities are marked and shown. diff -r 48823642c4fb -r 3b613fcbf3ff tools/gfxconv.c --- a/tools/gfxconv.c Sat May 12 21:00:22 2018 +0300 +++ b/tools/gfxconv.c Sat May 12 21:01:46 2018 +0300 @@ -49,7 +49,7 @@ { char *name; // Descriptive name of the format char *fext; // File extension - BOOL in, out; // Can read/write? + int flags; // DM_FMT_* flags, see libgfx.h int format; // Format identifier int subformat; // Subformat identifier } DMConvFormat; @@ -57,52 +57,17 @@ static DMConvFormat convFormatList[] = { - { - "ASCII text", "asc", FALSE, TRUE, - FFMT_ASCII , 0, - }, - { - "ANSI colored text", "ansi", FALSE, TRUE, - FFMT_ANSI , 0, - }, - { - "PNG image file", "png", TRUE, TRUE, - FFMT_IMAGE , DM_IMGFMT_PNG, - }, - { - "PPM image file", "ppm", FALSE, TRUE, - FFMT_IMAGE , DM_IMGFMT_PPM, - }, - { - "PCX image file", "pcx", TRUE, TRUE, - FFMT_IMAGE , DM_IMGFMT_PCX, - }, - { - "IFF ILBM file", "lbm", TRUE, FALSE, - FFMT_IMAGE , DM_IMGFMT_ILBM, - }, - { - "Bitplaned RAW (intl/non-intl) image file", "raw", FALSE, TRUE, - FFMT_IMAGE , DM_IMGFMT_RAW, - }, - { - "IFFMaster RAW image file", "araw", FALSE, TRUE, - FFMT_IMAGE , DM_IMGFMT_ARAW, - }, - - { - "C64 bitmap image file", NULL, TRUE, TRUE, - FFMT_BITMAP , -1, - }, - - { - "C64 character/font data", "chr", TRUE, TRUE, - FFMT_CHAR , 0 - }, - { - "C64 sprite data", "spr", TRUE, TRUE, - FFMT_SPRITE , 0 - }, + { "ASCII text" , "asc" , DM_FMT_WR , FFMT_ASCII , 0 }, + { "ANSI colored text" , "ansi" , DM_FMT_WR , FFMT_ANSI , 0 }, + { "PNG image" , "png" , DM_FMT_RDWR , FFMT_IMAGE , DM_IMGFMT_PNG }, + { "PPM image" , "ppm" , DM_FMT_WR , FFMT_IMAGE , DM_IMGFMT_PPM }, + { "PCX image" , "pcx" , DM_FMT_RDWR , FFMT_IMAGE , DM_IMGFMT_PCX }, + { "IFF ILBM" , "lbm" , DM_FMT_RD , FFMT_IMAGE , DM_IMGFMT_ILBM }, + { "Bitplaned RAW (intl/non-intl) image" , "raw" , DM_FMT_WR , FFMT_IMAGE , DM_IMGFMT_RAW }, + { "IFFMaster RAW image" , "araw" , DM_FMT_WR , FFMT_IMAGE , DM_IMGFMT_ARAW }, + { "C64 bitmap image" , NULL , DM_FMT_RDWR , FFMT_BITMAP , -1 }, + { "C64 character/font data" , "chr" , DM_FMT_RDWR , FFMT_CHAR , 0 }, + { "C64 sprite data" , "spr" , DM_FMT_RDWR , FFMT_SPRITE , 0 }, }; static const int nconvFormatList = sizeof(convFormatList) / sizeof(convFormatList[0]); @@ -180,20 +145,19 @@ void argShowFormats() { - printf( - "Available input/output formats:\n" - " Ext | I | O | Description\n" - "------+---+---+-----------------------------------------------\n" + "Available input/output formats (-f ):\n" + " frmt | RW | Description\n" + "------+----+-------------------------------------------------------\n" ); for (int i = 0; i < nconvFormatList; i++) { - DMConvFormat *fmt = &convFormatList[i]; - printf("%-5s | %c | %c | %s\n", + const DMConvFormat *fmt = &convFormatList[i]; + printf("%-5s | %c%c | %s\n", fmt->fext ? fmt->fext : "", - fmt->in ? 'X' : ' ', - fmt->out ? 'X' : ' ', + (fmt->flags & DM_FMT_RD) ? 'R' : ' ', + (fmt->flags & DM_FMT_WR) ? 'W' : ' ', fmt->name); } @@ -201,17 +165,19 @@ "\n" "(Not all input->output combinations are actually supported.)\n" "\n" - "Available bitmap formats (-f ):\n" - " bfrm | Type | Description\n" - "------+-----------------+-------------------------------------\n" + "Available C64 bitmap formats (-f ):\n" + " frmt | RW | Type | Description\n" + "------+----+-----------------+-------------------------------------\n" ); for (int i = 0; i < ndmC64ImageFormats; i++) { const DMC64ImageFormat *fmt = &dmC64ImageFormats[i]; char buf[64]; - printf("%-5s | %-15s | %s\n", + printf("%-5s | %c%c | %-15s | %s\n", fmt->fext, + (fmt->flags & DM_FMT_RD) ? 'R' : ' ', + (fmt->flags & DM_FMT_WR) ? 'W' : ' ', dmC64GetImageTypeString(buf, sizeof(buf), fmt->type, FALSE), fmt->name); } diff -r 48823642c4fb -r 3b613fcbf3ff tools/lib64fmts.c --- a/tools/lib64fmts.c Sat May 12 21:00:22 2018 +0300 +++ b/tools/lib64fmts.c Sat May 12 21:01:46 2018 +0300 @@ -507,7 +507,7 @@ const DMC64ImageFormat dmC64ImageFormats[] = { { - D64_FMT_MC, "d2p", "DrazPaint 1.4/2.0 (packed)", 0x5800, 0, + D64_FMT_MC, "d2p", "DrazPaint 1.4/2.0 (packed)", 0x5800, 0, DM_FMT_RDWR, C64_SCR_WIDTH / 2, C64_SCR_HEIGHT, C64_SCR_CH_WIDTH , C64_SCR_CH_HEIGHT, fmtProbeDrazPaint20Packed, @@ -524,7 +524,7 @@ }, { - D64_FMT_MC, "drp", "DrazPaint (unpacked)", 0x5800, 10051, + D64_FMT_MC, "drp", "DrazPaint (unpacked)", 0x5800, 10051, DM_FMT_RDWR, C64_SCR_WIDTH / 2, C64_SCR_HEIGHT, C64_SCR_CH_WIDTH , C64_SCR_CH_HEIGHT, NULL, @@ -541,7 +541,7 @@ }, { - D64_FMT_MC | D64_FMT_ILACE, "dlp", "DrazLace 1.0 (packed)", 0x5800, 0, + D64_FMT_MC | D64_FMT_ILACE, "dlp", "DrazLace 1.0 (packed)", 0x5800, 0, DM_FMT_RDWR, C64_SCR_WIDTH , C64_SCR_HEIGHT, C64_SCR_CH_WIDTH, C64_SCR_CH_HEIGHT, fmtProbeDrazLace10Packed, @@ -561,7 +561,7 @@ }, { - D64_FMT_MC | D64_FMT_ILACE, "drl", "DrazLace 1.0 (unpacked)", 0x5800, 18242, + D64_FMT_MC | D64_FMT_ILACE, "drl", "DrazLace 1.0 (unpacked)", 0x5800, 18242, DM_FMT_RDWR, C64_SCR_WIDTH , C64_SCR_HEIGHT, C64_SCR_CH_WIDTH, C64_SCR_CH_HEIGHT, NULL, @@ -581,7 +581,7 @@ }, { - D64_FMT_MC | D64_FMT_ILACE, "mci", "Truepaint (unpacked)", 0x9c00, 19434, + D64_FMT_MC | D64_FMT_ILACE, "mci", "Truepaint (unpacked)", 0x9c00, 19434, DM_FMT_RD, C64_SCR_WIDTH , C64_SCR_HEIGHT, C64_SCR_CH_WIDTH, C64_SCR_CH_HEIGHT, NULL, @@ -601,7 +601,7 @@ }, { - D64_FMT_MC, "kla", "Koala Paint (unpacked)", 0x6000, 10003, + D64_FMT_MC, "kla", "Koala Paint (unpacked)", 0x6000, 10003, DM_FMT_RDWR, C64_SCR_WIDTH / 2, C64_SCR_HEIGHT, C64_SCR_CH_WIDTH , C64_SCR_CH_HEIGHT, NULL, @@ -618,7 +618,7 @@ }, { - D64_FMT_MC, "ocp", "Advanced Art Studio (unpacked)", 0x2000, 10018, + D64_FMT_MC, "aas", "Advanced Art Studio (unpacked)", 0x2000, 10018, DM_FMT_RDWR, C64_SCR_WIDTH / 2, C64_SCR_HEIGHT, C64_SCR_CH_WIDTH , C64_SCR_CH_HEIGHT, NULL, @@ -635,7 +635,7 @@ }, { - D64_FMT_MC, "ami", "Amica Paint (packed)", 0x4000, 0, + D64_FMT_MC, "ami", "Amica Paint (packed)", 0x4000, 0, DM_FMT_RDWR, C64_SCR_WIDTH / 2, C64_SCR_HEIGHT, C64_SCR_CH_WIDTH , C64_SCR_CH_HEIGHT, fmtProbeAmicaPaintPacked, @@ -652,7 +652,7 @@ }, { - D64_FMT_MC, "rpm", "Run Paint (unpacked)", 0x6000, 10006, + D64_FMT_MC, "rpm", "Run Paint (unpacked)", 0x6000, 10006, DM_FMT_RDWR, C64_SCR_WIDTH / 2, C64_SCR_HEIGHT, C64_SCR_CH_WIDTH , C64_SCR_CH_HEIGHT, NULL, @@ -669,7 +669,7 @@ }, { - D64_FMT_HIRES, "art", "Art Studio (unpacked)", 0x2000, 9009, + D64_FMT_HIRES, "art", "Art Studio (unpacked)", 0x2000, 9009, DM_FMT_RD, C64_SCR_WIDTH , C64_SCR_HEIGHT, C64_SCR_CH_WIDTH , C64_SCR_CH_HEIGHT, NULL, @@ -684,7 +684,7 @@ }, { - D64_FMT_HIRES, "iph", "Interpaint (unpacked)", 0x4000, 9002, + D64_FMT_HIRES, "iph", "Interpaint (unpacked)", 0x4000, 9002, DM_FMT_RD, C64_SCR_WIDTH , C64_SCR_HEIGHT, C64_SCR_CH_WIDTH, C64_SCR_CH_HEIGHT, NULL, @@ -699,7 +699,7 @@ }, { - D64_FMT_MC, "ipc", "Interpaint MC (unpacked)", 0x4000, 10003, + D64_FMT_MC, "ipc", "Interpaint MC (unpacked)", 0x4000, 10003, DM_FMT_RDWR, C64_SCR_WIDTH / 2, C64_SCR_HEIGHT, C64_SCR_CH_WIDTH, C64_SCR_CH_HEIGHT, NULL, @@ -716,7 +716,7 @@ }, { - D64_FMT_HIRES, "dd", "Doodle (unpacked)", 0x1c00, 9218, + D64_FMT_HIRES, "dd", "Doodle (unpacked)", 0x1c00, 9218, DM_FMT_RDWR, C64_SCR_WIDTH , C64_SCR_HEIGHT, C64_SCR_CH_WIDTH, C64_SCR_CH_HEIGHT, NULL, @@ -731,7 +731,7 @@ }, { - D64_FMT_MC | D64_FMT_FLI, "bml", "Blackmail FLI (unpacked)", 0x3b00, 17474, + D64_FMT_MC | D64_FMT_FLI, "bml", "Blackmail FLI (unpacked)", 0x3b00, 17474, DM_FMT_RDWR, C64_SCR_WIDTH / 2, C64_SCR_HEIGHT, C64_SCR_CH_WIDTH , C64_SCR_CH_HEIGHT, NULL, @@ -748,7 +748,7 @@ }, { - D64_FMT_MC | D64_FMT_FLI, "fli", "FLI Designer (unpacked)", 0, 17409, + D64_FMT_MC | D64_FMT_FLI, "fli", "FLI Designer (unpacked)", 0, 17409, DM_FMT_RD, C64_SCR_WIDTH / 2, C64_SCR_HEIGHT, C64_SCR_CH_WIDTH , C64_SCR_CH_HEIGHT, fmtProbeFLIDesigner, @@ -764,7 +764,7 @@ }, { - D64_FMT_MC, "xx1", "Unknown $2000 format (unpacked)", 0x2000, 10242, + D64_FMT_MC, "xx1", "Unknown $2000 format (unpacked)", 0x2000, 10242, DM_FMT_RD, C64_SCR_WIDTH / 2, C64_SCR_HEIGHT, C64_SCR_CH_WIDTH , C64_SCR_CH_HEIGHT, NULL, @@ -786,7 +786,7 @@ #define XX2_BSIZE (XX2_SIZE * 8) { - D64_FMT_MC, "xx2", "Unknown $2000 format (unpacked)", 0x2000, 0, + D64_FMT_MC, "xx2", "Unknown $2000 format (unpacked)", 0x2000, 0, DM_FMT_RD, XX2_WIDTH_CH * 4, XX2_HEIGHT_CH * 8, XX2_WIDTH_CH , XX2_HEIGHT_CH, fmtProbeFormatXX2, @@ -803,7 +803,8 @@ }, { - D64_FMT_MC | D64_FMT_FLI | D64_FMT_ILACE, "fp2", "FunPaint II (unpacked)", 0x3ff0, 33694, + D64_FMT_MC | D64_FMT_FLI | D64_FMT_ILACE, + "fp2", "FunPaint II (unpacked)", 0x3ff0, 33694, DM_FMT_RD, C64_SCR_WIDTH, C64_SCR_HEIGHT, C64_SCR_CH_WIDTH , C64_SCR_CH_HEIGHT, fmtProbeFunPaint2Unpacked, @@ -823,7 +824,8 @@ }, { - D64_FMT_MC | D64_FMT_FLI | D64_FMT_ILACE, "fp2p", "FunPaint II (packed)", 0x3ff0, 0, + D64_FMT_MC | D64_FMT_FLI | D64_FMT_ILACE, + "fp2p", "FunPaint II (packed)", 0x3ff0, 0, DM_FMT_RD, C64_SCR_WIDTH, C64_SCR_HEIGHT, C64_SCR_CH_WIDTH , C64_SCR_CH_HEIGHT, fmtProbeFunPaint2Packed, @@ -843,7 +845,8 @@ }, { - D64_FMT_MC | D64_FMT_FLI | D64_FMT_ILACE, "gun", "GunPaint (unpacked)", 0x4000, 0, + D64_FMT_MC | D64_FMT_FLI | D64_FMT_ILACE, + "gun", "GunPaint (unpacked)", 0x4000, 0, DM_FMT_RD, C64_SCR_WIDTH, C64_SCR_HEIGHT, C64_SCR_CH_WIDTH , C64_SCR_CH_HEIGHT, fmtProbeGunPaint, @@ -863,7 +866,8 @@ }, { - D64_FMT_HIRES | D64_FMT_FLI, "chi", "Crest Hires FLI Designer (unpacked)", 0x4000, 16386, + D64_FMT_HIRES | D64_FMT_FLI, + "chi", "Crest Hires FLI Designer (unpacked)", 0x4000, 16386, DM_FMT_RD, C64_SCR_WIDTH, 14 * 8, C64_SCR_CH_WIDTH , 14, NULL, diff -r 48823642c4fb -r 3b613fcbf3ff tools/lib64gfx.h --- a/tools/lib64gfx.h Sat May 12 21:00:22 2018 +0300 +++ b/tools/lib64gfx.h Sat May 12 21:01:46 2018 +0300 @@ -179,6 +179,8 @@ size_t addr; // Loading address (0 if no loading address) size_t size; // Size, including loading address. Only used in probing and encoding. + int flags; // DM_FMT_* flags, see libgfx.h + int width, height; // Width and height in pixels int chWidth, chHeight; // Width and height in charblocks diff -r 48823642c4fb -r 3b613fcbf3ff tools/libgfx.h --- a/tools/libgfx.h Sat May 12 21:00:22 2018 +0300 +++ b/tools/libgfx.h Sat May 12 21:01:46 2018 +0300 @@ -57,6 +57,15 @@ }; +// Flags for readability/writeability of formats +enum +{ + DM_FMT_WR = 0x0001, + DM_FMT_RD = 0x0002, + DM_FMT_RDWR = (DM_FMT_RD | DM_FMT_WR), +}; + + // Bitmapped image struct typedef struct {