Ejemplo n.º 1
0
bool CDIF_ST::ReadRawSector(uint8 *buf, uint32 lba)
{
 if(UnrecoverableError)
 {
  memset(buf, 0, 2352 + 96);
  return(false);
 }

 //try
 {
  if(!disc_cdaccess->Read_Raw_Sector(buf, lba))
	{
  	MDFN_PrintError(_("Sector %u read error"), lba);
  	memset(buf, 0, 2352 + 96);
  	return(false);
	}
 }
 /*catch(std::exception &e)
 {
  MDFN_PrintError(_("Sector %u read error: %s"), lba, e.what());
  memset(buf, 0, 2352 + 96);
  return(false);
 }*/

 static const int max_ra = 16;
 static const int initial_ra = 1;
 static const int speedmult_ra = 2;
 int ra_count = 0;

 if(last_read_lba != ~0U && lba == (last_read_lba + 1))
 {
  int how_far_ahead = ra_lba - lba;

  if(how_far_ahead <= max_ra)
   ra_count = std::min(speedmult_ra, 1 + max_ra - how_far_ahead);
  else
   ra_count++;
 }
 else if(lba != last_read_lba)
 {
  ra_lba = lba;
  ra_count = initial_ra;
 }
 last_read_lba = lba;
 if(ra_count)
 {
	 disc_cdaccess->HintReadSector(ra_lba, ra_count);
	 ra_lba += ra_count;
 }

 return(true);
}
Ejemplo n.º 2
0
void CDIF_ST::HintReadSector(uint32 lba)
{
 // TODO: disc_cdaccess seek hint? (probably not, would require asynchronousitycamel)
	disc_cdaccess->HintReadSector(lba, 1);
}