Add CHD precache support
This uses the chd_precache() function of libchdr which just loads the CHD image to memory without decompressing it. So this is "weaker" than the full preload to RAM option, which fully decompresses the CHD image, but it still solves the problem of having the CHD images stored on unreliable network storage. It's also much faster, since CHDs are quite slow to decompress in whole. The main point of this is to be able to use M3U files to run multi-disc games and still be able to work around unreliable storage. The full preload to RAM option does not work with M3U files. This option does. CHD precache is ignored (and the option disabled in the UI) if the full preload to RAM option is enabled.
This commit is contained in:
parent
bbd7398028
commit
0cca23ff30
25 changed files with 156 additions and 77 deletions
|
|
@ -10,7 +10,7 @@ Log_SetChannel(CDImageMemory);
|
|||
class CDImageMemory : public CDImage
|
||||
{
|
||||
public:
|
||||
CDImageMemory();
|
||||
CDImageMemory(OpenFlags open_flags);
|
||||
~CDImageMemory() override;
|
||||
|
||||
bool CopyImage(CDImage* image, ProgressCallback* progress);
|
||||
|
|
@ -27,7 +27,7 @@ private:
|
|||
CDSubChannelReplacement m_sbi;
|
||||
};
|
||||
|
||||
CDImageMemory::CDImageMemory() = default;
|
||||
CDImageMemory::CDImageMemory(OpenFlags open_flags) : CDImage(open_flags) {}
|
||||
|
||||
CDImageMemory::~CDImageMemory()
|
||||
{
|
||||
|
|
@ -143,7 +143,7 @@ bool CDImageMemory::ReadSectorFromIndex(void* buffer, const Index& index, LBA lb
|
|||
std::unique_ptr<CDImage>
|
||||
CDImage::CreateMemoryImage(CDImage* image, ProgressCallback* progress /* = ProgressCallback::NullProgressCallback */)
|
||||
{
|
||||
std::unique_ptr<CDImageMemory> memory_image = std::make_unique<CDImageMemory>();
|
||||
std::unique_ptr<CDImageMemory> memory_image = std::make_unique<CDImageMemory>(image->GetOpenFlags());
|
||||
if (!memory_image->CopyImage(image, progress))
|
||||
return {};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue