Skip to content

Commit

Permalink
Backport CD-ROM code
Browse files Browse the repository at this point in the history
  • Loading branch information
inactive123 committed Aug 7, 2016
1 parent 959b721 commit 7aaa4ed
Show file tree
Hide file tree
Showing 26 changed files with 1,641 additions and 1,499 deletions.
14 changes: 8 additions & 6 deletions Makefile.common
Expand Up @@ -76,15 +76,17 @@ ifneq ($(HAVE_GRIFFIN),1)
SOURCES_CXX += $(MEDNAFEN_DIR)/cdrom/CDAccess.cpp \
$(MEDNAFEN_DIR)/cdrom/CDAccess_Image.cpp \
$(MEDNAFEN_DIR)/cdrom/CDAccess_CCD.cpp \
$(MEDNAFEN_DIR)/cdrom/CDUtility.cpp \
$(MEDNAFEN_DIR)/cdrom/lec.cpp \
$(MEDNAFEN_DIR)/cdrom/SimpleFIFO.cpp \
$(MEDNAFEN_DIR)/cdrom/audioreader.cpp \
$(MEDNAFEN_DIR)/cdrom/galois.cpp \
$(MEDNAFEN_DIR)/cdrom/recover-raw.cpp \
$(MEDNAFEN_DIR)/cdrom/l-ec.cpp \
$(MEDNAFEN_DIR)/cdrom/crc32.cpp \
$(MEDNAFEN_DIR)/cdrom/cdromif.cpp

SOURCES_C += \
$(MEDNAFEN_DIR)/cdrom/CDUtility.c \
$(MEDNAFEN_DIR)/cdrom/lec.c \
$(MEDNAFEN_DIR)/cdrom/galois.c \
$(MEDNAFEN_DIR)/cdrom/recover-raw.c \
$(MEDNAFEN_DIR)/cdrom/l-ec.c \
$(MEDNAFEN_DIR)/cdrom/edc_crc32.c
endif
FLAGS += -DNEED_CD
endif
Expand Down
6 changes: 3 additions & 3 deletions libretro.cpp
Expand Up @@ -298,7 +298,7 @@ static bool TestMagicCD(std::vector<CDIF *> *CDInterfaces)
};
uint8 sector_buffer[2048];
CDIF *cdiface = (*CDInterfaces)[0];
CDUtility::TOC toc;
TOC toc;
bool ret = FALSE;

memset(sector_buffer, 0, sizeof(sector_buffer));
Expand Down Expand Up @@ -970,7 +970,7 @@ MDFNGI *MDFNI_LoadCD(const char *force_module, const char *devicename)
MDFN_indent(1);
for(unsigned i = 0; i < CDInterfaces.size(); i++)
{
CDUtility::TOC toc;
TOC toc;

CDInterfaces[i]->ReadTOC(&toc);

Expand Down Expand Up @@ -1251,7 +1251,7 @@ void retro_init(void)
log_cb = NULL;

#ifdef NEED_CD
CDUtility::CDUtility_Init();
CDUtility_Init();
#endif

const char *dir = NULL;
Expand Down
6 changes: 0 additions & 6 deletions mednafen/cdrom/CDAccess.cpp
Expand Up @@ -22,12 +22,6 @@
#include "CDAccess_Image.h"
#include "CDAccess_CCD.h"

#ifdef HAVE_LIBCDIO
#include "CDAccess_Physical.h"
#endif

using namespace CDUtility;

CDAccess::CDAccess()
{

Expand Down
2 changes: 1 addition & 1 deletion mednafen/cdrom/CDAccess.h
Expand Up @@ -14,7 +14,7 @@ class CDAccess

virtual void Read_Raw_Sector(uint8 *buf, int32 lba) = 0;

virtual void Read_TOC(CDUtility::TOC *toc) = 0;
virtual void Read_TOC(TOC *toc) = 0;

virtual bool Is_Physical(void) throw() = 0;

Expand Down
4 changes: 1 addition & 3 deletions mednafen/cdrom/CDAccess_CCD.cpp
Expand Up @@ -24,8 +24,6 @@
#include <limits.h>
#include <map>

using namespace CDUtility;

static void MDFN_strtoupper(std::string &str)
{
const size_t len = str.length();
Expand Down Expand Up @@ -502,7 +500,7 @@ void CDAccess_CCD::Read_Raw_Sector(uint8 *buf, int32 lba)
}


void CDAccess_CCD::Read_TOC(CDUtility::TOC *toc)
void CDAccess_CCD::Read_TOC(TOC *toc)
{
*toc = tocd;
}
Expand Down
4 changes: 2 additions & 2 deletions mednafen/cdrom/CDAccess_CCD.h
Expand Up @@ -30,7 +30,7 @@ class CDAccess_CCD : public CDAccess

virtual void Read_Raw_Sector(uint8 *buf, int32 lba);

virtual void Read_TOC(CDUtility::TOC *toc);
virtual void Read_TOC(TOC *toc);

virtual bool Is_Physical(void) throw();

Expand All @@ -46,5 +46,5 @@ class CDAccess_CCD : public CDAccess
Stream* img_stream;
Stream* sub_stream;
size_t img_numsectors;
CDUtility::TOC tocd;
TOC tocd;
};
4 changes: 1 addition & 3 deletions mednafen/cdrom/CDAccess_Image.cpp
Expand Up @@ -49,8 +49,6 @@

#include <map>

using namespace CDUtility;

enum
{
CDRF_SUBM_NONE = 0,
Expand Down Expand Up @@ -1119,7 +1117,7 @@ void CDAccess_Image::MakeSubPQ(int32 lba, uint8 *SubPWBuf)

void CDAccess_Image::Read_TOC(TOC *toc)
{
toc->Clear();
TOC_Clear(toc);

toc->first_track = FirstTrack;
toc->last_track = FirstTrack + NumTracks - 1;
Expand Down
2 changes: 1 addition & 1 deletion mednafen/cdrom/CDAccess_Image.h
Expand Up @@ -68,7 +68,7 @@ class CDAccess_Image : public CDAccess

virtual void Read_Raw_Sector(uint8 *buf, int32 lba);

virtual void Read_TOC(CDUtility::TOC *toc);
virtual void Read_TOC(TOC *toc);

virtual bool Is_Physical(void) throw();

Expand Down

0 comments on commit 7aaa4ed

Please sign in to comment.