There goes the legacy host_drive.
This commit is contained in:
@@ -1961,7 +1961,7 @@ cdrom_hard_reset(void)
|
||||
|
||||
dev->cd_status = CD_STATUS_EMPTY;
|
||||
|
||||
if (dev->host_drive == 200) {
|
||||
if (strlen(dev->image_path) > 0) {
|
||||
#ifdef _WIN32
|
||||
if ((strlen(dev->image_path) >= 1) && (dev->image_path[strlen(dev->image_path) - 1] == '/'))
|
||||
dev->image_path[strlen(dev->image_path) - 1] = '\\';
|
||||
@@ -2023,16 +2023,12 @@ cdrom_eject(uint8_t id)
|
||||
cdrom_t *dev = &cdrom[id];
|
||||
|
||||
/* This entire block should be in cdrom.c/cdrom_eject(dev*) ... */
|
||||
if (dev->host_drive == 0) {
|
||||
if (strlen(dev->image_path) == 0) {
|
||||
/* Switch from empty to empty. Do nothing. */
|
||||
return;
|
||||
}
|
||||
|
||||
if (dev->host_drive >= 200)
|
||||
strcpy(dev->prev_image_path, dev->image_path);
|
||||
|
||||
dev->prev_host_drive = dev->host_drive + (dev->host ? 1 : 0);
|
||||
dev->host_drive = 0;
|
||||
strcpy(dev->prev_image_path, dev->image_path);
|
||||
|
||||
dev->ops->exit(dev);
|
||||
dev->ops = NULL;
|
||||
@@ -2051,7 +2047,7 @@ cdrom_reload(uint8_t id)
|
||||
{
|
||||
cdrom_t *dev = &cdrom[id];
|
||||
|
||||
if (!dev->host && ((dev->host_drive == dev->prev_host_drive) || (dev->prev_host_drive == 0) || (dev->host_drive != 0))) {
|
||||
if ((strcmp(dev->image_path, dev->prev_image_path) == 0) || (strlen(dev->prev_image_path) == 0) || (strlen(dev->image_path) > 0)) {
|
||||
/* Switch from empty to empty. Do nothing. */
|
||||
return;
|
||||
}
|
||||
@@ -2061,18 +2057,18 @@ cdrom_reload(uint8_t id)
|
||||
dev->ops = NULL;
|
||||
memset(dev->image_path, 0, sizeof(dev->image_path));
|
||||
|
||||
if (dev->prev_host_drive >= 200) {
|
||||
if (strlen(dev->image_path) > 0) {
|
||||
/* Reload a previous image. */
|
||||
if (dev->prev_host_drive == 200)
|
||||
if (strlen(dev->prev_image_path) > 0)
|
||||
strcpy(dev->image_path, dev->prev_image_path);
|
||||
|
||||
#ifdef _WIN32
|
||||
if (dev->prev_host_drive == 200) {
|
||||
if (strlen(dev->prev_image_path) > 0) {
|
||||
if ((strlen(dev->image_path) >= 1) && (dev->image_path[strlen(dev->image_path) - 1] == '/'))
|
||||
dev->image_path[strlen(dev->image_path) - 1] = '\\';
|
||||
}
|
||||
#else
|
||||
if (dev->prev_host_drive == 200) {
|
||||
if (strlen(dev->prev_image_path) > 0) {
|
||||
if ((strlen(dev->image_path) >= 1) && (dev->image_path[strlen(dev->image_path) - 1] == '\\'))
|
||||
dev->image_path[strlen(dev->image_path) - 1] = '/';
|
||||
}
|
||||
@@ -2084,11 +2080,6 @@ cdrom_reload(uint8_t id)
|
||||
cdrom_image_open(dev, dev->image_path);
|
||||
|
||||
cdrom_insert(id);
|
||||
|
||||
if (strlen(dev->image_path) == 0)
|
||||
dev->host_drive = 0;
|
||||
else
|
||||
dev->host_drive = 200;
|
||||
}
|
||||
|
||||
plat_cdrom_ui_update(id, 1);
|
||||
|
@@ -259,7 +259,6 @@ image_open_abort(cdrom_t *dev)
|
||||
{
|
||||
cdrom_image_close(dev);
|
||||
dev->ops = NULL;
|
||||
dev->host_drive = 0;
|
||||
dev->image_path[0] = 0;
|
||||
return 1;
|
||||
}
|
||||
|
@@ -230,7 +230,6 @@ cdrom_ioctl_open_abort(cdrom_t *dev)
|
||||
{
|
||||
cdrom_ioctl_close(dev);
|
||||
dev->ops = NULL;
|
||||
dev->host_drive = 0;
|
||||
dev->image_path[0] = 0;
|
||||
return 1;
|
||||
}
|
||||
|
@@ -147,14 +147,18 @@ mitsumi_cdrom_log(const char *fmt, ...)
|
||||
# define mitsumi_cdrom_log(fmt, ...)
|
||||
#endif
|
||||
|
||||
static int
|
||||
mitsumi_cdrom_is_ready(const cdrom_t *dev)
|
||||
{
|
||||
return (dev->image_path[0] != 0x00);
|
||||
}
|
||||
|
||||
static void
|
||||
mitsumi_cdrom_reset(mcd_t *dev)
|
||||
{
|
||||
cdrom_t cdrom;
|
||||
|
||||
cdrom.host_drive = 0;
|
||||
|
||||
dev->stat = cdrom.host_drive ? (STAT_READY | STAT_CHANGE) : 0;
|
||||
dev->stat = mitsumi_cdrom_is_ready(&cdrom) ? (STAT_READY | STAT_CHANGE) : 0;
|
||||
dev->cmdrd_count = 0;
|
||||
dev->cmdbuf_count = 0;
|
||||
dev->buf_count = 0;
|
||||
@@ -344,18 +348,18 @@ mitsumi_cdrom_out(uint16_t port, uint8_t val, void *priv)
|
||||
break;
|
||||
}
|
||||
if (!dev->cmdrd_count)
|
||||
dev->stat = cdrom.host_drive ? (STAT_READY | (dev->change ? STAT_CHANGE : 0)) : 0;
|
||||
dev->stat = mitsumi_cdrom_is_ready(&cdrom) ? (STAT_READY | (dev->change ? STAT_CHANGE : 0)) : 0;
|
||||
return;
|
||||
}
|
||||
dev->cmd = val;
|
||||
dev->cmdbuf_idx = 0;
|
||||
dev->cmdrd_count = 0;
|
||||
dev->cmdbuf_count = 1;
|
||||
dev->cmdbuf[0] = cdrom.host_drive ? (STAT_READY | (dev->change ? STAT_CHANGE : 0)) : 0;
|
||||
dev->cmdbuf[0] = mitsumi_cdrom_is_ready(&cdrom) ? (STAT_READY | (dev->change ? STAT_CHANGE : 0)) : 0;
|
||||
dev->data = 0;
|
||||
switch (val) {
|
||||
case CMD_GET_INFO:
|
||||
if (cdrom.host_drive) {
|
||||
if (mitsumi_cdrom_is_ready(&cdrom)) {
|
||||
cdrom_get_track_buffer(&cdrom, &(dev->cmdbuf[1]));
|
||||
dev->cmdbuf_count = 10;
|
||||
dev->readcount = 0;
|
||||
@@ -365,7 +369,7 @@ mitsumi_cdrom_out(uint16_t port, uint8_t val, void *priv)
|
||||
}
|
||||
break;
|
||||
case CMD_GET_Q:
|
||||
if (cdrom.host_drive) {
|
||||
if (mitsumi_cdrom_is_ready(&cdrom)) {
|
||||
cdrom_get_q(&cdrom, &(dev->cmdbuf[1]), &dev->cur_toc_track, dev->mode & MODE_GET_TOC);
|
||||
dev->cmdbuf_count = 11;
|
||||
dev->readcount = 0;
|
||||
@@ -391,7 +395,7 @@ mitsumi_cdrom_out(uint16_t port, uint8_t val, void *priv)
|
||||
break;
|
||||
case CMD_READ1X:
|
||||
case CMD_READ2X:
|
||||
if (cdrom.host_drive) {
|
||||
if (mitsumi_cdrom_is_ready(&cdrom)) {
|
||||
dev->readcount = 0;
|
||||
dev->drvmode = (val == CMD_READ1X) ? DRV_MODE_CDDA : DRV_MODE_READ;
|
||||
dev->cmdrd_count = 6;
|
||||
|
23
src/config.c
23
src/config.c
@@ -1175,8 +1175,7 @@ load_floppy_and_cdrom_drives(void)
|
||||
memset(temp, 0x00, sizeof(temp));
|
||||
for (c = 0; c < CDROM_NUM; c++) {
|
||||
sprintf(temp, "cdrom_%02i_host_drive", c + 1);
|
||||
cdrom[c].host_drive = ini_section_get_int(cat, temp, 0);
|
||||
cdrom[c].prev_host_drive = cdrom[c].host_drive;
|
||||
ini_section_delete_var(cat, temp);
|
||||
|
||||
sprintf(temp, "cdrom_%02i_parameters", c + 1);
|
||||
p = ini_section_get_string(cat, temp, NULL);
|
||||
@@ -1263,12 +1262,6 @@ load_floppy_and_cdrom_drives(void)
|
||||
path_normalize(cdrom[c].image_path);
|
||||
}
|
||||
|
||||
if (cdrom[c].host_drive && (cdrom[c].host_drive != 200) && (cdrom[c].host_drive != 201))
|
||||
cdrom[c].host_drive = 0;
|
||||
|
||||
if ((cdrom[c].host_drive == 0x200) && (strlen(cdrom[c].image_path) == 0))
|
||||
cdrom[c].host_drive = 0;
|
||||
|
||||
for (int i = 0; i < MAX_PREV_IMAGES; i++) {
|
||||
cdrom[c].image_history[i] = (char *) calloc((MAX_IMAGE_PATH_LEN + 1) << 1, sizeof(char));
|
||||
sprintf(temp, "cdrom_%02i_image_history_%02i", c + 1, i + 1);
|
||||
@@ -1289,9 +1282,6 @@ load_floppy_and_cdrom_drives(void)
|
||||
|
||||
/* If the CD-ROM is disabled, delete all its variables. */
|
||||
if (cdrom[c].bus_type == CDROM_BUS_DISABLED) {
|
||||
sprintf(temp, "cdrom_%02i_host_drive", c + 1);
|
||||
ini_section_delete_var(cat, temp);
|
||||
|
||||
sprintf(temp, "cdrom_%02i_parameters", c + 1);
|
||||
ini_section_delete_var(cat, temp);
|
||||
|
||||
@@ -1422,9 +1412,6 @@ load_other_removable_devices(void)
|
||||
|
||||
/* If the ZIP drive is disabled, delete all its variables. */
|
||||
if (zip_drives[c].bus_type == ZIP_BUS_DISABLED) {
|
||||
sprintf(temp, "zip_%02i_host_drive", c + 1);
|
||||
ini_section_delete_var(cat, temp);
|
||||
|
||||
sprintf(temp, "zip_%02i_parameters", c + 1);
|
||||
ini_section_delete_var(cat, temp);
|
||||
|
||||
@@ -1538,9 +1525,6 @@ load_other_removable_devices(void)
|
||||
|
||||
/* If the MO drive is disabled, delete all its variables. */
|
||||
if (mo_drives[c].bus_type == MO_BUS_DISABLED) {
|
||||
sprintf(temp, "mo_%02i_host_drive", c + 1);
|
||||
ini_section_delete_var(cat, temp);
|
||||
|
||||
sprintf(temp, "mo_%02i_parameters", c + 1);
|
||||
ini_section_delete_var(cat, temp);
|
||||
|
||||
@@ -2575,10 +2559,7 @@ save_floppy_and_cdrom_drives(void)
|
||||
|
||||
for (c = 0; c < CDROM_NUM; c++) {
|
||||
sprintf(temp, "cdrom_%02i_host_drive", c + 1);
|
||||
if ((cdrom[c].bus_type == 0) || ((cdrom[c].host_drive != 200) && (cdrom[c].host_drive != 201)))
|
||||
ini_section_delete_var(cat, temp);
|
||||
else
|
||||
ini_section_set_int(cat, temp, cdrom[c].host_drive);
|
||||
ini_section_delete_var(cat, temp);
|
||||
|
||||
sprintf(temp, "cdrom_%02i_speed", c + 1);
|
||||
if ((cdrom[c].bus_type == 0) || (cdrom[c].speed == 8))
|
||||
|
@@ -241,8 +241,6 @@ typedef struct cdrom {
|
||||
uint32_t cd_end;
|
||||
uint32_t type;
|
||||
|
||||
int host_drive;
|
||||
int prev_host_drive;
|
||||
int cd_buflen;
|
||||
int audio_op;
|
||||
int audio_muted_soft;
|
||||
|
@@ -33,11 +33,7 @@ machine_status_init(void)
|
||||
machine_status.fdd[i].active = false;
|
||||
}
|
||||
for (size_t i = 0; i < CDROM_NUM; ++i) {
|
||||
if (cdrom[i].host)
|
||||
machine_status.cdrom[i].empty = cdrom[i].host_drive != 201;
|
||||
else
|
||||
machine_status.cdrom[i].empty = cdrom[i].host_drive != 200 || (strlen(cdrom[i].image_path) == 0);
|
||||
|
||||
machine_status.cdrom[i].empty = (strlen(cdrom[i].image_path) == 0);
|
||||
machine_status.cdrom[i].active = false;
|
||||
}
|
||||
for (size_t i = 0; i < ZIP_NUM; i++) {
|
||||
|
@@ -533,7 +533,7 @@ MachineStatus::refresh(QStatusBar *sbar)
|
||||
|
||||
iterateCDROM([this, sbar](int i) {
|
||||
d->cdrom[i].label = std::make_unique<ClickableLabel>();
|
||||
d->cdrom[i].setEmpty((cdrom[i].host_drive != 200) || QString(cdrom[i].image_path).isEmpty());
|
||||
d->cdrom[i].setEmpty(QString(cdrom[i].image_path).isEmpty());
|
||||
d->cdrom[i].setActive(false);
|
||||
d->cdrom[i].refresh();
|
||||
connect((ClickableLabel *) d->cdrom[i].label.get(), &ClickableLabel::clicked, [i](QPoint pos) {
|
||||
|
@@ -478,7 +478,6 @@ MediaMenu::cdromMount(int i, const QString &filename)
|
||||
{
|
||||
QByteArray fn = filename.toUtf8().data();
|
||||
|
||||
cdrom[i].prev_host_drive = cdrom[i].host_drive;
|
||||
strcpy(cdrom[i].prev_image_path, cdrom[i].image_path);
|
||||
if (cdrom[i].ops && cdrom[i].ops->exit)
|
||||
cdrom[i].ops->exit(&(cdrom[i]));
|
||||
@@ -499,9 +498,8 @@ MediaMenu::cdromMount(int i, const QString &filename)
|
||||
/* Signal media change to the emulated machine. */
|
||||
if (cdrom[i].insert)
|
||||
cdrom[i].insert(cdrom[i].priv);
|
||||
cdrom[i].host_drive = (strlen(cdrom[i].image_path) == 0) ? 0 : 200;
|
||||
|
||||
if (cdrom[i].host_drive >= 200)
|
||||
if (strlen(cdrom[i].image_path) > 0)
|
||||
ui_sb_update_icon_state(SB_CDROM | i, 0);
|
||||
else
|
||||
ui_sb_update_icon_state(SB_CDROM | i, 1);
|
||||
@@ -557,7 +555,7 @@ MediaMenu::cdromUpdateUi(int i)
|
||||
{
|
||||
cdrom_t *drv = &cdrom[i];
|
||||
|
||||
if (drv->host_drive == 0) {
|
||||
if (strlen(cdrom[i].image_path) == 0) {
|
||||
mhm.addImageToHistory(i, ui::MediaType::Optical, drv->prev_image_path, QString());
|
||||
ui_sb_update_icon_state(SB_CDROM | i, 1);
|
||||
} else {
|
||||
|
@@ -1887,7 +1887,7 @@ begin:
|
||||
case GPCMD_AUDIO_SCAN:
|
||||
scsi_cdrom_set_phase(dev, SCSI_PHASE_STATUS);
|
||||
|
||||
if ((dev->drv->host_drive < 1) || (dev->drv->cd_status <= CD_STATUS_DATA_ONLY)) {
|
||||
if ((dev->drv->image_path[0] == 0x00) || (dev->drv->cd_status <= CD_STATUS_DATA_ONLY)) {
|
||||
scsi_cdrom_illegal_mode(dev);
|
||||
break;
|
||||
}
|
||||
@@ -2563,7 +2563,7 @@ begin:
|
||||
case CDROM_TYPE_TOSHIBA_XM5701TA_3136:
|
||||
case CDROM_TYPE_TOSHIBA_SDM1401_1008: /*GPCMD_AUDIO_TRACK_SEARCH_TOSHIBA*/
|
||||
scsi_cdrom_set_phase(dev, SCSI_PHASE_STATUS);
|
||||
if ((dev->drv->host_drive < 1) || (dev->drv->cd_status <= CD_STATUS_DATA_ONLY)) {
|
||||
if ((dev->drv->image_path[0] == 0x00) || (dev->drv->cd_status <= CD_STATUS_DATA_ONLY)) {
|
||||
scsi_cdrom_illegal_mode(dev);
|
||||
break;
|
||||
}
|
||||
@@ -2591,7 +2591,7 @@ begin:
|
||||
case CDROM_TYPE_NEC_211_100:
|
||||
case CDROM_TYPE_NEC_464_105: /*GPCMD_AUDIO_TRACK_SEARCH_NEC*/
|
||||
scsi_cdrom_set_phase(dev, SCSI_PHASE_STATUS);
|
||||
if ((dev->drv->host_drive < 1) || (dev->drv->cd_status <= CD_STATUS_DATA_ONLY)) {
|
||||
if ((dev->drv->image_path[0] == 0x00) || (dev->drv->cd_status <= CD_STATUS_DATA_ONLY)) {
|
||||
scsi_cdrom_illegal_mode(dev);
|
||||
break;
|
||||
}
|
||||
@@ -2670,7 +2670,7 @@ begin:
|
||||
case CDROM_TYPE_TOSHIBA_XM5701TA_3136:
|
||||
case CDROM_TYPE_TOSHIBA_SDM1401_1008: /*GPCMD_PLAY_AUDIO_TOSHIBA*/
|
||||
scsi_cdrom_set_phase(dev, SCSI_PHASE_STATUS);
|
||||
if ((dev->drv->host_drive < 1) || (dev->drv->cd_status <= CD_STATUS_DATA_ONLY)) {
|
||||
if ((dev->drv->image_path[0] == 0x00) || (dev->drv->cd_status <= CD_STATUS_DATA_ONLY)) {
|
||||
scsi_cdrom_illegal_mode(dev);
|
||||
break;
|
||||
}
|
||||
@@ -2697,7 +2697,7 @@ begin:
|
||||
case CDROM_TYPE_NEC_211_100:
|
||||
case CDROM_TYPE_NEC_464_105: /*GPCMD_PLAY_AUDIO_NEC*/
|
||||
scsi_cdrom_set_phase(dev, SCSI_PHASE_STATUS);
|
||||
if ((dev->drv->host_drive < 1) || (dev->drv->cd_status <= CD_STATUS_DATA_ONLY)) {
|
||||
if ((dev->drv->image_path[0] == 0x00) || (dev->drv->cd_status <= CD_STATUS_DATA_ONLY)) {
|
||||
scsi_cdrom_illegal_mode(dev);
|
||||
break;
|
||||
}
|
||||
@@ -2765,7 +2765,7 @@ begin:
|
||||
break;
|
||||
}
|
||||
|
||||
if ((dev->drv->host_drive < 1) || (dev->drv->cd_status <= CD_STATUS_DATA_ONLY)) {
|
||||
if ((dev->drv->image_path[0] == 0x00) || (dev->drv->cd_status <= CD_STATUS_DATA_ONLY)) {
|
||||
scsi_cdrom_illegal_mode(dev);
|
||||
break;
|
||||
}
|
||||
@@ -2882,7 +2882,7 @@ begin:
|
||||
}
|
||||
pos = cdb[4];
|
||||
|
||||
if ((dev->drv->host_drive < 1) || (dev->drv->cd_status <= CD_STATUS_DATA_ONLY)) {
|
||||
if ((dev->drv->image_path[0] == 0x00) || (dev->drv->cd_status <= CD_STATUS_DATA_ONLY)) {
|
||||
scsi_cdrom_illegal_mode(dev);
|
||||
break;
|
||||
}
|
||||
@@ -3596,7 +3596,7 @@ atapi_out:
|
||||
break;
|
||||
case CDROM_TYPE_PIONEER_DRM604X_2403: /*GPCMD_AUDIO_TRACK_SEARCH_PIONEER*/
|
||||
scsi_cdrom_set_phase(dev, SCSI_PHASE_STATUS);
|
||||
if ((dev->drv->host_drive < 1) || (dev->drv->cd_status <= CD_STATUS_DATA_ONLY)) {
|
||||
if ((dev->drv->image_path[0] == 0x00) || (dev->drv->cd_status <= CD_STATUS_DATA_ONLY)) {
|
||||
scsi_cdrom_illegal_mode(dev);
|
||||
break;
|
||||
}
|
||||
@@ -3646,7 +3646,7 @@ atapi_out:
|
||||
break;
|
||||
case CDROM_TYPE_PIONEER_DRM604X_2403: /*GPCMD_PLAY_AUDIO_PIONEER*/
|
||||
scsi_cdrom_set_phase(dev, SCSI_PHASE_STATUS);
|
||||
if ((dev->drv->host_drive < 1) || (dev->drv->cd_status <= CD_STATUS_DATA_ONLY)) {
|
||||
if ((dev->drv->image_path[0] == 0x00) || (dev->drv->cd_status <= CD_STATUS_DATA_ONLY)) {
|
||||
scsi_cdrom_illegal_mode(dev);
|
||||
break;
|
||||
}
|
||||
|
@@ -124,7 +124,7 @@ plat_cdrom_ui_update(uint8_t id, uint8_t reload)
|
||||
{
|
||||
cdrom_t *drv = &cdrom[id];
|
||||
|
||||
if (drv->host_drive == 0) {
|
||||
if (drv->image_path[0] == 0x00) {
|
||||
ui_sb_update_icon_state(SB_CDROM | id, 1);
|
||||
} else {
|
||||
ui_sb_update_icon_state(SB_CDROM | id, 0);
|
||||
@@ -139,7 +139,6 @@ plat_cdrom_ui_update(uint8_t id, uint8_t reload)
|
||||
void
|
||||
cdrom_mount(uint8_t id, char *fn)
|
||||
{
|
||||
cdrom[id].prev_host_drive = cdrom[id].host_drive;
|
||||
strcpy(cdrom[id].prev_image_path, cdrom[id].image_path);
|
||||
if (cdrom[id].ops && cdrom[id].ops->exit)
|
||||
cdrom[id].ops->exit(&(cdrom[id]));
|
||||
@@ -151,12 +150,10 @@ cdrom_mount(uint8_t id, char *fn)
|
||||
/* Signal media change to the emulated machine. */
|
||||
if (cdrom[id].insert)
|
||||
cdrom[id].insert(cdrom[id].priv);
|
||||
cdrom[id].host_drive = (strlen(cdrom[id].image_path) == 0) ? 0 : 200;
|
||||
if (cdrom[id].host_drive == 200) {
|
||||
if (cdrom[id].image_path[0] == 0x00)
|
||||
ui_sb_update_icon_state(SB_CDROM | id, 0);
|
||||
} else {
|
||||
else
|
||||
ui_sb_update_icon_state(SB_CDROM | id, 1);
|
||||
}
|
||||
#if 0
|
||||
media_menu_update_cdrom(id);
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user