Annotation of uae/src/main.c, revision 1.1.1.15

1.1       root        1:  /*
                      2:   * UAE - The Un*x Amiga Emulator
1.1.1.3   root        3:   *
                      4:   * Main program
                      5:   *
                      6:   * Copyright 1995 Ed Hanway
                      7:   * Copyright 1995, 1996, 1997 Bernd Schmidt
1.1       root        8:   */
                      9: #include "sysconfig.h"
                     10: #include "sysdeps.h"
                     11: #include <assert.h>
                     12: 
                     13: #include "config.h"
                     14: #include "options.h"
1.1.1.15! root       15: #include "threaddep/thread.h"
1.1.1.2   root       16: #include "uae.h"
1.1.1.3   root       17: #include "gensound.h"
1.1.1.13  root       18: #include "audio.h"
1.1.1.3   root       19: #include "sounddep/sound.h"
1.1.1.2   root       20: #include "events.h"
1.1       root       21: #include "memory.h"
                     22: #include "custom.h"
                     23: #include "serial.h"
                     24: #include "newcpu.h"
                     25: #include "disk.h"
                     26: #include "debug.h"
                     27: #include "xwin.h"
1.1.1.3   root       28: #include "joystick.h"
1.1       root       29: #include "keybuf.h"
                     30: #include "gui.h"
                     31: #include "zfile.h"
                     32: #include "autoconf.h"
1.1.1.2   root       33: #include "osemu.h"
1.1.1.3   root       34: #include "osdep/exectasks.h"
1.1       root       35: #include "compiler.h"
1.1.1.3   root       36: #include "picasso96.h"
1.1.1.6   root       37: #include "bsdsocket.h"
1.1.1.3   root       38: #include "uaeexe.h"
1.1.1.8   root       39: #include "native2amiga.h"
                     40: #include "scsidev.h"
1.1       root       41: 
1.1.1.15! root       42: #ifdef USE_SDL
        !            43: #include "SDL.h"
        !            44: #endif
        !            45: 
1.1.1.4   root       46: long int version = 256*65536L*UAEMAJOR + 65536L*UAEMINOR + UAESUBREV;
1.1.1.3   root       47: 
1.1.1.6   root       48: struct uae_prefs currprefs, changed_prefs;
1.1.1.4   root       49: 
1.1.1.6   root       50: int no_gui = 0;
1.1.1.4   root       51: int joystickpresent = 0;
                     52: int cloanto_rom = 0;
                     53: 
1.1.1.11  root       54: struct gui_info gui_data;
                     55: 
1.1.1.4   root       56: char warning_buffer[256];
                     57: 
                     58: char optionsfile[256];
                     59: 
                     60: /* If you want to pipe printer output to a file, put something like
                     61:  * "cat >>printerfile.tmp" above.
                     62:  * The printer support was only tested with the driver "PostScript" on
                     63:  * Amiga side, using apsfilter for linux to print ps-data.
                     64:  *
                     65:  * Under DOS it ought to be -p LPT1: or -p PRN: but you'll need a
                     66:  * PostScript printer or ghostscript -=SR=-
                     67:  */
                     68: 
                     69: /* Slightly stupid place for this... */
                     70: /* ncurses.c might use quite a few of those. */
                     71: char *colormodes[] = { "256 colors", "32768 colors", "65536 colors",
                     72:     "256 colors dithered", "16 colors dithered", "16 million colors",
                     73:     "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
                     74:     "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
                     75:     "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
                     76:     "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
                     77:     "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""
                     78: };
                     79: 
