- fixes related to the wx 2nd run support (not yet complete)

- siminterface: don't create plugin parameter if it already exists
  - wx: make sure all plugins are loaded when creating plugin control dialog
  - USB HC's: fixed removal of parameters when unloading plugin
This commit is contained in:
Volker Ruppert 2012-02-23 21:26:13 +00:00
parent 86c7033a63
commit 1425e2370c
5 changed files with 11 additions and 7 deletions

View File

@ -1383,7 +1383,9 @@ bx_bool bx_real_sim_c::opt_plugin_ctrl(const char *plugname, bx_bool load)
if (load != PLUG_device_present(plugname)) {
if (load) {
if (PLUG_load_opt_plugin(plugname)) {
new bx_param_bool_c(base, plugname, "", "", 1);
if (base->get_by_name(plugname) == NULL) {
new bx_param_bool_c(base, plugname, "", "", 1);
}
return 1;
} else {
BX_PANIC(("optional plugin '%s' not found", plugname));

View File

@ -593,11 +593,13 @@ PluginControlDialog::PluginControlDialog(
buttonSizer->Add(btn, 0, wxALL, 5);
btn = new wxButton(this, wxID_OK, BTNLABEL_OK);
buttonSizer->Add(btn, 0, wxALL, 5);
// add loaded plugins to the listbox
// make sure all plugins are loaded and add them to the listbox
bx_list_c *plugin_ctrl = (bx_list_c*) SIM->get_param(BXPN_PLUGIN_CTRL);
unsigned count = plugin_ctrl->get_size();
for (unsigned i = 0; i < count; i++) {
pluglist->Insert(wxString(plugin_ctrl->get(i)->get_name(), wxConvUTF8), i);
bx_param_bool_c *plugin = (bx_param_bool_c*)plugin_ctrl->get(i);
SIM->opt_plugin_ctrl(plugin->get_name(), 1);
pluglist->Insert(wxString(plugin->get_name(), wxConvUTF8), i);
}
btn_load->Enable(0);
btn_unload->Enable(0);
@ -636,7 +638,7 @@ void PluginControlDialog::OnEvent(wxCommandEvent& event)
if (SIM->opt_plugin_ctrl(buf, 1)) {
tmpname.Printf(wxT("Plugin '%s' loaded"), buf);
wxMessageBox(tmpname, wxT("Plugin Control"), wxOK | wxICON_INFORMATION, this);
pluglist->Insert(tmpname, pluglist->GetCount());
pluglist->Insert(wxString(buf, wxConvUTF8), pluglist->GetCount());
}
}
break;

View File

@ -122,8 +122,8 @@ void libusb_ohci_LTX_plugin_fini(void)
{
SIM->unregister_addon_option("usb_ohci");
bx_list_c *menu = (bx_list_c*)SIM->get_param("ports.usb");
menu->remove("usb_ohci");
delete theUSB_OHCI;
menu->remove("ohci");
}
// the device object

View File

@ -95,8 +95,8 @@ void libusb_uhci_LTX_plugin_fini(void)
{
SIM->unregister_addon_option("usb_uhci");
bx_list_c *menu = (bx_list_c*)SIM->get_param("ports.usb");
menu->remove("usb_uhci");
delete theUSB_UHCI;
menu->remove("uhci");
}
// the device object

View File

@ -119,8 +119,8 @@ void libusb_xhci_LTX_plugin_fini(void)
{
SIM->unregister_addon_option("usb_xhci");
bx_list_c *menu = (bx_list_c*)SIM->get_param("ports.usb");
menu->remove("usb_xhci");
delete theUSB_XHCI;
menu->remove("xhci");
}
// the device object