1 /*
2 ucon64_defines.h - definitions for uCON64
3 
4 Copyright (c) 2002 - 2005              NoisyB
5 Copyright (c) 2002 - 2005, 2015 - 2021 dbjh
6 
7 
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
12 
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 GNU General Public License for more details.
17 
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 */
22 #ifndef UCON64_DEFINES_H
23 #define UCON64_DEFINES_H
24 
25 // Please make sure that NO definition except FALSE has 0 as value!
26 #if     (!defined TRUE || !defined FALSE)
27 #define FALSE 0
28 #define TRUE (!FALSE)
29 #endif
30 
31 #if     (!defined MIN || !defined MAX)
32 #define MIN(a,b) ((a) < (b) ? (a) : (b))
33 #define MAX(a,b) ((a) > (b) ? (a) : (b))
34 #endif
35 
36 #ifndef LIB_VERSION
37 #define LIB_VERSION(ver, rel, seq) (((ver) << 16) | ((rel) << 8) | (seq))
38 #endif
39 #define NULL_TO_EMPTY(str) ((str) ? (str) : (""))
40 //#define RANDOM(min, max) ((rand () % (max - min)) + min)
41 #define OFFSET(a, offset) ((((unsigned char *) &(a)) + (offset))[0])
42 
43 #define UCON64_UNKNOWN (-1)
44 #define UCON64_UNKNOWN_S "Unknown"
45 #define NULL_TO_UNKNOWN_S(str) ((str) ? (str) : (UCON64_UNKNOWN_S))
46 
47 #define UCON64_VERSION_S "2.2.2"
48 
49 /* program version counter */
50 //#define UCON64_VERSION 222
51 
52 /* version of config file layout */
53 #define UCON64_CONFIG_VERSION 211
54 
55 #define MBIT 131072U
56 #define TOMBIT(x) ((unsigned int)(x) / MBIT)
57 #define TOMBIT_F(x) ((float)(x) / MBIT)
58 
59 #define MAXROMSIZE (512 * MBIT)
60 
61 #ifndef MAXBUFSIZE
62 #define MAXBUFSIZE 32768
63 #endif // MAXBUFSIZE
64 
65 // maximum number of arguments uCON64 takes from the cmdline
66 #define UCON64_MAX_ARGS 512
67 
68 #define UCON64_OPTION 1000
69 #define UCON64_CONSOLE 0
70 
71 
72 // options (consoles)
73 enum
74 {
75   UCON64_3DO = UCON64_CONSOLE + 1,
76   UCON64_ATA,
77   UCON64_CD32,
78   UCON64_CDI,
79   UCON64_COLECO,
80   UCON64_DC,
81   UCON64_GB,
82   UCON64_GBA,
83   UCON64_GC,
84   UCON64_GEN,
85   UCON64_GP32,
86   UCON64_INTELLI,
87   UCON64_JAG,
88   UCON64_LYNX,
89   UCON64_ARCADE,
90   UCON64_N64,
91   UCON64_NDS,
92   UCON64_NES,
93   UCON64_NG,
94   UCON64_NGP,
95   UCON64_PCE,
96   UCON64_PS2,
97   UCON64_PSX,
98   UCON64_S16,
99   UCON64_SAT,
100   UCON64_SMS,
101   // don't mix the following with UCON64_GG (Game Genie), used only for --mgdgg
102   UCON64_GAMEGEAR,
103   UCON64_SNES,
104   UCON64_SWAN,
105   UCON64_VBOY,
106   UCON64_VEC,
107   UCON64_XBOX
108 };
109 
110 
111 // option strings (consoles)
112 #define UCON64_3DO_S      "3do"
113 #define UCON64_ATA_S      "ata"
114 #define UCON64_CD32_S     "cd32"
115 #define UCON64_CDI_S      "cdi"
116 #define UCON64_COLECO_S   "coleco"
117 #define UCON64_DC_S       "dc"
118 #define UCON64_GB_S       "gb"
119 #define UCON64_GBA_S      "gba"
120 #define UCON64_GC_S       "gc"
121 #define UCON64_GEN_S      "gen"
122 #define UCON64_GP32_S     "gp32"
123 #define UCON64_INTELLI_S  "intelli"
124 #define UCON64_JAG_S      "jag"
125 #define UCON64_LYNX_S     "lynx"
126 #define UCON64_ARCADE_S   "arcade"
127 #define UCON64_N64_S      "n64"
128 #define UCON64_NDS_S      "nds"
129 #define UCON64_NES_S      "nes"
130 #define UCON64_NG_S       "ng"
131 #define UCON64_NGP_S      "ngp"
132 #define UCON64_PCE_S      "pce"
133 #define UCON64_PS2_S      "ps2"
134 #define UCON64_PSX_S      "psx"
135 #define UCON64_S16_S      "s16"
136 #define UCON64_SAT_S      "sat"
137 #define UCON64_SMS_S      "sms"
138 #define UCON64_GAMEGEAR_S "gg"
139 #define UCON64_SNES_S     "snes"
140 #define UCON64_SWAN_S     "swan"
141 #define UCON64_VBOY_S     "vboy"
142 #define UCON64_VEC_S      "vec"
143 #define UCON64_XBOX_S     "xbox"
144 
145 
146 // the other options
147 enum
148 {
149   UCON64_1991 = UCON64_OPTION + 1,
150   UCON64_A,
151   UCON64_B,
152   UCON64_B0,
153   UCON64_B1,
154   UCON64_BAT,
155   UCON64_BIN,
156   UCON64_BIOS,
157   UCON64_BIT,
158   UCON64_BOT,
159   UCON64_BS,
160   UCON64_C,
161   UCON64_CHK,
162   UCON64_CODE,
163   UCON64_COL,
164   UCON64_CRC,
165   UCON64_CRCHD,
166   UCON64_CRP,
167   UCON64_CS,
168   UCON64_CTRL,
169   UCON64_CTRL2,
170   UCON64_CMNT,
171   UCON64_DB,
172   UCON64_DBS,
173   UCON64_DBUH,
174   UCON64_DBV,
175   UCON64_DFIND,
176   UCON64_DFINDR,
177   UCON64_DINT,
178   UCON64_DMIRR,
179   UCON64_DNSRT,
180   UCON64_DUMPINFO,
181   UCON64_E,
182   UCON64_EROM,
183   UCON64_F,
184   UCON64_FDS,
185   UCON64_FDSL,
186   UCON64_FFE,
187   UCON64_FIG,
188   UCON64_FIGS,
189   UCON64_FILE,
190   UCON64_FIND,
191   UCON64_FINDI,
192   UCON64_FINDR,
193   UCON64_FRONTEND,
194   UCON64_GBX,
195   UCON64_GD3,
196   UCON64_GD3S,
197   UCON64_GG,
198   UCON64_GGD,
199   UCON64_GGE,
200   UCON64_GP2BMP,
201   UCON64_HD,
202   UCON64_HDN,
203   UCON64_HELP,
204   UCON64_HEX,
205   UCON64_HFIND,
206   UCON64_HFINDR,
207   UCON64_HI,
208   UCON64_HREPLACE,
209   UCON64_I,
210   UCON64_IC2,
211   UCON64_ID,
212   UCON64_IDNUM,
213   UCON64_IDPPF,
214   UCON64_INES,
215   UCON64_INESHD,
216   UCON64_INS,
217   UCON64_INSN,
218   UCON64_INT,
219   UCON64_INT2,
220   UCON64_ISPAD,
221   UCON64_J,
222   UCON64_K,
223   UCON64_L,
224   UCON64_LNX,
225   UCON64_LOGO,
226   UCON64_LS,
227   UCON64_LSD,
228   UCON64_LSRAM,
229   UCON64_LSV,
230   UCON64_LYX,
231   UCON64_MAPR,
232   UCON64_MD5,
233   UCON64_MGD,
234   UCON64_MGDGG,
235   UCON64_MGH,
236   UCON64_MIRR,
237   UCON64_MKA,
238   UCON64_MKDAT,
239   UCON64_MKI,
240   UCON64_MKIP,
241   UCON64_MKPPF,
242   UCON64_MKSRM,
243   UCON64_MSG,
244   UCON64_MULTI,
245 //  UCON64_MVS,
246   UCON64_N,
247   UCON64_N2,
248   UCON64_N2GB,
249   UCON64_NA,
250   UCON64_NBAK,
251   UCON64_NBAT,
252   UCON64_NBS,
253   UCON64_NCOL,
254   UCON64_NHD,
255   UCON64_NHI,
256   UCON64_NINT,
257   UCON64_NPPF,
258   UCON64_NROT,
259   UCON64_NS,
260   UCON64_NSWP,
261   UCON64_NTSC,
262   UCON64_NVRAM,
263   UCON64_O,
264   UCON64_P,
265   UCON64_PAD,
266   UCON64_PADHD,
267   UCON64_PADN,
268   UCON64_PAL,
269   UCON64_PARSE,
270   UCON64_PASOFAMI,
271   UCON64_PATCH,
272   UCON64_PATTERN,
273   UCON64_POKE,
274   UCON64_PORT,
275   UCON64_PPF,
276   UCON64_PRINT,
277   UCON64_Q,
278   UCON64_QQ,                                    // already reserved ;-)
279   UCON64_R,
280   UCON64_R83,
281   UCON64_RANGE,
282   UCON64_RDAT,
283   UCON64_REGION,
284   UCON64_RJOLIET,
285   UCON64_RROM,
286   UCON64_RL,
287   UCON64_ROM,
288   UCON64_ROTL,
289   UCON64_ROTR,
290   UCON64_RU,
291   UCON64_S,
292   UCON64_SAM,
293   UCON64_SC,
294   UCON64_SCAN,
295   UCON64_SCR,
296   UCON64_SGB,
297   UCON64_SHA1,
298   UCON64_SMC,
299   UCON64_SMD,
300   UCON64_SMDS,
301   UCON64_SMGH,
302   UCON64_SMINI2SRM,
303   UCON64_SMINIS,
304   UCON64_SPLIT,
305   UCON64_SRAM,
306   UCON64_SSC,
307   UCON64_SSIZE,
308   UCON64_STP,
309   UCON64_STPN,
310   UCON64_STRIP,
311   UCON64_SWAP,
312   UCON64_SWAP2,
313   UCON64_SWC,
314   UCON64_SWCS,
315   UCON64_SWP,
316   UCON64_TEST,
317   UCON64_UFO,
318   UCON64_UFOS,
319   UCON64_UFOSD,
320   UCON64_UFOSDS,
321   UCON64_UNIF,
322   UCON64_UNSCR,
323   UCON64_USMS,
324   UCON64_V,
325   UCON64_V64,
326   UCON64_VER,
327   UCON64_VMS,
328   UCON64_VRAM,
329   UCON64_XCD64,
330   UCON64_XCD64B,
331   UCON64_XCD64C,
332   UCON64_XCD64E,
333   UCON64_XCD64F,
334   UCON64_XCD64M,
335   UCON64_XCD64P,
336   UCON64_XCD64S,
337   UCON64_XCMC,
338   UCON64_XCMCM,
339   UCON64_XCMCT,
340   UCON64_XDJR,
341   UCON64_XF2A,
342   UCON64_XF2AB,
343   UCON64_XF2AC,
344   UCON64_XF2AMULTI,
345   UCON64_XF2AS,
346   UCON64_XFAL,
347   UCON64_XFALB,
348   UCON64_XFALC,
349   UCON64_XFALMULTI,
350   UCON64_XFALS,
351   UCON64_XFALM,
352   UCON64_XFIG,
353   UCON64_XFIGS,
354   UCON64_XFIGC,
355   UCON64_XGBX,
356   UCON64_XGBXB,
357   UCON64_XGBXS,
358   UCON64_XGBXM,
359   UCON64_XGD3,
360   UCON64_XGD3R,
361   UCON64_XGD3S,
362   UCON64_XGD6,
363   UCON64_XGD6R,
364   UCON64_XGD6S,
365   UCON64_XGG,
366   UCON64_XGGB,
367   UCON64_XGGS,
368   UCON64_XIC2,
369   UCON64_XLIT,
370   UCON64_XMCCL,
371   UCON64_XMCD,
372   UCON64_XMD,
373   UCON64_XMDB,
374   UCON64_XMDS,
375   UCON64_XMSG,
376   UCON64_XPCE,
377   UCON64_XPL,
378   UCON64_XPLI,
379   UCON64_XPLM,
380   UCON64_XQD16,
381   UCON64_XRESET,
382   UCON64_XSF,
383   UCON64_XSFS,
384   UCON64_XSMC,
385   UCON64_XSMCR,
386   UCON64_XSMD,
387   UCON64_XSMDS,
388   UCON64_XSWC,
389   UCON64_XSWC2,
390   UCON64_XSWC_IO,
391   UCON64_XSWCR,
392   UCON64_XSWCS,
393   UCON64_XSWCC,
394   UCON64_XUFOSD,
395   UCON64_XV64,
396   UCON64_Z64,
397 
398 //  UCON64_FORCE63,
399   UCON64_GUI,
400 
401   // Keep these (libdiscmage) options separate
402   UCON64_DISC = UCON64_OPTION + 250,
403   UCON64_MKCUE,
404   UCON64_MKSHEET,
405   UCON64_MKTOC,
406   UCON64_RIP,
407   UCON64_BIN2ISO,
408   UCON64_ISOFIX,
409   UCON64_XCDRW,
410   UCON64_CDMAGE
411 };
412 
413 /*
414   uCON64 workflow flags
415 
416   WF_PROBE          probe for console type
417   WF_INIT           init ROM info (ucon64_init()) necessary
418                       w/o this flag WF_NFO will be ignored
419   WF_NFO            show info output before processing rom
420   WF_NO_ROM         for this option no ROM is required
421   WF_NO_CRC32       no CRC32 calculation necessary for this option; this
422                       overrides even WF_INIT and WF_NFO
423   WF_NO_SPLIT       this option does not work with split ROMs
424   WF_STOP           a "stop" option:
425                     - -multi (and -xfalmulti) takes more than one file as
426                       argument, but should be executed only once.
427                     - stop after sending one ROM to a copier ("multizip")
428                     - stop after applying a patch so that the patch file won't
429                       be interpreted as ROM
430   WF_PAR            this option requires a parallel port
431   WF_USB            this option requires a USB port
432   WF_DEFAULT        same as WF_INIT | WF_PROBE | WF_NFO
433 */
434 #define WF_PROBE      (1)
435 #define WF_INIT       (1 << 1)
436 #define WF_NFO        (1 << 2)
437 #define WF_NO_ROM     (1 << 3)
438 #define WF_NO_CRC32   (1 << 4)
439 #define WF_NO_SPLIT   (1 << 5)
440 #define WF_STOP       (1 << 6)
441 //#define WF_PAR        (1 << 7)
442 //#define WF_USB        (1 << 8)
443 #define WF_SWITCH     (1 << 9)
444 #define WF_NO_ARCHIVE (1 << 10)
445 #define WF_DEFAULT    (WF_PROBE | WF_INIT | WF_NFO)
446 
447 #endif // UCON64_DEFINES_H
448