int snapshot_copy_from( libspectrum_snap *snap ) { int error; libspectrum_machine machine; module_snapshot_enabled( snap ); machine = libspectrum_snap_machine( snap ); settings_current.late_timings = libspectrum_snap_late_timings( snap ); if( machine != machine_current->machine ) { error = machine_select( machine ); if( error ) { ui_error( UI_ERROR_ERROR, "Loading a %s snapshot, but that's not available", libspectrum_machine_name( machine ) ); } } else { machine_reset( 0 ); } module_snapshot_from( snap ); /* Need to reset memory_map_[read|write] after all modules have had a turn initialising from the snapshot */ machine_current->memory_map(); return 0; }
int uidisplay_init( int width, int height ) { int x, y, error; libspectrum_dword black; const char *machine_name; colour_format_t colour_format; #if !GTK_CHECK_VERSION( 3, 0, 0 ) g_signal_connect( G_OBJECT( gtkui_drawing_area ), "expose_event", G_CALLBACK( gtkdisplay_expose ), NULL ); colour_format = FORMAT_x8b8g8r8; #else g_signal_connect( G_OBJECT( gtkui_drawing_area ), "draw", G_CALLBACK( gtkdisplay_draw ), NULL ); colour_format = FORMAT_x8r8g8b8; #endif /* #if !GTK_CHECK_VERSION( 3, 0, 0 ) */ g_signal_connect( G_OBJECT( gtkui_drawing_area ), "configure_event", G_CALLBACK( drawing_area_resize_callback ), NULL ); error = init_colours( colour_format ); if( error ) return error; black = settings_current.bw_tv ? bw_colours[0] : gtkdisplay_colours[0]; for( y = 0; y < DISPLAY_SCREEN_HEIGHT + 4; y++ ) for( x = 0; x < DISPLAY_SCREEN_WIDTH + 3; x++ ) *(libspectrum_dword*)( rgb_image + y * rgb_pitch + 4 * x ) = black; image_width = width; image_height = height; image_scale = width / DISPLAY_ASPECT_WIDTH; register_scalers( 0 ); display_refresh_all(); if ( scaler_select_scaler( current_scaler ) ) scaler_select_scaler( SCALER_NORMAL ); gtkdisplay_load_gfx_mode(); machine_name = libspectrum_machine_name( machine_current->machine ); gtkstatusbar_update_machine( machine_name ); display_ui_initialised = 1; return 0; }
void menu_machine_select( int action ) { widget_select_t info; char **options, *buffer; size_t i; int error; libspectrum_machine new_machine; options = malloc( machine_count * sizeof( const char * ) ); if( !options ) { ui_error( UI_ERROR_ERROR, "out of memory at %s:%d", __FILE__, __LINE__ ); return; } buffer = malloc( 40 * machine_count ); if( !buffer ) { ui_error( UI_ERROR_ERROR, "out of memory at %s:%d", __FILE__, __LINE__ ); free( options ); return; } for( i = 0; i < machine_count; i++ ) { options[i] = &buffer[ i * 40 ]; snprintf( options[i], 40, "%s", libspectrum_machine_name( machine_types[i]->machine ) ); if( machine_current->machine == machine_types[i]->machine ) info.current = i; } info.title = "Select machine"; info.options = (const char**)options; info.count = machine_count; info.finish_all = 1; error = widget_do( WIDGET_TYPE_SELECT, &info ); free( buffer ); free( options ); if( error ) return; if( info.result == -1 ) return; new_machine = machine_types[ info.result ]->machine; if( machine_current->machine != new_machine ) machine_select( new_machine ); }
/* Called by the menu when Machine/Select selected */ void menu_machine_select( int action ) { /* FIXME: choosing spectrum SE crashes Fuse sound_frame () at sound.c:477 "ay_change[f].ofs = ( ay_change[f].tstates * sfreq ) / cpufreq;" */ /* FIXME: choosing some Timexes crashes (win32) fuse as well */ int selected_machine; win32ui_select_info items; int i; /* Stop emulation */ fuse_emulation_pause(); /* Populate win32ui_select_info */ items.dialog_title = TEXT( "Fuse - Select Machine" ); items.labels = malloc( machine_count * sizeof( char * ) ); items.length = machine_count; for( i=0; i<machine_count; i++ ) { items.labels[i] = libspectrum_machine_name( machine_types[i]->machine ); if( machine_current == machine_types[i] ) { items.selected = i; } } /* start the machine select dialog box */ selected_machine = selector_dialog( &items ); if( selected_machine >= 0 && machine_types[ selected_machine ] != machine_current ) { machine_select( machine_types[ selected_machine ]->machine ); } free( items.labels ); /* Resume emulation */ fuse_emulation_unpause(); }
const char* menu_machine_detail( void ) { return libspectrum_machine_name( machine_current->machine ); }
static int menu_select_machine_roms( libspectrum_machine machine, size_t start, size_t n ) { return menu_select_roms_with_title( libspectrum_machine_name( machine ), start, n, 0 ); }