1.1.1.6   root       80: void discard_prefs (struct uae_prefs *p)
1.1.1.3   root       81: {
1.1.1.6   root       82:     struct strlist **ps = &p->unknown_lines;
                     83:     while (*ps) {
                     84:        struct strlist *s = *ps;
                     85:        *ps = s->next;
                     86:        free (s->str);
                     87:        free (s);
                     88:     }
                     89:     free_mountinfo (p->mountinfo);
                     90: }
                     91: 
                     92: void default_prefs (struct uae_prefs *p)
                     93: {
                     94:     strcpy (p->description, "UAE default configuration");
                     95: 
                     96:     p->start_gui = 1;
                     97:     p->start_debugger = 0;
                     98: 
                     99:     p->unknown_lines = 0;
1.1.1.4   root      100:     /* Note to porters: please don't change any of these options! UAE is supposed
                    101:      * to behave identically on all platforms if possible. */
1.1.1.6   root      102:     p->illegal_mem = 0;
                    103:     p->no_xhair = 0;
                    104:     p->use_serial = 0;
                    105:     p->serial_demand = 0;
                    106:     p->parallel_demand = 0;
                    107: 
                    108:     p->jport0 = 2;
                    109:     p->jport1 = 0;
                    110:     p->keyboard_lang = KBD_LANG_US;
                    111:     p->emul_accuracy = 2;
                    112:     p->test_drawing_speed = 0;
                    113: 
                    114:     p->produce_sound = 0;
                    115:     p->stereo = 0;
                    116:     p->sound_bits = DEFAULT_SOUND_BITS;
                    117:     p->sound_freq = DEFAULT_SOUND_FREQ;
                    118:     p->sound_minbsiz = DEFAULT_SOUND_MINB;
                    119:     p->sound_maxbsiz = DEFAULT_SOUND_MAXB;
1.1.1.9   root      120:     p->sound_interpol = 0;
1.1.1.6   root      121: 
1.1.1.8   root      122:     p->gfx_framerate = 1;
1.1.1.6   root      123:     p->gfx_width = 800;
                    124:     p->gfx_height = 600;
                    125:     p->gfx_lores = 0;
1.1.1.15! root      126:     p->gfx_linedbl = 2;
1.1.1.6   root      127:     p->gfx_afullscreen = 0;
                    128:     p->gfx_pfullscreen = 0;
                    129:     p->gfx_correct_aspect = 0;
                    130:     p->gfx_xcenter = 0;
                    131:     p->gfx_ycenter = 0;
                    132:     p->color_mode = 0;
                    133: 
                    134:     p->x11_use_low_bandwidth = 0;
                    135:     p->x11_use_mitshm = 0;
                    136:     p->x11_hide_cursor = 1;
                    137: 
1.1.1.8   root      138:     p->svga_no_linear = 0;
                    139: 
1.1.1.10  root      140:     p->curses_reverse_video = 0;
                    141: 
1.1.1.8   root      142:     p->win32_middle_mouse = 0;
                    143:     p->win32_sound_style = 0;
                    144:     p->win32_sound_tweak = 0;
                    145:     p->win32_logfile = 0;
                    146:     p->win32_iconified_nospeed = 0;
                    147:     p->win32_iconified_nosound = 0;
                    148: 
1.1.1.6   root      149:     p->immediate_blits = 0;
                    150:     p->blits_32bit_enabled = 0;
1.1.1.14  root      151:     p->collision_level = 1;
                    152:     p->fast_copper = 1;
1.1.1.6   root      153: 
                    154:     strcpy (p->df[0], "df0.adf");
                    155:     strcpy (p->df[1], "df1.adf");
                    156:     strcpy (p->df[2], "df2.adf");
                    157:     strcpy (p->df[3], "df3.adf");
                    158: 
                    159:     strcpy (p->romfile, "kick.rom");
                    160:     strcpy (p->keyfile, "");
                    161:     strcpy (p->prtname, DEFPRTNAME);
                    162: 
                    163:     strcpy (p->path_rom, "./");
                    164:     strcpy (p->path_floppy, "./");
                    165:     strcpy (p->path_hardfile, "./");
                    166: 
1.1.1.15! root      167:     strcpy (p->prtname, "");
        !           168:     strcpy (p->sername, "");
        !           169: 
1.1.1.11  root      170:     p->m68k_speed = 0;
1.1.1.6   root      171:     p->cpu_level = 2;
                    172:     p->cpu_compatible = 0;
                    173:     p->address_space_24 = 0;
                    174: 
                    175:     p->fastmem_size = 0x00000000;
                    176:     p->a3000mem_size = 0x00000000;
                    177:     p->z3fastmem_size = 0x00000000;
                    178:     p->chipmem_size = 0x00200000;
                    179:     p->bogomem_size = 0x00000000;
                    180:     p->gfxmem_size = 0x00000000;
1.1       root      181: 
1.1.1.11  root      182:     p->nr_floppies = 4;
                    183: 
1.1.1.6   root      184:     p->mountinfo = alloc_mountinfo ();
1.1.1.4   root      185: }
1.1       root      186: 
1.1.1.4   root      187: void fixup_prefs_dimensions (struct uae_prefs *prefs)
                    188: {
                    189:     if (prefs->gfx_width < 320)
                    190:        prefs->gfx_width = 320;
                    191:     if (prefs->gfx_height < 200)
                    192:        prefs->gfx_height = 200;
                    193:     if (prefs->gfx_height > 300 && ! prefs->gfx_linedbl)
                    194:        prefs->gfx_height = 300;
                    195:     if (prefs->gfx_height > 600)
                    196:        prefs->gfx_height = 600;
1.1       root      197: 
1.1.1.4   root      198:     prefs->gfx_width += 7; /* X86.S wants multiples of 4 bytes, might be 8 in the future. */
                    199:     prefs->gfx_width &= ~7;
                    200: }
