1 #include "config.h"
2 
3 #define USAGE_C_
4 #include "cfg.h"
5 
6 LOCAL const char *jzintv_copyright =
7 "Copyright 2018, Joseph Zbiciak"                                            "\n"
8 ""
9 "Portions    Tim Lindner, John Tanner, Rick Reynolds, Pedro Giffuni,"       "\n"
10 "copyright:  Joe Fisher, Frank Palazzolo, Kjell Breding, Daniele Moglia,"   "\n"
11 "            Marco Turconi, Patrick Nadeau, Andrea Mazzoleni (scale2x/3x/4x),\n"
12 "            Markus Oberhumer (minilzo), Oscar Toledo (AVI),"               "\n"
13 "            Jean-loup Gailly (zlib), Mark Adler (zlib)"                    "\n"
14 ;
15 
16 
17 /* ======================================================================== */
18 /*  USAGE            -- Just give usage info and exit.                      */
19 /* ======================================================================== */
usage(void)20 void usage(void)
21 {
22     jzp_init(0,stdout,NULL,NULL);
23     jzp_printf(
24                                                                             "\n"
25 "jzIntv v%d.%d"                                                             "\n"
26 "%s%c"
27                                                                             "\n"
28 "%s"
29                                                                             "\n"
30 "Usage:"                                                                    "\n"
31 "    jzintv [flags] gamefile"                                               "\n"
32                                                                             "\n"
33 "Specifying a game image:"                                                  "\n"
34 "    jzIntv supports most, if not all, known formats for Intellivision"     "\n"
35 "    game ROM images.  When invoking jzIntv, provide the full path to"      "\n"
36 "    the game-image file.  If you omit the file extension, jzIntv will"     "\n"
37 "    search for an appropriate file by trying the following extensions:"    "\n"
38 "    .rom, .bin, .int, and .itv.  The overall ROM search process is"        "\n"
39 "    somewhat involved.  See the jzIntv documentation for details."         "\n"
40                                                                             "\n"
41 "    If the filename ends in .bin, .int, or .itv, or if jzIntv does not"    "\n"
42 "    recognize the file's extension, it will assume the file is in BIN+CFG" "\n"
43 "    format.  In that case, jzIntv will look for a matching .cfg file."     "\n"
44                                                                             "\n"
45 "    Systems with case-sensitive file names (Linux, UNIX, etc.) need to"    "\n"
46 "    ensure the filename extensions are in lower-case.  On all systems,"    "\n"
47 "    jzIntv expects to receive file names with lower-case extensions."      "\n"
48                                                                             "\n"
49     ,JZINTV_VERSION_MAJOR
50     ,JZINTV_VERSION_MINOR
51     ,svn_revision ? svn_revision : ""
52     ,svn_revision ? '\n' : ' '
53     ,jzintv_copyright
54     );
55     jzp_printf(
56 "ROM Image Flags:"                                                          "\n"
57 "    -e /path/to/exec.bin          Specifies path to the EXEC ROM image."   "\n"
58 "    --execimg=/path/to/exec.bin   By default, jzIntv looks in current dir.  \n"
59                                                                             "\n"
60 "    -g /path/to/grom.bin          Specifies path to the GROM ROM image."   "\n"
61 "    --gromimg=/path/to/grom.bin   By default, jzIntv looks in current dir.  \n"
62                                                                             "\n"
63 "    -E /path/to/ecs.bin           Specifies path to the ECS ROM image"     "\n"
64 "    --ecsimg=/path/to/ecs.bin     By default, jzIntv looks in current dir.  \n"
65 "                                  Only needed when ECS is enabled."        "\n"
66                                                                             "\n"
67 "Intellivision Hardware Flags:"                                             "\n"
68 "    -s#     --ecs=#               ECS.           0: Disable, 1: Enable"    "\n"
69 "    -v#     --voice=#             Intellivoice.  0: Disable, 1: Enable"    "\n"
70 "    -W#     --voicewindow=#       Sets averaging window for voice filter." "\n"
71 "    -Vname  --voicefiles=name     Saves voice WAV files to name####.wav."  "\n"
72 "    -P      --pal                 Start jzIntv in PAL (50Hz) mode."        "\n"
73                                                                             "\n"
74 "Video and Sound Flags:"                                                    "\n"
75     );
76 #ifndef GP2X
77     jzp_printf(
78 "    -z<res> --displaysize=<res>   Desired active display size, *before*"   "\n"
79 "                                  adding border area."                     "\n"
80 "                                  <res> can be a string of the form"       "\n"
81 "                                  XDIMxYDIM,DEPTH such as \"320x200,8\""   "\n"
82 "                                  or a single digit specifying a built-in" "\n"
83 "                                  resolution from the following set."      "\n"
84 "                                      0:  320x200,8bpp"                    "\n"
85 "                                      1:  640x480,8bpp"                    "\n"
86 "                                      2:  320x240,16bpp"                   "\n"
87 "                                      3:  1024x768,8bpp"                   "\n"
88 "                                      4:  1680x1050,8bpp"                  "\n"
89 "                                      5:  800x400,16bpp"                   "\n"
90 "                                      6:  1600x1200,32bpp"                 "\n"
91 "                                      7:  3280x1200,32bpp"                 "\n"
92                                                                             "\n"
93 "    -b#     --gfx-border-pct=#    Increase display size by # percent,"     "\n"
94 "                                  filling the add'l space w/ border color.\n"
95 "                                  e.g. -z0 -b10 produces a 384x240 display\n"
96 "                                  with 320x200 active area centered within.\n"
97                                                                             "\n"
98 "            --gfx-border-x=#      Directly set horizontal border padding." "\n"
99 "            --gfx-border-y=#      Directly set vertical border padding."   "\n"
100                                                                             "\n"
101 "            --resolution=<res>    Synonym for --displaysize"               "\n"
102 "    -f# -x# --fullscreen=#        Full screen display:"                    "\n"
103 "                                      0:  Windowed"                        "\n"
104 "                                      1:  Full screen"                     "\n"
105 "            --prescale=<ps>       Enable prescaler <ps>.  Use the flag"    "\n"
106 "                                  \"--prescale=-1\" to print a list of the\n"
107 "                                  supported prescalers."                   "\n"
108     );
109 #endif
110     jzp_printf(
111 "            --gfx-palette=<file>  Load alternate palette from <file>"      "\n"
112 "    -G#     --gramsize=#          Change number of GRAM tiles"             "\n"
113 "                                      0:  64 tiles (standard)"             "\n"
114 "                                      1:  128 tiles"                       "\n"
115 "                                      2:  256 tiles (INTV88)"              "\n"
116                                                                             "\n"
117 "    -a#     --audiorate=#         Audio sampling rate.  0 disables audio." "\n"
118 "            --audio=#             Synonym for --audiorate."                "\n"
119 "    -Fname  --audiofile=name      Records all audio to specified file."    "\n"
120 "    -w#     --audiowindow=#       Sets averaging window for audio filter." "\n"
121 "    -B#     --audiobufsize=#      Internal audio buffer size."             "\n"
122 "    -C#     --audiobufcnt=#       Internal audio buffer count."            "\n"
123 "    -M#     --audiomintick=#      Minimum Intellivision cycles between"    "\n"
124 "                                  explicit calls to snd_tick()."           "\n"
125                                                                             "\n"
126 "Input Configuration Flags:"                                                "\n"
127 "    Currently, jzIntv does not offer a flexible method to re-bind keys."   "\n"
128 "    The kbdhackfile does allow you to crudely specify key bindings."       "\n"
129                                                                             "\n"
130 "    --kbdhackfile=/path/to/file   Configure key bindings."                 "\n"
131                                                                             "\n"
132 "    -m#     --kbdmap=#            Specify initial keyboard map (0-3)"      "\n"
133 
134                                                                             "\n"
135 "    Analog and USB joysticks have a rich set of configuration parameters." "\n"
136 "    Run jzIntv with an empty configuration string to find out defaults"    "\n"
137 "    are for your joystick and operating system.  For more information on"  "\n"
138 "    configuring joysticks, see the file jzintv/doc/jzintv/joystick.txt"    "\n"
139                                                                             "\n"
140 "    --js0=\"config string\"         Configures Joystick #0"                "\n"
141 "    --js1=\"config string\"         Configures Joystick #1"                "\n"
142 "    --js2=\"config string\"         Configures Joystick #2"                "\n"
143 "    --js3=\"config string\"         Configures Joystick #3"                "\n"
144                                                                             "\n"
145     );
146 #ifdef DIRECT_INTV2PC
147     jzp_printf(
148 "    The INTV2PC can drive either the Master Component or the ECS' controller\n"
149 "    inputs.  The following flags associate INTV2PCs with controllers:"     "\n"
150                                                                             "\n"
151 "    -i#     --i2pc0=#             Port # for INTV2PC for Master Comp inputs.\n"
152 "    -I#     --i2pc1=#             Port # for INTV2PC for ECS inputs."      "\n"
153 "            --intv2pc0=#          Synonym for --i2pc0"                     "\n"
154 "            --intv2pc1=#          Synonym for --i2pc1"                     "\n"
155                                                                             "\n"
156     );
157 #endif
158 #ifdef CGC_DLL
159     jzp_printf(
160 "    The Classic Game Controller can drive either the Master Component or"  "\n"
161 "    the ECS' controller inputs.  The following flags associate CGCs with"  "\n"
162 "    controllers:"                                                          "\n"
163                                                                             "\n"
164 "    --cgc0[=#]                    CGC for Master Component inputs."        "\n"
165 "    --cgc1[=#]                    CGC for ECS inputs."                     "\n"
166                                                                             "\n"
167     );
168 #endif
169 #ifdef CGC_THREAD
170     jzp_printf(
171 "    The Classic Game Controller can drive either the Master Component or"  "\n"
172 "    the ECS' controller inputs.  The following flags associate CGCs with"  "\n"
173 "    controllers.  They also specify the path to the CGC's device node:"    "\n"
174                                                                             "\n"
175 "    --cgc0=/path/to/cgc           CGC for Master Component inputs."        "\n"
176 "    --cgc1=/path/to/cgc           CGC for ECS inputs."                     "\n"
177                                                                             "\n"
178     );
179 #endif
180     jzp_printf(
181 "Intellicart .ROM emulation specific flags:"                                "\n"
182 "    -c#     --icartcache=#        Change caching policy for Intellicart"   "\n"
183 "                                  .ROM programs:"                          "\n"
184 "                                  0:  Cache bankswitched memory (default)" "\n"
185 "                                  1:  Don't cache bankswitched memory"     "\n"
186 "                                  2:  Only cache read-only, non-banksw."   "\n"
187 "                                  3:  Do not cache anything."              "\n"
188                                                                             "\n"
189 "Debugger flags:"                                                           "\n"
190 "    -d      --debugger            Enable jzIntv's debugger."               "\n"
191 "            --sym-file=path       Load symbol table from 'path'."          "\n"
192 "            --src-map=path        Load source/listing map from 'path'."    "\n"
193 "            --script=path         Execute debug commands from 'path'."     "\n"
194 "            --rand-mem            Randomize memories on startup"           "\n"
195                                                                             "\n"
196     );
197     jzp_printf(
198 "Misc Flags:"                                                               "\n"
199 "    -r#     --ratecontrol=#       \\_ Speed up by factor #.  Setting #"    "\n"
200 "            --macho=#             /  to 0 disables rate control."          "\n"
201                                                                             "\n"
202 "    -p path --rom-path=path       Append path to the ROM search path."     "\n"
203                                                                             "\n"
204 "    -q      --quiet               Hide jzIntv's non-error output."         "\n"
205                                                                             "\n"
206 "            --gui-mode            Tells jzIntv to listen for commands from""\n"
207 "                                  a GUI over stdin."                       "\n"
208                                                                             "\n"
209 "    -J<#>                         Explicitly set JLP accelerator enable."  "\n"
210 "                                  0:  Off"                                 "\n"
211 "                                  1:  Accel+RAM On, no flash"              "\n"
212 "                                  2:  Accel+RAM Off"                       "\n"
213 "                                  3:  Accel+RAM On, with flash"            "\n"
214                                                                             "\n"
215 "            --jlp-savegame=path   Enable JLP-style save-game support with" "\n"
216 "                                  'path' as the save-game file."           "\n"
217                                                                             "\n"
218 "            --file-io             Enable Emu-Link File-IO support"         "\n"
219 "                                  (See examples/fileio/fileio.asm)"        "\n"
220                                                                             "\n"
221 "            --start-delay=#       Delay jzIntv startup by # seconds."      "\n"
222 "                                  # can be floating point (e.g. 1.5)."     "\n"
223                                                                             "\n"
224 "            --avirate=#           Scales time by # when recording AVI files.\n"
225 "                                  # can be floating point (e.g. 1.5)."     "\n"
226                                                                             "\n"
227 "            --ecs-tape=path       Template for ECS tape file names."       "\n"
228 "                                  An '#' in the name expands to the 4 char""\n"
229 "                                  CSAV/CLOD name preceded by an '_', if"   "\n"
230 "                                  provided."                               "\n"
231                                                                             "\n"
232 "            --ecs-printer=path    File to append ECS printer output to."   "\n"
233                                                                             "\n"
234 "            --cheat='<cheat>'     Adds a cheat code.  Up to 8 cheats can"  "\n"
235 "                                  be added.  See doc/jzintv/cheat.txt."    "\n"
236                                                                             "\n"
237 "    -l      --license             License information"                     "\n"
238 " -h -?      --help                This usage info"                         "\n"
239                                                                             "\n"
240     );
241     jzp_printf(
242 "Environment:"                                                              "\n"
243 "    JZINTV_ROM_PATH               Controls ROM search path.  Components of\n"
244 "                                  the ROM search path should be separated" "\n"
245 "                                  by \"" PATH_COMPONENT_SEP
246                                        "\" characters.  jzIntv examines"    "\n"
247 "                                  dirs specified by --rom-path before"     "\n"
248 "                                  dirs specified by JZINTV_ROM_PATH."      "\n"
249                                                                             "\n"
250 #ifdef GP2X
251 "GP2X specific flags"                                                       "\n"
252 "            --gp2xclock=#         Set clock rate in MHz.  Default:  200MHz.\n"
253 "                                  0 means \"do not change current rate.\"" "\n"
254                                                                             "\n"
255 "            --gp2x-pad-bias=#     Set the biasing mode for the GP2X's"     "\n"
256 "                                  directional control pad:"                "\n"
257 "                                  1: 16-dir, no bias (default)"            "\n"
258 "                                  2: 8-dir, UD/LR bias"                    "\n"
259 "                                  3: 8-dir, diagonal bias"                 "\n"
260 "                                  4: 8-dir with dead zones"                "\n"
261 "                                  5: 4-dir, UD/LR bias"                    "\n"
262 "                                  6: 4-dir, diagonal bias"                 "\n"
263                                                                             "\n"
264 #endif
265 "Legal note:"                                                               "\n"
266 "    Intellivision(TM) is a trademark of Intellivision Entertainment.  Neither"
267                                                                             "\n"
268 "    Joe Zbiciak nor jzIntv are affiliated with Intellivision Entertainment.\n"
269                                                                             "\n"
270     );
271 
272     jzp_flush();
273     exit(0);
274 }
275 
276 /* ======================================================================== */
277 /*  LICENSE          -- Just give license/authorship info and exit.         */
278 /* ======================================================================== */
license(void)279 void license(void)
280 {
281     jzp_init(0,stdout,NULL,NULL);
282     jzp_printf(
283                                                                             "\n"
284 "jzIntv v%d.%d"                                                             "\n"
285 "%s%c"
286                                                                             "\n"
287 "%s"
288                                                                             "\n"
289 "This program is free software; you can redistribute it and/or modify it"   "\n"
290 "under the terms of the GNU General Public License as published by the Free\n"
291 "Software Foundation; either version 2 of the License, or (at your option)" "\n"
292 "any later version."                                                        "\n"
293                                                                             "\n"
294 "This program is distributed in the hope that it will be useful, but WITHOUT\n"
295 "ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or"     "\n"
296 "FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for" "\n"
297 "more details."                                                             "\n"
298                                                                             "\n"
299 "You should have received a copy of the GNU General Public License along"   "\n"
300 "with this program; if not, write to the Free Software Foundation, Inc.,"   "\n"
301 "51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA."               "\n"
302                                                                             "\n"
303 "Run \"jzintv --help\" for usage information."                              "\n"
304                                                                             "\n"
305 "Legal note:"                                                               "\n"
306 "    Intellivision(TM) is a trademark of Intellivision Entertainment.  Joe" "\n"
307 "    Zbiciak and jzIntv are not affiliated with Intellivision Entertainment.\n"
308                                                                             "\n"
309     ,JZINTV_VERSION_MAJOR
310     ,JZINTV_VERSION_MINOR
311     ,svn_revision ? svn_revision : ""
312     ,svn_revision ? '\n' : ' '
313     ,jzintv_copyright
314     );
315 
316     jzp_flush();
317     exit(0);
318 }
319