Add feature to cache ISOs in RAM to avoid I/O stutters. 64-bit only. Loading gets slow though.

TODO: Make it cache in the background on load. Allow on 32-bit for small ISOs.
This commit is contained in:
Henrik Rydgard committed 2014-10-31 00:14:00 +01:00
1 parent 0df4afce67
commit 291e5e53c0
6 files changed
+56 -4

No files matched your search

+14
View File
@@ -44,6 +44,20 @@ BlockDevice *constructBlockDevice(const char *filename) {
return new FileBlockDevice(f);
}
RAMBlockDevice::RAMBlockDevice(BlockDevice *device) {
totalBlocks_ = device->GetNumBlocks();
u32 blockSize = GetBlockSize();
image_ = new u8[totalBlocks_ * blockSize];
for (int i = 0; i < totalBlocks_; i++) {
device->ReadBlock(i, image_ + i * blockSize);
}
delete device;
}
RAMBlockDevice::~RAMBlockDevice() {
delete[] image_;
}
// Android NDK does not support 64-bit file I/O using C streams
// so we fall back onto syscalls