Search
lxdream.org :: lxdream/src/main.c :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/main.c
changeset 144:7f0714e89aaa
prev111:230243c2b520
next180:e6dcf9b65658
author nkeynes
date Mon May 15 08:28:52 2006 +0000 (13 years ago)
permissions -rw-r--r--
last change Rename video_driver to display_driver
Add input source to display
Implement configuration file support
Hook controllers up to configuration
file annotate diff log raw
1.1 --- a/src/main.c Thu Mar 16 12:41:59 2006 +0000
1.2 +++ b/src/main.c Mon May 15 08:28:52 2006 +0000
1.3 @@ -1,5 +1,5 @@
1.4 /**
1.5 - * $Id: main.c,v 1.16 2006-03-16 12:41:59 nkeynes Exp $
1.6 + * $Id: main.c,v 1.17 2006-05-15 08:28:48 nkeynes Exp $
1.7 *
1.8 * Main program, initializes dreamcast and gui, then passes control off to
1.9 * the gtk main loop (currently).
1.10 @@ -30,16 +30,19 @@
1.11 #include "syscall.h"
1.12 #include "dreamcast.h"
1.13 #include "aica/audio.h"
1.14 -#include "video.h"
1.15 +#include "display.h"
1.16 +#include "maple/maple.h"
1.17
1.18 #define S3M_PLAYER "s3mplay.bin"
1.19
1.20 -char *option_list = "a:s:A:V:phb";
1.21 +char *option_list = "a:s:A:V:phbd:c:";
1.22 struct option longopts[1] = { { NULL, 0, 0, 0 } };
1.23 char *aica_program = NULL;
1.24 char *s3m_file = NULL;
1.25 -char *video_driver_name = "gtk";
1.26 +char *disc_file = NULL;
1.27 +char *display_driver_name = "gtk";
1.28 char *audio_driver_name = "esd";
1.29 +char *config_file = DEFAULT_CONFIG_FILENAME;
1.30 gboolean start_immediately = FALSE;
1.31 gboolean headless = FALSE;
1.32 gboolean without_bios = FALSE;
1.33 @@ -48,9 +51,9 @@
1.34 &audio_esd_driver,
1.35 NULL };
1.36
1.37 -video_driver_t video_driver_list[] = { &video_null_driver,
1.38 - &video_gtk_driver,
1.39 - NULL };
1.40 +display_driver_t display_driver_list[] = { &display_null_driver,
1.41 + &display_gtk_driver,
1.42 + NULL };
1.43
1.44 int main (int argc, char *argv[])
1.45 {
1.46 @@ -65,6 +68,12 @@
1.47 case 'a': /* AICA only mode - argument is an AICA program */
1.48 aica_program = optarg;
1.49 break;
1.50 + case 'c': /* Config file */
1.51 + config_file = optarg;
1.52 + break;
1.53 + case 'd': /* Mount disc */
1.54 + disc_file = optarg;
1.55 + break;
1.56 case 's': /* AICA-only w/ S3M player */
1.57 aica_program = S3M_PLAYER;
1.58 s3m_file = optarg;
1.59 @@ -73,7 +82,7 @@
1.60 audio_driver_name = optarg;
1.61 break;
1.62 case 'V': /* Video driver */
1.63 - video_driver_name = optarg;
1.64 + display_driver_name = optarg;
1.65 break;
1.66 case 'p': /* Start immediately */
1.67 start_immediately = TRUE;
1.68 @@ -87,6 +96,8 @@
1.69 }
1.70 }
1.71
1.72 + dreamcast_load_config( config_file );
1.73 +
1.74 if( aica_program == NULL ) {
1.75 if( !headless ) {
1.76 gnome_init ("dreamon", VERSION, argc, argv);
1.77 @@ -129,25 +140,30 @@
1.78 }
1.79
1.80 if( headless ) {
1.81 - video_set_driver( &video_null_driver );
1.82 + display_set_driver( &display_null_driver );
1.83 } else {
1.84 - for( i=0; video_driver_list[i] != NULL; i++ ) {
1.85 - if( strcasecmp( video_driver_list[i]->name, video_driver_name ) == 0 ) {
1.86 - video_set_driver( video_driver_list[i] );
1.87 + for( i=0; display_driver_list[i] != NULL; i++ ) {
1.88 + if( strcasecmp( display_driver_list[i]->name, display_driver_name ) == 0 ) {
1.89 + display_set_driver( display_driver_list[i] );
1.90 break;
1.91 }
1.92 }
1.93 - if( video_driver_list[i] == NULL ) {
1.94 - ERROR( "Video driver '%s' not found, using null driver", video_driver_name );
1.95 - video_set_driver( &video_null_driver );
1.96 + if( display_driver_list[i] == NULL ) {
1.97 + ERROR( "Video driver '%s' not found, using null driver", display_driver_name );
1.98 + display_set_driver( &display_null_driver );
1.99 }
1.100 }
1.101
1.102 + maple_reattach_all();
1.103 INFO( "DreamOn! ready..." );
1.104 if( optind < argc ) {
1.105 file_load_magic( argv[optind] );
1.106 }
1.107
1.108 + if( disc_file != NULL ) {
1.109 + gdrom_mount_image( disc_file );
1.110 + }
1.111 +
1.112 if( start_immediately )
1.113 dreamcast_run();
1.114 if( !headless ) {
.