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
file annotate diff log raw
nkeynes@30
     1
/**
nkeynes@68
     2
 * $Id: main.c,v 1.10 2006-01-10 13:57:54 nkeynes Exp $
nkeynes@30
     3
 *
nkeynes@30
     4
 * Main program, initializes dreamcast and gui, then passes control off to
nkeynes@30
     5
 * the gtk main loop (currently). 
nkeynes@30
     6
 *
nkeynes@30
     7
 * FIXME: Remove explicit GTK/Gnome references from this file
nkeynes@30
     8
 *
nkeynes@30
     9
 * Copyright (c) 2005 Nathan Keynes.
nkeynes@30
    10
 *
nkeynes@30
    11
 * This program is free software; you can redistribute it and/or modify
nkeynes@30
    12
 * it under the terms of the GNU General Public License as published by
nkeynes@30
    13
 * the Free Software Foundation; either version 2 of the License, or
nkeynes@30
    14
 * (at your option) any later version.
nkeynes@30
    15
 *
nkeynes@30
    16
 * This program is distributed in the hope that it will be useful,
nkeynes@30
    17
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
nkeynes@30
    18
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
nkeynes@30
    19
 * GNU General Public License for more details.
nkeynes@1
    20
 */
nkeynes@1
    21
nkeynes@1
    22
#ifdef HAVE_CONFIG_H
nkeynes@1
    23
#  include <config.h>
nkeynes@1
    24
#endif
nkeynes@1
    25
nkeynes@68
    26
#include <unistd.h>
nkeynes@1
    27
#include <gnome.h>
nkeynes@25
    28
#include "gui/gui.h"
nkeynes@27
    29
#include "dream.h"
nkeynes@27
    30
#include "dreamcast.h"
nkeynes@11
    31
nkeynes@68
    32
char *option_list = "a:A:V:p";
nkeynes@68
    33
char *aica_program = NULL;
nkeynes@68
    34
gboolean start_immediately = FALSE;
nkeynes@68
    35
nkeynes@30
    36
int main (int argc, char *argv[])
nkeynes@1
    37
{
nkeynes@68
    38
    int opt;
nkeynes@1
    39
#ifdef ENABLE_NLS
nkeynes@68
    40
    bindtextdomain (PACKAGE, PACKAGE_LOCALE_DIR);
nkeynes@68
    41
    textdomain (PACKAGE);
nkeynes@1
    42
#endif
nkeynes@68
    43
  
nkeynes@68
    44
    while( (opt = getopt( argc, argv, option_list )) != -1 ) {
nkeynes@68
    45
	switch( opt ) {
nkeynes@68
    46
	case 'a': /* AICA only mode - argument is an AICA program */
nkeynes@68
    47
	    aica_program = optarg;
nkeynes@68
    48
	    break;
nkeynes@68
    49
	case 'A': /* Audio driver */
nkeynes@68
    50
	    break;
nkeynes@68
    51
	case 'V': /* Video driver */
nkeynes@68
    52
	    break;
nkeynes@68
    53
	case 'p': /* Start immediately */
nkeynes@68
    54
	    start_immediately = TRUE;
nkeynes@68
    55
	}
nkeynes@68
    56
    }
nkeynes@30
    57
nkeynes@68
    58
    if( aica_program == NULL ) {
nkeynes@68
    59
	dreamcast_init();
nkeynes@68
    60
	gnome_init ("dreamon", VERSION, argc, argv);
nkeynes@68
    61
	video_open();
nkeynes@68
    62
	dreamcast_register_module( &gtk_gui_module );
nkeynes@68
    63
    } else {
nkeynes@68
    64
	dreamcast_configure_aica_only();
nkeynes@68
    65
	mem_load_block( aica_program, 0x00800000, 2048*1024 );
nkeynes@68
    66
	gnome_init ("dreamon", VERSION, argc, argv);
nkeynes@68
    67
	dreamcast_register_module( &gtk_gui_module );
nkeynes@68
    68
	set_disassembly_cpu( main_debug, "ARM7" );
nkeynes@68
    69
    }
nkeynes@1
    70
nkeynes@68
    71
    INFO( "DreamOn! ready..." );
nkeynes@68
    72
    if( start_immediately )
nkeynes@68
    73
	dreamcast_run();
nkeynes@68
    74
    gtk_main ();
nkeynes@68
    75
    return 0;
nkeynes@1
    76
}
nkeynes@1
    77
.