Browse Source

Recognize FDxx filename and configure as floppy (#68)

Petteri Aimonen 3 năm trước cách đây
mục cha
commit
c723051f9d
3 tập tin đã thay đổi với 13 bổ sung7 xóa
  1. 4 3
      src/ZuluSCSI.cpp
  2. 8 3
      src/ZuluSCSI_disk.cpp
  3. 1 1
      src/ZuluSCSI_disk.h

+ 4 - 3
src/ZuluSCSI.cpp

@@ -211,8 +211,9 @@ bool findHDDImages()
       file.close();
       bool is_hd = (tolower(name[0]) == 'h' && tolower(name[1]) == 'd');
       bool is_cd = (tolower(name[0]) == 'c' && tolower(name[1]) == 'd');
+      bool is_fd = (tolower(name[0]) == 'f' && tolower(name[1]) == 'd');
 
-      if (is_hd || is_cd)
+      if (is_hd || is_cd || is_fd)
       {
         // Check file extension
         // We accept anything except known compressed files
@@ -307,7 +308,7 @@ bool findHDDImages()
         // Open the image file
         if(id < NUM_SCSIID && lun < NUM_SCSILUN) {
           azlog("-- Opening ", fullname, " for id:", id, " lun:", lun);
-          imageReady = scsiDiskOpenHDDImage(id, fullname, id, lun, blk, is_cd);
+          imageReady = scsiDiskOpenHDDImage(id, fullname, id, lun, blk, is_cd, is_fd);
           if(imageReady)
           {
             foundImage = true;
@@ -392,7 +393,7 @@ static void reinitSCSI()
 #if RAW_FALLBACK_ENABLE
     azlog("No images found, enabling RAW fallback partition");
     scsiDiskOpenHDDImage(RAW_FALLBACK_SCSI_ID, "RAW:0:0xFFFFFFFF", RAW_FALLBACK_SCSI_ID, 0,
-                         RAW_FALLBACK_BLOCKSIZE, false);
+                         RAW_FALLBACK_BLOCKSIZE, false, false);
 #endif
   }
 

+ 8 - 3
src/ZuluSCSI_disk.cpp

@@ -364,7 +364,7 @@ static void setDefaultDriveInfo(int target_idx)
     formatDriveInfoField(img.serial, sizeof(img.serial), true);
 }
 
-bool scsiDiskOpenHDDImage(int target_idx, const char *filename, int scsi_id, int scsi_lun, int blocksize, bool is_cd)
+bool scsiDiskOpenHDDImage(int target_idx, const char *filename, int scsi_id, int scsi_lun, int blocksize, bool is_cd, bool is_fd)
 {
     image_config_t &img = g_DiskImages[target_idx];
     img.file = ImageBackingStore(filename);
@@ -406,6 +406,11 @@ bool scsiDiskOpenHDDImage(int target_idx, const char *filename, int scsi_id, int
             azlog("---- Configuring as CD-ROM drive based on image name");
             img.deviceType = S2S_CFG_OPTICAL;
         }
+        else if (is_fd)
+        {
+            azlog("---- Configuring as floppy drive based on image name");
+            img.deviceType = S2S_CFG_FLOPPY_14MB;
+        }
 
 #ifdef AZPLATFORM_CONFIG_HOOK
         AZPLATFORM_CONFIG_HOOK(&img);
@@ -511,7 +516,7 @@ void scsiDiskLoadConfig(int target_idx)
         image_config_t &img = g_DiskImages[target_idx];
         int blocksize = (img.deviceType == S2S_CFG_OPTICAL) ? 2048 : 512;
         azlog("-- Opening ", filename, " for id:", target_idx, ", specified in " CONFIGFILE);
-        scsiDiskOpenHDDImage(target_idx, filename, target_idx, 0, blocksize, false);
+        scsiDiskOpenHDDImage(target_idx, filename, target_idx, 0, blocksize, false, false);
     }
 }
 
@@ -763,7 +768,7 @@ static bool checkNextCDImage()
         azlog("Switching to next CD-ROM image for ", target_idx, ": ", filename);
         image_config_t &img = g_DiskImages[target_idx];
         img.file.close();
-        bool status = scsiDiskOpenHDDImage(target_idx, filename, target_idx, 0, 2048, false);
+        bool status = scsiDiskOpenHDDImage(target_idx, filename, target_idx, 0, 2048, false, false);
 
         if (status)
         {

+ 1 - 1
src/ZuluSCSI_disk.h

@@ -14,5 +14,5 @@ extern "C" {
 }
 
 void scsiDiskResetImages();
-bool scsiDiskOpenHDDImage(int target_idx, const char *filename, int scsi_id, int scsi_lun, int blocksize, bool is_cd);
+bool scsiDiskOpenHDDImage(int target_idx, const char *filename, int scsi_id, int scsi_lun, int blocksize, bool is_cd, bool is_fd);
 void scsiDiskLoadConfig(int target_idx);