/***************************************************************************** * pce * *****************************************************************************/ /***************************************************************************** * File name: src/utils/pti/main.c * * Created: 2020-04-25 by Hampa Hug * * Copyright: (C) 2020-2023 Hampa Hug * *****************************************************************************/ /***************************************************************************** * This program is free software. You can redistribute it and / or modify it * * under the terms of the GNU General Public License version 2 as published * * by the Free Software Foundation. * * * * This program is distributed in the hope that it will be useful, but * * WITHOUT ANY WARRANTY, without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * * Public License for more details. * *****************************************************************************/ #include "main.h" #include "comment.h" #include "ops.h" #include #include #include #include #include #include int pti_info (pti_img_t *img); const char *arg0 = NULL; int par_verbose = 0; int par_print_info = 0; unsigned par_fmt_inp = PTI_FORMAT_NONE; unsigned par_fmt_out = PTI_FORMAT_NONE; unsigned long par_default_clock = PTI_CLOCK_C64_PAL; static pce_option_t opts[] = { { '?', 0, "help", NULL, "Print usage information" }, { 'c', 1, "default-clock","clock", "Set the default clock [c64-pal]" }, { 'f', 0, "info", NULL, "Print image information [no]" }, { 'i', 1, "input", "filename", "Load an input file" }, { 'I', 1, "input-format", "format", "Set the input format [auto]" }, { 'm', 1, "cat", "filename", "Concatenate an image" }, { 'o', 1, "output", "filename", "Set the output file name [none]" }, { 'O', 1, "output-format", "format", "Set the output format [auto]" }, { 'p', 1, "operation", "name [...]", "Perform an operation" }, { 's', 2, "set", "par val", "Set a parameter value" }, { 'v', 0, "verbose", NULL, "Verbose operation [no]" }, { 'V', 0, "version", NULL, "Print version information" }, { -1, 0, NULL, NULL, NULL } }; static void print_help (void) { pce_getopt_help ( "pti: convert and modify PCE Tape Image files", "usage: pti [options] [input] [options] [output]", opts ); fputs ( "\n" "operations are:\n" " cat Add an image to the end of the current image\n" " comment-add text Add to the image comment\n" " comment-load filename Load the image comment from a file\n" " comment-print Print the image comment\n" " comment-save filename Save the image comment to a file\n" " comment-set text Set the image comment\n" " duty-cycle Adjust the duty cycles\n" " decode Decode tracks\n" " encode Encode a file\n" " fix-clock Set the sample clock without modifying the image\n" " info Print image information\n" " invert Invert the amplitude\n" " new Create a new image\n" " scale Scale the image by a factor\n" " set-clock Set the sample clock rate\n" " space-add-left