Imported CD-ROM-related changes from VARCem;

Removed cdrom_null.c/h;
Some changes to logging (will be spread to everything else soon).
This commit is contained in:
OBattler
2018-10-17 05:29:48 +02:00
parent 2cd20ea319
commit c663147d11
18 changed files with 908 additions and 972 deletions

View File

@@ -333,13 +333,13 @@ DLG_CFG_VIDEO DIALOG DISCARDABLE 97, 0, 267, 45
STYLE DS_CONTROL | WS_CHILD
FONT 9, "Segoe UI"
BEGIN
LTEXT "Video:",IDT_1707,7,8,55,10
COMBOBOX IDC_COMBO_VIDEO,71,7,140,120,CBS_DROPDOWNLIST |
LTEXT "Video:",IDT_1707,7,8,48,10
COMBOBOX IDC_COMBO_VIDEO,64,7,155,120,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "Configure",IDC_CONFIGURE_VID,214,7,46,12
PUSHBUTTON "Configure",IDC_CONFIGURE_VID,222,7,38,12
CONTROL "Voodoo Graphics",IDC_CHECK_VOODOO,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,7,27,199,10
PUSHBUTTON "Configure",IDC_BUTTON_VOODOO,214,26,46,12
PUSHBUTTON "Configure",IDC_BUTTON_VOODOO,222,26,38,12
END
DLG_CFG_INPUT DIALOG DISCARDABLE 97, 0, 267, 65
@@ -438,49 +438,49 @@ DLG_CFG_PERIPHERALS DIALOG DISCARDABLE 97, 0, 267, 200
STYLE DS_CONTROL | WS_CHILD
FONT 9, "Segoe UI"
BEGIN
LTEXT "SCSI Controller:",IDT_1716,7,8,59,10
COMBOBOX IDC_COMBO_SCSI,71,7,140,120,CBS_DROPDOWNLIST |
LTEXT "SCSI Controller:",IDT_1716,7,8,48,10
COMBOBOX IDC_COMBO_SCSI,64,7,155,120,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "Configure",IDC_CONFIGURE_SCSI,214,7,46,12
PUSHBUTTON "Configure",IDC_CONFIGURE_SCSI,222,7,38,12
LTEXT "HD Controller:",IDT_1717,7,26,61,10
COMBOBOX IDC_COMBO_HDC,71,25,140,120,CBS_DROPDOWNLIST |
LTEXT "HD Controller:",IDT_1717,7,26,48,10
COMBOBOX IDC_COMBO_HDC,64,25,155,120,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "Configure",IDC_CONFIGURE_HDC,214,25,46,12
PUSHBUTTON "Configure",IDC_CONFIGURE_HDC,222,25,38,12
CONTROL "Tertiary IDE Controller",IDC_CHECK_IDE_TER,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,7,44,199,10
PUSHBUTTON "Configure",IDC_BUTTON_IDE_TER,214,43,46,12
PUSHBUTTON "Configure",IDC_BUTTON_IDE_TER,222,43,38,12
CONTROL "Quaternary IDE Controller",IDC_CHECK_IDE_QUA,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,7,62,199,10
PUSHBUTTON "Configure",IDC_BUTTON_IDE_QUA,214,61,46,12
PUSHBUTTON "Configure",IDC_BUTTON_IDE_QUA,222,61,38,12
CONTROL "ISABugger device",IDC_CHECK_BUGGER,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,7,80,94,10
LTEXT "ISA RTC",IDT_1767,7,99,61,10
COMBOBOX IDC_COMBO_ISARTC,71,98,140,120,
LTEXT "ISA RTC",IDT_1767,7,99,48,10
COMBOBOX IDC_COMBO_ISARTC,64,98,155,120,
CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "Configure",IDC_CONFIGURE_ISARTC,214,98,46,12
PUSHBUTTON "Configure",IDC_CONFIGURE_ISARTC,222,98,38,12
GROUPBOX "ISA Memory Expansion",IDC_GROUP_ISAMEM,7,118,255,70
LTEXT "#1:",IDT_1763,12,130,21,10
COMBOBOX IDC_COMBO_ISAMEM_1,25,129,180,120,
COMBOBOX IDC_COMBO_ISAMEM_1,25,129,190,120,
CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "Configure",IDC_CONFIGURE_ISAMEM_1,209,129,46,12
PUSHBUTTON "Configure",IDC_CONFIGURE_ISAMEM_1,217,129,38,12
LTEXT "#2:",IDT_1764,12,144,21,10
COMBOBOX IDC_COMBO_ISAMEM_2,25,143,180,120,
COMBOBOX IDC_COMBO_ISAMEM_2,25,143,190,120,
CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "Configure",IDC_CONFIGURE_ISAMEM_2,209,143,46,12
PUSHBUTTON "Configure",IDC_CONFIGURE_ISAMEM_2,217,143,38,12
LTEXT "#3:",IDT_1765,12,158,21,10
COMBOBOX IDC_COMBO_ISAMEM_3,25,157,180,120,
COMBOBOX IDC_COMBO_ISAMEM_3,25,157,190,120,
CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "Configure",IDC_CONFIGURE_ISAMEM_3,209,157,46,12
PUSHBUTTON "Configure",IDC_CONFIGURE_ISAMEM_3,217,157,38,12
LTEXT "#4:",IDT_1766,12,172,21,10
COMBOBOX IDC_COMBO_ISAMEM_4,25,171,180,120,
COMBOBOX IDC_COMBO_ISAMEM_4,25,171,190,120,
CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "Configure",IDC_CONFIGURE_ISAMEM_4,209,171,46,12
PUSHBUTTON "Configure",IDC_CONFIGURE_ISAMEM_4,217,171,38,12
END
DLG_CFG_HARD_DISKS DIALOG DISCARDABLE 97, 0, 267, 154

