mirror of https://github.com/PCSX2/pcsx2.git
async-iso: linux. Create an empty FlatFileReader implementation. It will be completed later based on http://code.google.com/p/kernel/wiki/AIOUserGuide
git-svn-id: http://pcsx2.googlecode.com/svn/branches/async-iso@5474 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
parent
cf5d7780ba
commit
7a1d67409d
|
@ -47,12 +47,11 @@ class FlatFileReader : public AsyncFileReader
|
|||
HANDLE hOverlappedFile;
|
||||
|
||||
OVERLAPPED asyncOperationContext;
|
||||
bool asyncInProgress;
|
||||
|
||||
HANDLE hEvent;
|
||||
#else
|
||||
# error Not implemented
|
||||
#endif
|
||||
bool asyncInProgress;
|
||||
|
||||
public:
|
||||
FlatFileReader(void);
|
||||
|
|
|
@ -146,6 +146,8 @@ set(pcsx2Sources
|
|||
MMI.cpp
|
||||
MTGS.cpp
|
||||
MTVU.cpp
|
||||
MultipartFileReader.cpp
|
||||
OutputIsoFile.cpp
|
||||
Patch.cpp
|
||||
Patch_Memory.cpp
|
||||
Pcsx2Config.cpp
|
||||
|
@ -243,14 +245,17 @@ set(pcsx2Headers
|
|||
|
||||
# CDVD sources
|
||||
set(pcsx2CDVDSources
|
||||
CDVD/BlockdumpFileReader.cpp
|
||||
CDVD/CdRom.cpp
|
||||
CDVD/CDVDaccess.cpp
|
||||
CDVD/CDVD.cpp
|
||||
CDVD/CDVDisoReader.cpp
|
||||
CDVD/IsoFileFormats.cpp
|
||||
CDVD/InputIsoFile.cpp
|
||||
CDVD/OutputIsoFile.cpp
|
||||
CDVD/IsoFS/IsoFile.cpp
|
||||
CDVD/IsoFS/IsoFSCDVD.cpp
|
||||
CDVD/IsoFS/IsoFS.cpp)
|
||||
CDVD/IsoFS/IsoFS.cpp
|
||||
)
|
||||
|
||||
# CDVD headers
|
||||
set(pcsx2CDVDHeaders
|
||||
|
@ -415,7 +420,9 @@ set(pcsx2IPUHeaders
|
|||
|
||||
# Linux sources
|
||||
set(pcsx2LinuxSources
|
||||
Linux/LnxKeyCodes.cpp)
|
||||
Linux/LnxKeyCodes.cpp
|
||||
Linux/LnxFlatFileReader.cpp
|
||||
)
|
||||
|
||||
# Linux headers
|
||||
set(pcsx2LinuxHeaders
|
||||
|
|
|
@ -0,0 +1,100 @@
|
|||
#include "PrecompiledHeader.h"
|
||||
#include "AsyncFileReader.h"
|
||||
|
||||
FlatFileReader::FlatFileReader(void)
|
||||
{
|
||||
m_blocksize = 2048;
|
||||
//hOverlappedFile = INVALID_HANDLE_VALUE;
|
||||
//hEvent = INVALID_HANDLE_VALUE;
|
||||
asyncInProgress = false;
|
||||
}
|
||||
|
||||
FlatFileReader::~FlatFileReader(void)
|
||||
{
|
||||
Close();
|
||||
}
|
||||
|
||||
bool FlatFileReader::Open(const wxString& fileName)
|
||||
{
|
||||
m_filename = fileName;
|
||||
|
||||
//hEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
|
||||
|
||||
//hOverlappedFile = CreateFile(
|
||||
// fileName,
|
||||
// GENERIC_READ,
|
||||
// FILE_SHARE_READ,
|
||||
// NULL,
|
||||
// OPEN_EXISTING,
|
||||
// FILE_FLAG_SEQUENTIAL_SCAN | FILE_FLAG_OVERLAPPED,
|
||||
// NULL);
|
||||
|
||||
//return hOverlappedFile != INVALID_HANDLE_VALUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
int FlatFileReader::ReadSync(void* pBuffer, uint sector, uint count)
|
||||
{
|
||||
BeginRead(pBuffer, sector, count);
|
||||
return FinishRead();
|
||||
}
|
||||
|
||||
void FlatFileReader::BeginRead(void* pBuffer, uint sector, uint count)
|
||||
{
|
||||
LARGE_INTEGER offset;
|
||||
//offset.QuadPart = sector * (__int64)m_blocksize;
|
||||
|
||||
//DWORD bytesToRead = count * m_blocksize;
|
||||
|
||||
//ZeroMemory(&asyncOperationContext, sizeof(asyncOperationContext));
|
||||
//asyncOperationContext.hEvent = hEvent;
|
||||
//asyncOperationContext.Offset = offset.LowPart;
|
||||
//asyncOperationContext.OffsetHigh = offset.HighPart;
|
||||
|
||||
//ReadFile(hOverlappedFile, pBuffer, bytesToRead, NULL, &asyncOperationContext);
|
||||
asyncInProgress = true;
|
||||
}
|
||||
|
||||
int FlatFileReader::FinishRead(void)
|
||||
{
|
||||
//DWORD bytes;
|
||||
//
|
||||
//if(!GetOverlappedResult(hOverlappedFile, &asyncOperationContext, &bytes, TRUE))
|
||||
//{
|
||||
// asyncInProgress = false;
|
||||
// return -1;
|
||||
//}
|
||||
|
||||
asyncInProgress = false;
|
||||
//return bytes;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void FlatFileReader::CancelRead(void)
|
||||
{
|
||||
//CancelIo(hOverlappedFile);
|
||||
}
|
||||
|
||||
void FlatFileReader::Close(void)
|
||||
{
|
||||
//if(asyncInProgress)
|
||||
// CancelRead();
|
||||
|
||||
//if(hOverlappedFile != INVALID_HANDLE_VALUE)
|
||||
// CloseHandle(hOverlappedFile);
|
||||
|
||||
//if(hEvent != INVALID_HANDLE_VALUE)
|
||||
// CloseHandle(hEvent);
|
||||
|
||||
//hOverlappedFile = INVALID_HANDLE_VALUE;
|
||||
//hEvent = INVALID_HANDLE_VALUE;
|
||||
}
|
||||
|
||||
int FlatFileReader::GetBlockCount(void) const
|
||||
{
|
||||
LARGE_INTEGER fileSize;
|
||||
//fileSize.LowPart = GetFileSize(hOverlappedFile, (DWORD*)&(fileSize.HighPart));
|
||||
|
||||
//return (int)(fileSize.QuadPart / m_blocksize);
|
||||
return 0;
|
||||
}
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
#include "PrecompiledHeader.h"
|
||||
#include "IopCommon.h"
|
||||
#include "IsoFileFormats.h"
|
||||
#include "CDVD/IsoFileFormats.h"
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
|
@ -145,4 +145,4 @@ bool OutputIsoFile::IsOpened() const
|
|||
{
|
||||
return m_outstream && m_outstream->IsOk();
|
||||
}
|
||||
*/
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue