diff --git a/cpp/devices/disk.h b/cpp/devices/disk.h index 6bb54d66..4b9e9faf 100644 --- a/cpp/devices/disk.h +++ b/cpp/devices/disk.h @@ -112,7 +112,7 @@ protected: void SetUpCache(off_t, bool = false); void ResizeCache(const string&, bool); - + bool GetRawMode() { return (cache?cache->GetRawMode():false); } void SetUpModePages(map>&, int, bool) const override; void AddErrorPage(map>&, bool) const; virtual void AddFormatPage(map>&, bool) const; diff --git a/cpp/devices/disk_cache.h b/cpp/devices/disk_cache.h index ec486edd..b1f299c5 100644 --- a/cpp/devices/disk_cache.h +++ b/cpp/devices/disk_cache.h @@ -51,6 +51,7 @@ public: ~DiskCache() = default; void SetRawMode(bool b) { cd_raw = b; } // CD-ROM raw mode setting + bool GetRawMode() { return cd_raw; } bool Save(); // Save and release all bool ReadSector(span, uint32_t); // Sector Read diff --git a/cpp/devices/scsicd.cpp b/cpp/devices/scsicd.cpp index 23e76510..e1d356bd 100644 --- a/cpp/devices/scsicd.cpp +++ b/cpp/devices/scsicd.cpp @@ -178,6 +178,8 @@ void SCSICD::ModeSelect(scsi_command cmd, cdb_t cdb, span buf, in SetSectorSizeInBytes(wanted_sector_size); ClearTrack(); CreateDataTrack(); + FlushCache(); + ResizeCache(GetFilename(), GetRawMode()); } if (const string result = scsi_command_util::ModeSelect(cmd, cdb, buf, length, sector_size);