Search
lxdream.org :: lxdream/src/main.c :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/main.c
changeset 106:9048bac046c3
prev105:1faa0745f200
next111:230243c2b520
author nkeynes
date Tue Mar 14 12:45:53 2006 +0000 (15 years ago)
permissions -rw-r--r--
last change Move driver selection out to main at long last. Add video NULL driver for
headless operation
Make dcload exit() actually exit
file annotate diff log raw
1.1 --- a/src/main.c Tue Mar 14 11:44:29 2006 +0000
1.2 +++ b/src/main.c Tue Mar 14 12:45:53 2006 +0000
1.3 @@ -1,5 +1,5 @@
1.4 /**
1.5 - * $Id: main.c,v 1.14 2006-03-14 11:44:29 nkeynes Exp $
1.6 + * $Id: main.c,v 1.15 2006-03-14 12:45:50 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 @@ -29,6 +29,8 @@
1.11 #include "dream.h"
1.12 #include "syscall.h"
1.13 #include "dreamcast.h"
1.14 +#include "aica/audio.h"
1.15 +#include "video.h"
1.16
1.17 #define S3M_PLAYER "s3mplay.bin"
1.18
1.19 @@ -36,13 +38,23 @@
1.20 struct option longopts[1] = { { NULL, 0, 0, 0 } };
1.21 char *aica_program = NULL;
1.22 char *s3m_file = NULL;
1.23 +char *video_driver_name = "gtk";
1.24 +char *audio_driver_name = "esd";
1.25 gboolean start_immediately = FALSE;
1.26 gboolean headless = FALSE;
1.27 gboolean without_bios = FALSE;
1.28
1.29 +audio_driver_t audio_driver_list[] = { &audio_null_driver,
1.30 + &audio_esd_driver,
1.31 + NULL };
1.32 +
1.33 +video_driver_t video_driver_list[] = { &video_null_driver,
1.34 + &video_gtk_driver,
1.35 + NULL };
1.36 +
1.37 int main (int argc, char *argv[])
1.38 {
1.39 - int opt;
1.40 + int opt, i;
1.41 #ifdef ENABLE_NLS
1.42 bindtextdomain (PACKAGE, PACKAGE_LOCALE_DIR);
1.43 textdomain (PACKAGE);
1.44 @@ -58,8 +70,10 @@
1.45 s3m_file = optarg;
1.46 break;
1.47 case 'A': /* Audio driver */
1.48 + audio_driver_name = optarg;
1.49 break;
1.50 case 'V': /* Video driver */
1.51 + video_driver_name = optarg;
1.52 break;
1.53 case 'p': /* Start immediately */
1.54 start_immediately = TRUE;
1.55 @@ -99,6 +113,34 @@
1.56 bios_install();
1.57 dcload_install();
1.58 }
1.59 +
1.60 + for( i=0; audio_driver_list[i] != NULL; i++ ) {
1.61 + if( strcasecmp( audio_driver_list[i]->name, audio_driver_name ) == 0 ) {
1.62 + audio_set_driver( audio_driver_list[i], 44100, AUDIO_FMT_16ST );
1.63 + break;
1.64 + }
1.65 +
1.66 + }
1.67 + if( audio_driver_list[i] == NULL ) {
1.68 + ERROR( "Audio driver '%s' not found, using null driver", audio_driver_name );
1.69 + audio_set_driver( &audio_null_driver, 44100, AUDIO_FMT_16ST );
1.70 + }
1.71 +
1.72 + if( headless ) {
1.73 + video_set_driver( &video_null_driver );
1.74 + } else {
1.75 + for( i=0; video_driver_list[i] != NULL; i++ ) {
1.76 + if( strcasecmp( video_driver_list[i]->name, video_driver_name ) == 0 ) {
1.77 + video_set_driver( video_driver_list[i] );
1.78 + break;
1.79 + }
1.80 + }
1.81 + if( video_driver_list[i] == NULL ) {
1.82 + ERROR( "Video driver '%s' not found, using null driver", video_driver_name );
1.83 + video_set_driver( &video_null_driver );
1.84 + }
1.85 + }
1.86 +
1.87 INFO( "DreamOn! ready..." );
1.88 if( optind < argc ) {
1.89 file_load_magic( argv[optind] );
.