1.1 --- a/src/dreamcast.c Tue Jan 16 10:34:46 2007 +0000
1.2 +++ b/src/dreamcast.c Thu Oct 04 08:47:52 2007 +0000
1.5 - * $Id: dreamcast.c,v 1.21 2007-01-16 10:34:46 nkeynes Exp $
1.6 + * $Id: dreamcast.c,v 1.22 2007-09-08 04:38:38 nkeynes Exp $
1.7 * Central switchboard for the system. This pulls all the individual modules
1.8 * together into some kind of coherent structure. This is also where you'd
1.9 * add Naomi support, if I ever get a board to play with...
1.10 @@ -154,6 +154,42 @@
1.11 dreamcast_state = STATE_STOPPED;
1.14 +void dreamcast_run_for( unsigned int seconds, unsigned int nanosecs )
1.18 + if( dreamcast_state != STATE_RUNNING ) {
1.19 + for( i=0; i<num_modules; i++ ) {
1.20 + if( modules[i]->start != NULL )
1.21 + modules[i]->start();
1.24 + dreamcast_state = STATE_RUNNING;
1.25 + uint32_t nanos = 0;
1.26 + if( nanosecs != 0 ) {
1.27 + nanos = 1000000000 - nanosecs;
1.30 + while( dreamcast_state == STATE_RUNNING && seconds != 0 ) {
1.31 + int time_to_run = timeslice_length;
1.32 + for( i=0; i<num_modules; i++ ) {
1.33 + if( modules[i]->run_time_slice != NULL )
1.34 + time_to_run = modules[i]->run_time_slice( time_to_run );
1.36 + nanos += time_to_run;
1.37 + if( nanos >= 1000000000 ) {
1.38 + nanos -= 1000000000;
1.43 + for( i=0; i<num_modules; i++ ) {
1.44 + if( modules[i]->stop != NULL )
1.45 + modules[i]->stop();
1.47 + dreamcast_state = STATE_STOPPED;
1.50 void dreamcast_stop( void )
1.52 if( dreamcast_state == STATE_RUNNING )