Search
lxdream.org :: lxdream/src/main.c
lxdream 0.9.1
released Jun 29
Download Now
filename src/main.c
changeset 87:11208d725b61
prev77:935dd09c5ace
next94:8d80d9c7cc7d
author nkeynes
date Sun Jan 22 22:42:53 2006 +0000 (18 years ago)
permissions -rw-r--r--
last change Fix copy_to_sh4 for ta + vram-64 regions
view annotate diff log raw
     1 /**
     2  * $Id: main.c,v 1.12 2006-01-22 22:40:53 nkeynes Exp $
     3  *
     4  * Main program, initializes dreamcast and gui, then passes control off to
     5  * the gtk main loop (currently). 
     6  *
     7  * FIXME: Remove explicit GTK/Gnome references from this file
     8  *
     9  * Copyright (c) 2005 Nathan Keynes.
    10  *
    11  * This program is free software; you can redistribute it and/or modify
    12  * it under the terms of the GNU General Public License as published by
    13  * the Free Software Foundation; either version 2 of the License, or
    14  * (at your option) any later version.
    15  *
    16  * This program is distributed in the hope that it will be useful,
    17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    19  * GNU General Public License for more details.
    20  */
    22 #ifdef HAVE_CONFIG_H
    23 #  include <config.h>
    24 #endif
    26 #include <unistd.h>
    27 #include <gnome.h>
    28 #include "gui/gui.h"
    29 #include "dream.h"
    30 #include "bios.h"
    31 #include "dreamcast.h"
    33 #define S3M_PLAYER "s3mplay.bin"
    35 char *option_list = "a:s:A:V:phb";
    36 char *aica_program = NULL;
    37 char *s3m_file = NULL;
    38 gboolean start_immediately = FALSE;
    39 gboolean headless = FALSE;
    40 gboolean without_bios = FALSE;
    42 int main (int argc, char *argv[])
    43 {
    44     int opt;
    45 #ifdef ENABLE_NLS
    46     bindtextdomain (PACKAGE, PACKAGE_LOCALE_DIR);
    47     textdomain (PACKAGE);
    48 #endif
    50     while( (opt = getopt( argc, argv, option_list )) != -1 ) {
    51 	switch( opt ) {
    52 	case 'a': /* AICA only mode - argument is an AICA program */
    53 	    aica_program = optarg;
    54 	    break;
    55 	case 's': /* AICA-only w/ S3M player */
    56 	    aica_program = S3M_PLAYER;
    57 	    s3m_file = optarg;
    58 	    break;
    59 	case 'A': /* Audio driver */
    60 	    break;
    61 	case 'V': /* Video driver */
    62 	    break;
    63 	case 'p': /* Start immediately */
    64 	    start_immediately = TRUE;
    65     	    break;
    66     	case 'b': /* No BIOS */
    67     	    without_bios = TRUE;
    68     	    break;
    69         case 'h': /* Headless */
    70             headless = TRUE;
    71             break;
    72 	}
    73     }
    75     if( aica_program == NULL ) {
    76 	dreamcast_init();
    77 	if( !headless ) {
    78 	    gnome_init ("dreamon", VERSION, argc, argv);
    79 	    video_open();
    80 	    dreamcast_register_module( &gtk_gui_module );
    81 	}
    82     } else {
    83 	dreamcast_configure_aica_only();
    84 	mem_load_block( aica_program, 0x00800000, 2048*1024 );
    85 	if( s3m_file != NULL ) {
    86 	    mem_load_block( s3m_file, 0x00810000, 2048*1024 - 0x10000 );
    87 	}
    88 	if( !headless ) {
    89 	    gnome_init ("dreamon", VERSION, argc, argv);
    90 	    dreamcast_register_module( &gtk_gui_module );
    91 	    set_disassembly_cpu( main_debug, "ARM7" );
    92 	}
    93     }
    95     if( without_bios ) {
    96     	bios_install();
    97     }
    98     INFO( "DreamOn! ready..." );
    99     if( start_immediately )
   100 	dreamcast_run();
   101     if( !headless ) {
   102         gtk_main ();
   103     }
   104     return 0;
   105 }
.