- apply 'log actions by device' to the existing modules before editing them

in the config interface. Applied settings are marked as 'done' with the value
  -1 to avoid unwanted modification. NOTE: Not all Bochs modules exist when
  running the start menu / dialog.
This commit is contained in:
Volker Ruppert 2012-04-06 13:15:27 +00:00
parent a68ad9a7f6
commit 70a38a8a3d
8 changed files with 23 additions and 9 deletions

View File

@ -118,6 +118,7 @@ int bx_parse_cmdline(int arg, int argc, char *argv[]);
int bx_read_configuration(const char *rcfile);
int bx_write_configuration(const char *rcfile, int overwrite);
void bx_reset_options(void);
void bx_set_log_actions_by_device(bx_bool panic_flag);
// special config parameter and options functions for plugins
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);

View File

@ -1984,7 +1984,7 @@ static Bit32s parse_log_options(const char *context, int num_params, char *param
if (mparam != NULL) {
mparam->set(action);
} else {
mparam = new bx_param_num_c(base, module, "", "", 0, BX_MAX_BIT32U, action);
mparam = new bx_param_num_c(base, module, "", "", -1, BX_MAX_BIT32U, action);
if (mparam == NULL) {
PARSE_ERR(("%s: %s: failed to add log module.", context, params[0]));
}

View File

@ -101,6 +101,9 @@ public:
virtual void set_default_log_action(int level, int action) {
logfunctions::set_default_action(level, action);
}
virtual void apply_log_actions_by_device() {
bx_set_log_actions_by_device(0);
}
virtual const char *get_log_level_name(int level);
virtual int get_max_log_level() { return N_LOGLEV; }
virtual void quit_sim(int code);

View File

@ -610,6 +610,7 @@ public:
virtual void set_log_action(int mod, int level, int action) {}
virtual int get_default_log_action(int level) {return -1;}
virtual void set_default_log_action(int level, int action) {}
virtual void apply_log_actions_by_device() {}
virtual const char *get_action_name(int action) {return 0;}
virtual const char *get_log_level_name(int level) {return 0;}
virtual int get_max_log_level() {return -1;}

View File

@ -589,6 +589,7 @@ static int log_level_n_choices_normal = 4;
void bx_log_options(int individual)
{
SIM->apply_log_actions_by_device(); // settings from bochsrc
if (individual) {
int done = 0;
while (!done) {

View File

@ -398,7 +398,7 @@ void ApplyLogOptions(HWND hDlg, BOOL advanced)
for (level=0; level<N_LOGLEV; level++) {
idx = SendMessage(GetDlgItem(hDlg, IDLOGEVT1+level), CB_GETCURSEL, 0, 0);
value = SendMessage(GetDlgItem(hDlg, IDLOGEVT1+level), CB_GETITEMDATA, idx, 0);
SIM->set_log_action (mod, level, value);
SIM->set_log_action(mod, level, value);
}
EnableWindow(GetDlgItem(hDlg, IDDEVLIST), TRUE);
} else {
@ -425,6 +425,7 @@ static BOOL CALLBACK LogOptDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lP
switch (msg) {
case WM_INITDIALOG:
advanced = (BOOL)lParam;
SIM->apply_log_actions_by_device(); // settings from bochsrc
InitLogOptionsDialog(hDlg, advanced);
changed = FALSE;
EnableWindow(GetDlgItem(hDlg, IDAPPLY), FALSE);

View File

@ -304,7 +304,9 @@ void AdvancedLogOptionsDialog::Init()
Center();
}
void AdvancedLogOptionsDialog::CopyParamToGui() {
void AdvancedLogOptionsDialog::CopyParamToGui()
{
SIM->apply_log_actions_by_device(); // settings from bochsrc
bx_param_string_c *logfile = SIM->get_param_string(BXPN_LOG_FILENAME);
SetLogfile(wxString(logfile->getptr(), wxConvUTF8));
// copy log action settings from siminterface to gui

View File

@ -1044,9 +1044,9 @@ void bx_sr_after_restore_state(void)
DEV_after_restore_state();
}
void bx_set_log_action_by_device()
void bx_set_log_actions_by_device(bx_bool panic_flag)
{
int id, l, m;
int id, l, m, val;
bx_list_c *loglev, *level;
bx_param_num_c *action;
@ -1056,10 +1056,15 @@ void bx_set_log_action_by_device()
for (m = 0; m < level->get_size(); m++) {
action = (bx_param_num_c*) level->get(m);
id = SIM->get_logfn_id(action->get_name());
val = action->get();
if (id < 0) {
BX_PANIC(("unknown log function module '%s'", action->get_name()));
} else {
SIM->set_log_action(id, l, action->get());
if (panic_flag) {
BX_PANIC(("unknown log function module '%s'", action->get_name()));
}
} else if (val >= 0) {
SIM->set_log_action(id, l, val);
// mark as 'done'
action->set(-1);
}
}
}
@ -1272,7 +1277,7 @@ void bx_init_hardware()
SIM->get_param_bool(BXPN_RESTORE_FLAG)->set(0);
}
} else {
bx_set_log_action_by_device();
bx_set_log_actions_by_device(1);
}
// will enable A20 line and reset CPU and devices