1 /*
2 * raster-cmdline-options.c - Raster-based video chip emulation helper,
3 * command line options.
4 *
5 * Written by
6 * Andreas Boose <viceteam@t-online.de>
7 *
8 * This file is part of VICE, the Versatile Commodore Emulator.
9 * See README for copyright notice.
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
24 * 02111-1307 USA.
25 *
26 */
27
28 #include "vice.h"
29
30 #include <stdio.h>
31
32 #include "cmdline.h"
33 #include "lib.h"
34 #include "machine.h"
35 #include "raster-cmdline-options.h"
36 #include "util.h"
37 #include "video.h"
38
39 static const char *cname_chip[] = {
40 "-", "vcache", "VideoCache",
41 "+", "vcache", "VideoCache",
42 NULL
43 };
44
45 static cmdline_option_t cmdline_options_chip[] =
46 {
47 { NULL, SET_RESOURCE, CMDLINE_ATTRIB_NONE,
48 NULL, NULL, NULL, (void *)1,
49 NULL, "Enable the video cache" },
50 { NULL, SET_RESOURCE, CMDLINE_ATTRIB_NONE,
51 NULL, NULL, NULL, (void *)0,
52 NULL, "Disable the video cache" },
53 CMDLINE_LIST_END
54 };
55
raster_cmdline_options_chip_init(const char * chipname,struct video_chip_cap_s * video_chip_cap)56 int raster_cmdline_options_chip_init(const char *chipname,
57 struct video_chip_cap_s *video_chip_cap)
58 {
59 unsigned int i;
60
61 if (machine_class != VICE_MACHINE_VSID) {
62 for (i = 0; cname_chip[i * 3] != NULL; i++) {
63 cmdline_options_chip[i].name = util_concat(cname_chip[i * 3], chipname,
64 cname_chip[i * 3 + 1], NULL);
65 cmdline_options_chip[i].resource_name = util_concat(chipname,
66 cname_chip[i * 3 + 2], NULL);
67 }
68
69 if (cmdline_register_options(cmdline_options_chip) < 0) {
70 return -1;
71 }
72
73 for (i = 0; cname_chip[i * 3] != NULL; i++) {
74 lib_free(cmdline_options_chip[i].name);
75 lib_free(cmdline_options_chip[i].resource_name);
76 }
77 }
78
79 return video_cmdline_options_chip_init(chipname, video_chip_cap);
80 }
81