changed floppy media status parameter type to bx_param_enum_c
This commit is contained in:
parent
a0c9522fef
commit
b5dd859da8
@ -275,8 +275,8 @@ void bx_init_options()
|
||||
bx_list_c *menu;
|
||||
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, *status2;
|
||||
bx_param_bool_c *enabled, *readonly;
|
||||
bx_param_enum_c *mode, *type, *toggle, *status;
|
||||
bx_param_filename_c *path;
|
||||
char name[BX_PATHNAME_LEN], descr[512], label[512];
|
||||
|
||||
@ -1095,6 +1095,8 @@ void bx_init_options()
|
||||
new bx_list_c(floppy, "0", "First Floppy Drive");
|
||||
new bx_list_c(floppy, "1", "Second Floppy Drive");
|
||||
|
||||
static const char *media_status_names[] = { "ejected", "inserted", NULL };
|
||||
|
||||
bx_param_enum_c *devtype;
|
||||
// floppy options
|
||||
for (i = 0; i < 2; i++) {
|
||||
@ -1140,12 +1142,14 @@ void bx_init_options()
|
||||
0);
|
||||
readonly->set_ask_format("Is media write protected? [%s] ");
|
||||
|
||||
status = new bx_param_bool_c(floppyX,
|
||||
status = new bx_param_enum_c(floppyX,
|
||||
"status",
|
||||
"Inserted",
|
||||
"Status",
|
||||
"Floppy media status (inserted / ejected)",
|
||||
0);
|
||||
status->set_ask_format("Is media inserted in drive? [%s] ");
|
||||
media_status_names,
|
||||
BX_INSERTED,
|
||||
BX_EJECTED);
|
||||
status->set_ask_format("Is the device inserted or ejected? [%s] ");
|
||||
|
||||
deplist = new bx_list_c(NULL);
|
||||
deplist->add(path);
|
||||
@ -1285,17 +1289,15 @@ void bx_init_options()
|
||||
BX_HDIMAGE_MODE_FLAT);
|
||||
mode->set_ask_format("Enter mode of ATA device, (flat, concat, etc.): [%s] ");
|
||||
|
||||
static const char *media_status_names[] = { "ejected", "inserted", NULL };
|
||||
|
||||
status2 = new bx_param_enum_c(menu,
|
||||
status = 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] ");
|
||||
|
||||
status->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",
|
||||
@ -2196,10 +2198,10 @@ static int parse_line_formatted(const char *context, int num_params, char *param
|
||||
context, params[0]));
|
||||
}
|
||||
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 (!strcmp(params[i], "status=ejected")) {
|
||||
SIM->get_param_bool("status", base)->set(0);
|
||||
SIM->get_param_enum("status", base)->set(BX_EJECTED);
|
||||
}
|
||||
else if (!strncmp(params[i], "write_protected=", 16)) {
|
||||
SIM->get_param_bool("readonly", base)->set(atol(¶ms[i][16]));
|
||||
@ -3280,7 +3282,7 @@ int bx_write_floppy_options(FILE *fp, int drive)
|
||||
fprintf(fp, ", %s=\"%s\", status=%s, write_protected=%d",
|
||||
fdtypes[SIM->get_param_enum(type)->get() - BX_FLOPPY_NONE],
|
||||
SIM->get_param_string(path)->getptr(),
|
||||
SIM->get_param_bool(status)->get() ? "inserted":"ejected",
|
||||
SIM->get_param_enum(status)->get_selected(),
|
||||
SIM->get_param_bool(readonly)->get());
|
||||
}
|
||||
fprintf(fp, "\n");
|
||||
|
@ -2,7 +2,7 @@
|
||||
// $Id$
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002-2012 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
|
||||
@ -179,7 +179,7 @@ void bx_gui_c::init(int argc, char **argv, unsigned max_xres, unsigned max_yres,
|
||||
// when that bitmap is clicked on
|
||||
|
||||
// Floppy A:
|
||||
BX_GUI_THIS floppyA_status = SIM->get_param_bool(BXPN_FLOPPYA_STATUS)->get();
|
||||
BX_GUI_THIS floppyA_status = (SIM->get_param_enum(BXPN_FLOPPYA_STATUS)->get() == BX_INSERTED);
|
||||
if (BX_GUI_THIS floppyA_status)
|
||||
BX_GUI_THIS floppyA_hbar_id = headerbar_bitmap(BX_GUI_THIS floppyA_bmap_id,
|
||||
BX_GRAVITY_LEFT, floppyA_handler);
|
||||
@ -189,7 +189,7 @@ void bx_gui_c::init(int argc, char **argv, unsigned max_xres, unsigned max_yres,
|
||||
BX_GUI_THIS set_tooltip(BX_GUI_THIS floppyA_hbar_id, "Change floppy A: media");
|
||||
|
||||
// Floppy B:
|
||||
BX_GUI_THIS floppyB_status = SIM->get_param_bool(BXPN_FLOPPYB_STATUS)->get();
|
||||
BX_GUI_THIS floppyB_status = (SIM->get_param_enum(BXPN_FLOPPYB_STATUS)->get() == BX_INSERTED);
|
||||
if (BX_GUI_THIS floppyB_status)
|
||||
BX_GUI_THIS floppyB_hbar_id = headerbar_bitmap(BX_GUI_THIS floppyB_bmap_id,
|
||||
BX_GRAVITY_LEFT, floppyB_handler);
|
||||
@ -271,8 +271,8 @@ void bx_gui_c::cleanup(void)
|
||||
|
||||
void bx_gui_c::update_drive_status_buttons(void)
|
||||
{
|
||||
BX_GUI_THIS floppyA_status = SIM->get_param_bool(BXPN_FLOPPYA_STATUS)->get();
|
||||
BX_GUI_THIS floppyB_status = SIM->get_param_bool(BXPN_FLOPPYB_STATUS)->get();
|
||||
BX_GUI_THIS floppyA_status = (SIM->get_param_enum(BXPN_FLOPPYA_STATUS)->get() == BX_INSERTED);
|
||||
BX_GUI_THIS floppyB_status = (SIM->get_param_enum(BXPN_FLOPPYB_STATUS)->get() == BX_INSERTED);
|
||||
Bit32u handle = DEV_hd_get_first_cd_handle();
|
||||
BX_GUI_THIS cdrom1_status = DEV_hd_get_cd_media_status(handle);
|
||||
if (BX_GUI_THIS floppyA_status)
|
||||
|
@ -365,7 +365,7 @@ void build_runtime_options_prompt(const char *format, char *buf, int size)
|
||||
else {
|
||||
sprintf(buffer[i], "%s, size=%s, %s", SIM->get_param_string("path", floppyop)->getptr(),
|
||||
SIM->get_param_enum("type", floppyop)->get_selected(),
|
||||
SIM->get_param_bool("status", floppyop)->get() ? "inserted":"ejected");
|
||||
SIM->get_param_enum("status", floppyop)->get_selected());
|
||||
if (!SIM->get_param_string("path", floppyop)->getptr()[0]) strcpy(buffer[i], "none");
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
// $Id$
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2003-2012 The Bochs Project
|
||||
// Copyright (C) 2003-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
|
||||
@ -201,8 +201,8 @@ static BOOL CALLBACK StringParamProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM
|
||||
static BOOL CALLBACK FloppyDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
static bx_param_filename_c *param;
|
||||
static bx_param_bool_c *status, *readonly;
|
||||
static bx_param_enum_c *devtype;
|
||||
static bx_param_bool_c *readonly;
|
||||
static bx_param_enum_c *devtype, *status;
|
||||
static bx_param_enum_c *mediatype;
|
||||
bx_list_c *list;
|
||||
char mesg[MAX_PATH];
|
||||
@ -214,7 +214,7 @@ static BOOL CALLBACK FloppyDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lP
|
||||
case WM_INITDIALOG:
|
||||
param = (bx_param_filename_c *)lParam;
|
||||
list = (bx_list_c *)param->get_parent();
|
||||
status = SIM->get_param_bool("status", list);
|
||||
status = SIM->get_param_enum("status", list);
|
||||
readonly = SIM->get_param_bool("readonly", list);
|
||||
devtype = SIM->get_param_enum("devtype", list);
|
||||
mediatype = SIM->get_param_enum("type", list);
|
||||
@ -228,7 +228,7 @@ static BOOL CALLBACK FloppyDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lP
|
||||
}
|
||||
cap = mediatype->get() - (int)mediatype->get_min();
|
||||
SendMessage(GetDlgItem(hDlg, IDMEDIATYPE), CB_SETCURSEL, cap, 0);
|
||||
if (status->get()) {
|
||||
if (status->get() == BX_INSERTED) {
|
||||
SendMessage(GetDlgItem(hDlg, IDSTATUS), BM_SETCHECK, BST_CHECKED, 0);
|
||||
}
|
||||
if (readonly->get()) {
|
||||
@ -257,7 +257,7 @@ static BOOL CALLBACK FloppyDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lP
|
||||
}
|
||||
return TRUE;
|
||||
case IDOK:
|
||||
status->set(0);
|
||||
status->set(BX_EJECTED);
|
||||
if (SendMessage(GetDlgItem(hDlg, IDSTATUS), BM_GETCHECK, 0, 0) == BST_CHECKED) {
|
||||
GetDlgItemText(hDlg, IDPATH, path, MAX_PATH);
|
||||
if (lstrlen(path) == 0) {
|
||||
@ -272,7 +272,7 @@ static BOOL CALLBACK FloppyDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lP
|
||||
cap = SendMessage(GetDlgItem(hDlg, IDMEDIATYPE), CB_GETITEMDATA, i, 0);
|
||||
mediatype->set(cap);
|
||||
if (lstrcmp(path, "none")) {
|
||||
status->set(1);
|
||||
status->set(BX_INSERTED);
|
||||
}
|
||||
EndDialog(hDlg, 1);
|
||||
return TRUE;
|
||||
|
@ -2,6 +2,8 @@
|
||||
// $Id$
|
||||
/////////////////////////////////////////////////////////////////
|
||||
|
||||
// Copyright (C) 2002-2013 The Bochs Project
|
||||
//
|
||||
// Define BX_PLUGGABLE in files that can be compiled into plugins. For
|
||||
// platforms that require a special tag on exported symbols, BX_PLUGGABLE
|
||||
// is used to know when we are exporting symbols and when we are importing.
|
||||
@ -1578,7 +1580,7 @@ void FloppyConfigDialog::OnEvent(wxCommandEvent& event)
|
||||
createButton->Enable((val1 != BX_FDD_NONE) && (val2 != BX_FLOPPY_NONE));
|
||||
} else if ((pstr == pstrPath) && (!pstrPath->u.text->IsModified())) {
|
||||
pstrMedia->u.choice->SetSelection(pstrMedia->u.choice->FindString(wxT("auto")));
|
||||
pstrStatus->u.checkbox->SetValue(1);
|
||||
pstrStatus->u.choice->SetSelection(BX_INSERTED);
|
||||
}
|
||||
}
|
||||
ParamDialog::OnEvent(event);
|
||||
|
@ -2,7 +2,7 @@
|
||||
// $Id$
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002-2012 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
|
||||
@ -142,7 +142,7 @@ bx_floppy_ctrl_c::~bx_floppy_ctrl_c()
|
||||
bx_list_c *floppy = (bx_list_c*)SIM->get_param(pname);
|
||||
SIM->get_param_string("path", floppy)->set_handler(NULL);
|
||||
SIM->get_param_bool("readonly", floppy)->set_handler(NULL);
|
||||
SIM->get_param_bool("status", floppy)->set_handler(NULL);
|
||||
SIM->get_param_enum("status", floppy)->set_handler(NULL);
|
||||
}
|
||||
SIM->get_bochs_root()->remove("floppy");
|
||||
BX_DEBUG(("Exit"));
|
||||
@ -194,7 +194,7 @@ void bx_floppy_ctrl_c::init(void)
|
||||
}
|
||||
|
||||
if (SIM->get_param_enum(BXPN_FLOPPYA_TYPE)->get() != BX_FLOPPY_NONE) {
|
||||
if (SIM->get_param_bool(BXPN_FLOPPYA_STATUS)->get()) {
|
||||
if (SIM->get_param_enum(BXPN_FLOPPYA_STATUS)->get() == BX_INSERTED) {
|
||||
BX_FD_THIS s.media[0].write_protected = SIM->get_param_bool(BXPN_FLOPPYA_READONLY)->get();
|
||||
if (evaluate_media(BX_FD_THIS s.device_type[0], SIM->get_param_enum(BXPN_FLOPPYA_TYPE)->get(),
|
||||
SIM->get_param_string(BXPN_FLOPPYA_PATH)->getptr(), & BX_FD_THIS s.media[0])) {
|
||||
@ -207,7 +207,7 @@ void bx_floppy_ctrl_c::init(void)
|
||||
SIM->get_param_bool(BXPN_FLOPPYA_READONLY)->set(1);
|
||||
#undef MED
|
||||
} else {
|
||||
SIM->get_param_bool(BXPN_FLOPPYA_STATUS)->set(0);
|
||||
SIM->get_param_enum(BXPN_FLOPPYA_STATUS)->set(BX_EJECTED);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -227,7 +227,7 @@ void bx_floppy_ctrl_c::init(void)
|
||||
}
|
||||
|
||||
if (SIM->get_param_enum(BXPN_FLOPPYB_TYPE)->get() != BX_FLOPPY_NONE) {
|
||||
if (SIM->get_param_bool(BXPN_FLOPPYB_STATUS)->get()) {
|
||||
if (SIM->get_param_enum(BXPN_FLOPPYB_STATUS)->get() == BX_INSERTED) {
|
||||
BX_FD_THIS s.media[1].write_protected = SIM->get_param_bool(BXPN_FLOPPYB_READONLY)->get();
|
||||
if (evaluate_media(BX_FD_THIS s.device_type[1], SIM->get_param_enum(BXPN_FLOPPYB_TYPE)->get(),
|
||||
SIM->get_param_string(BXPN_FLOPPYB_PATH)->getptr(), & BX_FD_THIS s.media[1])) {
|
||||
@ -240,7 +240,7 @@ void bx_floppy_ctrl_c::init(void)
|
||||
SIM->get_param_bool(BXPN_FLOPPYB_READONLY)->set(1);
|
||||
#undef MED
|
||||
} else {
|
||||
SIM->get_param_bool(BXPN_FLOPPYB_STATUS)->set(0);
|
||||
SIM->get_param_enum(BXPN_FLOPPYB_STATUS)->set(BX_EJECTED);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -273,8 +273,8 @@ void bx_floppy_ctrl_c::init(void)
|
||||
SIM->get_param_string("path", floppy)->set_runtime_param(1);
|
||||
SIM->get_param_bool("readonly", floppy)->set_handler(floppy_param_handler);
|
||||
SIM->get_param_bool("readonly", floppy)->set_runtime_param(1);
|
||||
SIM->get_param_bool("status", floppy)->set_handler(floppy_param_handler);
|
||||
SIM->get_param_bool("status", floppy)->set_runtime_param(1);
|
||||
SIM->get_param_enum("status", floppy)->set_handler(floppy_param_handler);
|
||||
SIM->get_param_enum("status", floppy)->set_runtime_param(1);
|
||||
}
|
||||
// register handler for correct floppy parameter handling after runtime config
|
||||
SIM->register_runtime_config_handler(this, runtime_config_handler);
|
||||
@ -419,7 +419,7 @@ void bx_floppy_ctrl_c::runtime_config(void)
|
||||
for (drive=0; drive<2; drive++) {
|
||||
if (BX_FD_THIS s.media[drive].status_changed) {
|
||||
sprintf(pname, "floppy.%d.status", drive);
|
||||
status = SIM->get_param_bool(pname)->get();
|
||||
status = (SIM->get_param_enum(pname)->get() == BX_INSERTED);
|
||||
if (BX_FD_THIS s.media_present[drive]) {
|
||||
BX_FD_THIS set_media_status(drive, 0);
|
||||
}
|
||||
@ -1460,9 +1460,9 @@ unsigned bx_floppy_ctrl_c::set_media_status(unsigned drive, bx_bool status)
|
||||
close_media(&BX_FD_THIS s.media[drive]);
|
||||
BX_FD_THIS s.media_present[drive] = 0;
|
||||
if (drive == 0) {
|
||||
SIM->get_param_bool(BXPN_FLOPPYA_STATUS)->set(0);
|
||||
SIM->get_param_enum(BXPN_FLOPPYA_STATUS)->set(BX_EJECTED);
|
||||
} else {
|
||||
SIM->get_param_bool(BXPN_FLOPPYB_STATUS)->set(0);
|
||||
SIM->get_param_enum(BXPN_FLOPPYB_STATUS)->set(BX_EJECTED);
|
||||
}
|
||||
BX_FD_THIS s.DIR[drive] |= 0x80; // disk changed line
|
||||
return(0);
|
||||
@ -1485,7 +1485,7 @@ unsigned bx_floppy_ctrl_c::set_media_status(unsigned drive, bx_bool status)
|
||||
if (MED.write_protected)
|
||||
SIM->get_param_bool(BXPN_FLOPPYA_READONLY)->set(1);
|
||||
#undef MED
|
||||
SIM->get_param_bool(BXPN_FLOPPYA_STATUS)->set(1);
|
||||
SIM->get_param_enum(BXPN_FLOPPYA_STATUS)->set(BX_INSERTED);
|
||||
} else {
|
||||
#define MED (BX_FD_THIS s.media[1])
|
||||
BX_INFO(("fd1: '%s' ro=%d, h=%d,t=%d,spt=%d",
|
||||
@ -1494,16 +1494,16 @@ unsigned bx_floppy_ctrl_c::set_media_status(unsigned drive, bx_bool status)
|
||||
if (MED.write_protected)
|
||||
SIM->get_param_bool(BXPN_FLOPPYB_READONLY)->set(1);
|
||||
#undef MED
|
||||
SIM->get_param_bool(BXPN_FLOPPYB_STATUS)->set(1);
|
||||
SIM->get_param_enum(BXPN_FLOPPYB_STATUS)->set(BX_INSERTED);
|
||||
}
|
||||
return(1);
|
||||
} else {
|
||||
BX_FD_THIS s.media_present[drive] = 0;
|
||||
if (drive == 0) {
|
||||
SIM->get_param_bool(BXPN_FLOPPYA_STATUS)->set(0);
|
||||
SIM->get_param_enum(BXPN_FLOPPYA_STATUS)->set(BX_EJECTED);
|
||||
SIM->get_param_enum(BXPN_FLOPPYA_TYPE)->set(BX_FLOPPY_NONE);
|
||||
} else {
|
||||
SIM->get_param_bool(BXPN_FLOPPYB_STATUS)->set(0);
|
||||
SIM->get_param_enum(BXPN_FLOPPYB_STATUS)->set(BX_EJECTED);
|
||||
SIM->get_param_enum(BXPN_FLOPPYB_TYPE)->set(BX_FLOPPY_NONE);
|
||||
}
|
||||
return(0);
|
||||
@ -1947,7 +1947,7 @@ const char* bx_floppy_ctrl_c::floppy_param_string_handler(bx_param_string_c *par
|
||||
BX_ERROR(("Cannot add a floppy drive at runtime"));
|
||||
SIM->get_param_string("path", base)->set("none");
|
||||
}
|
||||
if (SIM->get_param_bool("status", base)->get() == 1) {
|
||||
if (SIM->get_param_enum("status", base)->get() == BX_INSERTED) {
|
||||
// tell the device model that we removed, then inserted the disk
|
||||
BX_FD_THIS s.media[drive].status_changed = 1;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user