Browse Source

Allow use of read only file for cdrom

Eric Helgeson 2 years ago
parent
commit
833cc8f780
2 changed files with 13 additions and 3 deletions
  1. 1 1
      src/BlueSCSI.cpp
  2. 12 2
      src/BlueSCSI_disk.cpp

+ 1 - 1
src/BlueSCSI.cpp

@@ -298,7 +298,7 @@ bool findHDDImages()
         // Apple computers reserve ID 7, so warn the user this configuration wont work
         if(id == 7 && cfg->quirks == S2S_CFG_QUIRKS_APPLE )
         {
-          bluelog("-- Ignoring ", fullname, ", SCSI ID ", id, " Quirks set to Apple so can not use SCSI ID 7!");
+          log("-- Ignoring ", fullname, ", SCSI ID ", id, " Quirks set to Apple so can not use SCSI ID 7!");
           continue;
         }
 

+ 12 - 2
src/BlueSCSI_disk.cpp

@@ -272,6 +272,7 @@ public:
     {
         m_israw = false;
         m_isrom = false;
+        m_iscdrom = false;
         m_blockdev = nullptr;
         m_bgnsector = m_endsector = m_cursector = 0;
     }
@@ -319,7 +320,15 @@ public:
         }
         else
         {
-            m_fsfile = SD.open(filename, O_RDWR);
+            if(tolower(filename[0]) == 'c')
+            {
+                m_fsfile = SD.open(filename, O_RDONLY);
+                m_iscdrom = true;
+            }
+            else
+            {
+                m_fsfile = SD.open(filename, O_RDWR);
+            }
 
             uint32_t sectorcount = m_fsfile.size() / SD_SECTOR_SIZE;
             uint32_t begin = 0, end = 0;
@@ -354,7 +363,7 @@ public:
 
     bool isWritable()
     {
-        return !m_isrom;
+        return !m_isrom || !m_iscdrom;
     }
 
     bool isRom()
@@ -523,6 +532,7 @@ public:
 private:
     bool m_israw;
     bool m_isrom;
+    bool m_iscdrom;
     romdrive_hdr_t m_romhdr;
     FsFile m_fsfile;
     SdCard *m_blockdev;