DriveReader: Fix View > Show Drives

DriveReader::m_size was never initialized which was indirectly
causing CGameListCtrl to crash Dolphin when it tried to insert a
character at a negative index in a string.

Reading one sector at a time is very inefficient and appears to
be causing timing issues during boot so SectorReader has been
enhanced to support batching.

SectorReader has been given a working cache system.
This commit is contained in:
EmptyChaos
2016-04-26 11:24:08 +00:00
parent bdb9da2104
commit 97d570f0c9
8 changed files with 308 additions and 121 deletions

View File

@ -30,18 +30,18 @@ public:
private:
DriveReader(const std::string& drive);
void GetBlock(u64 block_num, u8 *out_ptr) override;
bool GetBlock(u64 block_num, u8 *out_ptr) override;
bool ReadMultipleAlignedBlocks(u64 block_num, u64 num_blocks, u8* out_ptr) override;
#ifdef _WIN32
HANDLE m_disc_handle;
HANDLE m_disc_handle = INVALID_HANDLE_VALUE;
PREVENT_MEDIA_REMOVAL m_lock_cdrom;
bool IsOK() { return m_disc_handle != INVALID_HANDLE_VALUE; }
bool IsOK() const { return m_disc_handle != INVALID_HANDLE_VALUE; }
#else
File::IOFile m_file;
bool IsOK() { return m_file != nullptr; }
bool IsOK() const { return m_file.IsOpen() && m_file.IsGood(); }
#endif
s64 m_size;
u64 m_size = 0;
};
} // namespace