--- uae/src/main.c 2018/04/24 16:47:23 1.1.1.8 +++ uae/src/main.c 2018/04/24 17:01:54 1.1.1.15 @@ -6,22 +6,21 @@ * Copyright 1995 Ed Hanway * Copyright 1995, 1996, 1997 Bernd Schmidt */ - #include "sysconfig.h" #include "sysdeps.h" #include #include "config.h" #include "options.h" -#include "threaddep/penguin.h" +#include "threaddep/thread.h" #include "uae.h" #include "gensound.h" +#include "audio.h" #include "sounddep/sound.h" #include "events.h" #include "memory.h" #include "custom.h" #include "serial.h" -#include "readcpu.h" #include "newcpu.h" #include "disk.h" #include "debug.h" @@ -40,6 +39,10 @@ #include "native2amiga.h" #include "scsidev.h" +#ifdef USE_SDL +#include "SDL.h" +#endif + long int version = 256*65536L*UAEMAJOR + 65536L*UAEMINOR + UAESUBREV; struct uae_prefs currprefs, changed_prefs; @@ -48,6 +51,8 @@ int no_gui = 0; int joystickpresent = 0; int cloanto_rom = 0; +struct gui_info gui_data; + char warning_buffer[256]; char optionsfile[256]; @@ -61,9 +66,6 @@ char optionsfile[256]; * PostScript printer or ghostscript -=SR=- */ -/* People must provide their own name for this */ -char sername[256] = ""; - /* Slightly stupid place for this... */ /* ncurses.c might use quite a few of those. */ char *colormodes[] = { "256 colors", "32768 colors", "65536 colors", @@ -102,7 +104,6 @@ void default_prefs (struct uae_prefs *p) p->use_serial = 0; p->serial_demand = 0; p->parallel_demand = 0; - p->automount_uaedev = 1; p->jport0 = 2; p->jport1 = 0; @@ -116,12 +117,13 @@ void default_prefs (struct uae_prefs *p) p->sound_freq = DEFAULT_SOUND_FREQ; p->sound_minbsiz = DEFAULT_SOUND_MINB; p->sound_maxbsiz = DEFAULT_SOUND_MAXB; + p->sound_interpol = 0; p->gfx_framerate = 1; p->gfx_width = 800; p->gfx_height = 600; p->gfx_lores = 0; - p->gfx_linedbl = 0; + p->gfx_linedbl = 2; p->gfx_afullscreen = 0; p->gfx_pfullscreen = 0; p->gfx_correct_aspect = 0; @@ -135,6 +137,8 @@ void default_prefs (struct uae_prefs *p) p->svga_no_linear = 0; + p->curses_reverse_video = 0; + p->win32_middle_mouse = 0; p->win32_sound_style = 0; p->win32_sound_tweak = 0; @@ -144,6 +148,8 @@ void default_prefs (struct uae_prefs *p) p->immediate_blits = 0; p->blits_32bit_enabled = 0; + p->collision_level = 1; + p->fast_copper = 1; strcpy (p->df[0], "df0.adf"); strcpy (p->df[1], "df1.adf"); @@ -158,7 +164,10 @@ void default_prefs (struct uae_prefs *p) strcpy (p->path_floppy, "./"); strcpy (p->path_hardfile, "./"); - p->m68k_speed = 4; + strcpy (p->prtname, ""); + strcpy (p->sername, ""); + + p->m68k_speed = 0; p->cpu_level = 2; p->cpu_compatible = 0; p->address_space_24 = 0; @@ -170,6 +179,8 @@ void default_prefs (struct uae_prefs *p) p->bogomem_size = 0x00000000; p->gfxmem_size = 0x00000000; + p->nr_floppies = 4; + p->mountinfo = alloc_mountinfo (); } @@ -239,11 +250,14 @@ static void fix_options (void) currprefs.fastmem_size = 0; err = 1; } +#if 0 if (currprefs.m68k_speed < -1 || currprefs.m68k_speed > 20) { fprintf (stderr, "Bad value for -w parameter: must be -1, 0, or within 1..20.\n"); currprefs.m68k_speed = 4; err = 1; } +#endif + if (currprefs.produce_sound < 0 || currprefs.produce_sound > 3) { fprintf (stderr, "Bad value for -S parameter: enable value must be within 0..3\n"); currprefs.produce_sound = 0; @@ -269,6 +283,17 @@ static void fix_options (void) } #endif + if (currprefs.nr_floppies < 1 || currprefs.nr_floppies > 4) { + fprintf (stderr, "Invalid number of floppies. Using 4.\n"); + currprefs.nr_floppies = 4; + err = 1; + } + if (currprefs.collision_level < 0 || currprefs.collision_level > 3) { + fprintf (stderr, "Invalid collision support level. Using 1.\n"); + currprefs.collision_level = 1; + err = 1; + } + if (err) fprintf (stderr, "Please use \"uae -h\" to get usage information.\n"); } @@ -331,6 +356,15 @@ void parse_cmdline (int argc, char **arg } else if (strcmp (argv[i], "-h") == 0 || strcmp (argv[i], "-help") == 0) { usage (); exit (0); + } else { + if (argv[i][0] == '-' && argv[i][1] != '\0') { + const char *arg = argv[i] + 2; + int extra_arg = *arg == '\0'; + if (extra_arg) + arg = i + 1 < argc ? argv[i + 1] : 0; + if (parse_cmdline_option (argv[i][1], arg) && extra_arg) + i++; + } } } } @@ -364,31 +398,11 @@ static void parse_cmdline_and_init_file parse_cmdline (argc, argv); } -void write_log_standard (const char *fmt, ...) -{ - va_list ap; - va_start (ap, fmt); -#ifdef HAVE_VFPRINTF - vfprintf (stderr, fmt, ap); -#else - /* Technique stolen from GCC. */ - { - int x1, x2, x3, x4, x5, x6, x7, x8; - x1 = va_arg (ap, int); - x2 = va_arg (ap, int); - x3 = va_arg (ap, int); - x4 = va_arg (ap, int); - x5 = va_arg (ap, int); - x6 = va_arg (ap, int); - x7 = va_arg (ap, int); - x8 = va_arg (ap, int); - fprintf (stderr, fmt, x1, x2, x3, x4, x5, x6, x7, x8); - } -#endif -} - void reset_all_systems (void) { + init_eventtab (); + + memory_reset (); bsdlib_reset (); filesys_reset (); filesys_start_threads (); @@ -423,6 +437,11 @@ void do_leave_program (void) zfile_exit (); if (! no_gui) gui_exit (); +#ifdef USE_SDL + SDL_Quit (); +#endif + expansion_cleanup (); + memory_cleanup (); } void start_program (void) @@ -439,6 +458,10 @@ void real_main (int argc, char **argv) { FILE *hf; +#ifdef USE_SDL + SDL_Init (SDL_INIT_EVERYTHING | SDL_INIT_NOPARACHUTE); +#endif + default_prefs (&currprefs); if (! graphics_setup ()) { @@ -448,6 +471,7 @@ void real_main (int argc, char **argv) rtarea_init (); hardfile_install (); scsidev_install (); + ahi_install (); parse_cmdline_and_init_file (argc, argv); @@ -459,16 +483,18 @@ void real_main (int argc, char **argv) } init_joystick (); + changed_prefs = currprefs; no_gui = ! currprefs.start_gui; if (! no_gui) { int err = gui_init (); + currprefs = changed_prefs; if (err == -1) { fprintf (stderr, "Failed to initialize the GUI\n"); } else if (err == -2) { exit (0); } } - if (sound_available && currprefs.produce_sound > 1 && ! init_sound ()) { + if (sound_available && currprefs.produce_sound > 1 && ! init_audio ()) { fprintf (stderr, "Sound driver unavailable: Sound output disabled\n"); currprefs.produce_sound = 0; }