Search
lxdream.org :: lxdream/src/main.c :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/main.c
changeset 372:86aa060ddcec
prev370:3131ba1440fc
next379:7e1c33a184d8
author nkeynes
date Sat Sep 08 04:38:38 2007 +0000 (12 years ago)
permissions -rw-r--r--
last change Add time-limited run option (for time trials)
file annotate diff log raw
1.1 --- a/src/main.c Sat Sep 08 04:05:35 2007 +0000
1.2 +++ b/src/main.c Sat Sep 08 04:38:38 2007 +0000
1.3 @@ -1,5 +1,5 @@
1.4 /**
1.5 - * $Id: main.c,v 1.21 2007-09-08 04:05:35 nkeynes Exp $
1.6 + * $Id: main.c,v 1.22 2007-09-08 04:38:38 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 @@ -35,7 +35,7 @@
1.11
1.12 #define S3M_PLAYER "s3mplay.bin"
1.13
1.14 -char *option_list = "a:s:A:V:puhbd:c:";
1.15 +char *option_list = "a:s:A:V:puhbd:c:t:";
1.16 struct option longopts[1] = { { NULL, 0, 0, 0 } };
1.17 char *aica_program = NULL;
1.18 char *s3m_file = NULL;
1.19 @@ -46,6 +46,8 @@
1.20 gboolean start_immediately = FALSE;
1.21 gboolean headless = FALSE;
1.22 gboolean without_bios = FALSE;
1.23 +uint32_t time_secs = 0;
1.24 +uint32_t time_nanos = 0;
1.25
1.26 audio_driver_t audio_driver_list[] = { &audio_null_driver,
1.27 &audio_esd_driver,
1.28 @@ -58,6 +60,7 @@
1.29 int main (int argc, char *argv[])
1.30 {
1.31 int opt, i;
1.32 + double t;
1.33 #ifdef ENABLE_NLS
1.34 bindtextdomain (PACKAGE, PACKAGE_LOCALE_DIR);
1.35 textdomain (PACKAGE);
1.36 @@ -96,6 +99,10 @@
1.37 case 'h': /* Headless */
1.38 headless = TRUE;
1.39 break;
1.40 + case 't': /* Time limit */
1.41 + t = strtod(optarg, NULL);
1.42 + time_secs = (uint32_t)t;
1.43 + time_nanos = (int)((t - time_secs) * 1000000000);
1.44 }
1.45 }
1.46
1.47 @@ -172,8 +179,14 @@
1.48 gdrom_mount_image( disc_file );
1.49 }
1.50
1.51 - if( start_immediately )
1.52 - dreamcast_run();
1.53 + if( start_immediately ) {
1.54 + if( time_nanos != 0 || time_secs != 0 ) {
1.55 + dreamcast_run_for(time_secs, time_nanos);
1.56 + return 0;
1.57 + } else {
1.58 + dreamcast_run();
1.59 + }
1.60 + }
1.61 if( !headless ) {
1.62 gtk_main ();
1.63 }
.