1.1.1.3   root      201: 
1.1.1.4   root      202: static void fix_options (void)
1.1.1.2   root      203: {
1.1.1.3   root      204:     int err = 0;
                    205: 
1.1.1.4   root      206:     if ((currprefs.chipmem_size & (currprefs.chipmem_size - 1)) != 0
                    207:        || currprefs.chipmem_size < 0x80000
                    208:        || currprefs.chipmem_size > 0x800000)
1.1.1.3   root      209:     {
1.1.1.4   root      210:        currprefs.chipmem_size = 0x200000;
1.1.1.3   root      211:        fprintf (stderr, "Unsupported chipmem size!\n");
                    212:        err = 1;
                    213:     }
1.1.1.4   root      214:     if ((currprefs.fastmem_size & (currprefs.fastmem_size - 1)) != 0
                    215:        || (currprefs.fastmem_size != 0 && (currprefs.fastmem_size < 0x100000 || currprefs.fastmem_size > 0x800000)))
1.1.1.3   root      216:     {
1.1.1.4   root      217:        currprefs.fastmem_size = 0;
1.1.1.3   root      218:        fprintf (stderr, "Unsupported fastmem size!\n");
                    219:        err = 1;
                    220:     }
1.1.1.4   root      221:     if ((currprefs.gfxmem_size & (currprefs.gfxmem_size - 1)) != 0
                    222:        || (currprefs.gfxmem_size != 0 && (currprefs.gfxmem_size < 0x100000 || currprefs.gfxmem_size > 0x800000)))
1.1.1.3   root      223:     {
1.1.1.4   root      224:        currprefs.gfxmem_size = 0;
1.1.1.3   root      225:        fprintf (stderr, "Unsupported graphics card memory size!\n");
                    226:        err = 1;
                    227:     }
1.1.1.4   root      228:     if ((currprefs.z3fastmem_size & (currprefs.z3fastmem_size - 1)) != 0
                    229:        || (currprefs.z3fastmem_size != 0 && (currprefs.z3fastmem_size < 0x100000 || currprefs.z3fastmem_size > 0x4000000)))
1.1.1.3   root      230:     {
1.1.1.4   root      231:        currprefs.z3fastmem_size = 0;
1.1.1.3   root      232:        fprintf (stderr, "Unsupported Zorro III fastmem size!\n");
                    233:        err = 1;
                    234:     }
1.1.1.4   root      235:     if (currprefs.address_space_24 && (currprefs.gfxmem_size != 0 || currprefs.z3fastmem_size != 0)) {
                    236:        currprefs.z3fastmem_size = currprefs.gfxmem_size = 0;
1.1.1.3   root      237:        fprintf (stderr, "Can't use a graphics card or Zorro III fastmem when using a 24 bit\n"
                    238:                 "address space - sorry.\n");
                    239:     }
1.1.1.4   root      240:     if ((currprefs.bogomem_size & (currprefs.bogomem_size - 1)) != 0
                    241:        || (currprefs.bogomem_size != 0 && (currprefs.bogomem_size < 0x80000 || currprefs.bogomem_size > 0x100000)))
1.1.1.3   root      242:     {
1.1.1.4   root      243:        currprefs.bogomem_size = 0;
1.1.1.3   root      244:        fprintf (stderr, "Unsupported bogomem size!\n");
                    245:        err = 1;
                    246:     }
                    247: 
1.1.1.4   root      248:     if (currprefs.chipmem_size > 0x200000 && currprefs.fastmem_size != 0) {
1.1.1.3   root      249:        fprintf (stderr, "You can't use fastmem and more than 2MB chip at the same time!\n");
1.1.1.4   root      250:        currprefs.fastmem_size = 0;
1.1.1.3   root      251:        err = 1;
                    252:     }
1.1.1.13  root      253: #if 0
1.1.1.4   root      254:     if (currprefs.m68k_speed < -1 || currprefs.m68k_speed > 20) {
                    255:        fprintf (stderr, "Bad value for -w parameter: must be -1, 0, or within 1..20.\n");
1.1.1.3   root      256:        currprefs.m68k_speed = 4;
                    257:        err = 1;
                    258:     }
1.1.1.13  root      259: #endif
                    260:   
1.1.1.3   root      261:     if (currprefs.produce_sound < 0 || currprefs.produce_sound > 3) {
                    262:        fprintf (stderr, "Bad value for -S parameter: enable value must be within 0..3\n");
                    263:        currprefs.produce_sound = 0;
                    264:        err = 1;
                    265:     }
1.1.1.4   root      266:     if (currprefs.cpu_level < 2 && currprefs.z3fastmem_size > 0) {
1.1.1.3   root      267:        fprintf (stderr, "Z3 fast memory can't be used with a 68000/68010 emulation. It\n"
                    268:                 "requires a 68020 emulation. Turning off Z3 fast memory.\n");
1.1.1.4   root      269:        currprefs.z3fastmem_size = 0;
1.1.1.3   root      270:        err = 1;
                    271:     }
1.1.1.8   root      272:     if (currprefs.gfxmem_size > 0 && (currprefs.cpu_level < 2 || currprefs.address_space_24)) {
                    273:        fprintf (stderr, "Picasso96 can't be used with a 68000/68010 or 68EC020 emulation. It\n"
1.1.1.3   root      274:                 "requires a 68020 emulation. Turning off Picasso96.\n");
1.1.1.4   root      275:        currprefs.gfxmem_size = 0;
1.1.1.3   root      276:        err = 1;
                    277:     }
1.1.1.8   root      278: #ifndef BSDSOCKET_SUPPORTED
                    279:     if (currprefs.socket_emu) {
                    280:        fprintf (stderr, "Compile-time option of BSDSOCKET_SUPPORTED was not enabled.  You can't use bsd-socket emulation.\n");
                    281:        currprefs.socket_emu = 0;
                    282:        err = 1;
                    283:     }
                    284: #endif
1.1.1.3   root      285: 
1.1.1.11  root      286:     if (currprefs.nr_floppies < 1 || currprefs.nr_floppies > 4) {
                    287:        fprintf (stderr, "Invalid number of floppies.  Using 4.\n");
                    288:        currprefs.nr_floppies = 4;
                    289:        err = 1;
                    290:     }
1.1.1.14  root      291:     if (currprefs.collision_level < 0 || currprefs.collision_level > 3) {
                    292:        fprintf (stderr, "Invalid collision support level.  Using 1.\n");
                    293:        currprefs.collision_level = 1;
                    294:        err = 1;
                    295:     }
1.1.1.11  root      296: 
1.1.1.3   root      297:     if (err)
                    298:        fprintf (stderr, "Please use \"uae -h\" to get usage information.\n");
                    299: }
                    300: 
                    301: int quit_program = 0;
                    302: 
                    303: void uae_reset (void)
                    304: {
1.1.1.4   root      305:     if (quit_program == 0)
1.1.1.3   root      306:        quit_program = -2;
                    307: }
                    308: 
                    309: void uae_quit (void)
                    310: {
                    311:     if (quit_program != -1)
                    312:        quit_program = -1;
1.1.1.2   root      313: }
1.1       root      314: 
1.1.1.3   root      315: const char *gameport_state (int nr)
1.1       root      316: {
1.1.1.6   root      317:     if (JSEM_ISJOY0 (nr, &currprefs) && nr_joysticks > 0)
1.1.1.3   root      318:        return "using joystick #0";
1.1.1.6   root      319:     else if (JSEM_ISJOY1 (nr, &currprefs) && nr_joysticks > 1)
1.1.1.3   root      320:        return "using joystick #1";
1.1.1.6   root      321:     else if (JSEM_ISMOUSE (nr, &currprefs))
1.1.1.3   root      322:        return "using mouse";
1.1.1.6   root      323:     else if (JSEM_ISNUMPAD (nr, &currprefs))
1.1.1.3   root      324:        return "using numeric pad as joystick";
1.1.1.6   root      325:     else if (JSEM_ISCURSOR (nr, &currprefs))
1.1.1.3   root      326:        return "using cursor keys as joystick";
1.1.1.6   root      327:     else if (JSEM_ISSOMEWHEREELSE (nr, &currprefs))
1.1.1.3   root      328:        return "using T/F/H/B/Alt as joystick";
                    329: 
                    330:     return "not connected";
                    331: }
                    332: 
