+const char * FloppyDrive::GetImageName(uint8_t driveNum/*= 0*/)
+{
+ // Set up a zero-length string for return value
+ nameBuf[0] = 0;
+
+ if (driveNum > 1)
+ {
+ WriteLog("FLOPPY: Attempted to get image name for drive #%u!\n", driveNum);
+ return nameBuf;
+ }
+
+ // Now we attempt to strip out extraneous paths/extensions to get just the filename
+ const char * startOfFile = strrchr(imageName[driveNum], '/');
+ const char * startOfExt = strrchr(imageName[driveNum], '.');
+
+ // If there isn't a path, assume we're starting at the beginning
+ if (startOfFile == NULL)
+ startOfFile = &imageName[driveNum][0];
+ else
+ startOfFile++;
+
+ // If there isn't an extension, assume it's at the terminating NULL
+ if (startOfExt == NULL)
+ startOfExt = &imageName[driveNum][0] + strlen(imageName[driveNum]);
+
+ // Now copy the filename (may copy nothing!)
+ int j = 0;
+
+ for(const char * i=startOfFile; i<startOfExt; i++)
+ nameBuf[j++] = *i;
+
+ nameBuf[j] = 0;
+
+ return nameBuf;
+}
+
+void FloppyDrive::EjectImage(uint8_t driveNum/*= 0*/)
+{
+ // Probably want to save a dirty image... ;-)
+ SaveImage(driveNum);
+
+ WriteLog("FLOPPY: Ejected image file '%s' from drive %u...\n", imageName[driveNum], driveNum);
+
+ if (disk[driveNum])
+ delete[] disk[driveNum];
+
+ disk[driveNum] = NULL;
+ diskSize[driveNum] = 0;
+ diskType[driveNum] = DT_UNKNOWN;
+ imageDirty[driveNum] = false;
+ writeProtected[driveNum] = false;
+ imageName[driveNum][0] = 0; // Zero out filenames
+ memset(nybblizedImage[driveNum], 0xFF, 232960); // Doesn't matter if 00s or FFs...
+}
+
+bool FloppyDrive::DriveIsEmpty(uint8_t driveNum/*= 0*/)
+{
+ if (driveNum > 1)
+ {
+ WriteLog("FLOPPY: Attempted DriveIsEmtpy() for drive #%u!\n", driveNum);
+ return true;
+ }
+
+ // This is kinda gay, but it works
+ return (imageName[driveNum][0] == 0 ? true : false);
+}
+
+bool FloppyDrive::DiskIsWriteProtected(uint8_t driveNum/*= 0*/)
+{
+ if (driveNum > 1)
+ {
+ WriteLog("FLOPPY: Attempted DiskIsWriteProtected() for drive #%u!\n", driveNum);
+ return true;
+ }
+
+ return writeProtected[driveNum];
+}
+
+void FloppyDrive::SetWriteProtect(bool state, uint8_t driveNum/*= 0*/)
+{
+ if (driveNum > 1)
+ {
+ WriteLog("FLOPPY: Attempted set write protect for drive #%u!\n", driveNum);
+ return;
+ }
+
+ writeProtected[driveNum] = state;
+}
+
+