Search
lxdream.org :: lxdream/src/main.c
lxdream 0.9.1
released Jun 29
Download Now
filename src/main.c
changeset 68:0cf3ead96627
prev35:21a4be098304
next77:935dd09c5ace
author nkeynes
date Tue Jan 10 13:57:54 2006 +0000 (15 years ago)
permissions -rw-r--r--
last change Add command line parser, and aica-only mode
view annotate diff log raw
     1 /**
     2  * $Id: main.c,v 1.10 2006-01-10 13:57:54 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 "dreamcast.h"
    32 char *option_list = "a:A:V:p";
    33 char *aica_program = NULL;
    34 gboolean start_immediately = FALSE;
    36 int main (int argc, char *argv[])
    37 {
    38     int opt;
    39 #ifdef ENABLE_NLS
    40     bindtextdomain (PACKAGE, PACKAGE_LOCALE_DIR);
    41     textdomain (PACKAGE);
    42 #endif
    44     while( (opt = getopt( argc, argv, option_list )) != -1 ) {
    45 	switch( opt ) {
    46 	case 'a': /* AICA only mode - argument is an AICA program */
    47 	    aica_program = optarg;
    48 	    break;
    49 	case 'A': /* Audio driver */
    50 	    break;
    51 	case 'V': /* Video driver */
    52 	    break;
    53 	case 'p': /* Start immediately */
    54 	    start_immediately = TRUE;
    55 	}
    56     }
    58     if( aica_program == NULL ) {
    59 	dreamcast_init();
    60 	gnome_init ("dreamon", VERSION, argc, argv);
    61 	video_open();
    62 	dreamcast_register_module( &gtk_gui_module );
    63     } else {
    64 	dreamcast_configure_aica_only();
    65 	mem_load_block( aica_program, 0x00800000, 2048*1024 );
    66 	gnome_init ("dreamon", VERSION, argc, argv);
    67 	dreamcast_register_module( &gtk_gui_module );
    68 	set_disassembly_cpu( main_debug, "ARM7" );
    69     }
    71     INFO( "DreamOn! ready..." );
    72     if( start_immediately )
    73 	dreamcast_run();
    74     gtk_main ();
    75     return 0;
    76 }
.