1.1.1.6   root      333: #ifndef DONT_PARSE_CMDLINE
1.1.1.3   root      334: 
1.1.1.6   root      335: void usage (void)
                    336: {
1.1.1.3   root      337: }
                    338: 
1.1.1.6   root      339: void parse_cmdline (int argc, char **argv)
                    340: {
1.1.1.8   root      341:     int i;
                    342:     for (i = 1; i < argc; i++) {
                    343:        if (strncmp (argv[i], "-config=", 8) == 0)
                    344:            cfgfile_load (&currprefs, argv[i] + 8);
                    345:        /* Check for new-style "-f xxx" argument, where xxx is config-file */
                    346:        else if (strcmp (argv[i], "-f") == 0) {
                    347:            if (i + 1 == argc)
                    348:                fprintf (stderr, "Missing argument for '-f' option.\n");
                    349:            else
                    350:                cfgfile_load (&currprefs, argv[++i]);
                    351:        } else if (strcmp (argv[i], "-s") == 0) {
                    352:            if (i + 1 == argc)
                    353:                fprintf (stderr, "Missing argument for '-s' option.\n");
                    354:            else
                    355:                cfgfile_parse_line (&currprefs, argv[++i]);
                    356:        } else if (strcmp (argv[i], "-h") == 0 || strcmp (argv[i], "-help") == 0) {
1.1.1.6   root      357:            usage ();
                    358:            exit (0);
1.1.1.9   root      359:        } else {
                    360:            if (argv[i][0] == '-' && argv[i][1] != '\0') {
                    361:                const char *arg = argv[i] + 2;
1.1.1.10  root      362:                int extra_arg = *arg == '\0';
                    363:                if (extra_arg)
1.1.1.9   root      364:                    arg = i + 1 < argc ? argv[i + 1] : 0;
1.1.1.10  root      365:                if (parse_cmdline_option (argv[i][1], arg) && extra_arg)
                    366:                    i++;
1.1.1.9   root      367:            }
1.1.1.3   root      368:        }
1.1       root      369:     }
                    370: }
                    371: #endif
                    372: 
