From 6c32ee7a11ef95584e6208abac167d728e0f24ee Mon Sep 17 00:00:00 2001 From: Daveo Date: Wed, 4 Apr 2001 12:38:57 +0000 Subject: [PATCH] --- source/fileio/cdfile.cpp | 36 ++++++++++++++++++++++++++++++++++++ source/fileio/cdfile.h | 1 + source/fileio/fileio.cpp | 23 +++++++++++++++++++++++ source/fileio/fileio.h | 17 +++++++++++++++++ 4 files changed, 77 insertions(+) diff --git a/source/fileio/cdfile.cpp b/source/fileio/cdfile.cpp index d9018a03e..8c0507486 100644 --- a/source/fileio/cdfile.cpp +++ b/source/fileio/cdfile.cpp @@ -46,6 +46,42 @@ int Error=0; BigLump->Sector+=Count; } + +/*****************************************************************************/ +void CCDFileIO::ReadAsync(sASyncQueue &File) +{ +u8 Com=CdlModeSpeed; +static int Error=0; +/* + switch(File.Status) + { + case BLStatusReady: + CdIntToPos(File.Sector+FileStart,&CdPos); + CdControlF(CdlSetloc, (u8*)&CdPos); // Set CD Pos + File.Status=BLStatusOpen; + break; + case BLStatusOpen: + if (CdReadSync(1,0) > 0) return; + CdControlB(CdlSetmode, &Com,0); + CdRead(File.Length, (u32*)File.Dst, CdlModeSpeed); + File.Status=BLStatusRead; + break; + case BLStatusRead: + if (CdReadSync(1,0) > 0) return; + File.Status=BLStatusOffline; + + break; + } +*/ + + CdIntToPos(File.Sector+FileStart,&CdPos); + CdControlB(CdlSetloc, (u8*)&CdPos, 0); // Set CD Pos + CdControlB(CdlSetmode, &Com, 0); + Error=CdRead(File.Length, (u32*)File.Dst, CdlModeSpeed); + if (Error!=0) File.Status=BLStatusOffline; + +} + /*****************************************************************************/ void CCDFileIO::Close() { diff --git a/source/fileio/cdfile.h b/source/fileio/cdfile.h index ab751fb95..b2fe8d658 100644 --- a/source/fileio/cdfile.h +++ b/source/fileio/cdfile.h @@ -16,6 +16,7 @@ public: void Open(); void Read(u32 Length,void *Buffer); + void ReadAsync(sASyncQueue &File); void Close(); private: diff --git a/source/fileio/fileio.cpp b/source/fileio/fileio.cpp index 914688e2c..d9861f45d 100644 --- a/source/fileio/fileio.cpp +++ b/source/fileio/fileio.cpp @@ -23,6 +23,8 @@ CLOFileIO *CFileIO::FileIO; int CFileIO::FilePosList[FILEPOS_MAX]; sFAT *CFileIO::MainFAT=0; +sASyncQueue CFileIO::ASyncQueue; +bool CFileIO::ASyncFlag; /*****************************************************************************/ sDataBank CFileIO::DataBank[DATABANK_MAX]= @@ -77,6 +79,8 @@ int FATSize=FileEquate_MAX*sizeof(sFAT); for (int Bank=0;BankReadAsync(ASyncQueue); + } +} + /*****************************************************************************/ /*** Data Banks **************************************************************/ /*****************************************************************************/ diff --git a/source/fileio/fileio.h b/source/fileio/fileio.h index 7321a1f70..b1d8d60ae 100644 --- a/source/fileio/fileio.h +++ b/source/fileio/fileio.h @@ -76,6 +76,15 @@ struct sDataBank sFAT *Data; }; +/*****************************************************************************/ +struct sASyncQueue +{ + int Sector; + int Length; + u8 *Dst; + int Status; +}; + /*****************************************************************************/ class CLOFileIO; class CFileIO @@ -110,6 +119,11 @@ static void FindAllFilePos(); static void GetAllFilePos(); static int GetReadLeft(); +// Fake ASync Que Stuff +static void EnableASync(bool f) {ASyncFlag=f;} +static void AddASyncFile(FileEquate file,u8 *Dst); +static void LoadASyncFiles(); + private: static void CheckChunk(); @@ -121,6 +135,8 @@ static sDataBank DataBank[DATABANK_MAX]; static DataBankEquate CurrentDataBank; static sFAT *MainFAT; +static sASyncQueue ASyncQueue; +static bool ASyncFlag; }; /*****************************************************************************/ @@ -129,6 +145,7 @@ class CLOFileIO public: virtual void Open()=0; virtual void Read(u32 Length,void *Buffer)=0; + virtual void ReadAsync(sASyncQueue &File){}; virtual void Close()=0; };