static int machine_select_machine( fuse_machine_info *machine ) { int width, height, i; int capabilities; machine_current = machine; settings_set_string( &settings_current.start_machine, machine->id ); tstates = 0; /* Reset the event stack */ event_reset(); if( event_add( 0, timer_event ) ) return 1; if( event_add( machine->timings.tstates_per_frame, spectrum_frame_event ) ) return 1; sound_end(); if( uidisplay_end() ) return 1; capabilities = libspectrum_machine_capabilities( machine->machine ); /* Set screen sizes here */ if( capabilities & LIBSPECTRUM_MACHINE_CAPABILITY_TIMEX_VIDEO ) { width = DISPLAY_SCREEN_WIDTH; height = 2*DISPLAY_SCREEN_HEIGHT; } else { width = DISPLAY_ASPECT_WIDTH; height = DISPLAY_SCREEN_HEIGHT; } if( uidisplay_init( width, height ) ) return 1; sound_init( settings_current.sound_device ); /* Mark RAM as not-present/read-only. The machine's reset function will * mark available pages as present/writeable. */ for( i = 0; i < 2 * SPECTRUM_RAM_PAGES; i++ ) memory_map_ram[i].writable = 0; /* Do a hard reset */ if( machine_reset( 1 ) ) return 1; /* And the dock menu item */ if( capabilities & LIBSPECTRUM_MACHINE_CAPABILITY_TIMEX_DOCK ) { ui_menu_activate( UI_MENU_ITEM_MEDIA_CARTRIDGE_DOCK_EJECT, 0 ); } /* Reset any dialogue boxes etc. which contain machine-dependent state */ ui_widgets_reset(); return 0; }
static int machine_select_machine( fuse_machine_info *machine ) { int width, height; int capabilities; machine_current = machine; settings_set_string( &settings_current.start_machine, machine->id ); tstates = 0; /* Reset the event stack */ event_reset(); event_add( 0, timer_event ); event_add( machine->timings.tstates_per_frame, spectrum_frame_event ); sound_end(); if( uidisplay_end() ) return 1; capabilities = libspectrum_machine_capabilities( machine->machine ); /* Set screen sizes here */ if( capabilities & LIBSPECTRUM_MACHINE_CAPABILITY_TIMEX_VIDEO ) { width = DISPLAY_SCREEN_WIDTH; height = 2*DISPLAY_SCREEN_HEIGHT; } else { width = DISPLAY_ASPECT_WIDTH; height = DISPLAY_SCREEN_HEIGHT; } if( uidisplay_init( width, height ) ) return 1; sound_init( settings_current.sound_device ); /* Do a hard reset */ if( machine_reset( 1 ) ) return 1; /* And the dock menu item */ if( capabilities & LIBSPECTRUM_MACHINE_CAPABILITY_TIMEX_DOCK ) { ui_menu_activate( UI_MENU_ITEM_MEDIA_CARTRIDGE_DOCK_EJECT, 0 ); } /* Reset any dialogue boxes etc. which contain machine-dependent state */ ui_widgets_reset(); return 0; }