View File

@@ -8,7 +8,7 @@
#
# Makefile for Win32 (MinGW32) environment.
#
# Version: @(#)Makefile.mingw 1.0.129 2018/10/12
# Version: @(#)Makefile.mingw 1.0.130 2018/10/17
#
# Authors: Miran Grca, <mgrca8@gmail.com>
# Fred N. van Kempen, <decwiz@yahoo.com>
@@ -471,7 +471,7 @@ HDDOBJ := hdd.o \
hdc_xtide.o hdc_ide.o
CDROMOBJ := cdrom.o \
cdrom_dosbox.o cdrom_image.o cdrom_null.o
cdrom_dosbox.o cdrom_image.o
ZIPOBJ := zip.o

View File

@@ -8,7 +8,7 @@
*
* Handle the platform-side of CDROM drives.
*
* Version: @(#)win_cdrom.c 1.0.10 2018/10/09
* Version: @(#)win_cdrom.c 1.0.10 2018/10/17
*
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
@@ -32,8 +32,6 @@
#include "../scsi/scsi_device.h"
#include "../cdrom/cdrom.h"
#include "../disk/zip.h"
#include "../cdrom/cdrom_image.h"
#include "../cdrom/cdrom_null.h"
#include "../scsi/scsi_disk.h"
#include "../plat.h"
#include "../ui.h"
@@ -41,86 +39,24 @@
void
cdrom_eject(uint8_t id)
plat_cdrom_ui_update(uint8_t id, uint8_t reload)
{
cdrom_drive_t *drv = &cdrom_drives[id];
cdrom_image_t *img = &cdrom_image[id];
cdrom_t *drv = &cdrom[id];
if (drv->host_drive == 0) {
/* Switch from empty to empty. Do nothing. */
return;
ui_sb_check_menu_item(SB_CDROM|id, IDM_CDROM_EMPTY | id, MF_CHECKED);
drv->host_drive = 0;
ui_sb_check_menu_item(SB_CDROM|id, IDM_CDROM_IMAGE | id, MF_UNCHECKED);
ui_sb_update_icon_state(SB_CDROM|id, 1);
} else {
ui_sb_check_menu_item(SB_CDROM|id, IDM_CDROM_EMPTY | id, MF_UNCHECKED);
drv->host_drive = 200;
ui_sb_check_menu_item(SB_CDROM|id, IDM_CDROM_IMAGE | id, MF_CHECKED);
ui_sb_update_icon_state(SB_CDROM|id, 0);
}
if (img->prev_image_path) {
free(img->prev_image_path);
img->prev_image_path = NULL;
}
if (drv->host_drive == 200) {
img->prev_image_path = (wchar_t *) malloc(1024);
wcscpy(img->prev_image_path, img->image_path);
}
drv->prev_host_drive = drv->host_drive;
drv->handler->exit(id);
cdrom_close_handler(id);
memset(img->image_path, 0, 2048);
cdrom_null_open(id);
if (drv->insert) {
/* Signal disc change to the emulated machine. */
drv->insert(drv->p);
}
ui_sb_check_menu_item(SB_CDROM|id, IDM_CDROM_IMAGE | id, MF_UNCHECKED);
drv->host_drive=0;
ui_sb_check_menu_item(SB_CDROM|id, IDM_CDROM_EMPTY | id, MF_CHECKED);
ui_sb_update_icon_state(SB_CDROM|id, 1);
ui_sb_enable_menu_item(SB_CDROM|id, IDM_CDROM_RELOAD | id, MF_BYCOMMAND | MF_ENABLED);
ui_sb_enable_menu_item(SB_CDROM|id, IDM_CDROM_RELOAD | id, MF_BYCOMMAND | (reload ? MF_GRAYED : MF_ENABLED));
ui_sb_update_tip(SB_CDROM|id);
config_save();
}
void
cdrom_reload(uint8_t id)
{
cdrom_drive_t *drv = &cdrom_drives[id];
cdrom_image_t *img = &cdrom_image[id];
if ((drv->host_drive == drv->prev_host_drive) || !drv->prev_host_drive || drv->host_drive) {
/* Switch from empty to empty. Do nothing. */
return;
}
cdrom_close_handler(id);
memset(img->image_path, 0, 2048);
if (drv->prev_host_drive == 200) {
wcscpy(img->image_path, img->prev_image_path);
free(img->prev_image_path);
img->prev_image_path = NULL;
image_open(id, img->image_path);
if (drv->insert) {
/* Signal disc change to the emulated machine. */
drv->insert(drv->p);
}
if (wcslen(img->image_path) == 0) {
ui_sb_check_menu_item(SB_CDROM|id, IDM_CDROM_EMPTY | id, MF_CHECKED);
drv->host_drive = 0;
ui_sb_check_menu_item(SB_CDROM|id, IDM_CDROM_IMAGE | id, MF_UNCHECKED);
ui_sb_update_icon_state(SB_CDROM|id, 1);
} else {
ui_sb_check_menu_item(SB_CDROM|id, IDM_CDROM_EMPTY | id, MF_UNCHECKED);
drv->host_drive = 200;
ui_sb_check_menu_item(SB_CDROM|id, IDM_CDROM_IMAGE | id, 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);
ui_sb_update_tip(SB_CDROM|id);
config_save();
}

View File

@@ -8,7 +8,7 @@
*
* Windows 86Box Settings dialog handler.
*
* Version: @(#)win_settings.c 1.0.64 2018/10/08
* Version: @(#)win_settings.c 1.0.65 2018/10/17
*
* Authors: Miran Grca, <mgrca8@gmail.com>
* David Hrdlička, <hrdlickadavid@outlook.com>
@@ -120,7 +120,7 @@ static int temp_fdd_turbo[FDD_NUM];
static int temp_fdd_check_bpb[FDD_NUM];
/* Other removable devices category */
static cdrom_drive_t temp_cdrom_drives[CDROM_NUM];
static cdrom_t temp_cdrom[CDROM_NUM];
static zip_drive_t temp_zip_drives[ZIP_NUM];
static HWND hwndParentDialog, hwndChildDialog;
@@ -281,12 +281,12 @@ win_settings_init(void)
}
/* Other removable devices category */
memcpy(temp_cdrom_drives, cdrom_drives, CDROM_NUM * sizeof(cdrom_drive_t));
memcpy(temp_cdrom, cdrom, CDROM_NUM * sizeof(cdrom_t));
for (i = 0; i < CDROM_NUM; i++) {
if (cdrom_drives[i].bus_type == CDROM_BUS_ATAPI)
ide_tracking |= (2 << (cdrom_drives[i].ide_channel << 3));
else if (cdrom_drives[i].bus_type == CDROM_BUS_SCSI)
scsi_tracking[cdrom_drives[i].scsi_device_id >> 3] |= (1 << ((cdrom_drives[i].scsi_device_id & 0x07) << 3));
if (cdrom[i].bus_type == CDROM_BUS_ATAPI)
ide_tracking |= (2 << (cdrom[i].ide_channel << 3));
else if (cdrom[i].bus_type == CDROM_BUS_SCSI)
scsi_tracking[cdrom[i].scsi_device_id >> 3] |= (1 << ((cdrom[i].scsi_device_id & 0x07) << 3));
}
memcpy(temp_zip_drives, zip_drives, ZIP_NUM * sizeof(zip_drive_t));
for (i = 0; i < ZIP_NUM; i++) {
@@ -372,7 +372,7 @@ win_settings_changed(void)
}
/* Other removable devices category */
i = i || memcmp(cdrom_drives, temp_cdrom_drives, CDROM_NUM * sizeof(cdrom_drive_t));
i = i || memcmp(cdrom, temp_cdrom, CDROM_NUM * sizeof(cdrom_t));
i = i || memcmp(zip_drives, temp_zip_drives, ZIP_NUM * sizeof(zip_drive_t));
i = i || !!temp_deviceconfig;
@@ -482,7 +482,7 @@ win_settings_save(void)
}
/* Removable devices category */
memcpy(cdrom_drives, temp_cdrom_drives, CDROM_NUM * sizeof(cdrom_drive_t));
memcpy(cdrom, temp_cdrom, CDROM_NUM * sizeof(cdrom_t));
memcpy(zip_drives, temp_zip_drives, ZIP_NUM * sizeof(zip_drive_t));
/* Mark configuration as changed. */
@@ -3435,22 +3435,22 @@ win_settings_cdrom_drives_recalc_list(HWND hwndList)
lvI.stateMask = lvI.iSubItem = lvI.state = 0;
for (i = 0; i < 4; i++) {
fsid = combo_id_to_format_string_id(temp_cdrom_drives[i].bus_type);
fsid = combo_id_to_format_string_id(temp_cdrom[i].bus_type);
lvI.iSubItem = 0;
switch (temp_cdrom_drives[i].bus_type) {
switch (temp_cdrom[i].bus_type) {
case CDROM_BUS_DISABLED:
default:
lvI.pszText = plat_get_string(fsid);
lvI.iImage = 0;
break;
case CDROM_BUS_ATAPI:
wsprintf(szText, plat_get_string(fsid), temp_cdrom_drives[i].ide_channel >> 1, temp_cdrom_drives[i].ide_channel & 1);
wsprintf(szText, plat_get_string(fsid), temp_cdrom[i].ide_channel >> 1, temp_cdrom[i].ide_channel & 1);
lvI.pszText = szText;
lvI.iImage = 1;
break;
case CDROM_BUS_SCSI:
wsprintf(szText, plat_get_string(fsid), temp_cdrom_drives[i].scsi_device_id);
wsprintf(szText, plat_get_string(fsid), temp_cdrom[i].scsi_device_id);
lvI.pszText = szText;
lvI.iImage = 1;
break;
@@ -3462,10 +3462,10 @@ win_settings_cdrom_drives_recalc_list(HWND hwndList)
return FALSE;
lvI.iSubItem = 1;
if (temp_cdrom_drives[i].bus_type == CDROM_BUS_DISABLED)
if (temp_cdrom[i].bus_type == CDROM_BUS_DISABLED)
lvI.pszText = plat_get_string(IDS_2112);
else {
wsprintf(szText, L"%ix", temp_cdrom_drives[i].speed);
wsprintf(szText, L"%ix", temp_cdrom[i].speed);
lvI.pszText = szText;
}
lvI.iItem = i;
@@ -3698,21 +3698,21 @@ win_settings_cdrom_drives_update_item(HWND hwndList, int i)
lvI.iSubItem = 0;
lvI.iItem = i;
fsid = combo_id_to_format_string_id(temp_cdrom_drives[i].bus_type);
fsid = combo_id_to_format_string_id(temp_cdrom[i].bus_type);
switch (temp_cdrom_drives[i].bus_type) {
switch (temp_cdrom[i].bus_type) {
case CDROM_BUS_DISABLED:
default:
lvI.pszText = plat_get_string(fsid);
lvI.iImage = 0;
break;
case CDROM_BUS_ATAPI:
wsprintf(szText, plat_get_string(fsid), temp_cdrom_drives[i].ide_channel >> 1, temp_cdrom_drives[i].ide_channel & 1);
wsprintf(szText, plat_get_string(fsid), temp_cdrom[i].ide_channel >> 1, temp_cdrom[i].ide_channel & 1);
lvI.pszText = szText;
lvI.iImage = 1;
break;
case CDROM_BUS_SCSI:
wsprintf(szText, plat_get_string(fsid), temp_cdrom_drives[i].scsi_device_id);
wsprintf(szText, plat_get_string(fsid), temp_cdrom[i].scsi_device_id);
lvI.pszText = szText;
lvI.iImage = 1;
break;
@@ -3722,10 +3722,10 @@ win_settings_cdrom_drives_update_item(HWND hwndList, int i)
return;
lvI.iSubItem = 1;
if (temp_cdrom_drives[i].bus_type == CDROM_BUS_DISABLED)
if (temp_cdrom[i].bus_type == CDROM_BUS_DISABLED)
lvI.pszText = plat_get_string(IDS_2112);
else {
wsprintf(szText, L"%ix", temp_cdrom_drives[i].speed);
wsprintf(szText, L"%ix", temp_cdrom[i].speed);
lvI.pszText = szText;
}
lvI.iItem = i;
@@ -3824,7 +3824,7 @@ static void cdrom_recalc_location_controls(HWND hdlg, int assign_id)
int i = 0;
HWND h;
int bus = temp_cdrom_drives[lv1_current_sel].bus_type;
int bus = temp_cdrom[lv1_current_sel].bus_type;
for (i = IDT_1741; i < (IDT_1742 + 1); i++) {
h = GetDlgItem(hdlg, i);
@@ -3847,7 +3847,7 @@ static void cdrom_recalc_location_controls(HWND hdlg, int assign_id)
} else {
ShowWindow(h, SW_SHOW);
EnableWindow(h, TRUE);
SendMessage(h, CB_SETCURSEL, temp_cdrom_drives[lv1_current_sel].speed - 1, 0);
SendMessage(h, CB_SETCURSEL, temp_cdrom[lv1_current_sel].speed - 1, 0);
}
h = GetDlgItem(hdlg, IDT_1758);
@@ -3866,12 +3866,12 @@ static void cdrom_recalc_location_controls(HWND hdlg, int assign_id)
EnableWindow(h, TRUE);
if (assign_id)
temp_cdrom_drives[lv1_current_sel].ide_channel = next_free_ide_channel();
temp_cdrom[lv1_current_sel].ide_channel = next_free_ide_channel();
h = GetDlgItem(hdlg, IDC_COMBO_CD_CHANNEL_IDE);
ShowWindow(h, SW_SHOW);
EnableWindow(h, TRUE);
SendMessage(h, CB_SETCURSEL, temp_cdrom_drives[lv1_current_sel].ide_channel, 0);
SendMessage(h, CB_SETCURSEL, temp_cdrom[lv1_current_sel].ide_channel, 0);
break;
case CDROM_BUS_SCSI: /* SCSI */
h = GetDlgItem(hdlg, IDT_1741);
@@ -3879,12 +3879,12 @@ static void cdrom_recalc_location_controls(HWND hdlg, int assign_id)
EnableWindow(h, TRUE);
if (assign_id)
next_free_scsi_id((uint8_t *) &temp_cdrom_drives[lv1_current_sel].scsi_device_id);
next_free_scsi_id((uint8_t *) &temp_cdrom[lv1_current_sel].scsi_device_id);
h = GetDlgItem(hdlg, IDC_COMBO_CD_ID);
ShowWindow(h, SW_SHOW);
EnableWindow(h, TRUE);
SendMessage(h, CB_SETCURSEL, temp_cdrom_drives[lv1_current_sel].scsi_device_id, 0);
SendMessage(h, CB_SETCURSEL, temp_cdrom[lv1_current_sel].scsi_device_id, 0);
break;
}
}
@@ -3987,20 +3987,20 @@ zip_recalc_location_controls(HWND hdlg, int assign_id)
static void
cdrom_track(uint8_t id)
{
if (temp_cdrom_drives[id].bus_type == CDROM_BUS_ATAPI)
ide_tracking |= (2 << (temp_cdrom_drives[id].ide_channel << 3));
else if (temp_cdrom_drives[id].bus_type == CDROM_BUS_SCSI)
scsi_tracking[temp_cdrom_drives[id].scsi_device_id >> 3] |= (1 << (temp_cdrom_drives[id].scsi_device_id & 0x07));
if (temp_cdrom[id].bus_type == CDROM_BUS_ATAPI)
ide_tracking |= (2 << (temp_cdrom[id].ide_channel << 3));
else if (temp_cdrom[id].bus_type == CDROM_BUS_SCSI)
scsi_tracking[temp_cdrom[id].scsi_device_id >> 3] |= (1 << (temp_cdrom[id].scsi_device_id & 0x07));
}
static void
cdrom_untrack(uint8_t id)
{
if (temp_cdrom_drives[id].bus_type == CDROM_BUS_ATAPI)
ide_tracking &= ~(2 << (temp_cdrom_drives[id].ide_channel << 3));
else if (temp_cdrom_drives[id].bus_type == CDROM_BUS_SCSI)
scsi_tracking[temp_cdrom_drives[id].scsi_device_id >> 3] &= ~(1 << (temp_cdrom_drives[id].scsi_device_id & 0x07));
if (temp_cdrom[id].bus_type == CDROM_BUS_ATAPI)
ide_tracking &= ~(2 << (temp_cdrom[id].ide_channel << 3));
else if (temp_cdrom[id].bus_type == CDROM_BUS_SCSI)
scsi_tracking[temp_cdrom[id].scsi_device_id >> 3] &= ~(1 << (temp_cdrom[id].scsi_device_id & 0x07));
}
@@ -4157,7 +4157,7 @@ win_settings_other_removable_devices_proc(HWND hdlg, UINT message, WPARAM wParam
h = GetDlgItem(hdlg, IDC_COMBO_CD_BUS);
switch (temp_cdrom_drives[lv1_current_sel].bus_type) {
switch (temp_cdrom[lv1_current_sel].bus_type) {
case CDROM_BUS_DISABLED:
default:
b = 0;
@@ -4224,7 +4224,7 @@ win_settings_other_removable_devices_proc(HWND hdlg, UINT message, WPARAM wParam
h = GetDlgItem(hdlg, IDC_COMBO_CD_BUS);
switch (temp_cdrom_drives[lv1_current_sel].bus_type) {
switch (temp_cdrom[lv1_current_sel].bus_type) {
case CDROM_BUS_DISABLED:
default:
b = 0;
@@ -4298,13 +4298,13 @@ win_settings_other_removable_devices_proc(HWND hdlg, UINT message, WPARAM wParam
b2 = CDROM_BUS_SCSI;
break;
}
if (b2 == temp_cdrom_drives[lv1_current_sel].bus_type)
if (b2 == temp_cdrom[lv1_current_sel].bus_type)
break;
cdrom_untrack(lv1_current_sel);
assign = (temp_cdrom_drives[lv1_current_sel].bus_type == b2) ? 0 : 1;
if (temp_cdrom_drives[lv1_current_sel].bus_type == CDROM_BUS_DISABLED)
temp_cdrom_drives[lv1_current_sel].speed = 8;
temp_cdrom_drives[lv1_current_sel].bus_type = b2;
assign = (temp_cdrom[lv1_current_sel].bus_type == b2) ? 0 : 1;
if (temp_cdrom[lv1_current_sel].bus_type == CDROM_BUS_DISABLED)
temp_cdrom[lv1_current_sel].speed = 8;
temp_cdrom[lv1_current_sel].bus_type = b2;
cdrom_recalc_location_controls(hdlg, assign);
cdrom_track(lv1_current_sel);
h = GetDlgItem(hdlg, IDC_LIST_CDROM_DRIVES);
@@ -4314,7 +4314,7 @@ win_settings_other_removable_devices_proc(HWND hdlg, UINT message, WPARAM wParam
case IDC_COMBO_CD_ID:
h = GetDlgItem(hdlg, IDC_COMBO_CD_ID);
cdrom_untrack(lv1_current_sel);
temp_cdrom_drives[lv1_current_sel].scsi_device_id = SendMessage(h, CB_GETCURSEL, 0, 0);
temp_cdrom[lv1_current_sel].scsi_device_id = SendMessage(h, CB_GETCURSEL, 0, 0);
cdrom_track(lv1_current_sel);
h = GetDlgItem(hdlg, IDC_LIST_CDROM_DRIVES);
win_settings_cdrom_drives_update_item(h, lv1_current_sel);
@@ -4323,7 +4323,7 @@ win_settings_other_removable_devices_proc(HWND hdlg, UINT message, WPARAM wParam
case IDC_COMBO_CD_CHANNEL_IDE:
h = GetDlgItem(hdlg, IDC_COMBO_CD_CHANNEL_IDE);
cdrom_untrack(lv1_current_sel);
temp_cdrom_drives[lv1_current_sel].ide_channel = SendMessage(h, CB_GETCURSEL, 0, 0);
temp_cdrom[lv1_current_sel].ide_channel = SendMessage(h, CB_GETCURSEL, 0, 0);
cdrom_track(lv1_current_sel);
h = GetDlgItem(hdlg, IDC_LIST_CDROM_DRIVES);
win_settings_cdrom_drives_update_item(h, lv1_current_sel);
@@ -4331,7 +4331,7 @@ win_settings_other_removable_devices_proc(HWND hdlg, UINT message, WPARAM wParam
case IDC_COMBO_CD_SPEED:
h = GetDlgItem(hdlg, IDC_COMBO_CD_SPEED);
temp_cdrom_drives[lv1_current_sel].speed = SendMessage(h, CB_GETCURSEL, 0, 0) + 1;
temp_cdrom[lv1_current_sel].speed = SendMessage(h, CB_GETCURSEL, 0, 0) + 1;
h = GetDlgItem(hdlg, IDC_LIST_CDROM_DRIVES);
win_settings_cdrom_drives_update_item(h, lv1_current_sel);
break;

View File

@@ -8,7 +8,7 @@
*
* Implement the application's Status Bar.
*
* Version: @(#)win_stbar.c 1.0.20 2018/10/09
* Version: @(#)win_stbar.c 1.0.21 2018/10/17
*
* Authors: Miran Grca, <mgrca8@gmail.com>
* Fred N. van Kempen, <decwiz@yahoo.com>
@@ -41,7 +41,6 @@
#include "../cdrom/cdrom.h"
#include "../disk/zip.h"
#include "../cdrom/cdrom_image.h"
#include "../cdrom/cdrom_null.h"
#include "../scsi/scsi_disk.h"
#include "../network/network.h"
#include "../video/video.h"
@@ -153,13 +152,13 @@ StatusBarCreateCdromSubmenu(HMENU m, int id)
AppendMenu(m, MF_STRING, IDM_CDROM_IMAGE | id,
plat_get_string(IDS_2089));
if (! cdrom_drives[id].sound_on)
if (! cdrom[id].sound_on)
CheckMenuItem(m, IDM_CDROM_MUTE | id, MF_CHECKED);
if (cdrom_drives[id].host_drive == 200)
if (cdrom[id].host_drive == 200)
CheckMenuItem(m, IDM_CDROM_IMAGE | id, MF_CHECKED);
else {
cdrom_drives[id].host_drive = 0;
cdrom[id].host_drive = 0;
CheckMenuItem(m, IDM_CDROM_EMPTY | id, MF_CHECKED);
}
}
@@ -269,16 +268,16 @@ StatusBarCreateCdromTip(int part)
WCHAR *szText;
int id;
int drive = sb_part_meanings[part] & 0xf;
int bus = cdrom_drives[drive].bus_type;
int bus = cdrom[drive].bus_type;
id = IDS_5377 + (bus - 1);
szText = plat_get_string(id);
if (cdrom_drives[drive].host_drive == 200) {
if (wcslen(cdrom_image[drive].image_path) == 0)
if (cdrom[drive].host_drive == 200) {
if (wcslen(cdrom[drive].image_path) == 0)
_swprintf(tempTip, plat_get_string(IDS_5120), drive+1, szText, plat_get_string(IDS_2057));
else
_swprintf(tempTip, plat_get_string(IDS_5120), drive+1, szText, cdrom_image[drive].image_path);
_swprintf(tempTip, plat_get_string(IDS_5120), drive+1, szText, cdrom[drive].image_path);
} else
_swprintf(tempTip, plat_get_string(IDS_5120), drive+1, szText, plat_get_string(IDS_2057));
@@ -518,14 +517,14 @@ ui_sb_update_panes(void)
}
for (i=0; i<CDROM_NUM; i++) {
/* Could be Internal or External IDE.. */
if ((cdrom_drives[i].bus_type == CDROM_BUS_ATAPI) &&
if ((cdrom[i].bus_type == CDROM_BUS_ATAPI) &&
!(hdint || !memcmp(hdc_name, "ide", 3)))
continue;
if ((cdrom_drives[i].bus_type == CDROM_BUS_SCSI) &&
if ((cdrom[i].bus_type == CDROM_BUS_SCSI) &&
(scsi_card_current == 0))
continue;
if (cdrom_drives[i].bus_type != 0)
if (cdrom[i].bus_type != 0)
sb_parts++;
}
for (i=0; i<ZIP_NUM; i++) {
@@ -581,13 +580,13 @@ ui_sb_update_panes(void)
}
for (i=0; i<CDROM_NUM; i++) {
/* Could be Internal or External IDE.. */
if ((cdrom_drives[i].bus_type == CDROM_BUS_ATAPI) &&
if ((cdrom[i].bus_type == CDROM_BUS_ATAPI) &&
!(hdint || !memcmp(hdc_name, "ide", 3))) {
continue;
}
if ((cdrom_drives[i].bus_type == CDROM_BUS_SCSI) && (scsi_card_current == 0))
if ((cdrom[i].bus_type == CDROM_BUS_SCSI) && (scsi_card_current == 0))
continue;
if (cdrom_drives[i].bus_type != 0) {
if (cdrom[i].bus_type != 0) {
edge += SB_ICON_WIDTH;
iStatusWidths[sb_parts] = edge;
sb_part_meanings[sb_parts] = SB_CDROM | i;
@@ -681,8 +680,8 @@ ui_sb_update_panes(void)
case SB_CDROM: /* CD-ROM */
id = sb_part_meanings[i] & 0xf;
if (cdrom_drives[id].host_drive == 200)
sb_part_icons[i] = (wcslen(cdrom_image[id].image_path) == 0) ? 128 : 0;
if (cdrom[id].host_drive == 200)
sb_part_icons[i] = (wcslen(cdrom[id].image_path) == 0) ? 128 : 0;
else
sb_part_icons[i] = 128;
sb_part_icons[i] |= 32;
@@ -854,8 +853,8 @@ StatusBarProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
if ((part == 0xff) || (sb_menu_handles == NULL))
break;
cdrom_drives[id].sound_on ^= 1;
CheckMenuItem(sb_menu_handles[part], IDM_CDROM_MUTE | id, cdrom_drives[id].sound_on ? MF_UNCHECKED : MF_CHECKED);
cdrom[id].sound_on ^= 1;
CheckMenuItem(sb_menu_handles[part], IDM_CDROM_MUTE | id, cdrom[id].sound_on ? MF_UNCHECKED : MF_CHECKED);
config_save();
sound_cd_thread_reset();
break;
@@ -876,22 +875,23 @@ StatusBarProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
if ((part == 0xff) || (sb_menu_handles == NULL))
break;
if (!file_dlg_w_st(hwnd, IDS_2075, cdrom_image[id].image_path, 0)) {
cdrom_drives[id].prev_host_drive = cdrom_drives[id].host_drive;
if (!file_dlg_w_st(hwnd, IDS_2075, cdrom[id].image_path, 0)) {
cdrom[id].prev_host_drive = cdrom[id].host_drive;
wcscpy(temp_path, wopenfilestring);
if (!cdrom_image[id].prev_image_path)
cdrom_image[id].prev_image_path = (wchar_t *) malloc(1024);
wcscpy(cdrom_image[id].prev_image_path, cdrom_image[id].image_path);
cdrom_drives[id].handler->exit(id);
cdrom_close_handler(id);
memset(cdrom_image[id].image_path, 0, 2048);
image_open(id, temp_path);
if (!cdrom[id].prev_image_path)
cdrom[id].prev_image_path = (wchar_t *) malloc(1024);
wcscpy(cdrom[id].prev_image_path, cdrom[id].image_path);
if (cdrom[id].ops && cdrom[id].ops->exit)
cdrom[id].ops->exit(&(cdrom[id]));
cdrom[id].ops = NULL;
memset(cdrom[id].image_path, 0, 2048);
cdrom_image_open(&(cdrom[id]), temp_path);
/* Signal media change to the emulated machine. */
if (cdrom_drives[id].insert)
cdrom_drives[id].insert(cdrom_drives[id].p);
if (cdrom[id].insert)
cdrom[id].insert(cdrom[id].p);
CheckMenuItem(sb_menu_handles[part], IDM_CDROM_EMPTY | id, MF_UNCHECKED);
cdrom_drives[id].host_drive = (wcslen(cdrom_image[id].image_path) == 0) ? 0 : 200;
if (cdrom_drives[id].host_drive == 200) {
cdrom[id].host_drive = (wcslen(cdrom[id].image_path) == 0) ? 0 : 200;
if (cdrom[id].host_drive == 200) {
CheckMenuItem(sb_menu_handles[part], IDM_CDROM_IMAGE | id, MF_CHECKED);
ui_sb_update_icon_state(SB_CDROM | id, 0);
} else {