Browse Source

Add storage to track the current image for dynamic image listing.

It would make more sense to use getName() on the current image. However, during testing this always seemed to return '\0' as the filename, even without close() being invoked. Not certain if this is a bug or something I was doing wrong. If that can be sorted out this variable can be removed to save a chunk of SRAM.
saybur 2 years ago
parent
commit
b2ce3db3b2
2 changed files with 4 additions and 1 deletions
  1. 1 1
      src/BlueSCSI_disk.cpp
  2. 3 0
      src/BlueSCSI_disk.h

+ 1 - 1
src/BlueSCSI_disk.cpp

@@ -534,7 +534,7 @@ static void scsiDiskLoadConfig(int target_idx, const char *section)
         ini_gets(section, "ImgDir", "", tmp, sizeof(tmp), CONFIGFILE);
         if (tmp[0])
         {
-            logmsg("-- SCSI", target_idx, " using image directory \'", tmp, "'");
+            log("-- SCSI", target_idx, " using image directory \'", tmp, "'");
             img.image_directory = true;
         }
     }

+ 3 - 0
src/BlueSCSI_disk.h

@@ -32,6 +32,7 @@
 #include <scsi2sd.h>
 #include <scsiPhy.h>
 #include "ImageBackingStore.h"
+#include "BlueSCSI_config.h"
 
 extern "C" {
 #include <disk.h>
@@ -65,6 +66,8 @@ struct image_config_t: public S2S_TargetCfg
 
     // True if there is a subdirectory of images for this target
     bool image_directory;
+    // the name of the currently mounted image in a dynamic image directory
+    char current_image[MAX_FILE_PATH] = {'\0'};
     // Index of image, for when image on-the-fly switching is used for CD drives
     uint8_t image_index = IMAGE_INDEX_MAX;