Browse Source

Add a 'ImgDir' configuration file option.

The initial code just looks for its presence, actual value will be re-read during image scanning.
saybur 2 years ago
parent
commit
db4a392952
2 changed files with 12 additions and 0 deletions
  1. 10 0
      src/BlueSCSI_disk.cpp
  2. 2 0
      src/BlueSCSI_disk.h

+ 10 - 0
src/BlueSCSI_disk.cpp

@@ -528,6 +528,16 @@ static void scsiDiskLoadConfig(int target_idx, const char *section)
     memset(tmp, 0, sizeof(tmp));
     ini_gets(section, "Serial", "", tmp, sizeof(tmp), CONFIGFILE);
     if (tmp[0]) memcpy(img.serial, tmp, sizeof(img.serial));
+
+    if (strlen(section) == 5 && strncmp(section, "SCSI", 4) == 0) // allow within target [SCSIx] blocks only
+    {
+        ini_gets(section, "ImgDir", "", tmp, sizeof(tmp), CONFIGFILE);
+        if (tmp[0])
+        {
+            logmsg("-- SCSI", target_idx, " using image directory \'", tmp, "'");
+            img.image_directory = true;
+        }
+    }
 }
 
 int scsiDiskGetNextImageName(image_config_t &img, char *buf, size_t buflen)

+ 2 - 0
src/BlueSCSI_disk.h

@@ -63,6 +63,8 @@ struct image_config_t: public S2S_TargetCfg
     // For tape drive emulation, current position in blocks
     uint32_t tape_pos;
 
+    // True if there is a subdirectory of images for this target
+    bool image_directory;
     // Index of image, for when image on-the-fly switching is used for CD drives
     uint8_t image_index = IMAGE_INDEX_MAX;