1.1.1.4   root      373: static void parse_cmdline_and_init_file (int argc, char **argv)
1.1       root      374: {
1.1.1.3   root      375:     char *home;
1.1       root      376: 
1.1.1.6   root      377:     strcpy (optionsfile, "");
1.1       root      378: 
1.1.1.3   root      379: #ifdef OPTIONS_IN_HOME
1.1.1.4   root      380:     home = getenv ("HOME");
                    381:     if (home != NULL && strlen (home) < 240)
1.1       root      382:     {
1.1.1.4   root      383:        strcpy (optionsfile, home);
                    384:        strcat (optionsfile, "/");
1.1       root      385:     }
                    386: #endif
                    387: 
1.1.1.4   root      388:     strcat (optionsfile, OPTIONSFILENAME);
1.1       root      389: 
1.1.1.6   root      390:     if (! cfgfile_load (&currprefs, optionsfile)) {
1.1.1.3   root      391: #ifdef OPTIONS_IN_HOME
1.1.1.6   root      392:        /* sam: if not found in $HOME then look in current directory */
1.1.1.3   root      393:        strcpy (optionsfile, OPTIONSFILENAME);
1.1.1.6   root      394:        cfgfile_load (&currprefs, optionsfile);
1.1.1.2   root      395:     }
                    396: #endif
                    397: 
1.1.1.6   root      398:     parse_cmdline (argc, argv);
1.1       root      399: }
                    400: 
