Applied all relevant PCem commits;
Extensively cleaned up and changed the CD-ROM code; Removed CD-ROM IOCTTL (it was causing performance and stability issues); Turned a lot of things into device_t's; Added the PS/1 Model 2011 XTA and standalone XTA hard disk controllers, ported from Varcem; Numerous FDC fixes for the PS/1 Model 2121; NVR changes ported from Varcem; The PCap code no longer requires libpcap to be compiled; Numerous fixes to various SCSI controllers; Updated NukedOPL to 1.8; Fixes to OpenAL initialization and closing, should give less Audio issues now; Revorked parts of the common (S)VGA code (also based on code from QEMU); Removed the Removable SCSI hard disks (they were a never finished experiment so there was no need to keep them there); Cleaned up the SCSI hard disk and Iomega ZIP code (but more cleanups of that are coming in the future); In some occasions (IDE hard disks in multiple sector mode and SCSI hard disks) the status bar icon is no longer updated, should improve performance a bit; Redid the way the tertiary and quaternary IDE controllers are configured (and they are now device_t's); Extensively reworked the IDE code and fixed quite a few bugs; Fixes to XT MFM, AT MFM, and AT ESDI code; Some changes to XTIDE and MCA ESDI code; Some fixes to the CD-ROM image handler.
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Handle the platform-side of CDROM drives.
|
||||
*
|
||||
* Version: @(#)win_cdrom.c 1.0.6 2018/03/17
|
||||
* Version: @(#)win_cdrom.c 1.0.7 2018/03/26
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -28,43 +28,18 @@
|
||||
#include <stdlib.h>
|
||||
#include <wchar.h>
|
||||
#include "../config.h"
|
||||
#include "../cdrom/cdrom.h"
|
||||
#include "../cdrom/cdrom_image.h"
|
||||
#include "../cdrom/cdrom_null.h"
|
||||
#include "../disk/hdd.h"
|
||||
#include "../disk/zip.h"
|
||||
#include "../scsi/scsi.h"
|
||||
#include "../cdrom/cdrom.h"
|
||||
#include "../cdrom/cdrom_image.h"
|
||||
#include "../cdrom/cdrom_null.h"
|
||||
#include "../scsi/scsi_disk.h"
|
||||
#include "../plat.h"
|
||||
#include "../ui.h"
|
||||
#include "win.h"
|
||||
|
||||
|
||||
uint8_t host_cdrom_drive_available[26];
|
||||
uint8_t host_cdrom_drive_available_num = 0;
|
||||
|
||||
|
||||
void
|
||||
cdrom_init_host_drives(void)
|
||||
{
|
||||
WCHAR s[64];
|
||||
int i = 0;
|
||||
|
||||
host_cdrom_drive_available_num = 0;
|
||||
for (i='A'; i<='Z'; i++) {
|
||||
_swprintf(s, L"%c:\\", i);
|
||||
|
||||
if (GetDriveType(s)==DRIVE_CDROM) {
|
||||
host_cdrom_drive_available[i - 'A'] = 1;
|
||||
|
||||
host_cdrom_drive_available_num++;
|
||||
} else {
|
||||
host_cdrom_drive_available[i - 'A'] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
cdrom_eject(uint8_t id)
|
||||
{
|
||||
@@ -73,12 +48,6 @@ cdrom_eject(uint8_t id)
|
||||
return;
|
||||
}
|
||||
|
||||
if ((cdrom_drives[id].host_drive >= 'A') &&
|
||||
(cdrom_drives[id].host_drive <= 'Z')) {
|
||||
ui_sb_check_menu_item(SB_CDROM|id,
|
||||
IDM_CDROM_HOST_DRIVE | id | ((cdrom_drives[id].host_drive - 'A') << 3), MF_UNCHECKED);
|
||||
}
|
||||
|
||||
if (cdrom_image[id].prev_image_path) {
|
||||
free(cdrom_image[id].prev_image_path);
|
||||
cdrom_image[id].prev_image_path = NULL;
|
||||
@@ -89,12 +58,13 @@ cdrom_eject(uint8_t id)
|
||||
wcscpy(cdrom_image[id].prev_image_path, cdrom_image[id].image_path);
|
||||
}
|
||||
cdrom_drives[id].prev_host_drive = cdrom_drives[id].host_drive;
|
||||
cdrom_drives[id].handler->exit(id);
|
||||
cdrom_close(id);
|
||||
cdrom_null_open(id, 0);
|
||||
cdrom[id]->handler->exit(id);
|
||||
cdrom_close_handler(id);
|
||||
memset(cdrom_image[id].image_path, 0, 2048);
|
||||
cdrom_null_open(id);
|
||||
if (cdrom_drives[id].bus_type) {
|
||||
/* Signal disc change to the emulated machine. */
|
||||
cdrom_insert(id);
|
||||
cdrom_insert(cdrom[id]);
|
||||
}
|
||||
|
||||
ui_sb_check_menu_item(SB_CDROM|id, IDM_CDROM_IMAGE | id, MF_UNCHECKED);
|
||||
@@ -111,14 +81,13 @@ cdrom_eject(uint8_t id)
|
||||
void
|
||||
cdrom_reload(uint8_t id)
|
||||
{
|
||||
int new_cdrom_drive;
|
||||
|
||||
if ((cdrom_drives[id].host_drive == cdrom_drives[id].prev_host_drive) || (cdrom_drives[id].prev_host_drive == 0) || (cdrom_drives[id].host_drive != 0)) {
|
||||
/* Switch from empty to empty. Do nothing. */
|
||||
return;
|
||||
}
|
||||
|
||||
cdrom_close(id);
|
||||
cdrom_close_handler(id);
|
||||
memset(cdrom_image[id].image_path, 0, 2048);
|
||||
|
||||
if (cdrom_drives[id].prev_host_drive == 200) {
|
||||
wcscpy(cdrom_image[id].image_path, cdrom_image[id].prev_image_path);
|
||||
@@ -127,7 +96,7 @@ cdrom_reload(uint8_t id)
|
||||
image_open(id, cdrom_image[id].image_path);
|
||||
if (cdrom_drives[id].bus_type) {
|
||||
/* Signal disc change to the emulated machine. */
|
||||
cdrom_insert(id);
|
||||
cdrom_insert(cdrom[id]);
|
||||
}
|
||||
if (wcslen(cdrom_image[id].image_path) == 0) {
|
||||
ui_sb_check_menu_item(SB_CDROM|id, IDM_CDROM_EMPTY | id, MF_CHECKED);
|
||||
@@ -140,17 +109,6 @@ cdrom_reload(uint8_t id)
|
||||
ui_sb_check_menu_item(SB_CDROM|id, IDM_CDROM_IMAGE | id, MF_CHECKED);
|
||||
ui_sb_update_icon_state(SB_CDROM|id, 0);
|
||||
}
|
||||
} else {
|
||||
new_cdrom_drive = cdrom_drives[id].prev_host_drive;
|
||||
ioctl_open(id, new_cdrom_drive);
|
||||
if (cdrom_drives[id].bus_type) {
|
||||
/* Signal disc change to the emulated machine. */
|
||||
cdrom_insert(id);
|
||||
}
|
||||
ui_sb_check_menu_item(SB_CDROM|id, IDM_CDROM_EMPTY | id, MF_UNCHECKED);
|
||||
cdrom_drives[id].host_drive = new_cdrom_drive;
|
||||
ui_sb_check_menu_item(SB_CDROM|id, IDM_CDROM_HOST_DRIVE | id | ((cdrom_drives[id].host_drive - 'A') << 3), MF_CHECKED);
|
||||
ui_sb_update_icon_state(SB_CDROM|id, 0);
|
||||
}
|
||||
|
||||
ui_sb_enable_menu_item(SB_CDROM|id, IDM_CDROM_RELOAD | id, MF_BYCOMMAND | MF_GRAYED);
|
||||
@@ -194,56 +152,3 @@ zip_reload(uint8_t id)
|
||||
|
||||
config_save();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
removable_disk_unload(uint8_t id)
|
||||
{
|
||||
if (wcslen(hdd[id].fn) == 0) {
|
||||
/* Switch from empty to empty. Do nothing. */
|
||||
return;
|
||||
}
|
||||
|
||||
scsi_unloadhd(hdd[id].scsi_id, hdd[id].scsi_lun, id);
|
||||
scsi_disk_insert(id);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
removable_disk_eject(uint8_t id)
|
||||
{
|
||||
removable_disk_unload(id);
|
||||
ui_sb_update_icon_state(SB_RDISK|id, 1);
|
||||
ui_sb_enable_menu_item(SB_RDISK|id, IDM_RDISK_EJECT | id, MF_BYCOMMAND | MF_GRAYED);
|
||||
ui_sb_enable_menu_item(SB_RDISK|id, IDM_RDISK_RELOAD | id, MF_BYCOMMAND | MF_ENABLED);
|
||||
ui_sb_enable_menu_item(SB_RDISK|id, IDM_RDISK_SEND_CHANGE | id, MF_BYCOMMAND | MF_GRAYED);
|
||||
|
||||
ui_sb_update_tip(SB_RDISK|id);
|
||||
|
||||
config_save();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
removable_disk_reload(uint8_t id)
|
||||
{
|
||||
if (wcslen(hdd[id].fn) != 0) {
|
||||
/* Attempting to reload while an image is already loaded. Do nothing. */
|
||||
return;
|
||||
}
|
||||
|
||||
scsi_reloadhd(id);
|
||||
#if 0
|
||||
scsi_disk_insert(id);
|
||||
#endif
|
||||
|
||||
ui_sb_update_icon_state(SB_RDISK|id, wcslen(hdd[id].fn) ? 0 : 1);
|
||||
|
||||
ui_sb_enable_menu_item(SB_RDISK|id, IDM_RDISK_EJECT | id, MF_BYCOMMAND | (wcslen(hdd[id].fn) ? MF_ENABLED : MF_GRAYED));
|
||||
ui_sb_enable_menu_item(SB_RDISK|id, IDM_RDISK_RELOAD | id, MF_BYCOMMAND | MF_GRAYED);
|
||||
ui_sb_enable_menu_item(SB_RDISK|id, IDM_RDISK_SEND_CHANGE | id, MF_BYCOMMAND | (wcslen(hdd[id].fn) ? MF_ENABLED : MF_GRAYED));
|
||||
|
||||
ui_sb_update_tip(SB_RDISK|id);
|
||||
|
||||
config_save();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user