From: Philip K. <pa...@us...> - 2005-02-26 22:54:25
|
Update of /cvsroot/fuse-emulator/fuse In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22955 Modified Files: tape.c tape.h Log Message: Media/Tape/Play always starts the tape playing, even if tape traps are active. Makes working with normal speed custom loader blocks less painful (patch #1150682) (Darren). Index: tape.h =================================================================== RCS file: /cvsroot/fuse-emulator/fuse/tape.h,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** tape.h 11 Apr 2004 10:08:23 -0000 1.23 --- tape.h 26 Feb 2005 22:54:16 -0000 1.24 *************** *** 48,52 **** int tape_save_trap( void ); - int tape_play( void ); int tape_toggle_play( void ); --- 48,51 ---- Index: tape.c =================================================================== RCS file: /cvsroot/fuse-emulator/fuse/tape.c,v retrieving revision 1.122 retrieving revision 1.123 diff -C2 -d -r1.122 -r1.123 *** tape.c 12 Jan 2005 08:39:00 -0000 1.122 --- tape.c 26 Feb 2005 22:54:16 -0000 1.123 *************** *** 57,61 **** /* Is the emulated tape deck playing? */ ! static int tape_playing; /* Is there a high input to the EAR socket? */ --- 57,61 ---- /* Is the emulated tape deck playing? */ ! static int tape_playing, traps_suspended; /* Is there a high input to the EAR socket? */ *************** *** 66,70 **** static int tape_autoload( libspectrum_machine hardware ); static int trap_load_block( libspectrum_tape_block *block ); ! int trap_check_rom( void ); static void make_name( char *name, const char *data ); --- 66,71 ---- static int tape_autoload( libspectrum_machine hardware ); static int trap_load_block( libspectrum_tape_block *block ); ! static int tape_play( int force ); ! static int trap_check_rom( void ); static void make_name( char *name, const char *data ); *************** *** 84,87 **** --- 85,89 ---- tape_playing = 0; tape_microphone = 0; + traps_suspended = 0; if( settings_current.sound_load ) sound_beeper( 1, tape_microphone ); return 0; *************** *** 291,294 **** --- 293,302 ---- } + static int + traps_active( void ) + { + return settings_current.tape_traps && !traps_suspended; + } + /* Load the next tape block into memory; returns 0 if a block was loaded (even if it had an tape loading error or equivalent) or *************** *** 301,305 **** /* Do nothing if tape traps aren't active, or the tape is already playing */ ! if( ! settings_current.tape_traps || tape_playing ) return 2; /* Do nothing if we're not in the correct ROM */ --- 309,313 ---- /* Do nothing if tape traps aren't active, or the tape is already playing */ ! if( !traps_active() || tape_playing ) return 2; /* Do nothing if we're not in the correct ROM */ *************** *** 316,320 **** if( libspectrum_tape_block_type( block ) != LIBSPECTRUM_TAPE_BLOCK_ROM ) { ! error = tape_play(); if( error ) return 3; --- 324,328 ---- if( libspectrum_tape_block_type( block ) != LIBSPECTRUM_TAPE_BLOCK_ROM ) { ! error = tape_play( 0 ); if( error ) return 3; *************** *** 352,356 **** /* And start the tape playing */ ! error = tape_play(); /* On error, still return without error as we did sucessfully do the tape trap, and so don't want to do the trigger instruction */ --- 360,364 ---- /* And start the tape playing */ ! error = tape_play( 0 ); /* On error, still return without error as we did sucessfully do the tape trap, and so don't want to do the trigger instruction */ *************** *** 467,471 **** /* Do nothing if tape traps aren't active */ ! if( ! settings_current.tape_traps ) return 2; /* Check we're in the right ROM */ --- 475,479 ---- /* Do nothing if tape traps aren't active */ ! if( !traps_active() ) return 2; /* Check we're in the right ROM */ *************** *** 520,524 **** /* Check whether we're actually in the right ROM when a tape trap hit */ ! int trap_check_rom( void ) { switch( machine_current->machine ) { --- 528,533 ---- /* Check whether we're actually in the right ROM when a tape trap hit */ ! static int ! trap_check_rom( void ) { switch( machine_current->machine ) { *************** *** 564,568 **** } ! int tape_play( void ) { libspectrum_tape_block* block; --- 573,578 ---- } ! static int ! tape_play( int force ) { libspectrum_tape_block* block; *************** *** 578,582 **** its end which (hopefully) means we're in the magic state involving starting slow loading whilst tape traps are active */ ! if( settings_current.tape_traps && libspectrum_tape_block_type( block ) == LIBSPECTRUM_TAPE_BLOCK_ROM && libspectrum_tape_block_state( block ) != LIBSPECTRUM_TAPE_STATE_PAUSE ) --- 588,592 ---- its end which (hopefully) means we're in the magic state involving starting slow loading whilst tape traps are active */ ! if( !force && traps_active() && libspectrum_tape_block_type( block ) == LIBSPECTRUM_TAPE_BLOCK_ROM && libspectrum_tape_block_state( block ) != LIBSPECTRUM_TAPE_STATE_PAUSE ) *************** *** 586,589 **** --- 596,600 ---- tape_playing = 1; tape_microphone = 0; + if( force ) traps_suspended = 1; /* Update the status bar */ *************** *** 604,608 **** return tape_stop(); } else { ! return tape_play(); } } --- 615,619 ---- return tape_stop(); } else { ! return tape_play( 1 ); } } *************** *** 611,614 **** --- 622,626 ---- { tape_playing = 0; + traps_suspended = 0; ui_statusbar_update( UI_STATUSBAR_ITEM_TAPE, UI_STATUSBAR_STATE_INACTIVE ); return 0; *************** *** 663,667 **** return without putting another event into the queue */ block = libspectrum_tape_current_block( tape ); ! if( settings_current.tape_traps && libspectrum_tape_block_type( block ) == LIBSPECTRUM_TAPE_BLOCK_ROM ) { --- 675,679 ---- return without putting another event into the queue */ block = libspectrum_tape_current_block( tape ); ! if( traps_active() && libspectrum_tape_block_type( block ) == LIBSPECTRUM_TAPE_BLOCK_ROM ) { |