Some config option changes.
- Moved serial and parallel config parameter list creation to the corresponding device code. - Unregister serial and parallel bochsrc options in PLUGIN_FINI mode. - Moved USB config and runtime parameter list creation to bx_init_usb_options(). - textconfig.cc: Small fixes in the optional plugin control.
This commit is contained in:
parent
66d9fd53b5
commit
0c2a9c69d6
@ -201,9 +201,19 @@ void bx_init_std_nic_options(const char *name, bx_list_c *menu)
|
||||
void bx_init_usb_options(const char *usb_name, const char *pname, int maxports)
|
||||
{
|
||||
char group[16], name[8], descr[512], label[512];
|
||||
bx_list_c *deplist, *deplist2;
|
||||
bx_list_c *usb, *usbrt, *deplist, *deplist2;
|
||||
|
||||
bx_param_c *usb = SIM->get_param("ports.usb");
|
||||
bx_list_c *ports = (bx_list_c*)SIM->get_param("ports");
|
||||
usb = (bx_list_c*)ports->get_by_name("usb");
|
||||
if (usb == NULL) {
|
||||
usb = new bx_list_c(ports, "usb", "USB Configuration");
|
||||
usb->set_options(usb->USE_TAB_WINDOW | usb->SHOW_PARENT);
|
||||
// prepare runtime options
|
||||
bx_list_c *rtmenu = (bx_list_c*)SIM->get_param("menu.runtime");
|
||||
usbrt = new bx_list_c(rtmenu, "usb", "USB options");
|
||||
usbrt->set_runtime_param(1);
|
||||
usbrt->set_options(usbrt->SHOW_PARENT | usbrt->USE_TAB_WINDOW);
|
||||
}
|
||||
sprintf(group, "USB %s", usb_name);
|
||||
sprintf(label, "%s Configuration", usb_name);
|
||||
bx_list_c *menu = new bx_list_c(usb, pname, label);
|
||||
@ -1538,33 +1548,19 @@ void bx_init_options()
|
||||
#endif
|
||||
|
||||
// ports subtree
|
||||
bx_list_c *ports = new bx_list_c(root_param, "ports", "Serial and Parallel Port Options");
|
||||
bx_list_c *ports = new bx_list_c(root_param, "ports", "Serial / Parallel / USB Options");
|
||||
ports->set_options(ports->USE_TAB_WINDOW | ports->SHOW_PARENT);
|
||||
|
||||
// parallel ports
|
||||
bx_list_c *parallel = new bx_list_c(ports, "parallel", "Parallel Port Options");
|
||||
parallel->set_options(parallel->SHOW_PARENT);
|
||||
// parport options initialized in the devive plugin code
|
||||
|
||||
// serial ports
|
||||
bx_list_c *serial = new bx_list_c(ports, "serial", "Serial Port Options");
|
||||
serial->set_options(serial->SHOW_PARENT);
|
||||
// serial port options initialized in the devive plugin code
|
||||
|
||||
#if BX_SUPPORT_PCIUSB
|
||||
// usb subtree
|
||||
bx_list_c *usb = new bx_list_c(ports, "usb", "USB Configuration");
|
||||
usb->set_options(usb->USE_TAB_WINDOW | usb->SHOW_PARENT);
|
||||
bx_usbdev_ctl.init();
|
||||
// USB host controller options initialized in the devive plugin code
|
||||
#endif
|
||||
// parallel / serial / USB options initialized in the device plugin code
|
||||
|
||||
#if BX_NETWORKING
|
||||
// network subtree
|
||||
bx_list_c *network = new bx_list_c(root_param, "network", "Network Configuration");
|
||||
network->set_options(network->USE_TAB_WINDOW | network->SHOW_PARENT);
|
||||
bx_netmod_ctl.init();
|
||||
// network device options initialized in the devive plugin code
|
||||
// network device options initialized in the device plugin code
|
||||
#endif
|
||||
|
||||
// sound subtree
|
||||
@ -1613,7 +1609,7 @@ void bx_init_options()
|
||||
"This is the device where the MIDI output is sent to",
|
||||
"", BX_PATHNAME_LEN);
|
||||
#endif
|
||||
// sound device options initialized in the devive plugin code
|
||||
// sound device options initialized in the device plugin code
|
||||
|
||||
// misc options subtree
|
||||
bx_list_c *misc = new bx_list_c(root_param, "misc", "Configure Everything Else");
|
||||
@ -1702,11 +1698,6 @@ void bx_init_options()
|
||||
bx_list_c *cdrom = new bx_list_c(menu, "cdrom", "CD-ROM options");
|
||||
cdrom->set_runtime_param(1);
|
||||
cdrom->set_options(cdrom->SHOW_PARENT);
|
||||
#if BX_SUPPORT_PCIUSB
|
||||
usb = new bx_list_c(menu, "usb", "USB options");
|
||||
usb->set_runtime_param(1);
|
||||
usb->set_options(usb->SHOW_PARENT | usb->USE_TAB_WINDOW);
|
||||
#endif
|
||||
// misc runtime options
|
||||
misc = new bx_list_c(menu, "misc", "Misc options");
|
||||
misc->set_runtime_param(1);
|
||||
|
@ -677,7 +677,7 @@ void bx_plugin_ctrl()
|
||||
Bit32u choice;
|
||||
bx_list_c *plugin_ctrl;
|
||||
bx_param_bool_c *plugin;
|
||||
int i, count;
|
||||
int i, j, count;
|
||||
char plugname[512];
|
||||
|
||||
while (1) {
|
||||
@ -688,24 +688,28 @@ void bx_plugin_ctrl()
|
||||
plugin_ctrl = (bx_list_c*) SIM->get_param(BXPN_PLUGIN_CTRL);
|
||||
count = plugin_ctrl->get_size();
|
||||
if (count == 0) {
|
||||
bx_printf("\nNo optional plugins loaded\n");
|
||||
bx_printf("\nNo optional plugins available\n");
|
||||
} else {
|
||||
bx_printf("\nCurrently loaded plugins:");
|
||||
j = 0;
|
||||
for (i = 0; i < count; i++) {
|
||||
plugin = (bx_param_bool_c*)plugin_ctrl->get(i);
|
||||
if (plugin->get()) {
|
||||
if (i > 0) bx_printf(",");
|
||||
if (j > 0) bx_printf(",");
|
||||
bx_printf(" %s", plugin->get_name());
|
||||
j++;
|
||||
}
|
||||
}
|
||||
bx_printf("\n");
|
||||
if (choice == 1) {
|
||||
bx_printf("\nAdditionally available plugins:");
|
||||
j = 0;
|
||||
for (i = 0; i < count; i++) {
|
||||
plugin = (bx_param_bool_c*)plugin_ctrl->get(i);
|
||||
if (!plugin->get()) {
|
||||
if (i > 0) bx_printf(",");
|
||||
if (j > 0) bx_printf(",");
|
||||
bx_printf(" %s", plugin->get_name());
|
||||
j++;
|
||||
}
|
||||
}
|
||||
bx_printf("\n");
|
||||
|
@ -41,7 +41,9 @@ void parport_init_options(void)
|
||||
{
|
||||
char name[4], label[80], descr[80];
|
||||
|
||||
bx_list_c *parallel = (bx_list_c*)SIM->get_param("ports.parallel");
|
||||
bx_list_c *ports = (bx_list_c*)SIM->get_param("ports");
|
||||
bx_list_c *parallel = new bx_list_c(ports, "parallel", "Parallel Port Options");
|
||||
parallel->set_options(parallel->SHOW_PARENT);
|
||||
for (int i=0; i<BX_N_PARALLEL_PORTS; i++) {
|
||||
sprintf(name, "%d", i+1);
|
||||
sprintf(label, "Parallel Port %d", i+1);
|
||||
@ -113,16 +115,11 @@ PLUGIN_ENTRY_FOR_MODULE(parallel)
|
||||
SIM->register_addon_option("parport1", parport_options_parser, parport_options_save);
|
||||
SIM->register_addon_option("parport2", parport_options_parser, NULL);
|
||||
} else if (mode == PLUGIN_FINI) {
|
||||
char port[10];
|
||||
|
||||
delete theParallelDevice;
|
||||
bx_list_c *menu = (bx_list_c*)SIM->get_param("ports.parallel");
|
||||
for (int i=0; i<BX_N_PARALLEL_PORTS; i++) {
|
||||
sprintf(port, "parport%d", i+1);
|
||||
SIM->unregister_addon_option(port);
|
||||
sprintf(port, "%d", i+1);
|
||||
menu->remove(port);
|
||||
}
|
||||
SIM->unregister_addon_option("parport1");
|
||||
SIM->unregister_addon_option("parport2");
|
||||
bx_list_c *ports = (bx_list_c*)SIM->get_param("ports");
|
||||
ports->remove("parallel");
|
||||
} else if (mode == PLUGIN_PROBE) {
|
||||
return (int)PLUGTYPE_OPTIONAL;
|
||||
}
|
||||
|
@ -81,7 +81,9 @@ void serial_init_options(void)
|
||||
{
|
||||
char name[4], label[80], descr[120];
|
||||
|
||||
bx_list_c *serial = (bx_list_c*)SIM->get_param("ports.serial");
|
||||
bx_list_c *ports = (bx_list_c*)SIM->get_param("ports");
|
||||
bx_list_c *serial = new bx_list_c(ports, "serial", "Serial Port Options");
|
||||
serial->set_options(serial->SHOW_PARENT);
|
||||
for (int i=0; i<BX_N_SERIAL_PORTS; i++) {
|
||||
sprintf(name, "%d", i+1);
|
||||
sprintf(label, "Serial Port %d", i+1);
|
||||
@ -164,16 +166,13 @@ PLUGIN_ENTRY_FOR_MODULE(serial)
|
||||
SIM->register_addon_option("com3", serial_options_parser, NULL);
|
||||
SIM->register_addon_option("com4", serial_options_parser, NULL);
|
||||
} else if (mode == PLUGIN_FINI) {
|
||||
char port[6];
|
||||
|
||||
delete theSerialDevice;
|
||||
bx_list_c *menu = (bx_list_c*)SIM->get_param("ports.serial");
|
||||
for (int i=0; i<BX_N_SERIAL_PORTS; i++) {
|
||||
sprintf(port, "com%d", i+1);
|
||||
SIM->unregister_addon_option(port);
|
||||
sprintf(port, "%d", i+1);
|
||||
menu->remove(port);
|
||||
}
|
||||
SIM->unregister_addon_option("com1");
|
||||
SIM->unregister_addon_option("com2");
|
||||
SIM->unregister_addon_option("com3");
|
||||
SIM->unregister_addon_option("com4");
|
||||
bx_list_c *ports = (bx_list_c*)SIM->get_param("ports");
|
||||
ports->remove("serial");
|
||||
} else if (mode == PLUGIN_PROBE) {
|
||||
return (int)PLUGTYPE_OPTIONAL;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user