diff options
| author | LPFaint99 <lpfaint99@gmail.com> | 2009-02-22 07:52:02 +0000 |
|---|---|---|
| committer | LPFaint99 <lpfaint99@gmail.com> | 2009-02-22 07:52:02 +0000 |
| commit | e5cf9c8b8c591ad977b5700f788dcbea88d3d09b (patch) | |
| tree | 96a2e804019b73c6fda39c3657246c46eb618084 /Source/Core/DiscIO | |
| parent | 42101f0ce619c7c7eefe961b2c0a29fa0de7ce93 (diff) | |
Fix for read from raw drive on some machines,
must have been a fluke that it worked for me and a few others
thanks to shuffle2 and daxtsu for testing patch
some linux compile fixes
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2360 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/Core/DiscIO')
| -rw-r--r-- | Source/Core/DiscIO/Src/Blob.h | 1 | ||||
| -rw-r--r-- | Source/Core/DiscIO/Src/DriveBlob.cpp | 20 | ||||
| -rw-r--r-- | Source/Core/DiscIO/Src/DriveBlob.h | 8 |
3 files changed, 8 insertions, 21 deletions
diff --git a/Source/Core/DiscIO/Src/Blob.h b/Source/Core/DiscIO/Src/Blob.h index 1722173d5a..778cc1f8d9 100644 --- a/Source/Core/DiscIO/Src/Blob.h +++ b/Source/Core/DiscIO/Src/Blob.h @@ -64,6 +64,7 @@ public: ~SectorReader(); const u8 *GetBlockData(u64 block_num); bool Read(u64 offset, u64 size, u8* out_ptr); + friend class DriveReader; }; // Factory function - examines the path to choose the right type of IBlobReader, and returns one. diff --git a/Source/Core/DiscIO/Src/DriveBlob.cpp b/Source/Core/DiscIO/Src/DriveBlob.cpp index fd104f441f..ce7bd4d752 100644 --- a/Source/Core/DiscIO/Src/DriveBlob.cpp +++ b/Source/Core/DiscIO/Src/DriveBlob.cpp @@ -36,7 +36,7 @@ namespace DiscIO } else { - SetSectorSize(2048); + SectorReader::SetSectorSize(2048); #ifdef _LOCKDRIVE // Lock the compact disc in the CD-ROM drive to prevent accidental // removal while reading from it. @@ -127,27 +127,17 @@ namespace DiscIO delete lpSector; } - void DriveReader::SetSectorSize(int blocksize) - { - for (int i = 0; i < CACHE_SIZE; i++) - { - cache[i] = new u8[blocksize]; - cache_tags[i] = (u64)(s64) - 1; - } - m_blocksize = blocksize; - } - const u8 *DriveReader::GetBlockData(u64 block_num) { - if (cache_tags[0] == block_num) + if (SectorReader::cache_tags[0] == block_num) { - return cache[0]; + return SectorReader::cache[0]; } else { GetBlock(block_num, cache[0]); - cache_tags[0] = block_num; - return cache[0]; + SectorReader::cache_tags[0] = block_num; + return SectorReader::cache[0]; } } diff --git a/Source/Core/DiscIO/Src/DriveBlob.h b/Source/Core/DiscIO/Src/DriveBlob.h index efd0d53cee..bd84fc3afa 100644 --- a/Source/Core/DiscIO/Src/DriveBlob.h +++ b/Source/Core/DiscIO/Src/DriveBlob.h @@ -32,13 +32,8 @@ class DriveReader : public SectorReader { private: DriveReader(const char *drive); - void SetSectorSize(int blocksize); - enum { CACHE_SIZE = 32 }; - int m_blocksize; - u8* cache[CACHE_SIZE]; - u64 cache_tags[CACHE_SIZE]; - int cache_age[CACHE_SIZE]; void GetBlock(u64 block_num, u8 *out_ptr); + #ifdef _WIN32 HANDLE hDisc; PREVENT_MEDIA_REMOVAL pmrLockCDROM; @@ -47,6 +42,7 @@ private: #endif s64 size; u64 *block_pointers; + public: static DriveReader *Create(const char *drive); ~DriveReader(); |
