1 #pragma once
2 #ifndef SRC_INCLUDE_OPTIONS_H_INCLUDED
3 #define SRC_INCLUDE_OPTIONS_H_INCLUDED 1
4 
5 /*
6  * UAE - The Un*x Amiga Emulator
7  *
8  * Stuff
9  *
10  * Copyright 1995, 1996 Ed Hanway
11  * Copyright 1995-2001 Bernd Schmidt
12  */
13 
14 #define UAEMAJOR 2
15 #define UAEMINOR 6
16 #define UAESUBREV 1
17 
18 #include "uae_types.h"
19 
20 typedef enum { KBD_LANG_US, KBD_LANG_DK, KBD_LANG_DE, KBD_LANG_SE, KBD_LANG_FR, KBD_LANG_IT, KBD_LANG_ES, KBD_LANG_FI, KBD_LANG_TR } KbdLang;
21 
22 extern long int version;
23 struct uaedev_mount_info;
24 struct zfile;
25 
26 #define MAX_PATHS 8
27 #ifndef PATH_MAX
28 #define PATH_MAX 256
29 #endif
30 
31 struct multipath {
32 	TCHAR path[MAX_PATHS][PATH_MAX];
33 };
34 
35 struct strlist {
36 	struct strlist *next;
37 	TCHAR *option, *value;
38 	int unknown;
39 };
40 
41 #define MAX_TOTAL_SCSI_DEVICES 8
42 
43 /* maximum number native input devices supported (single type) */
44 #define MAX_INPUT_DEVICES 16
45 /* maximum number of native input device's buttons and axles supported */
46 #define MAX_INPUT_DEVICE_EVENTS 256
47 /* 4 different customization settings */
48 #define MAX_INPUT_SETTINGS 4
49 #define GAMEPORT_INPUT_SETTINGS 3 // last slot is for gameport panel mappings
50 
51 #define MAX_INPUT_SUB_EVENT 8
52 #define MAX_INPUT_SUB_EVENT_ALL 9
53 #define SPARE_SUB_EVENT 8
54 
55 // this better be here than in sound.h -mustafa.
56 #define FILTER_SOUND_OFF 0
57 #define FILTER_SOUND_EMUL 1
58 #define FILTER_SOUND_ON 2
59 
60 #define FILTER_SOUND_TYPE_A500 0
61 #define FILTER_SOUND_TYPE_A1200 1
62 
63 #define INTERNALEVENT_COUNT 1
64 
65 struct uae_input_device {
66 	TCHAR *name;
67 	TCHAR *configname;
68 	uae_s16 eventid[MAX_INPUT_DEVICE_EVENTS][MAX_INPUT_SUB_EVENT_ALL];
69 	TCHAR *custom[MAX_INPUT_DEVICE_EVENTS][MAX_INPUT_SUB_EVENT_ALL];
70 	uae_u64 flags[MAX_INPUT_DEVICE_EVENTS][MAX_INPUT_SUB_EVENT_ALL];
71 	uae_s8 port[MAX_INPUT_DEVICE_EVENTS][MAX_INPUT_SUB_EVENT_ALL];
72 	uae_s16 extra[MAX_INPUT_DEVICE_EVENTS];
73 	uae_s8 enabled;
74 };
75 
76 #define MAX_JPORTS 4
77 #define NORMAL_JPORTS 2
78 #define MAX_JPORTNAME 128
79 struct jport {
80 	int id;
81 	int mode; // 0=def,1=mouse,2=joy,3=anajoy,4=lightpen
82 	int autofire;
83 	TCHAR name[MAX_JPORTNAME];
84 	TCHAR configname[MAX_JPORTNAME];
85 };
86 #define JPORT_NONE -1
87 #define JPORT_CUSTOM -2
88 #define JPORT_AF_NORMAL 1
89 #define JPORT_AF_TOGGLE 2
90 #define JPORT_AF_ALWAYS 3
91 
92 #define KBTYPE_AMIGA 0
93 #define KBTYPE_PC1 1
94 #define KBTYPE_PC2 2
95 
96 #define MAX_SPARE_DRIVES 20
97 #define MAX_CUSTOM_MEMORY_ADDRS 2
98 
99 #define CONFIG_TYPE_HARDWARE 1
100 #define CONFIG_TYPE_HOST 2
101 #define CONFIG_BLEN 2560
102 
103 #define TABLET_OFF 0
104 #define TABLET_MOUSEHACK 1
105 #define TABLET_REAL 2
106 
107 struct cdslot
108 {
109 	TCHAR name[MAX_DPATH];
110 	bool inuse;
111 	bool delayed;
112 	int type;
113 };
114 struct floppyslot
115 {
116 	TCHAR df[MAX_DPATH];
117 	int dfxtype;
118 	int dfxclick;
119 	TCHAR dfxclickexternal[256];
120 	bool forcedwriteprotect;
121 };
122 
123 #define ASPECTMULT 1024
124 #define WH_NATIVE 1
125 struct wh {
126 	int x, y;
127 	int width, height;
128 	int special;
129 };
130 
131 #define MOUNT_CONFIG_SIZE 30
132 #define UAEDEV_DIR 0
133 #define UAEDEV_HDF 1
134 #define UAEDEV_CD 2
135 
136 #define BOOTPRI_NOAUTOBOOT -128
137 #define BOOTPRI_NOAUTOMOUNT -129
138 #define ISAUTOBOOT(ci) ((ci)->bootpri > BOOTPRI_NOAUTOBOOT)
139 #define ISAUTOMOUNT(ci) ((ci)->bootpri > BOOTPRI_NOAUTOMOUNT)
140 #ifndef HAS_UAEDEV_CONFIG_INFO
141 # define HAS_UAEDEV_CONFIG_INFO 1
142 #endif // HAS_UAEDEV_CONFIG_INFO
143 struct uaedev_config_info {
144 	int type;
145 	TCHAR devname[MAX_DPATH];
146 	TCHAR volname[MAX_DPATH];
147 	TCHAR rootdir[MAX_DPATH];
148 	bool readonly;
149 	int bootpri;
150 	TCHAR filesys[MAX_DPATH];
151 	int lowcyl;
152 	int highcyl; // zero if detected from size
153 	int cyls; // calculated/corrected highcyl
154 	int surfaces;
155 	int sectors;
156 	int reserved;
157 	int blocksize;
158 	int controller;
159 	// zero if default
160 	int pcyls, pheads, psecs;
161 	int flags;
162 	int buffers;
163 	int bufmemtype;
164 	int stacksize;
165 	int priority;
166 	uae_u32 mask;
167 	int maxtransfer;
168 	uae_u32 dostype;
169 	int unit;
170 	int interleave;
171 	int sectorsperblock;
172 	int forceload;
173 	int cd_emu_unit;
174 
175 };
176 
177 #ifndef HAS_UAEDEV_CONFIG_DATA
178 # define HAS_UAEDEV_CONFIG_DATA 1
179 #endif // HAS_UAEDEV_CONFIG_DATA
180 struct uaedev_config_data
181 {
182 	struct uaedev_config_info ci;
183 	int configoffset;
184 };
185 
186 enum { CP_GENERIC = 1, CP_CDTV, CP_CD32, CP_A500, CP_A500P, CP_A600, CP_A1000,
187 	CP_A1200, CP_A2000, CP_A3000, CP_A3000T, CP_A4000, CP_A4000T };
188 
189 #define IDE_A600A1200 1
190 #define IDE_A4000 2
191 
192 #define GFX_WINDOW 0
193 #define GFX_FULLSCREEN 1
194 #define GFX_FULLWINDOW 2
195 
196 #define AUTOSCALE_NONE 0
197 #define AUTOSCALE_STATIC_AUTO 1
198 #define AUTOSCALE_STATIC_NOMINAL 2
199 #define AUTOSCALE_STATIC_MAX 3
200 #define AUTOSCALE_NORMAL 4
201 #define AUTOSCALE_RESIZE 5
202 #define AUTOSCALE_CENTER 6
203 #define AUTOSCALE_MANUAL 7 // use gfx_xcenter_pos and gfx_ycenter_pos
204 #define AUTOSCALE_INTEGER 8
205 #define AUTOSCALE_INTEGER_AUTOSCALE 9
206 
207 #define MONITOREMU_NONE 0
208 #define MONITOREMU_AUTO 1
209 #define MONITOREMU_A2024 2
210 #define MONITOREMU_GRAFFITI 3
211 
212 #define MAX_FILTERSHADERS 4
213 
214 #define MAX_CHIPSET_REFRESH 10
215 #define MAX_CHIPSET_REFRESH_TOTAL (MAX_CHIPSET_REFRESH + 2)
216 #define CHIPSET_REFRESH_PAL (MAX_CHIPSET_REFRESH + 0)
217 #define CHIPSET_REFRESH_NTSC (MAX_CHIPSET_REFRESH + 1)
218 struct chipset_refresh
219 {
220 	int index;
221 	bool locked;
222 	bool rtg;
223 	int horiz;
224 	int vert;
225 	int lace;
226 	int ntsc;
227 	int vsync;
228 	int framelength;
229 	double rate;
230 	TCHAR label[16];
231 	TCHAR commands[256];
232 };
233 
234 #define APMODE_NATIVE 0
235 #define APMODE_RTG 1
236 
237 struct apmode
238 {
239 	int gfx_fullscreen;
240 	int gfx_display;
241 	int gfx_vsync;
242 	// 0 = immediate flip
243 	// -1 = wait for flip, before frame ends
244 	// 1 = wait for flip, after new frame has started
245 	int gfx_vflip;
246 	// doubleframemode strobo
247 	bool gfx_strobo;
248 	int gfx_vsyncmode;
249 	int gfx_backbuffers;
250 	bool gfx_interlaced;
251 	int gfx_refreshrate;
252 };
253 
254 #ifndef HAS_UAE_PREFS_STRUCT
255 # define HAS_UAE_PREFS_STRUCT 1
256 #endif // HAS_UAEPREFS_STRUCT
257 struct uae_prefs {
258 
259 	struct strlist *all_lines;
260 
261 	TCHAR description[256];
262 	TCHAR info[256];
263 	int config_version;
264 	TCHAR config_hardware_path[MAX_DPATH];
265 	TCHAR config_host_path[MAX_DPATH];
266 	TCHAR config_window_title[256];
267 
268 	bool illegal_mem;
269 	bool use_serial;
270 	bool serial_demand;
271 	bool serial_hwctsrts;
272 	bool serial_direct;
273 	int serial_stopbits;
274 	bool parallel_demand;
275 	int parallel_matrix_emulation;
276 	bool parallel_postscript_emulation;
277 	bool parallel_postscript_detection;
278 	int parallel_autoflush_time;
279 	TCHAR ghostscript_parameters[256];
280 	bool use_gfxlib;
281 	bool socket_emu;
282 
283 #ifdef DEBUGGER
284 	bool start_debugger;
285 #endif
286 	bool start_gui;
287 
288 	KbdLang keyboard_lang;
289 
290 	int produce_sound;
291 	int sound_stereo;
292 	int sound_stereo_separation;
293 	int sound_mixed_stereo_delay;
294 	int sound_freq;
295 	int sound_maxbsiz;
296 	int sound_interpol;
297 	int sound_filter;
298 	int sound_filter_type;
299 	int sound_volume;
300 	int sound_volume_cd;
301 	bool sound_stereo_swap_paula;
302 	bool sound_stereo_swap_ahi;
303 	bool sound_auto;
304 
305 	int sampler_freq;
306 	int sampler_buffer;
307 	bool sampler_stereo;
308 
309 #ifdef JIT
310 	int comptrustbyte;
311 	int comptrustword;
312 	int comptrustlong;
313 	int comptrustnaddr;
314 	bool compnf;
315 	bool compfpu;
316 	bool comp_midopt;
317 	bool comp_lowopt;
318 	bool fpu_strict;
319 
320 	bool comp_hardflush;
321 	bool comp_constjump;
322 	bool comp_oldsegv;
323 
324 	int optcount[10];
325 #endif
326 	int cachesize;
327 	bool avoid_cmov;
328 
329 	int gfx_framerate, gfx_autoframerate;
330 	struct wh gfx_size_win;
331 	struct wh gfx_size_fs;
332 	struct wh gfx_size;
333 	struct wh gfx_size_win_xtra[6];
334 	struct wh gfx_size_fs_xtra[6];
335 	bool gfx_autoresolution;
336 	int gfx_autoresolution_delay;
337 	int gfx_autoresolution_minv, gfx_autoresolution_minh;
338 	bool gfx_scandoubler;
339 	struct apmode gfx_apmode[2];
340 	int gfx_resolution;
341 	int gfx_vresolution;
342 	int gfx_lores_mode;
343 	int gfx_scanlines;
344 	int gfx_xcenter, gfx_ycenter;
345 	int gfx_xcenter_pos, gfx_ycenter_pos;
346 	int gfx_xcenter_size, gfx_ycenter_size;
347 	int gfx_max_horizontal, gfx_max_vertical;
348 	int gfx_saturation, gfx_luminance, gfx_contrast, gfx_gamma;
349 	bool gfx_blackerthanblack;
350 	int gfx_api;
351 	int color_mode;
352 	int gfx_extrawidth;
353 	bool lightboost_strobo;
354 
355 	int gfx_filter;
356 	TCHAR gfx_filtershader[2 * MAX_FILTERSHADERS + 1][MAX_DPATH];
357 	TCHAR gfx_filtermask[2 * MAX_FILTERSHADERS + 1][MAX_DPATH];
358 	TCHAR gfx_filteroverlay[MAX_DPATH];
359 	struct wh gfx_filteroverlay_pos;
360 	int gfx_filteroverlay_overscan;
361 	int gfx_filter_scanlines;
362 	int gfx_filter_scanlineratio;
363 	int gfx_filter_scanlinelevel;
364 	float gfx_filter_horiz_zoom, gfx_filter_vert_zoom;
365 	float gfx_filter_horiz_zoom_mult, gfx_filter_vert_zoom_mult;
366 	float gfx_filter_horiz_offset, gfx_filter_vert_offset;
367 	int gfx_filter_filtermode;
368 	int gfx_filter_bilinear;
369 	int gfx_filter_noise, gfx_filter_blur;
370 	int gfx_filter_saturation, gfx_filter_luminance, gfx_filter_contrast, gfx_filter_gamma;
371 	int gfx_filter_keep_aspect, gfx_filter_aspect;
372 	int gfx_filter_autoscale;
373 	int gfx_filter_keep_autoscale_aspect;
374 
375 	float rtg_horiz_zoom_mult;
376 	float rtg_vert_zoom_mult;
377 
378 	bool immediate_blits;
379 	int waiting_blits;
380 	unsigned int chipset_mask;
381 	bool ntscmode;
382 	bool genlock;
383 	int monitoremu;
384 	double chipset_refreshrate;
385 	struct chipset_refresh cr[MAX_CHIPSET_REFRESH + 2];
386 	int cr_selected;
387 	int collision_level;
388 	int leds_on_screen;
389 	int leds_on_screen_mask[2];
390 	struct wh osd_pos;
391 	int keyboard_leds[3];
392 	bool keyboard_leds_in_use;
393 	int scsi;
394 	bool sana2;
395 	bool uaeserial;
396 	int catweasel;
397 	int catweasel_io;
398 	int cpu_idle;
399 	bool cpu_cycle_exact;
400 	int cpu_clock_multiplier;
401 	int cpu_frequency;
402 	bool blitter_cycle_exact;
403 	int floppy_speed;
404 	int floppy_write_length;
405 	int floppy_random_bits_min;
406 	int floppy_random_bits_max;
407 	int floppy_auto_ext2;
408 	bool tod_hack;
409 	uae_u32 maprom;
410 	bool rom_readwrite;
411 	int turbo_emulation;
412 	bool headless;
413 	int filesys_limit;
414 
415 	int cs_compatible;
416 	int cs_ciaatod;
417 	int cs_rtc;
418 	int cs_rtc_adjust;
419 	int cs_rtc_adjust_mode;
420 	bool cs_ksmirror_e0;
421 	bool cs_ksmirror_a8;
422 	bool cs_ciaoverlay;
423 	bool cs_cd32cd;
424 	bool cs_cd32c2p;
425 	bool cs_cd32nvram;
426 	bool cs_cdtvcd;
427 	bool cs_cdtvram;
428 	int cs_cdtvcard;
429 	int cs_ide;
430 	bool cs_pcmcia;
431 	bool cs_a1000ram;
432 	int cs_fatgaryrev;
433 	int cs_ramseyrev;
434 	int cs_agnusrev;
435 	int cs_deniserev;
436 	int cs_mbdmac;
437 	bool cs_cdtvscsi;
438 	bool cs_a2091, cs_a4091;
439 	bool cs_df0idhw;
440 	bool cs_slowmemisfast;
441 	bool cs_resetwarning;
442 	bool cs_denisenoehb;
443 	bool cs_dipagnus;
444 	bool cs_agnusbltbusybug;
445 	int cs_hacks;
446 
447 	TCHAR romfile[MAX_DPATH];
448 	TCHAR romident[256];
449 	TCHAR romextfile[MAX_DPATH];
450 	uae_u32 romextfile2addr;
451 	TCHAR romextfile2[MAX_DPATH];
452 	TCHAR romextident[256];
453 	TCHAR flashfile[MAX_DPATH];
454 	TCHAR rtcfile[MAX_DPATH];
455 #ifdef ACTION_REPLAY
456 	TCHAR cartfile[MAX_DPATH];
457 	TCHAR cartident[256];
458 	int cart_internal;
459 #endif
460 	TCHAR pci_devices[256];
461 	TCHAR prtname[256];
462 	TCHAR sername[256];
463 	TCHAR amaxromfile[MAX_DPATH];
464 	TCHAR a2065name[MAX_DPATH];
465 	struct cdslot cdslots[MAX_TOTAL_SCSI_DEVICES];
466 	TCHAR quitstatefile[MAX_DPATH];
467 	TCHAR statefile[MAX_DPATH];
468 	TCHAR inprecfile[MAX_DPATH];
469 	bool inprec_autoplay;
470 	char scsi_device[256];
471 
472 	struct multipath path_floppy;
473 	struct multipath path_hardfile;
474 	struct multipath path_rom;
475 	struct multipath path_cd;
476 
477 	int m68k_speed;
478 	double m68k_speed_throttle;
479 	int cpu_model;
480 	int mmu_model;
481 	int cpu060_revision;
482 	int fpu_model;
483 	int fpu_revision;
484 	bool cpu_compatible;
485 	bool int_no_unimplemented;
486 	bool fpu_no_unimplemented;
487 	bool address_space_24;
488 	bool picasso96_nocustom;
489 	int picasso96_modeflags;
490 
491 	uae_u32 z3fastmem_size, z3fastmem2_size;
492 	uae_u32 z3fastmem_start;
493 	uae_u32 z3chipmem_size;
494 	uae_u32 z3chipmem_start;
495 	uae_u32 fastmem_size, fastmem2_size;
496 	bool fastmem_autoconfig;
497 	uae_u32 chipmem_size;
498 	uae_u32 bogomem_size;
499 	uae_u32 mbresmem_low_size;
500 	uae_u32 mbresmem_high_size;
501 	uae_u32 rtgmem_size;
502 	bool rtg_hardwareinterrupt;
503 	bool rtg_hardwaresprite;
504 	int rtgmem_type;
505 	uae_u32 custom_memory_addrs[MAX_CUSTOM_MEMORY_ADDRS];
506 	uae_u32 custom_memory_sizes[MAX_CUSTOM_MEMORY_ADDRS];
507 
508 	bool kickshifter;
509 	bool filesys_no_uaefsdb;
510 	bool filesys_custom_uaefsdb;
511 	bool mmkeyboard;
512 	int uae_hide;
513 	bool clipboard_sharing;
514 	bool native_code;
515 
516 	int mountitems;
517 	struct uaedev_config_data mountconfig[MOUNT_CONFIG_SIZE];
518 
519 	int nr_floppies;
520 	struct floppyslot floppyslots[4];
521 	bool floppy_read_only;
522 	TCHAR dfxlist[MAX_SPARE_DRIVES][MAX_DPATH];
523 #ifdef DRIVESOUND
524 	int dfxclickvolume;
525 	int dfxclickchannelmask;
526 #endif
527 
528 	bool hide_cursor;				/* Whether to hide host WM cursor or not */
529 
530 	/* Target specific options */
531 #ifdef USE_X11_GFX
532 	bool x11_use_low_bandwidth;
533 	bool x11_use_mitshm;
534 	int x11_use_dgamode;
535 	bool x11_hide_cursor;
536 #endif
537 
538 #ifdef USE_SVGALIB_GFX
539 	int svga_no_linear;
540 #endif
541 
542 	int win32_rtgvblankrate;
543 #ifdef USE_CURSES_GFX
544 	int curses_reverse_video;
545 #endif
546 
547 #if 0
548 #if defined USE_SDL_GFX || defined USE_X11_GFX
549 	bool map_raw_keys;
550 #endif
551 #endif
552 	bool use_gl;
553 
554 #ifdef USE_AMIGA_GFX
555 	int  amiga_screen_type;
556 	char amiga_publicscreen[256];
557 	int  amiga_use_grey;
558 	int  amiga_use_dither;
559 #endif
560 
561 #ifdef SAVESTATE
562 	bool statecapture;
563 	int statecapturerate, statecapturebuffersize;
564 #endif
565 
566 	/* input */
567 
568 	struct jport jports[MAX_JPORTS];
569 	int input_selected_setting;
570 	int input_joymouse_multiplier;
571 	int input_joymouse_deadzone;
572 	int input_joystick_deadzone;
573 	int input_joymouse_speed;
574 	int input_analog_joystick_mult;
575 	int input_analog_joystick_offset;
576 	int input_autofire_linecnt;
577 	int input_mouse_speed;
578 	int input_tablet;
579 	bool input_magic_mouse;
580 	int input_magic_mouse_cursor;
581 	int input_keyboard_type;
582 	struct uae_input_device joystick_settings[MAX_INPUT_SETTINGS][MAX_INPUT_DEVICES];
583 	struct uae_input_device mouse_settings[MAX_INPUT_SETTINGS][MAX_INPUT_DEVICES];
584 	struct uae_input_device keyboard_settings[MAX_INPUT_SETTINGS][MAX_INPUT_DEVICES];
585 	struct uae_input_device internalevent_settings[MAX_INPUT_SETTINGS][INTERNALEVENT_COUNT];
586 	TCHAR input_config_name[GAMEPORT_INPUT_SETTINGS][256];
587 	int dongle;
588 	int input_contact_bounce;
589 };
590 
591 extern int config_changed;
592 extern void config_check_vsync (void);
593 
594 /* Contains the filename of .uaerc */
595 extern TCHAR optionsfile[];
596 extern void save_options (struct zfile *, struct uae_prefs *, int);
597 
598 extern void cfgfile_write (struct zfile *, const TCHAR *option, const TCHAR *format,...);
599 extern void cfgfile_dwrite (struct zfile *, const TCHAR *option, const TCHAR *format,...);
600 extern void cfgfile_target_write (struct zfile *, const TCHAR *option, const TCHAR *format,...);
601 extern void cfgfile_target_dwrite (struct zfile *, const TCHAR *option, const TCHAR *format,...);
602 
603 extern void cfgfile_write_bool (struct zfile *f, const TCHAR *option, bool b);
604 extern void cfgfile_dwrite_bool (struct zfile *f,const  TCHAR *option, bool b);
605 extern void cfgfile_target_write_bool (struct zfile *f, const TCHAR *option, bool b);
606 extern void cfgfile_target_dwrite_bool (struct zfile *f, const TCHAR *option, bool b);
607 
608 extern void cfgfile_write_str (struct zfile *f, const TCHAR *option, const TCHAR *value);
609 extern void cfgfile_dwrite_str (struct zfile *f, const TCHAR *option, const TCHAR *value);
610 extern void cfgfile_target_write_str (struct zfile *f, const TCHAR *option, const TCHAR *value);
611 extern void cfgfile_target_dwrite_str (struct zfile *f, const TCHAR *option, const TCHAR *value);
612 
613 extern void cfgfile_backup (const TCHAR *path);
614 extern struct uaedev_config_data *add_filesys_config (struct uae_prefs *p, int index, struct uaedev_config_info*);
615 extern bool get_hd_geometry (struct uaedev_config_info *);
616 extern void uci_set_defaults (struct uaedev_config_info *uci, bool rdb);
617 
618 extern void default_prefs (struct uae_prefs *, int);
619 extern void discard_prefs (struct uae_prefs *, int);
620 
621 int parse_cmdline_option (struct uae_prefs *, TCHAR, const TCHAR *);
622 
623 extern int cfgfile_yesno (const TCHAR *option, const TCHAR *value, const TCHAR *name, bool *location);
624 extern int cfgfile_intval (const TCHAR *option, const TCHAR *value, const TCHAR *name, int *location, int scale);
625 extern int cfgfile_strval (const TCHAR *option, const TCHAR *value, const TCHAR *name, int *location, const TCHAR *table[], int more);
626 extern int cfgfile_string (const TCHAR *option, const TCHAR *value, const TCHAR *name, TCHAR *location, int maxsz);
627 extern TCHAR *cfgfile_subst_path (const TCHAR *path, const TCHAR *subst, const TCHAR *file);
628 
629 extern TCHAR *target_expand_environment (const TCHAR *path);
630 extern int target_parse_option (struct uae_prefs *, const TCHAR *option, const TCHAR *value);
631 extern void target_save_options (struct zfile*, struct uae_prefs *);
632 extern void target_default_options (struct uae_prefs *, int type);
633 extern void target_fixup_options (struct uae_prefs *);
634 extern int target_cfgfile_load (struct uae_prefs *, const TCHAR *filename, int type, int isdefault);
635 extern void cfgfile_save_options (struct zfile *f, struct uae_prefs *p, int type);
636 extern int target_get_display (const TCHAR*);
637 extern const TCHAR *target_get_display_name (int, bool);
638 
639 extern int cfgfile_load (struct uae_prefs *p, const TCHAR *filename, int *type, int ignorelink, int userconfig);
640 extern int cfgfile_save (struct uae_prefs *p, const TCHAR *filename, int);
641 extern void cfgfile_parse_line (struct uae_prefs *p, TCHAR *, int);
642 extern void cfgfile_parse_lines (struct uae_prefs *p, const TCHAR *, int);
643 extern int cfgfile_parse_option (struct uae_prefs *p, TCHAR *option, TCHAR *value, int);
644 extern int cfgfile_get_description (const TCHAR *filename, TCHAR *description, TCHAR *hostlink, TCHAR *hardwarelink, int *type);
645 extern void cfgfile_show_usage (void);
646 extern uae_u32 cfgfile_uaelib (int mode, uae_u32 name, uae_u32 dst, uae_u32 maxlen);
647 extern uae_u32 cfgfile_uaelib_modify (uae_u32 mode, uae_u32 parms, uae_u32 size, uae_u32 out, uae_u32 outsize);
648 extern uae_u32 cfgfile_modify (uae_u32 index, TCHAR *parms, uae_u32 size, TCHAR *out, uae_u32 outsize);
649 extern void cfgfile_addcfgparam (TCHAR *);
650 extern int built_in_prefs (struct uae_prefs *p, int model, int config, int compa, int romcheck);
651 extern int built_in_chipset_prefs (struct uae_prefs *p);
652 extern int cmdlineparser (const TCHAR *s, TCHAR *outp[], int max);
653 extern int cfgfile_configuration_change (int);
654 extern void fixup_prefs_dimensions (struct uae_prefs *prefs);
655 extern void fixup_prefs (struct uae_prefs *prefs);
656 extern void fixup_cpu (struct uae_prefs *prefs);
657 
658 extern void check_prefs_changed_custom (void);
659 extern void check_prefs_changed_cpu (void);
660 extern void check_prefs_changed_audio (void);
661 extern void check_prefs_changed_cd (void);
662 extern int check_prefs_changed_gfx (void);
663 
664 extern struct uae_prefs currprefs, changed_prefs;
665 
666 extern int machdep_init (void);
667 extern void machdep_free (void);
668 
669 /* AIX doesn't think it is Unix. Neither do I. */
670 #if defined(_ALL_SOURCE) || defined(_AIX)
671 #undef __unix
672 #define __unix
673 #endif
674 
675 #define MAX_COLOR_MODES 5
676 
677 /* #define NEED_TO_DEBUG_BADLY */
678 
679 #if !defined(USER_PROGRAMS_BEHAVE)
680 #define USER_PROGRAMS_BEHAVE 0
681 #endif
682 
683 /* Some memsets which know that they can safely overwrite some more memory
684  * at both ends and use that knowledge to align the pointers. */
685 
686 #define QUADRUPLIFY(c) (((c) | ((c) << 8)) | (((c) | ((c) << 8)) << 16))
687 
688 /* When you call this routine, bear in mind that it rounds the bounds and
689  * may need some padding for the array. */
690 
691 #define fuzzy_memset(p, c, o, l) fuzzy_memset_1 ((p), QUADRUPLIFY (c), (o) & ~3, ((l) + 4) >> 2)
fuzzy_memset_1(void * p,uae_u32 c,int offset,int len)692 STATIC_INLINE void fuzzy_memset_1 (void *p, uae_u32 c, int offset, int len)
693 {
694     uae_u32 *p2 = (uae_u32 *)((TCHAR *)p + offset);
695     int a = len & 7;
696     len >>= 3;
697     switch (a) {
698      case 7: p2--; goto l1;
699      case 6: p2-=2; goto l2;
700      case 5: p2-=3; goto l3;
701      case 4: p2-=4; goto l4;
702      case 3: p2-=5; goto l5;
703      case 2: p2-=6; goto l6;
704      case 1: p2-=7; goto l7;
705      case 0: if (!--len) return; break;
706     }
707 
708     for (;;) {
709 	p2[0] = c;
710 	l1:
711 	p2[1] = c;
712 	l2:
713 	p2[2] = c;
714 	l3:
715 	p2[3] = c;
716 	l4:
717 	p2[4] = c;
718 	l5:
719 	p2[5] = c;
720 	l6:
721 	p2[6] = c;
722 	l7:
723 	p2[7] = c;
724 
725 	if (!len)
726 	    break;
727 	len--;
728 	p2 += 8;
729     }
730 }
731 
732 /* This one knows it will never be asked to clear more than 32 bytes.  Make sure you call this with a
733    constant for the length.  */
734 #define fuzzy_memset_le32(p, c, o, l) fuzzy_memset_le32_1 ((p), QUADRUPLIFY (c), (o) & ~3, ((l) + 7) >> 2)
fuzzy_memset_le32_1(void * p,uae_u32 c,int offset,int len)735 STATIC_INLINE void fuzzy_memset_le32_1 (void *p, uae_u32 c, int offset, int len)
736 {
737     uae_u32 *p2 = (uae_u32 *)((TCHAR *)p + offset);
738 
739     switch (len) {
740      case 9: p2[0] = c; p2[1] = c; p2[2] = c; p2[3] = c; p2[4] = c; p2[5] = c; p2[6] = c; p2[7] = c; p2[8] = c; break;
741      case 8: p2[0] = c; p2[1] = c; p2[2] = c; p2[3] = c; p2[4] = c; p2[5] = c; p2[6] = c; p2[7] = c; break;
742      case 7: p2[0] = c; p2[1] = c; p2[2] = c; p2[3] = c; p2[4] = c; p2[5] = c; p2[6] = c; break;
743      case 6: p2[0] = c; p2[1] = c; p2[2] = c; p2[3] = c; p2[4] = c; p2[5] = c; break;
744      case 5: p2[0] = c; p2[1] = c; p2[2] = c; p2[3] = c; p2[4] = c; break;
745      case 4: p2[0] = c; p2[1] = c; p2[2] = c; p2[3] = c; break;
746      case 3: p2[0] = c; p2[1] = c; p2[2] = c; break;
747      case 2: p2[0] = c; p2[1] = c; break;
748      case 1: p2[0] = c; break;
749      case 0: break;
750      default: printf("Hit the programmer.\n"); break;
751     }
752 }
753 
754 #if defined TARGET_AMIGAOS && defined(__GNUC__)
755 #include "od-amiga/amiga-kludges.h"
756 #endif
757 
758 #endif // SRC_INCLUDE_OPTIONS_H_INCLUDED
759