1.1.1.4   root      401: void reset_all_systems (void)
                    402: {
1.1.1.14  root      403:     init_eventtab ();
                    404: 
                    405:     memory_reset ();
1.1.1.6   root      406:     bsdlib_reset ();
1.1.1.4   root      407:     filesys_reset ();
                    408:     filesys_start_threads ();
1.1.1.8   root      409:     scsidev_reset ();
                    410:     scsidev_start_threads ();
1.1.1.4   root      411: }
                    412: 
1.1.1.2   root      413: /* Okay, this stuff looks strange, but it is here to encourage people who
                    414:  * port UAE to re-use as much of this code as possible. Functions that you
                    415:  * should be using are do_start_program() and do_leave_program(), as well
                    416:  * as real_main(). Some OSes don't call main() (which is braindamaged IMHO,
                    417:  * but unfortunately very common), so you need to call real_main() from
                    418:  * whatever entry point you have. You may want to write your own versions
                    419:  * of start_program() and leave_program() if you need to do anything special.
                    420:  * Add #ifdefs around these as appropriate.
                    421:  */
                    422: 
1.1.1.4   root      423: void do_start_program (void)
1.1.1.2   root      424: {
1.1.1.3   root      425:     /* Do a reset on startup. Whether this is elegant is debatable. */
                    426:     quit_program = 2;
1.1.1.4   root      427:     m68k_go (1);
1.1.1.2   root      428: }
                    429: 
1.1.1.4   root      430: void do_leave_program (void)
1.1.1.2   root      431: {
1.1.1.4   root      432:     graphics_leave ();
                    433:     close_joystick ();
                    434:     close_sound ();
                    435:     dump_counts ();
                    436:     serial_exit ();
                    437:     zfile_exit ();
                    438:     if (! no_gui)
                    439:        gui_exit ();
1.1.1.15! root      440: #ifdef USE_SDL
        !           441:     SDL_Quit ();
        !           442: #endif
        !           443:     expansion_cleanup ();
        !           444:     memory_cleanup ();
1.1.1.2   root      445: }
                    446: 
1.1.1.4   root      447: void start_program (void)
1.1.1.2   root      448: {
1.1.1.4   root      449:     do_start_program ();
1.1.1.2   root      450: }
                    451: 
1.1.1.4   root      452: void leave_program (void)
1.1.1.2   root      453: {
1.1.1.4   root      454:     do_leave_program ();
1.1.1.2   root      455: }
                    456: 
