bool CDIF_ST::Eject(bool eject_status) { if(UnrecoverableError) return(false); try { if(eject_status != DiscEjected) { disc_cdaccess->Eject(eject_status); // Set after ->Eject(), since it might throw an exception. DiscEjected = -1; // For if TOC reading fails or there's something horribly wrong with the disc. if(!eject_status) // Re-read the TOC { disc_cdaccess->Read_TOC(&disc_toc); if(disc_toc.first_track < 1 || disc_toc.last_track > 99 || disc_toc.first_track > disc_toc.last_track) { throw(MDFN_Error(0, _("TOC first(%d)/last(%d) track numbers bad."), disc_toc.first_track, disc_toc.last_track)); } } DiscEjected = eject_status; } } catch(std::exception &e) { MDFN_PrintError("%s", e.what()); return(false); } return(true); }
bool CDIF_ST::Eject(bool eject_status) { if(UnrecoverableError) return(false); try { int32_t old_de = DiscEjected; DiscEjected = eject_status; if(old_de != DiscEjected) { disc_cdaccess->Eject(eject_status); if(!eject_status) // Re-read the TOC { disc_cdaccess->Read_TOC(&disc_toc); if(disc_toc.first_track < 1 || disc_toc.last_track > 99 || disc_toc.first_track > disc_toc.last_track) throw(MDFN_Error(0, _("TOC first(%d)/last(%d) track numbers bad."), disc_toc.first_track, disc_toc.last_track)); } } } catch(std::exception &e) { log_cb(RETRO_LOG_ERROR, "%s\n", e.what()); return(false); } return(true); }
void CDIF_MT::RT_EjectDisc(bool eject_status, bool skip_actual_eject) { if(eject_status != DiscEjected) { if(!skip_actual_eject) disc_cdaccess->Eject(eject_status); // Set after ->Eject(), since it might throw an exception. DiscEjected = -1; // For if TOC reading fails or there's something horribly wrong with the disc. if(!eject_status) // Re-read the TOC { disc_cdaccess->Read_TOC(&disc_toc); if(disc_toc.first_track < 1 || disc_toc.last_track > 99 || disc_toc.first_track > disc_toc.last_track) { throw(MDFN_Error(0, _("TOC first(%d)/last(%d) track numbers bad."), disc_toc.first_track, disc_toc.last_track)); } } DiscEjected = eject_status; SBWritePos = 0; ra_lba = 0; ra_count = 0; last_read_lba = ~0U; memset(SectorBuffers, 0, SBSize * sizeof(CDIF_Sector_Buffer)); } }
void CDIF_MT::RT_EjectDisc(bool eject_status, bool skip_actual_eject) { int32_t old_de = DiscEjected; DiscEjected = eject_status; if(old_de != DiscEjected) { if(!skip_actual_eject) disc_cdaccess->Eject(eject_status); if(!eject_status) // Re-read the TOC { disc_cdaccess->Read_TOC(&disc_toc); if(disc_toc.first_track < 1 || disc_toc.last_track > 99 || disc_toc.first_track > disc_toc.last_track) throw(MDFN_Error(0, _("TOC first(%d)/last(%d) track numbers bad."), disc_toc.first_track, disc_toc.last_track)); } SBWritePos = 0; ra_lba = 0; ra_count = 0; last_read_lba = ~0U; memset(SectorBuffers, 0, SBSize * sizeof(CDIF_Sector_Buffer)); } }