1.1 --- a/src/dreamcast.c Wed Jun 24 06:06:40 2009 +0000
1.2 +++ b/src/dreamcast.c Thu Jun 25 21:21:18 2009 +0000
1.12 static sh4addr_t dreamcast_entry_point = 0xA0000000;
1.13 static uint32_t timeslice_length = DEFAULT_TIMESLICE_LENGTH;
1.14 static uint64_t run_time_nanosecs = 0;
1.15 +static unsigned int quick_save_state = -1;
1.17 #define MAX_MODULES 32
1.18 static int num_modules = 0;
1.20 dreamcast_register_module( &aica_module );
1.21 dreamcast_register_module( &maple_module );
1.22 dreamcast_register_module( &ide_module );
1.28 @@ -502,6 +504,77 @@
1.32 +/********************** Quick save state support ***********************/
1.33 +/* This section doesn't necessarily belong here, but it probably makes the
1.34 + * most sense here next to the regular save/load functions
1.37 +static gchar *get_quick_state_filename( int state )
1.39 + gchar *path = lxdream_get_global_config_path_value(CONFIG_SAVE_PATH);
1.40 + gchar *str = g_strdup_printf( QUICK_STATE_FILENAME, path, state );
1.46 +static void dreamcast_quick_state_init()
1.48 + const char *state = lxdream_get_global_config_value(CONFIG_QUICK_STATE);
1.49 + if( state != NULL ) {
1.50 + quick_save_state = atoi(state);
1.51 + if( quick_save_state > MAX_QUICK_STATE ) {
1.52 + quick_save_state = 0;
1.55 + quick_save_state = 0;
1.59 +void dreamcast_quick_save()
1.61 + if( quick_save_state == -1 )
1.62 + dreamcast_quick_state_init();
1.63 + gchar *str = get_quick_state_filename(quick_save_state);
1.64 + dreamcast_save_state(str);
1.68 +void dreamcast_quick_load()
1.70 + if( quick_save_state == -1 )
1.71 + dreamcast_quick_state_init();
1.72 + gchar *str = get_quick_state_filename(quick_save_state);
1.73 + dreamcast_load_state(str);
1.77 +unsigned int dreamcast_get_quick_state( )
1.79 + if( quick_save_state == -1 )
1.80 + dreamcast_quick_state_init();
1.81 + return quick_save_state;
1.84 +void dreamcast_set_quick_state( unsigned int state )
1.86 + if( state <= MAX_QUICK_STATE && state != quick_save_state ) {
1.87 + quick_save_state = state;
1.89 + sprintf( buf, "%d", quick_save_state );
1.90 + lxdream_set_global_config_value(CONFIG_QUICK_STATE, buf);
1.91 + lxdream_save_config();
1.95 +gboolean dreamcast_has_quick_state( unsigned int state )
1.97 + gchar *str = get_quick_state_filename(state);
1.98 + int result = access(str, R_OK);
1.100 + return result == 0 ? TRUE : FALSE;
1.103 /********************* The Boot ROM address space **********************/
1.104 static int32_t FASTCALL ext_bootrom_read_long( sh4addr_t addr )