1.1.1.4   root      457: void real_main (int argc, char **argv)
1.1       root      458: {
                    459:     FILE *hf;
                    460: 
1.1.1.15! root      461: #ifdef USE_SDL
        !           462:     SDL_Init (SDL_INIT_EVERYTHING | SDL_INIT_NOPARACHUTE);
        !           463: #endif
        !           464: 
1.1.1.6   root      465:     default_prefs (&currprefs);
1.1.1.3   root      466:     
1.1.1.4   root      467:     if (! graphics_setup ()) {
                    468:        exit (1);
1.1       root      469:     }
1.1.1.2   root      470: 
1.1       root      471:     rtarea_init ();
                    472:     hardfile_install ();
1.1.1.8   root      473:     scsidev_install ();
1.1.1.13  root      474:     ahi_install ();
1.1       root      475: 
1.1.1.4   root      476:     parse_cmdline_and_init_file (argc, argv);
1.1.1.2   root      477: 
1.1.1.4   root      478:     machdep_init ();
1.1.1.3   root      479: 
1.1.1.4   root      480:     if (! setup_sound ()) {
1.1.1.3   root      481:        fprintf (stderr, "Sound driver unavailable: Sound output disabled\n");
                    482:        currprefs.produce_sound = 0;
1.1       root      483:     }
1.1.1.4   root      484:     init_joystick ();
1.1       root      485: 
1.1.1.15! root      486:     changed_prefs = currprefs;
1.1.1.6   root      487:     no_gui = ! currprefs.start_gui;
1.1.1.4   root      488:     if (! no_gui) {
                    489:        int err = gui_init ();
1.1.1.15! root      490:        currprefs = changed_prefs;
1.1.1.2   root      491:        if (err == -1) {
1.1.1.3   root      492:            fprintf (stderr, "Failed to initialize the GUI\n");
1.1.1.2   root      493:        } else if (err == -2) {
1.1.1.4   root      494:            exit (0);
1.1.1.2   root      495:        }
1.1       root      496:     }
1.1.1.13  root      497:     if (sound_available && currprefs.produce_sound > 1 && ! init_audio ()) {
1.1.1.3   root      498:        fprintf (stderr, "Sound driver unavailable: Sound output disabled\n");
                    499:        currprefs.produce_sound = 0;
                    500:     }
1.1.1.2   root      501: 
1.1.1.4   root      502:     fix_options ();
1.1.1.3   root      503:     changed_prefs = currprefs;
                    504: 
1.1.1.2   root      505:     /* Install resident module to get 8MB chipmem, if requested */
1.1.1.4   root      506:     rtarea_setup ();
1.1.1.3   root      507: 
1.1.1.4   root      508:     keybuf_init (); /* Must come after init_joystick */
1.1.1.3   root      509: 
1.1       root      510:     expansion_init ();
1.1.1.4   root      511:     memory_init ();
                    512: 
                    513:     filesys_install ();
                    514:     gfxlib_install ();
                    515:     emulib_install ();
                    516:     uaeexe_install ();
1.1.1.8   root      517:     native2amiga_install ();
1.1.1.4   root      518: 
                    519:     custom_init (); /* Must come after memory_init */
                    520:     serial_init ();
                    521:     DISK_init ();
                    522: 
                    523:     reset_frame_rate_hack ();
                    524:     init_m68k(); /* must come after reset_frame_rate_hack (); */
1.1       root      525: 
1.1.1.4   root      526:     compiler_init ();
                    527:     gui_update ();
1.1.1.2   root      528: 
1.1.1.3   root      529:     if (graphics_init ()) {
                    530:        setup_brkhandler ();
1.1.1.6   root      531:        if (currprefs.start_debugger && debuggable ())
1.1.1.3   root      532:            activate_debugger ();
                    533: 
                    534:        start_program ();
1.1       root      535:     }
1.1.1.3   root      536:     leave_program ();
1.1.1.2   root      537: }
                    538: 
1.1.1.3   root      539: #ifndef NO_MAIN_IN_MAIN_C
1.1.1.4   root      540: int main (int argc, char **argv)
1.1.1.2   root      541: {
1.1.1.4   root      542:     real_main (argc, argv);
1.1       root      543:     return 0;
                    544: }
1.1.1.3   root      545: #endif

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.