Improve disk image mounting: cycle disks only for the drive being mounted, make B: drive usable for BIOS access, and be insensitive to the order that drive letters are mounted.
Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@4129
This commit is contained in:
parent
30ef5aefe9
commit
be146f5c44
3 changed files with 34 additions and 29 deletions
|
@ -1322,7 +1322,7 @@ public:
|
|||
dos.dta(dos.tables.tempdta);
|
||||
|
||||
for(ct = 0; ct < imgDisks.size(); ct++) {
|
||||
DriveManager::CycleAllDisks();
|
||||
DriveManager::CycleDisks(drive - 'A', (ct == (imgDisks.size() - 1)));
|
||||
|
||||
char root[7] = {drive,':','\\','*','.','*',0};
|
||||
DOS_FindFirst(root, DOS_ATTR_VOLUME); // force obtaining the label and saving it in dirCache
|
||||
|
@ -1337,20 +1337,22 @@ public:
|
|||
|
||||
if (paths.size() == 1) {
|
||||
newdrive = imgDisks[0];
|
||||
if(((fatDrive *)newdrive)->loadedDisk->hardDrive) {
|
||||
if(imageDiskList[2] == NULL) {
|
||||
imageDiskList[2] = ((fatDrive *)newdrive)->loadedDisk;
|
||||
updateDPT();
|
||||
return;
|
||||
switch (drive - 'A') {
|
||||
case 0:
|
||||
case 1:
|
||||
if(!((fatDrive *)newdrive)->loadedDisk->hardDrive) {
|
||||
if(imageDiskList[drive - 'A'] != NULL) delete imageDiskList[drive - 'A'];
|
||||
imageDiskList[drive - 'A'] = ((fatDrive *)newdrive)->loadedDisk;
|
||||
}
|
||||
if(imageDiskList[3] == NULL) {
|
||||
imageDiskList[3] = ((fatDrive *)newdrive)->loadedDisk;
|
||||
break;
|
||||
case 2:
|
||||
case 3:
|
||||
if(((fatDrive *)newdrive)->loadedDisk->hardDrive) {
|
||||
if(imageDiskList[drive - 'A'] != NULL) delete imageDiskList[drive - 'A'];
|
||||
imageDiskList[drive - 'A'] = ((fatDrive *)newdrive)->loadedDisk;
|
||||
updateDPT();
|
||||
return;
|
||||
}
|
||||
}
|
||||
if(!((fatDrive *)newdrive)->loadedDisk->hardDrive) {
|
||||
imageDiskList[0] = ((fatDrive *)newdrive)->loadedDisk;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else if (fstype=="iso") {
|
||||
|
|
|
@ -169,26 +169,28 @@ void DriveManager::CycleDisk(bool pressed) {
|
|||
}
|
||||
*/
|
||||
|
||||
void DriveManager::CycleAllDisks(void) {
|
||||
for (int idrive=0; idrive<DOS_DRIVES; idrive++) {
|
||||
int numDisks = (int)driveInfos[idrive].disks.size();
|
||||
if (numDisks > 1) {
|
||||
// cycle disk
|
||||
int currentDisk = driveInfos[idrive].currentDisk;
|
||||
DOS_Drive* oldDisk = driveInfos[idrive].disks[currentDisk];
|
||||
currentDisk = (currentDisk + 1) % numDisks;
|
||||
DOS_Drive* newDisk = driveInfos[idrive].disks[currentDisk];
|
||||
driveInfos[idrive].currentDisk = currentDisk;
|
||||
|
||||
// copy working directory, acquire system resources and finally switch to next drive
|
||||
strcpy(newDisk->curdir, oldDisk->curdir);
|
||||
newDisk->Activate();
|
||||
Drives[idrive] = newDisk;
|
||||
LOG_MSG("Drive %c: disk %d of %d now active", 'A'+idrive, currentDisk+1, numDisks);
|
||||
}
|
||||
void DriveManager::CycleDisks(int drive, bool notify) {
|
||||
int numDisks = (int)driveInfos[drive].disks.size();
|
||||
if (numDisks > 1) {
|
||||
// cycle disk
|
||||
int currentDisk = driveInfos[drive].currentDisk;
|
||||
DOS_Drive* oldDisk = driveInfos[drive].disks[currentDisk];
|
||||
currentDisk = (currentDisk + 1) % numDisks;
|
||||
DOS_Drive* newDisk = driveInfos[drive].disks[currentDisk];
|
||||
driveInfos[drive].currentDisk = currentDisk;
|
||||
|
||||
// copy working directory, acquire system resources and finally switch to next drive
|
||||
strcpy(newDisk->curdir, oldDisk->curdir);
|
||||
newDisk->Activate();
|
||||
Drives[drive] = newDisk;
|
||||
if (notify) LOG_MSG("Drive %c: disk %d of %d now active", 'A'+drive, currentDisk+1, numDisks);
|
||||
}
|
||||
}
|
||||
|
||||
void DriveManager::CycleAllDisks(void) {
|
||||
for (int idrive=0; idrive<DOS_DRIVES; idrive++) CycleDisks(idrive, true);
|
||||
}
|
||||
|
||||
int DriveManager::UnmountDrive(int drive) {
|
||||
int result = 0;
|
||||
// unmanaged drive
|
||||
|
|
|
@ -35,6 +35,7 @@ public:
|
|||
static int UnmountDrive(int drive);
|
||||
// static void CycleDrive(bool pressed);
|
||||
// static void CycleDisk(bool pressed);
|
||||
static void CycleDisks(int drive, bool notify);
|
||||
static void CycleAllDisks(void);
|
||||
static void Init(Section* sec);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue