remove more unused functions

This commit is contained in:
aliaspider 2014-11-24 04:12:51 +01:00
parent a0a50da711
commit 7ac63a610f
7 changed files with 3 additions and 122 deletions

View File

@ -15,15 +15,6 @@ public:
virtual void Read_Raw_Sector(uint8* buf, int32 lba) = 0;
virtual void Read_TOC(CDUtility_TOC* toc) = 0;
virtual bool Is_Physical(void) throw() = 0;
virtual void Eject(bool eject_status) =
0; // Eject a disc if it's physical, otherwise NOP. Returns true on success(or NOP), false on error
private:
CDAccess(const CDAccess &); // No copy constructor.
CDAccess &operator=(const CDAccess &); // No assignment operator.
};
CDAccess* cdaccess_open_image(const char* path);

View File

@ -439,13 +439,4 @@ void CDAccess_CCD::Read_TOC(CDUtility_TOC* toc)
*toc = tocd;
}
bool CDAccess_CCD::Is_Physical(void) throw()
{
return false;
}
void CDAccess_CCD::Eject(bool eject_status)
{
}

View File

@ -21,7 +21,6 @@
class CDAccess_CCD : public CDAccess
{
public:
CDAccess_CCD(const char* path);
virtual ~CDAccess_CCD();
@ -29,12 +28,6 @@ public:
virtual void Read_TOC(CDUtility_TOC* toc);
virtual bool Is_Physical(void) throw();
virtual void Eject(bool eject_status);
private:
void Load(const char* path);
void Cleanup(void);

View File

@ -1018,13 +1018,3 @@ void CDAccess_Image::Read_TOC(CDUtility_TOC* toc)
toc->tracks[toc->last_track + 1] = toc->tracks[100];
}
bool CDAccess_Image::Is_Physical(void) throw()
{
return (false);
}
void CDAccess_Image::Eject(bool eject_status)
{
}

View File

@ -33,19 +33,12 @@ struct CDRFILE_TRACK_INFO
class CDAccess_Image : public CDAccess
{
public:
CDAccess_Image(const char* path);
virtual ~CDAccess_Image();
virtual void Read_Raw_Sector(uint8* buf, int32 lba);
virtual void Read_Raw_Sector(uint8* buf, int32 lba);
virtual void Read_TOC(CDUtility_TOC* toc);
virtual bool Is_Physical(void) throw();
virtual void Eject(bool eject_status);
private:
int32 NumTracks;
int32 FirstTrack;
int32 LastTrack;

View File

@ -35,41 +35,23 @@ typedef struct
uint8 data[2352 + 96];
} CDIF_Sector_Buffer;
// TODO: prohibit copy constructor
class CDIF_ST : public CDIF
{
public:
CDIF_ST(CDAccess* cda);
virtual ~CDIF_ST();
virtual void HintReadSector(uint32 lba);
virtual bool ReadRawSector(uint8* buf, uint32 lba);
virtual bool Eject(bool eject_status);
private:
CDAccess* disc_cdaccess;
};
CDIF::CDIF() : UnrecoverableError(false), is_phys_cache(false),
DiscEjected(false)
{
}
CDIF::~CDIF()
{
}
int CDIF::ReadSector(uint8* pBuf, uint32 lba, uint32 nSectors)
{
int ret = 0;
if (UnrecoverableError)
return (false);
while (nSectors--)
{
uint8 tmpbuf[2352 + 96];
@ -110,12 +92,6 @@ int CDIF::ReadSector(uint8* pBuf, uint32 lba, uint32 nSectors)
CDIF_ST::CDIF_ST(CDAccess* cda) : disc_cdaccess(cda)
{
//puts("***WARNING USING SINGLE-THREADED CD READER***");
is_phys_cache = false;
UnrecoverableError = false;
DiscEjected = false;
disc_cdaccess->Read_TOC(&disc_toc);
assert(disc_toc.first_track > 0 && disc_toc.last_track < 100
@ -139,12 +115,6 @@ void CDIF_ST::HintReadSector(uint32 lba)
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);
@ -160,41 +130,6 @@ bool CDIF_ST::ReadRawSector(uint8* buf, uint32 lba)
return (true);
}
bool CDIF_ST::Eject(bool eject_status)
{
if (UnrecoverableError)
return (false);
try
{
int32 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);
assert(disc_toc.first_track > 0 && disc_toc.last_track < 100
&& 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)
{
if (log_cb)
log_cb(RETRO_LOG_ERROR, "%s\n", e.what());
return (false);
}
return (true);
}
CDIF* CDIF_Open(const char* path)
{
CDAccess* cda = cdaccess_open_image(path);

View File

@ -29,8 +29,8 @@ class CDIF
{
public:
CDIF();
virtual ~CDIF();
CDIF(){}
virtual ~CDIF(){}
inline void ReadTOC(CDUtility_TOC* read_target)
{
@ -45,20 +45,8 @@ public:
// Will return the type(1, 2) of the first sector read to the buffer supplied, 0 on error
int ReadSector(uint8* pBuf, uint32 lba, uint32 nSectors);
// Return true if operation succeeded or it was a NOP(either due to not being implemented, or the current status matches eject_status).
// Returns false on failure(usually drive error of some kind; not completely fatal, can try again).
virtual bool Eject(bool eject_status) = 0;
inline bool IsPhysical(void)
{
return (is_phys_cache);
}
protected:
bool UnrecoverableError;
bool is_phys_cache;
CDUtility_TOC disc_toc;
bool DiscEjected;
};
CDIF* CDIF_Open(const char* path);