mirror of
https://github.com/joncampbell123/dosbox-x.git
synced 2025-10-15 03:48:24 +08:00
fix Win9x shutdown freeze after changing CD image
This commit is contained in:
@@ -53,6 +53,8 @@
|
||||
Fixes corrupt graphics in the PC Booter version
|
||||
of Apple Panic. (Allofich)
|
||||
- Fixed possible crash with printing. (jamesbond3142)
|
||||
- Fixed possible freeze when shutting down Windows 9x
|
||||
after changing a CD image from the menu. (Wengier)
|
||||
- Fixed config option windowposition=x,y not working
|
||||
in Linux/macOS SDL1 builds. (Wengier)
|
||||
- Make memory B0000-B7FFF unmapped for the CGA
|
||||
|
@@ -13,6 +13,7 @@ extern void (*ide_inits[MAX_IDE_CONTROLLERS])(Section *);
|
||||
void IDE_Auto(signed char &index,bool &slave);
|
||||
void IDE_CDROM_Attach(signed char index,bool slave,unsigned char drive_index);
|
||||
void IDE_CDROM_Detach(unsigned char drive_index);
|
||||
void IDE_CDROM_Detach_Ret(signed char &indexret,bool &slaveret,unsigned char drive_index);
|
||||
void IDE_Hard_Disk_Attach(signed char index,bool slave,unsigned char bios_disk_index);
|
||||
void IDE_Hard_Disk_Detach(unsigned char bios_disk_index);
|
||||
void IDE_ResetDiskByBIOS(unsigned char disk);
|
||||
|
@@ -509,16 +509,22 @@ void MenuBrowseCDImage(char drive, int num) {
|
||||
lTheOpenFileName = tinyfd_openFileDialog("Select a CD image file","",14,lFilterPatterns,lFilterDescription,0);
|
||||
|
||||
if (lTheOpenFileName) {
|
||||
isoDrive *cdrom = dynamic_cast<isoDrive*>(Drives[drive-'A']);
|
||||
DOS_Drive *newDrive = NULL;
|
||||
if (cdrom && dos_kernel_disabled) {
|
||||
cdrom->setFileName(lTheOpenFileName);
|
||||
} else {
|
||||
uint8_t mediaid = 0xF8;
|
||||
int error = -1;
|
||||
qmount = true;
|
||||
DOS_Drive* newDrive = new isoDrive(drive, lTheOpenFileName, mediaid, error);
|
||||
qmount = false;
|
||||
if (error) {
|
||||
tinyfd_messageBox("Error","Could not mount the selected CD image.","ok","error", 1);
|
||||
chdir( Temp_CurrentDir );
|
||||
return;
|
||||
}
|
||||
DriveManager::ChangeDisk(drive-'A', newDrive);
|
||||
cdrom = dynamic_cast<isoDrive*>(newDrive);
|
||||
}
|
||||
if (cdrom) DriveManager::ChangeDisk(drive-'A', cdrom);
|
||||
}
|
||||
chdir( Temp_CurrentDir );
|
||||
#endif
|
||||
@@ -557,6 +563,7 @@ void MenuBrowseFDImage(char drive, int num, int type) {
|
||||
fatDrive *newDrive = new fatDrive(lTheOpenFileName, 0, 0, 0, 0, options);
|
||||
if (!newDrive->created_successfully) {
|
||||
tinyfd_messageBox("Error","Could not mount the selected floppy disk image.","ok","error", 1);
|
||||
chdir( Temp_CurrentDir );
|
||||
return;
|
||||
}
|
||||
DriveManager::ChangeDisk(drive-'A', newDrive);
|
||||
|
@@ -192,6 +192,12 @@ isoDrive::isoDrive(char driveLetter, const char* fileName, uint8_t mediaid, int&
|
||||
|
||||
isoDrive::~isoDrive() { }
|
||||
|
||||
void isoDrive::setFileName(const char* fileName) {
|
||||
safe_strncpy(this->fileName, fileName, CROSS_LEN);
|
||||
strcpy(info, "isoDrive ");
|
||||
strcat(info, fileName);
|
||||
}
|
||||
|
||||
int isoDrive::UpdateMscdex(char driveLetter, const char* path, uint8_t& subUnit) {
|
||||
if (MSCDEX_HasDrive(driveLetter)) {
|
||||
subUnit = MSCDEX_GetSubUnit(driveLetter);
|
||||
|
@@ -25,6 +25,7 @@
|
||||
#include "mapper.h"
|
||||
#include "support.h"
|
||||
#include "control.h"
|
||||
#include "ide.h"
|
||||
|
||||
bool wild_match(const char *haystack, char *needle) {
|
||||
size_t max, i;
|
||||
@@ -279,6 +280,10 @@ void DriveManager::AppendDisk(int drive, DOS_Drive* disk) {
|
||||
void DriveManager::ChangeDisk(int drive, DOS_Drive* disk) {
|
||||
DriveInfo& driveInfo = driveInfos[drive];
|
||||
if (Drives[drive]==NULL||disk==NULL||!driveInfo.disks.size()) return;
|
||||
isoDrive *cdrom = dynamic_cast<isoDrive*>(Drives[drive]);
|
||||
bool slave=false;
|
||||
signed char index=-1;
|
||||
if (cdrom) IDE_CDROM_Detach_Ret(index,slave,drive);
|
||||
strcpy(disk->curdir,driveInfo.disks[driveInfo.currentDisk]->curdir);
|
||||
disk->Activate();
|
||||
disk->UpdateDPB(currentDrive);
|
||||
@@ -287,6 +292,7 @@ void DriveManager::ChangeDisk(int drive, DOS_Drive* disk) {
|
||||
Drives[drive] = disk;
|
||||
Drives[drive]->EmptyCache();
|
||||
Drives[drive]->MediaChange();
|
||||
if (cdrom && index>-1) IDE_CDROM_Attach(index,slave,drive);
|
||||
fatDrive *fdp = dynamic_cast<fatDrive*>(Drives[drive]);
|
||||
if (drive<2 && fdp && fdp->loadedDisk) {
|
||||
if (imageDiskList[drive]) {
|
||||
|
@@ -662,6 +662,7 @@ public:
|
||||
virtual bool isRemovable(void);
|
||||
virtual Bits UnMount(void);
|
||||
bool readSector(uint8_t *buffer, uint32_t sector);
|
||||
void setFileName(const char* fileName);
|
||||
virtual char const* GetLabel(void) {return discLabel;};
|
||||
virtual void Activate(void);
|
||||
private:
|
||||
|
@@ -2265,6 +2265,24 @@ void IDE_CDROM_Detach(unsigned char drive_index) {
|
||||
}
|
||||
}
|
||||
|
||||
void IDE_CDROM_Detach_Ret(signed char &indexret,bool &slaveret,unsigned char drive_index) {
|
||||
indexret = -1;
|
||||
for (int index = 0; index < MAX_IDE_CONTROLLERS; index++) {
|
||||
IDEController *c = idecontroller[index];
|
||||
if (c)
|
||||
for (int slave = 0; slave < 2; slave++) {
|
||||
IDEATAPICDROMDevice *dev;
|
||||
dev = dynamic_cast<IDEATAPICDROMDevice*>(c->device[slave]);
|
||||
if (dev && dev->drive_index == drive_index) {
|
||||
delete dev;
|
||||
c->device[slave] = NULL;
|
||||
slaveret = slave;
|
||||
indexret = index;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void IDE_CDROM_DetachAll() {
|
||||
for (int index = 0; index < MAX_IDE_CONTROLLERS; index++) {
|
||||
IDEController *c = idecontroller[index];
|
||||
|
Reference in New Issue
Block a user