本文整理汇总了C++中CDAccess::Read_Raw_Sector方法的典型用法代码示例。如果您正苦于以下问题:C++ CDAccess::Read_Raw_Sector方法的具体用法?C++ CDAccess::Read_Raw_Sector怎么用?C++ CDAccess::Read_Raw_Sector使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CDAccess
的用法示例。
在下文中一共展示了CDAccess::Read_Raw_Sector方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ReadRawSector
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);
}
示例2: ReadRawSector
bool CDIF_ST::ReadRawSector(uint8 *buf, uint32 lba)
{
if(UnrecoverableError)
{
memset(buf, 0, 2352 + 96);
return(false);
}
try
{
disc_cdaccess->Read_Raw_Sector(buf, lba);
}
catch(std::exception &e)
{
MDFN_PrintError(_("Sector %u read error: %s"), lba, e.what());
memset(buf, 0, 2352 + 96);
return(false);
}
return(true);
}
示例3: ReadRawSector
bool CDIF_ST::ReadRawSector(uint8 *buf, uint32 lba)
{
if(UnrecoverableError)
{
memset(buf, 0, 2352 + 96);
return(false);
}
try
{
disc_cdaccess->Read_Raw_Sector(buf, lba);
}
catch(std::exception &e)
{
log_cb(RETRO_LOG_ERROR, "Sector %u read error: %s\n", lba, e.what());
memset(buf, 0, 2352 + 96);
return(false);
}
return(true);
}
示例4: ReadThreadStart
int CDIF_MT::ReadThreadStart()
{
bool Running = TRUE;
DiscEjected = true;
SBWritePos = 0;
ra_lba = 0;
ra_count = 0;
last_read_lba = ~0U;
try
{
RT_EjectDisc(false, true);
}
catch(std::exception &e)
{
EmuThreadQueue.Write(CDIF_Message(CDIF_MSG_FATAL_ERROR, std::string(e.what())));
return(0);
}
is_phys_cache = disc_cdaccess->Is_Physical();
EmuThreadQueue.Write(CDIF_Message(CDIF_MSG_DONE));
while(Running)
{
CDIF_Message msg;
// Only do a blocking-wait for a message if we don't have any sectors to read-ahead.
// MDFN_DispMessage("%d %d %d\n", last_read_lba, ra_lba, ra_count);
if(ReadThreadQueue.Read(&msg, ra_count ? FALSE : TRUE))
{
switch(msg.message)
{
case CDIF_MSG_DIEDIEDIE:
Running = FALSE;
break;
case CDIF_MSG_EJECT:
try
{
RT_EjectDisc(msg.args[0]);
EmuThreadQueue.Write(CDIF_Message(CDIF_MSG_DONE));
}
catch(std::exception &e)
{
EmuThreadQueue.Write(CDIF_Message(CDIF_MSG_FATAL_ERROR, std::string(e.what())));
}
break;
case CDIF_MSG_READ_SECTOR:
{
static const int max_ra = 16;
static const int initial_ra = 1;
static const int speedmult_ra = 2;
uint32 new_lba = msg.args[0];
assert((unsigned int)max_ra < (SBSize / 4));
if(last_read_lba != ~0U && new_lba == (last_read_lba + 1))
{
int how_far_ahead = ra_lba - new_lba;
if(how_far_ahead <= max_ra)
ra_count = std::min(speedmult_ra, 1 + max_ra - how_far_ahead);
else
ra_count++;
}
else if(new_lba != last_read_lba)
{
ra_lba = new_lba;
ra_count = initial_ra;
}
last_read_lba = new_lba;
}
break;
}
}
// Don't read >= the "end" of the disc, silly snake. Slither.
if(ra_count && ra_lba == disc_toc.tracks[100].lba)
{
ra_count = 0;
//printf("Ephemeral scarabs: %d!\n", ra_lba);
}
if(ra_count)
{
uint8 tmpbuf[2352 + 96];
bool error_condition = false;
try
{
disc_cdaccess->Read_Raw_Sector(tmpbuf, ra_lba);
}
catch(std::exception &e)
{
MDFN_PrintError(_("Sector %u read error: %s"), ra_lba, e.what());
memset(tmpbuf, 0, sizeof(tmpbuf));
//.........这里部分代码省略.........