Browse Source

Ensure during config loading the image index is set properly.

scsiDiskResetImages() does a memset to 0 during reinit so default values need to be handled here.
saybur 2 years ago
parent
commit
f9d6571027
2 changed files with 3 additions and 2 deletions
  1. 1 0
      src/BlueSCSI_disk.cpp
  2. 2 2
      src/BlueSCSI_disk.h

+ 1 - 0
src/BlueSCSI_disk.cpp

@@ -593,6 +593,7 @@ void scsiDiskLoadConfig(int target_idx)
     // Check if we have image specified by name
     // Check if we have image specified by name
     char filename[MAX_FILE_PATH];
     char filename[MAX_FILE_PATH];
     image_config_t &img = g_DiskImages[target_idx];
     image_config_t &img = g_DiskImages[target_idx];
+    img.image_index = IMAGE_INDEX_MAX;
     if (scsiDiskGetNextImageName(img, filename, sizeof(filename)))
     if (scsiDiskGetNextImageName(img, filename, sizeof(filename)))
     {
     {
         int blocksize = (img.deviceType == S2S_CFG_OPTICAL) ? 2048 : 512;
         int blocksize = (img.deviceType == S2S_CFG_OPTICAL) ? 2048 : 512;

+ 2 - 2
src/BlueSCSI_disk.h

@@ -67,9 +67,9 @@ struct image_config_t: public S2S_TargetCfg
     // True if there is a subdirectory of images for this target
     // True if there is a subdirectory of images for this target
     bool image_directory;
     bool image_directory;
     // the name of the currently mounted image in a dynamic image directory
     // the name of the currently mounted image in a dynamic image directory
-    char current_image[MAX_FILE_PATH] = {'\0'};
+    char current_image[MAX_FILE_PATH];
     // Index of image, for when image on-the-fly switching is used for CD drives
     // Index of image, for when image on-the-fly switching is used for CD drives
-    uint8_t image_index = IMAGE_INDEX_MAX;
+    uint8_t image_index;
 
 
     // Cue sheet file for CD-ROM images
     // Cue sheet file for CD-ROM images
     FsFile cuesheetfile;
     FsFile cuesheetfile;