From e7e5f1b518bfcc2db657257ad4f7a9c8c66414c5 Mon Sep 17 00:00:00 2001 From: Volker Ruppert Date: Tue, 2 Sep 2003 19:34:48 +0000 Subject: [PATCH] - bx_param_c: formerly unused member 'runtime_param' now indicates parameters available at runtime - wx: 'runtime' flag added to ParamDialog. If this flag is set, all options with the flag 'runtime_param' clear will be disabled. - only the runtime options for cdrom's are now enabled in the ATA dialogs at runtime - the options 'keyboard paste delay', 'mouse' and 'vga update interval' are now available at runtime - wxdialog.h: unnecessary comments removed --- bochs/gui/siminterface.h | 3 ++- bochs/gui/wxdialog.cc | 7 ++++++- bochs/gui/wxdialog.h | 25 +++---------------------- bochs/gui/wxmain.cc | 11 +++++------ bochs/main.cc | 9 ++++++++- 5 files changed, 24 insertions(+), 31 deletions(-) diff --git a/bochs/gui/siminterface.h b/bochs/gui/siminterface.h index aa5402305..c8cd54ab3 100644 --- a/bochs/gui/siminterface.h +++ b/bochs/gui/siminterface.h @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////// -// $Id: siminterface.h,v 1.110 2003-08-30 11:21:56 vruppert Exp $ +// $Id: siminterface.h,v 1.111 2003-09-02 19:34:48 vruppert Exp $ ///////////////////////////////////////////////////////////////////////// // // Before I can describe what this file is for, I have to make the @@ -852,6 +852,7 @@ public: void set_label (char *text) {label = text;} char *get_label () {return label;} void set_runtime_param (int val) { runtime_param = val; } + int get_runtime_param () { return runtime_param; } char *get_name () { return name; } char *get_description () { return description; } int get_enabled () { return enabled; } diff --git a/bochs/gui/wxdialog.cc b/bochs/gui/wxdialog.cc index 683cdc536..aae4578f7 100644 --- a/bochs/gui/wxdialog.cc +++ b/bochs/gui/wxdialog.cc @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////// -// $Id: wxdialog.cc,v 1.63 2003-08-30 17:58:30 vruppert Exp $ +// $Id: wxdialog.cc,v 1.64 2003-09-02 19:34:48 vruppert Exp $ ///////////////////////////////////////////////////////////////// // Define BX_PLUGGABLE in files that can be compiled into plugins. For @@ -1162,6 +1162,7 @@ ParamDialog::ParamDialog( idHash = new wxHashTable (wxKEY_INTEGER); paramHash = new wxHashTable (wxKEY_INTEGER); nbuttons = 0; + runtime = 0; // top level objects mainSizer = new wxBoxSizer (wxVERTICAL); @@ -1535,6 +1536,10 @@ void ParamDialog::EnableChanged () EnableChanged (pstr); if (pstr->param->get_type () == BXT_PARAM_ENUM) EnumChanged (pstr); + if (runtime) { + if ((pstr->param->get_type() != BXT_LIST) && !pstr->param->get_runtime_param ()) + EnableParam (pstr->param->get_id (), false); + } // special cases that can't be handled in the usual way } } diff --git a/bochs/gui/wxdialog.h b/bochs/gui/wxdialog.h index 8baea933d..2959a432b 100644 --- a/bochs/gui/wxdialog.h +++ b/bochs/gui/wxdialog.h @@ -1,5 +1,5 @@ //////////////////////////////////////////////////////////////////// -// $Id: wxdialog.h,v 1.49 2003-08-25 16:46:18 vruppert Exp $ +// $Id: wxdialog.h,v 1.50 2003-09-02 19:34:48 vruppert Exp $ //////////////////////////////////////////////////////////////////// // // wxWindows dialogs for Bochs @@ -489,27 +489,6 @@ DECLARE_EVENT_TABLE() }; #endif -//////////////////////////////////////////////////////////////////////////// -// ConfigSoundDialog -//////////////////////////////////////////////////////////////////////////// -// -// +--- Configure Sound -------------------------------------------+ -// | | -// | Bochs can emulate a Sound Blaster 16. Would you like | -// | to enable it? | -// | | -// | Enable [X] | -// | | -// | DMA timer: [_________] | -// | | -// | Midi mode [ 1 ] Output file [_________________] [Browse] | -// | Wave mode [ 1 ] Output file [_________________] [Browse] | -// | Log mode [ 1 ] Output file [_________________] [Browse] | -// | | -// | [ Help ] [ Cancel ] [ Ok ] | -// +---------------------------------------------------------------+ - - //////////////////////////////////////////////////////////////////////////// // ParamDialog is a general purpose dialog box that displays and edits // any combination of parameters. It's always made up of a @@ -573,6 +552,7 @@ private: bool isGeneratedId (int id); bool isShowing; int nbuttons; + bool runtime; protected: wxBoxSizer *mainSizer, *buttonSizer; // hash table that maps the ID of a wxWindows control (e.g. wxChoice, @@ -607,6 +587,7 @@ public: void AddParamList (bx_id *idList, wxFlexGridSizer *sizer = NULL, bool plain = false); virtual void CopyParamToGui (); bool IsShowing () { return isShowing; } + void SetRuntimeFlag(bool val) { runtime = val; } DECLARE_EVENT_TABLE() }; diff --git a/bochs/gui/wxmain.cc b/bochs/gui/wxmain.cc index 2d36be2bc..a34c701b5 100644 --- a/bochs/gui/wxmain.cc +++ b/bochs/gui/wxmain.cc @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////// -// $Id: wxmain.cc,v 1.96 2003-08-30 11:21:29 vruppert Exp $ +// $Id: wxmain.cc,v 1.97 2003-09-02 19:34:48 vruppert Exp $ ///////////////////////////////////////////////////////////////// // // wxmain.cc implements the wxWindows frame, toolbar, menus, and dialogs. @@ -671,6 +671,7 @@ void MyFrame::OnEditKeyboard(wxCommandEvent& WXUNUSED(event)) bx_list_c *list = (bx_list_c*) SIM->get_param (BXP_MENU_KEYBOARD); dlg.SetTitle (list->get_name ()); dlg.AddParam (list); + dlg.SetRuntimeFlag (sim_thread != NULL); dlg.ShowModal (); } @@ -712,6 +713,7 @@ void MyFrame::OnEditOther(wxCommandEvent& WXUNUSED(event)) dlg.AddParam (SIM->get_param (BXP_I440FX_SUPPORT)); dlg.AddParam (SIM->get_param (BXP_CMOS_IMAGE)); dlg.AddParam (SIM->get_param (BXP_CMOS_PATH)); + dlg.SetRuntimeFlag (sim_thread != NULL); dlg.ShowModal (); } @@ -951,9 +953,6 @@ void MyFrame::simStatusChanged (StatusChange change, bx_bool popupNotify) { bool canConfigure = (change == Stop); menuConfiguration->Enable (ID_Config_New, canConfigure); menuConfiguration->Enable (ID_Config_Read, canConfigure); -#ifdef __GNUC__ -#warning For now, leave ATA devices so that you configure them during runtime. Otherwise you cannot change the CD image at runtime. -#endif // only enabled ATA channels with a cdrom connected are available at runtime for (unsigned i=0; i<4; i++) { if (!SIM->get_param_bool((bx_id)(BXP_ATA0_PRESENT+i))->get ()) { @@ -970,10 +969,8 @@ void MyFrame::simStatusChanged (StatusChange change, bx_bool popupNotify) { menuEdit->Enable( ID_Edit_Sound, canConfigure); menuEdit->Enable( ID_Edit_Timing, canConfigure); menuEdit->Enable( ID_Edit_Network, canConfigure); - menuEdit->Enable( ID_Edit_Keyboard, canConfigure); menuEdit->Enable( ID_Edit_Serial_Parallel, canConfigure); menuEdit->Enable( ID_Edit_LoadHack, canConfigure); - menuEdit->Enable( ID_Edit_Other, canConfigure); // during simulation, certain menu options like the floppy disk // can be modified under some circumstances. A floppy drive can // only be edited if it was enabled at boot time. @@ -1367,6 +1364,7 @@ void MyFrame::editFirstCdrom () ParamDialog dlg (this, -1); dlg.SetTitle ("Configure CDROM"); dlg.AddParam (firstcd); + dlg.SetRuntimeFlag (sim_thread != NULL); dlg.ShowModal (); } @@ -1378,6 +1376,7 @@ void MyFrame::OnEditATA (wxCommandEvent& event) wxString str; str.Printf ("Configure ATA%d", channel); dlg.SetTitle (str); + dlg.SetRuntimeFlag (sim_thread != NULL); dlg.AddParam (SIM->get_param ((bx_id)(BXP_ATA0_MENU+channel))); dlg.ShowModal (); } diff --git a/bochs/main.cc b/bochs/main.cc index 82f6e9c75..145c16098 100644 --- a/bochs/main.cc +++ b/bochs/main.cc @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////// -// $Id: main.cc,v 1.246 2003-08-31 10:53:59 vruppert Exp $ +// $Id: main.cc,v 1.247 2003-09-02 19:34:48 vruppert Exp $ ///////////////////////////////////////////////////////////////////////// // // Copyright (C) 2002 MandrakeSoft S.A. @@ -234,6 +234,8 @@ bx_param_handler (bx_param_c *param, int set, Bit64s val) SIM->get_param ((bx_id)(BXP_ATA0_MASTER_MODEL + device))->set_enabled (1); SIM->get_param ((bx_id)(BXP_ATA0_MASTER_BIOSDETECT + device))->set_enabled (1); SIM->get_param ((bx_id)(BXP_ATA0_MASTER_TRANSLATION + device))->set_enabled (1); + SIM->get_param ((bx_id)(BXP_ATA0_MASTER_PATH + device))->set_runtime_param (0); + SIM->get_param ((bx_id)(BXP_ATA0_MASTER_STATUS + device))->set_runtime_param (0); break; case BX_ATA_DEVICE_CDROM: SIM->get_param_num ((bx_id)(BXP_ATA0_MASTER_PRESENT + device))->set (1); @@ -247,6 +249,8 @@ bx_param_handler (bx_param_c *param, int set, Bit64s val) SIM->get_param ((bx_id)(BXP_ATA0_MASTER_MODEL + device))->set_enabled (1); SIM->get_param ((bx_id)(BXP_ATA0_MASTER_BIOSDETECT + device))->set_enabled (1); SIM->get_param ((bx_id)(BXP_ATA0_MASTER_TRANSLATION + device))->set_enabled (0); + SIM->get_param ((bx_id)(BXP_ATA0_MASTER_PATH + device))->set_runtime_param (1); + SIM->get_param ((bx_id)(BXP_ATA0_MASTER_STATUS + device))->set_runtime_param (1); break; } } @@ -1059,12 +1063,14 @@ void bx_init_options () 1, BX_MAX_BIT32U, 30000); bx_options.Ovga_update_interval->set_handler (bx_param_handler); + bx_options.Ovga_update_interval->set_runtime_param (1); bx_options.Ovga_update_interval->set_ask_format ("Type a new value for VGA update interval: [%d] "); bx_options.Omouse_enabled = new bx_param_bool_c (BXP_MOUSE_ENABLED, "Enable the mouse", "Controls whether the mouse sends events to the guest. The hardware emulation is always enabled.", 0); bx_options.Omouse_enabled->set_handler (bx_param_handler); + bx_options.Omouse_enabled->set_runtime_param (1); bx_options.Oips = new bx_param_num_c (BXP_IPS, "Emulated instructions per second (IPS)", "Emulated instructions per second, used to calibrate bochs emulated time with wall clock time.", @@ -1406,6 +1412,7 @@ void bx_init_options () 1000, BX_MAX_BIT32U, 100000); bx_options.Okeyboard_paste_delay->set_handler (bx_param_handler); + bx_options.Okeyboard_paste_delay->set_runtime_param (1); bx_options.Ofloppy_command_delay = new bx_param_num_c (BXP_FLOPPY_CMD_DELAY, "Floppy command delay", "Time in microseconds to wait before completing some floppy commands such as read/write/seek/etc, which normally have a delay associated. This used to be hardwired to 50,000 before.",