save the ata device options using the parameter tree
- removed parameter "present" and use the new drive type "none" instead - re-implemented cdrom media status parameter as a bx_param_enum_c - TODO: change floppy media status parameter type to be consistent
This commit is contained in:
parent
8865df606a
commit
c2b57c5a56
@ -172,7 +172,6 @@ ata
|
||||
ioaddr2
|
||||
irq
|
||||
master
|
||||
present
|
||||
type
|
||||
path
|
||||
mode
|
||||
|
115
bochs/config.cc
115
bochs/config.cc
@ -276,7 +276,7 @@ void bx_init_options()
|
||||
bx_list_c *deplist;
|
||||
bx_param_num_c *ioaddr, *ioaddr2, *irq;
|
||||
bx_param_bool_c *enabled, *readonly, *status;
|
||||
bx_param_enum_c *mode, *type, *toggle;
|
||||
bx_param_enum_c *mode, *type, *toggle, *status2;
|
||||
bx_param_filename_c *path;
|
||||
char name[BX_PATHNAME_LEN], descr[512], label[512];
|
||||
|
||||
@ -1257,22 +1257,15 @@ void bx_init_options()
|
||||
s_atadevice[channel][slave]);
|
||||
menu->set_options(menu->SERIES_ASK);
|
||||
|
||||
bx_param_bool_c *present = new bx_param_bool_c(menu,
|
||||
"present",
|
||||
"Enable this device",
|
||||
"Controls whether ata device is installed or not",
|
||||
0);
|
||||
present->set_ask_format("Device is enabled: [%s] ");
|
||||
|
||||
static const char *atadevice_type_names[] = { "disk", "cdrom", NULL };
|
||||
static const char *atadevice_type_names[] = { "none", "disk", "cdrom", NULL };
|
||||
|
||||
type = new bx_param_enum_c(menu,
|
||||
"type",
|
||||
"Type of ATA device",
|
||||
"Type of ATA device (disk or cdrom)",
|
||||
atadevice_type_names,
|
||||
BX_ATA_DEVICE_DISK,
|
||||
BX_ATA_DEVICE_DISK);
|
||||
BX_ATA_DEVICE_NONE,
|
||||
BX_ATA_DEVICE_NONE);
|
||||
type->set_ask_format("Enter type of ATA device, disk or cdrom: [%s] ");
|
||||
|
||||
path = new bx_param_filename_c(menu,
|
||||
@ -1292,13 +1285,17 @@ void bx_init_options()
|
||||
BX_HDIMAGE_MODE_FLAT);
|
||||
mode->set_ask_format("Enter mode of ATA device, (flat, concat, etc.): [%s] ");
|
||||
|
||||
status = new bx_param_bool_c(menu,
|
||||
"status",
|
||||
"Inserted",
|
||||
"CD-ROM media status (inserted / ejected)",
|
||||
0);
|
||||
status->set_ask_format("Is media inserted in drive? [%s] ");
|
||||
static const char *media_status_names[] = { "ejected", "inserted", NULL };
|
||||
|
||||
status2 = new bx_param_enum_c(menu,
|
||||
"status",
|
||||
"Status",
|
||||
"CD-ROM media status (inserted / ejected)",
|
||||
media_status_names,
|
||||
BX_INSERTED,
|
||||
BX_EJECTED);
|
||||
status2->set_ask_format("Is the device inserted or ejected? [%s] ");
|
||||
|
||||
bx_param_filename_c *journal = new bx_param_filename_c(menu,
|
||||
"journal",
|
||||
"Path of journal file",
|
||||
@ -1363,32 +1360,15 @@ void bx_init_options()
|
||||
BX_ATA_TRANSLATION_NONE);
|
||||
translation->set_ask_format("Enter translation type: [%s]");
|
||||
|
||||
// the menu and all items on it depend on the present flag
|
||||
deplist = new bx_list_c(NULL);
|
||||
deplist->add(type);
|
||||
deplist->add(path);
|
||||
deplist->add(model);
|
||||
deplist->add(biosdetect);
|
||||
present->set_dependent_list(deplist);
|
||||
// the master/slave menu depends on the ATA channel's enabled flag
|
||||
enabled->get_dependent_list()->add(menu);
|
||||
// the present flag depends on the ATA channel's enabled flag
|
||||
enabled->get_dependent_list()->add(present);
|
||||
// the type selector depends on the ATA channel's enabled flag
|
||||
enabled->get_dependent_list()->add(type);
|
||||
|
||||
// some items depend on the drive type
|
||||
bx_param_c *type_deplist[] = {
|
||||
mode,
|
||||
status,
|
||||
cylinders,
|
||||
heads,
|
||||
spt,
|
||||
translation,
|
||||
NULL
|
||||
};
|
||||
deplist = new bx_list_c(NULL, "deplist", "", type_deplist);
|
||||
type->set_dependent_list(deplist, 0);
|
||||
type->set_dependent_bitmap(BX_ATA_DEVICE_DISK, 0x3d);
|
||||
type->set_dependent_bitmap(BX_ATA_DEVICE_CDROM, 0x02);
|
||||
// all items depend on the drive type
|
||||
type->set_dependent_list(menu->clone(), 0);
|
||||
type->set_dependent_bitmap(BX_ATA_DEVICE_DISK, 0x7e6);
|
||||
type->set_dependent_bitmap(BX_ATA_DEVICE_CDROM, 0x30a);
|
||||
|
||||
type->set_handler(bx_param_handler);
|
||||
}
|
||||
@ -2349,9 +2329,9 @@ static int parse_line_formatted(const char *context, int num_params, char *param
|
||||
} else if (!strcmp(params[i], "translation=auto")) {
|
||||
SIM->get_param_enum("translation", base)->set(BX_ATA_TRANSLATION_AUTO);
|
||||
} else if (!strcmp(params[i], "status=ejected")) {
|
||||
SIM->get_param_bool("status", base)->set(0);
|
||||
SIM->get_param_enum("status", base)->set(BX_EJECTED);
|
||||
} else if (!strcmp(params[i], "status=inserted")) {
|
||||
SIM->get_param_bool("status", base)->set(1);
|
||||
SIM->get_param_enum("status", base)->set(BX_INSERTED);
|
||||
} else if (!strncmp(params[i], "journal=", 8)) {
|
||||
SIM->get_param_string("journal", base)->set(¶ms[i][8]);
|
||||
} else {
|
||||
@ -2365,7 +2345,6 @@ static int parse_line_formatted(const char *context, int num_params, char *param
|
||||
SIM->get_param_num("biosdetect", base)->set(biosdetect);
|
||||
if (type == BX_ATA_DEVICE_DISK) {
|
||||
if (strlen(SIM->get_param_string("path", base)->getptr()) > 0) {
|
||||
SIM->get_param_bool("present", base)->set(1);
|
||||
SIM->get_param_enum("mode", base)->set(mode);
|
||||
SIM->get_param_num("cylinders", base)->set(cylinders);
|
||||
if ((cylinders == 0) && (heads == 0) && (sectors == 0)) {
|
||||
@ -2378,13 +2357,9 @@ static int parse_line_formatted(const char *context, int num_params, char *param
|
||||
SIM->get_param_num("spt", base)->set(sectors);
|
||||
}
|
||||
} else {
|
||||
SIM->get_param_bool("present", base)->set(0);
|
||||
SIM->get_param_enum("type", base)->set(BX_ATA_DEVICE_NONE);
|
||||
}
|
||||
} else if (type == BX_ATA_DEVICE_CDROM) {
|
||||
SIM->get_param_bool("present", base)->set(1);
|
||||
}
|
||||
} else {
|
||||
SIM->get_param_bool("present", base)->set(0);
|
||||
}
|
||||
|
||||
} else if (!strcmp(params[0], "boot")) {
|
||||
@ -3199,6 +3174,7 @@ int bx_write_param_list(FILE *fp, bx_list_c *base, const char *optname, bx_bool
|
||||
char bxrcline[BX_PATHNAME_LEN], tmpstr[BX_PATHNAME_LEN], tmpbyte[4];
|
||||
|
||||
if (base == NULL) return -1;
|
||||
if (!base->get_enabled()) return -1;
|
||||
int p = 0;
|
||||
if (optname == NULL) {
|
||||
sprintf(bxrcline, "%s: ", base->get_name());
|
||||
@ -3311,43 +3287,6 @@ int bx_write_floppy_options(FILE *fp, int drive)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int bx_write_atadevice_options(FILE *fp, Bit8u channel, Bit8u drive, bx_list_c *base)
|
||||
{
|
||||
if (SIM->get_param_bool("present", base)->get()) {
|
||||
fprintf(fp, "ata%d-%s: ", channel, drive==0?"master":"slave");
|
||||
|
||||
if (SIM->get_param_enum("type", base)->get() == BX_ATA_DEVICE_DISK) {
|
||||
fprintf(fp, "type=disk");
|
||||
|
||||
fprintf(fp, ", mode=%s", SIM->get_param_enum("mode", base)->get_selected());
|
||||
fprintf(fp, ", translation=%s", SIM->get_param_enum("translation", base)->get_selected());
|
||||
fprintf(fp, ", path=\"%s\", cylinders=%d, heads=%d, spt=%d",
|
||||
SIM->get_param_string("path", base)->getptr(),
|
||||
SIM->get_param_num("cylinders", base)->get(),
|
||||
SIM->get_param_num("heads", base)->get(),
|
||||
SIM->get_param_num("spt", base)->get());
|
||||
|
||||
if (SIM->get_param_string("journal", base)->getptr() != NULL)
|
||||
if (strcmp(SIM->get_param_string("journal", base)->getptr(), "") != 0)
|
||||
fprintf(fp, ", journal=\"%s\"", SIM->get_param_string("journal", base)->getptr());
|
||||
|
||||
} else if (SIM->get_param_enum("type", base)->get() == BX_ATA_DEVICE_CDROM) {
|
||||
fprintf(fp, "type=cdrom, path=\"%s\", status=%s",
|
||||
SIM->get_param_string("path", base)->getptr(),
|
||||
SIM->get_param_bool("status", base)->get() ? "inserted":"ejected");
|
||||
}
|
||||
|
||||
fprintf(fp, ", biosdetect=%s", SIM->get_param_enum("biosdetect", base)->get_selected());
|
||||
|
||||
if (SIM->get_param_string("model", base)->getptr()>0) {
|
||||
fprintf(fp, ", model=\"%s\"", SIM->get_param_string("model", base)->getptr());
|
||||
}
|
||||
|
||||
fprintf(fp, "\n");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int bx_write_usb_options(FILE *fp, int maxports, bx_list_c *base)
|
||||
{
|
||||
int i;
|
||||
@ -3560,8 +3499,10 @@ int bx_write_configuration(const char *rc, int overwrite)
|
||||
base = (bx_list_c*) SIM->get_param(tmppath);
|
||||
sprintf(tmppath, "ata%d", channel);
|
||||
bx_write_param_list(fp, (bx_list_c*) SIM->get_param("resources", base), tmppath, 0);
|
||||
bx_write_atadevice_options(fp, channel, 0, (bx_list_c*) SIM->get_param("master", base));
|
||||
bx_write_atadevice_options(fp, channel, 1, (bx_list_c*) SIM->get_param("slave", base));
|
||||
sprintf(tmppath, "ata%d-master", channel);
|
||||
bx_write_param_list(fp, (bx_list_c*) SIM->get_param("master", base), tmppath, 0);
|
||||
sprintf(tmppath, "ata%d-slave", channel);
|
||||
bx_write_param_list(fp, (bx_list_c*) SIM->get_param("slave", base), tmppath, 0);
|
||||
}
|
||||
for (i=0; i<BX_N_OPTROM_IMAGES; i++) {
|
||||
sprintf(tmppath, "memory.optrom.%d.path", i+1);
|
||||
|
@ -741,11 +741,9 @@ bx_param_c *bx_real_sim_c::get_first_atadevice(Bit32u search_type)
|
||||
if (!SIM->get_param_bool(pname)->get())
|
||||
continue;
|
||||
for (int slave=0; slave<2; slave++) {
|
||||
sprintf(pname, "ata.%d.%s.present", channel, (slave==0)?"master":"slave");
|
||||
Bit32u present = SIM->get_param_bool(pname)->get();
|
||||
sprintf(pname, "ata.%d.%s.type", channel, (slave==0)?"master":"slave");
|
||||
Bit32u type = SIM->get_param_enum(pname)->get();
|
||||
if (present && (type == search_type)) {
|
||||
if (type == search_type) {
|
||||
sprintf(pname, "ata.%d.%s", channel, (slave==0)?"master":"slave");
|
||||
return SIM->get_param(pname);
|
||||
}
|
||||
|
@ -183,6 +183,10 @@ typedef enum {
|
||||
|| (type == LOGLEV_PANIC && choice == ACT_IGNORE) \
|
||||
)
|
||||
|
||||
// floppy / cdrom media status
|
||||
#define BX_EJECTED 0
|
||||
#define BX_INSERTED 1
|
||||
|
||||
// boot devices (using the same values as the rombios)
|
||||
enum {
|
||||
BX_BOOT_NONE,
|
||||
@ -511,9 +515,9 @@ enum {
|
||||
#define BX_FLOPPY_AUTO 19 // autodetect image size
|
||||
#define BX_FLOPPY_UNKNOWN 20 // image size doesn't match one of the types above
|
||||
|
||||
#define BX_ATA_DEVICE_DISK 0
|
||||
#define BX_ATA_DEVICE_CDROM 1
|
||||
#define BX_ATA_DEVICE_LAST 1
|
||||
#define BX_ATA_DEVICE_NONE 0
|
||||
#define BX_ATA_DEVICE_DISK 1
|
||||
#define BX_ATA_DEVICE_CDROM 2
|
||||
|
||||
#define BX_ATA_BIOSDETECT_NONE 0
|
||||
#define BX_ATA_BIOSDETECT_AUTO 1
|
||||
|
@ -2,7 +2,7 @@
|
||||
// $Id$
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2009 The Bochs Project
|
||||
// Copyright (C) 2002-2013 The Bochs Project
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
@ -373,7 +373,7 @@ void build_runtime_options_prompt(const char *format, char *buf, int size)
|
||||
// 4 cdroms supported at run time
|
||||
int device;
|
||||
for (Bit8u cdrom=0; cdrom<4; cdrom++) {
|
||||
if (!SIM->get_cdrom_options(cdrom, &cdromop, &device) || !SIM->get_param_bool("present", cdromop)->get())
|
||||
if (!SIM->get_cdrom_options(cdrom, &cdromop, &device))
|
||||
sprintf(buffer[2+cdrom], "(not present)");
|
||||
else
|
||||
sprintf(buffer[2+cdrom], "(%s on ata%d) %s, %s",
|
||||
@ -524,7 +524,7 @@ int bx_config_interface(int menu)
|
||||
case BX_CI_RT_CDROM3:
|
||||
case BX_CI_RT_CDROM4:
|
||||
int device;
|
||||
if (SIM->get_cdrom_options(choice - BX_CI_RT_CDROM1, &cdromop, &device) && SIM->get_param_bool("present", cdromop)->get()) {
|
||||
if (SIM->get_cdrom_options(choice - BX_CI_RT_CDROM1, &cdromop, &device)) {
|
||||
cdromop->get_param_path(pname, 80);
|
||||
do_menu(pname);
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
// $Id$
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2001-2012 The Bochs Project
|
||||
// Copyright (C) 2001-2013 The Bochs Project
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
@ -2487,7 +2487,7 @@ int x11_ask_dialog(BxEvent *event)
|
||||
return retcode;
|
||||
}
|
||||
|
||||
int x11_string_dialog(bx_param_string_c *param, bx_param_bool_c *param2)
|
||||
int x11_string_dialog(bx_param_string_c *param, bx_param_enum_c *param2)
|
||||
{
|
||||
x11_control_c *xctl_edit, *xbtn_status = NULL;
|
||||
int control = 0, h, num_ctrls, ok_button;
|
||||
@ -2497,7 +2497,7 @@ int x11_string_dialog(bx_param_string_c *param, bx_param_bool_c *param2)
|
||||
|
||||
if (param2 != NULL) {
|
||||
strcpy(name, "First CD-ROM image/device");
|
||||
status = param2->get();
|
||||
status = (param2->get() == BX_INSERTED);
|
||||
h = 110;
|
||||
ok_button = 2;
|
||||
num_ctrls = 4;
|
||||
@ -2613,7 +2613,7 @@ BxEvent *x11_notify_callback (void *unused, BxEvent *event)
|
||||
int opts;
|
||||
bx_param_c *param;
|
||||
bx_param_string_c *sparam;
|
||||
bx_param_bool_c *bparam;
|
||||
bx_param_enum_c *eparam;
|
||||
bx_list_c *list;
|
||||
|
||||
switch (event->type)
|
||||
@ -2637,8 +2637,8 @@ BxEvent *x11_notify_callback (void *unused, BxEvent *event)
|
||||
} else if (param->get_type() == BXT_LIST) {
|
||||
list = (bx_list_c *)param;
|
||||
sparam = (bx_param_string_c *)list->get_by_name("path");
|
||||
bparam = (bx_param_bool_c *)list->get_by_name("status");
|
||||
event->retcode = x11_string_dialog(sparam, bparam);
|
||||
eparam = (bx_param_enum_c *)list->get_by_name("status");
|
||||
event->retcode = x11_string_dialog(sparam, eparam);
|
||||
return event;
|
||||
} else if (param->get_type() == BXT_PARAM_BOOL) {
|
||||
event->retcode = x11_yesno_dialog((bx_param_bool_c *)param);
|
||||
|
@ -2,7 +2,7 @@
|
||||
// $Id$
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002-2011 The Bochs Project
|
||||
// Copyright (C) 2002-2013 The Bochs Project
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
@ -158,7 +158,7 @@ bx_hard_drive_c::~bx_hard_drive_c()
|
||||
sprintf(ata_name, "ata.%d.%s", channel, (device==0)?"master":"slave");
|
||||
base = (bx_list_c*) SIM->get_param(ata_name);
|
||||
SIM->get_param_string("path", base)->set_handler(NULL);
|
||||
SIM->get_param_bool("status", base)->set_handler(NULL);
|
||||
SIM->get_param_enum("status", base)->set_handler(NULL);
|
||||
}
|
||||
}
|
||||
SIM->get_bochs_root()->remove("hard_drive");
|
||||
@ -275,7 +275,7 @@ void bx_hard_drive_c::init(void)
|
||||
BX_HD_THIS channels[channel].drives[device].device_type = IDE_NONE;
|
||||
BX_HD_THIS channels[channel].drives[device].statusbar_id = -1;
|
||||
BX_HD_THIS channels[channel].drives[device].identify_set = 0;
|
||||
if (!SIM->get_param_bool("present", base)->get()) continue;
|
||||
if (SIM->get_param_enum("type", base)->get() == BX_ATA_DEVICE_NONE) continue;
|
||||
|
||||
// Make model string
|
||||
strncpy((char*)BX_HD_THIS channels[channel].drives[device].model_no,
|
||||
@ -356,7 +356,7 @@ void bx_hard_drive_c::init(void)
|
||||
base->set_runtime_param(1);
|
||||
SIM->get_param_string("path", base)->set_handler(cdrom_path_handler);
|
||||
SIM->get_param("path", base)->set_runtime_param(1);
|
||||
SIM->get_param_bool("status", base)->set_handler(cdrom_status_handler);
|
||||
SIM->get_param_enum("status", base)->set_handler(cdrom_status_handler);
|
||||
SIM->get_param("status", base)->set_runtime_param(1);
|
||||
BX_DEBUG(("CDROM on target %d/%d",channel,device));
|
||||
BX_HD_THIS channels[channel].drives[device].device_type = IDE_CDROM;
|
||||
@ -397,7 +397,7 @@ void bx_hard_drive_c::init(void)
|
||||
BX_HD_THIS channels[channel].drives[device].cdrom.cd = DEV_hdimage_init_cdrom(SIM->get_param_string("path", base)->getptr());
|
||||
BX_INFO(("CD on ata%d-%d: '%s'",channel, device, SIM->get_param_string("path", base)->getptr()));
|
||||
|
||||
if (SIM->get_param_bool("status", base)->get()) {
|
||||
if (SIM->get_param_enum("status", base)->get() == BX_INSERTED) {
|
||||
if (BX_HD_THIS channels[channel].drives[device].cdrom.cd->insert_cdrom()) {
|
||||
BX_INFO(("Media present in CD-ROM drive"));
|
||||
BX_HD_THIS channels[channel].drives[device].cdrom.ready = 1;
|
||||
@ -407,7 +407,7 @@ void bx_hard_drive_c::init(void)
|
||||
} else {
|
||||
BX_INFO(("Could not locate CD-ROM, continuing with media not present"));
|
||||
BX_HD_THIS channels[channel].drives[device].cdrom.ready = 0;
|
||||
SIM->get_param_bool("status", base)->set(0);
|
||||
SIM->get_param_enum("status", base)->set(BX_EJECTED);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -479,7 +479,7 @@ void bx_hard_drive_c::init(void)
|
||||
for (Bit8u device=0; device<2; device ++) {
|
||||
sprintf(ata_name, "ata.%d.%s", channel, (device==0)?"master":"slave");
|
||||
base = (bx_list_c*) SIM->get_param(ata_name);
|
||||
if (SIM->get_param_bool("present", base)->get()) {
|
||||
if (SIM->get_param_enum("type", base)->get() != BX_ATA_DEVICE_NONE) {
|
||||
if (BX_DRIVE_IS_HD(channel,device)) {
|
||||
Bit16u cylinders = BX_DRIVE(channel,device).hdimage->cylinders;
|
||||
Bit16u heads = BX_DRIVE(channel,device).hdimage->heads;
|
||||
@ -669,10 +669,10 @@ void bx_hard_drive_c::runtime_config(void)
|
||||
handle = (channel << 1) | device;
|
||||
sprintf(pname, "ata.%d.%s", channel, device ? "slave":"master");
|
||||
bx_list_c *base = (bx_list_c*) SIM->get_param(pname);
|
||||
status = SIM->get_param_bool("status", base)->get();
|
||||
status = SIM->get_param_enum("status", base)->get();
|
||||
BX_HD_THIS set_cd_media_status(handle, 0);
|
||||
if (status == 1) {
|
||||
BX_HD_THIS set_cd_media_status(handle, status);
|
||||
if (status == BX_INSERTED) {
|
||||
BX_HD_THIS set_cd_media_status(handle, 1);
|
||||
}
|
||||
BX_HD_THIS channels[channel].drives[device].status_changed = 0;
|
||||
}
|
||||
@ -1290,7 +1290,7 @@ void bx_hard_drive_c::write(Bit32u address, Bit32u value, unsigned io_len)
|
||||
BX_SELECTED_DRIVE(channel).cdrom.ready = 0;
|
||||
sprintf(ata_name, "ata.%d.%s", channel, BX_SLAVE_SELECTED(channel)?"slave":"master");
|
||||
bx_list_c *base = (bx_list_c*) SIM->get_param(ata_name);
|
||||
SIM->get_param_bool("status", base)->set(0);
|
||||
SIM->get_param_enum("status", base)->set(BX_EJECTED);
|
||||
bx_gui->update_drive_status_buttons();
|
||||
}
|
||||
raise_interrupt(channel);
|
||||
@ -3185,7 +3185,7 @@ bx_bool bx_hard_drive_c::set_cd_media_status(Bit32u handle, bx_bool status)
|
||||
BX_HD_THIS channels[channel].drives[device].cdrom.cd->eject_cdrom();
|
||||
#endif
|
||||
BX_HD_THIS channels[channel].drives[device].cdrom.ready = 0;
|
||||
SIM->get_param_bool("status", base)->set(0);
|
||||
SIM->get_param_enum("status", base)->set(BX_EJECTED);
|
||||
}
|
||||
} else {
|
||||
// insert cdrom
|
||||
@ -3196,7 +3196,7 @@ bx_bool bx_hard_drive_c::set_cd_media_status(Bit32u handle, bx_bool status)
|
||||
Bit32u capacity = BX_HD_THIS channels[channel].drives[device].cdrom.cd->capacity();
|
||||
BX_HD_THIS channels[channel].drives[device].cdrom.capacity = capacity;
|
||||
BX_INFO(("Capacity is %d sectors (%.2f MB)", capacity, (float)capacity / 512.0));
|
||||
SIM->get_param_bool("status", base)->set(1);
|
||||
SIM->get_param_enum("status", base)->set(BX_INSERTED);
|
||||
BX_SELECTED_DRIVE(channel).sense.sense_key = SENSE_UNIT_ATTENTION;
|
||||
BX_SELECTED_DRIVE(channel).sense.asc = ASC_MEDIUM_MAY_HAVE_CHANGED;
|
||||
BX_SELECTED_DRIVE(channel).sense.ascq = 0;
|
||||
@ -3207,7 +3207,7 @@ bx_bool bx_hard_drive_c::set_cd_media_status(Bit32u handle, bx_bool status)
|
||||
{
|
||||
BX_INFO(("Could not locate CD-ROM, continuing with media not present"));
|
||||
BX_HD_THIS channels[channel].drives[device].cdrom.ready = 0;
|
||||
SIM->get_param_bool("status", base)->set(0);
|
||||
SIM->get_param_enum("status", base)->set(BX_EJECTED);
|
||||
}
|
||||
}
|
||||
return (BX_HD_THIS channels[channel].drives[device].cdrom.ready);
|
||||
|
Loading…
Reference in New Issue
Block a user