mirror of
https://github.com/joncampbell123/dosbox-x.git
synced 2025-10-14 19:08:32 +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
|
Fixes corrupt graphics in the PC Booter version
|
||||||
of Apple Panic. (Allofich)
|
of Apple Panic. (Allofich)
|
||||||
- Fixed possible crash with printing. (jamesbond3142)
|
- 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
|
- Fixed config option windowposition=x,y not working
|
||||||
in Linux/macOS SDL1 builds. (Wengier)
|
in Linux/macOS SDL1 builds. (Wengier)
|
||||||
- Make memory B0000-B7FFF unmapped for the CGA
|
- 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_Auto(signed char &index,bool &slave);
|
||||||
void IDE_CDROM_Attach(signed char index,bool slave,unsigned char drive_index);
|
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(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_Attach(signed char index,bool slave,unsigned char bios_disk_index);
|
||||||
void IDE_Hard_Disk_Detach(unsigned char bios_disk_index);
|
void IDE_Hard_Disk_Detach(unsigned char bios_disk_index);
|
||||||
void IDE_ResetDiskByBIOS(unsigned char disk);
|
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);
|
lTheOpenFileName = tinyfd_openFileDialog("Select a CD image file","",14,lFilterPatterns,lFilterDescription,0);
|
||||||
|
|
||||||
if (lTheOpenFileName) {
|
if (lTheOpenFileName) {
|
||||||
uint8_t mediaid = 0xF8;
|
isoDrive *cdrom = dynamic_cast<isoDrive*>(Drives[drive-'A']);
|
||||||
int error = -1;
|
DOS_Drive *newDrive = NULL;
|
||||||
qmount = true;
|
if (cdrom && dos_kernel_disabled) {
|
||||||
DOS_Drive* newDrive = new isoDrive(drive, lTheOpenFileName, mediaid, error);
|
cdrom->setFileName(lTheOpenFileName);
|
||||||
qmount = false;
|
} else {
|
||||||
if (error) {
|
uint8_t mediaid = 0xF8;
|
||||||
tinyfd_messageBox("Error","Could not mount the selected CD image.","ok","error", 1);
|
int error = -1;
|
||||||
return;
|
DOS_Drive* newDrive = new isoDrive(drive, lTheOpenFileName, mediaid, error);
|
||||||
|
if (error) {
|
||||||
|
tinyfd_messageBox("Error","Could not mount the selected CD image.","ok","error", 1);
|
||||||
|
chdir( Temp_CurrentDir );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
cdrom = dynamic_cast<isoDrive*>(newDrive);
|
||||||
}
|
}
|
||||||
DriveManager::ChangeDisk(drive-'A', newDrive);
|
if (cdrom) DriveManager::ChangeDisk(drive-'A', cdrom);
|
||||||
}
|
}
|
||||||
chdir( Temp_CurrentDir );
|
chdir( Temp_CurrentDir );
|
||||||
#endif
|
#endif
|
||||||
@@ -557,6 +563,7 @@ void MenuBrowseFDImage(char drive, int num, int type) {
|
|||||||
fatDrive *newDrive = new fatDrive(lTheOpenFileName, 0, 0, 0, 0, options);
|
fatDrive *newDrive = new fatDrive(lTheOpenFileName, 0, 0, 0, 0, options);
|
||||||
if (!newDrive->created_successfully) {
|
if (!newDrive->created_successfully) {
|
||||||
tinyfd_messageBox("Error","Could not mount the selected floppy disk image.","ok","error", 1);
|
tinyfd_messageBox("Error","Could not mount the selected floppy disk image.","ok","error", 1);
|
||||||
|
chdir( Temp_CurrentDir );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
DriveManager::ChangeDisk(drive-'A', newDrive);
|
DriveManager::ChangeDisk(drive-'A', newDrive);
|
||||||
|
@@ -192,6 +192,12 @@ isoDrive::isoDrive(char driveLetter, const char* fileName, uint8_t mediaid, int&
|
|||||||
|
|
||||||
isoDrive::~isoDrive() { }
|
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) {
|
int isoDrive::UpdateMscdex(char driveLetter, const char* path, uint8_t& subUnit) {
|
||||||
if (MSCDEX_HasDrive(driveLetter)) {
|
if (MSCDEX_HasDrive(driveLetter)) {
|
||||||
subUnit = MSCDEX_GetSubUnit(driveLetter);
|
subUnit = MSCDEX_GetSubUnit(driveLetter);
|
||||||
|
@@ -25,6 +25,7 @@
|
|||||||
#include "mapper.h"
|
#include "mapper.h"
|
||||||
#include "support.h"
|
#include "support.h"
|
||||||
#include "control.h"
|
#include "control.h"
|
||||||
|
#include "ide.h"
|
||||||
|
|
||||||
bool wild_match(const char *haystack, char *needle) {
|
bool wild_match(const char *haystack, char *needle) {
|
||||||
size_t max, i;
|
size_t max, i;
|
||||||
@@ -279,6 +280,10 @@ void DriveManager::AppendDisk(int drive, DOS_Drive* disk) {
|
|||||||
void DriveManager::ChangeDisk(int drive, DOS_Drive* disk) {
|
void DriveManager::ChangeDisk(int drive, DOS_Drive* disk) {
|
||||||
DriveInfo& driveInfo = driveInfos[drive];
|
DriveInfo& driveInfo = driveInfos[drive];
|
||||||
if (Drives[drive]==NULL||disk==NULL||!driveInfo.disks.size()) return;
|
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);
|
strcpy(disk->curdir,driveInfo.disks[driveInfo.currentDisk]->curdir);
|
||||||
disk->Activate();
|
disk->Activate();
|
||||||
disk->UpdateDPB(currentDrive);
|
disk->UpdateDPB(currentDrive);
|
||||||
@@ -287,6 +292,7 @@ void DriveManager::ChangeDisk(int drive, DOS_Drive* disk) {
|
|||||||
Drives[drive] = disk;
|
Drives[drive] = disk;
|
||||||
Drives[drive]->EmptyCache();
|
Drives[drive]->EmptyCache();
|
||||||
Drives[drive]->MediaChange();
|
Drives[drive]->MediaChange();
|
||||||
|
if (cdrom && index>-1) IDE_CDROM_Attach(index,slave,drive);
|
||||||
fatDrive *fdp = dynamic_cast<fatDrive*>(Drives[drive]);
|
fatDrive *fdp = dynamic_cast<fatDrive*>(Drives[drive]);
|
||||||
if (drive<2 && fdp && fdp->loadedDisk) {
|
if (drive<2 && fdp && fdp->loadedDisk) {
|
||||||
if (imageDiskList[drive]) {
|
if (imageDiskList[drive]) {
|
||||||
|
@@ -662,6 +662,7 @@ public:
|
|||||||
virtual bool isRemovable(void);
|
virtual bool isRemovable(void);
|
||||||
virtual Bits UnMount(void);
|
virtual Bits UnMount(void);
|
||||||
bool readSector(uint8_t *buffer, uint32_t sector);
|
bool readSector(uint8_t *buffer, uint32_t sector);
|
||||||
|
void setFileName(const char* fileName);
|
||||||
virtual char const* GetLabel(void) {return discLabel;};
|
virtual char const* GetLabel(void) {return discLabel;};
|
||||||
virtual void Activate(void);
|
virtual void Activate(void);
|
||||||
private:
|
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() {
|
void IDE_CDROM_DetachAll() {
|
||||||
for (int index = 0; index < MAX_IDE_CONTROLLERS; index++) {
|
for (int index = 0; index < MAX_IDE_CONTROLLERS; index++) {
|
||||||
IDEController *c = idecontroller[index];
|
IDEController *c = idecontroller[index];
|
||||||
|
Reference in New Issue
Block a user