Search
lxdream.org :: lxdream/src/main.c
lxdream 0.9.1
released Jun 29
Download Now
filename src/main.c
changeset 77:935dd09c5ace
prev68:0cf3ead96627
next87:11208d725b61
author nkeynes
date Mon Jan 16 11:22:41 2006 +0000 (18 years ago)
permissions -rw-r--r--
last change Remove debug lines
view annotate diff log raw
     1 /**
     2  * $Id: main.c,v 1.11 2006-01-16 11:18:29 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 #define S3M_PLAYER "s3mplay.bin"
    34 char *option_list = "a:s:A:V:ph";
    35 char *aica_program = NULL;
    36 char *s3m_file = NULL;
    37 gboolean start_immediately = FALSE;
    38 gboolean headless = FALSE;
    40 int main (int argc, char *argv[])
    41 {
    42     int opt;
    43 #ifdef ENABLE_NLS
    44     bindtextdomain (PACKAGE, PACKAGE_LOCALE_DIR);
    45     textdomain (PACKAGE);
    46 #endif
    48     while( (opt = getopt( argc, argv, option_list )) != -1 ) {
    49 	switch( opt ) {
    50 	case 'a': /* AICA only mode - argument is an AICA program */
    51 	    aica_program = optarg;
    52 	    break;
    53 	case 's': /* AICA-only w/ S3M player */
    54 	    aica_program = S3M_PLAYER;
    55 	    s3m_file = optarg;
    56 	    break;
    57 	case 'A': /* Audio driver */
    58 	    break;
    59 	case 'V': /* Video driver */
    60 	    break;
    61 	case 'p': /* Start immediately */
    62 	    start_immediately = TRUE;
    63     	    break;
    64         case 'h': /* Headless */
    65             headless = TRUE;
    66             break;
    67 	}
    68     }
    70     if( aica_program == NULL ) {
    71 	dreamcast_init();
    72 	if( !headless ) {
    73 	    gnome_init ("dreamon", VERSION, argc, argv);
    74 	    video_open();
    75 	    dreamcast_register_module( &gtk_gui_module );
    76 	}
    77     } else {
    78 	dreamcast_configure_aica_only();
    79 	mem_load_block( aica_program, 0x00800000, 2048*1024 );
    80 	if( s3m_file != NULL ) {
    81 	    mem_load_block( s3m_file, 0x00810000, 2048*1024 - 0x10000 );
    82 	}
    83 	if( !headless ) {
    84 	    gnome_init ("dreamon", VERSION, argc, argv);
    85 	    dreamcast_register_module( &gtk_gui_module );
    86 	    set_disassembly_cpu( main_debug, "ARM7" );
    87 	}
    88     }
    90     INFO( "DreamOn! ready..." );
    91     if( start_immediately )
    92 	dreamcast_run();
    93     if( !headless ) {
    94         gtk_main ();
    95     }
    96     return 0;
    97 }
.