/* Free up a list of blocks */ libspectrum_error libspectrum_tape_free( libspectrum_tape *tape ) { libspectrum_error error; error = libspectrum_tape_clear( tape ); if( error ) return error; free( tape ); return LIBSPECTRUM_ERROR_NONE; }
int tape_close( void ) { int error; /* Stop the tape if it's currently playing */ if( tape_playing ) { error = tape_stop(); if( error ) return error; } /* And then remove it from memory */ error = libspectrum_tape_clear( tape ); if( error ) return error; //ui_tape_browser_update( UI_TAPE_BROWSER_NEW_TAPE, NULL ); return 0; }
/* Close the active tape file */ int tape_close( void ) { int error; ui_confirm_save_t confirm; /* If the tape has been modified, check if we want to do this */ if( tape_modified ) { confirm = ui_confirm_save( "Tape has been modified.\nDo you want to save it?" ); switch( confirm ) { case UI_CONFIRM_SAVE_SAVE: error = ui_tape_write(); if( error ) return error; break; case UI_CONFIRM_SAVE_DONTSAVE: break; case UI_CONFIRM_SAVE_CANCEL: return 1; } } /* Stop the tape if it's currently playing */ if( tape_playing ) { error = tape_stop(); if( error ) return error; } /* And then remove it from memory */ error = libspectrum_tape_clear( tape ); if( error ) return error; tape_modified = 0; ui_tape_browser_update( UI_TAPE_BROWSER_NEW_TAPE, NULL ); return 0; }