2001-10-03 17:10:38 +04:00
|
|
|
|
/////////////////////////////////////////////////////////////////////////
|
2006-03-04 15:43:47 +03:00
|
|
|
|
// $Id: textconfig.cc,v 1.45 2006-03-04 12:43:47 vruppert Exp $
|
2001-10-03 17:10:38 +04:00
|
|
|
|
/////////////////////////////////////////////////////////////////////////
|
|
|
|
|
//
|
2003-10-24 19:39:57 +04:00
|
|
|
|
// This is code for a text-mode configuration interface. Note that this file
|
- I've added lots of comments in siminterface.h, and tried to clean up
the terminology a bit. In particular, the term "gui" has started
to mean different things in different contexts, so I've defined
some more specific names for the parts of the user interface, and
updated comments and some variable names to reflect it. See
siminterface.h for a more complete description of all of these.
VGAW: VGA display window and toolbar buttons, the traditional Bochs
display which is ported to X, win32, MacOS X, etc. Implemented
in gui/gui.* and platform dependent gui/*.cc files.
CI: configuration interface that lets the user change settings such
as floppy disk image, ne2k settings, log options. The CI consists
of two parts: configuration user interface (CUI) which does the
actual rendering to the screen and handles key/mouse/menu events,
and the siminterface object.
CUI: configuration user interface. This handles the user interactions
that allow the user to configure Bochs. To actually change any
values it talks to the siminterface object. One implementation of
the CUI is the text-mode menus in gui/control.cc. Another
implementation is (will be) the wxWindows menus and dialogs in
gui/wxmain.cc.
siminterface: the glue between the CUI and the simulation code,
accessible throughout the code by the global variable
bx_simulator_interface_c *SIM;
Among other things, siminterface methods allow the simulator to ask the
CUI to display things or ask for user input, and allows the CUI
to query and modify variables in the simulation code.
GUI: Literally, "graphical user interface". Until the configuration menus
and wxWindows came along, everyone understood that "gui" referred to the
VGA display window and the toolbar buttons because that's all there
was. Now that we have the wxWindows code, which implements both the VGAW
and the CUI, while all other platforms implement only the VGAW, it's not
so clear. So, I'm trying to use VGAW, CI, and CUI consistently since
they are more specific.
control panel: This has been used as another name for the configuration
interface. "control panel" is also somewhat unspecific and it sounds
like it would be graphical with buttons and sliders, but our text-mode
thing is not graphical at all. I've replaced "control panel" with
"configuration interface" wherever I could find it. In configure script,
the --disable-control-panel option is still supported, but it politely
suggests that you use --disable-config-interface instead.
- clean up comments in siminterface,wx* code
- add comments and examples for bx_param_* and BxEvents
- remove some obsolete stuff: notify_*_args,
bx_simulator_interface_c::[sg]et_enabled() methods
- in siminterface.cc, move a few bx_real_sim_c methods to where they belong,
with the rest of the methods. No changes to the actual methods.
- remove some DOS ^M's which crept in and confused my editor.
2002-08-26 19:31:23 +04:00
|
|
|
|
// does NOT include bochs.h. Instead, it does all of its contact with
|
|
|
|
|
// the simulator through an object called SIM, defined in siminterface.cc
|
|
|
|
|
// and siminterface.h. This separation adds an extra layer of method
|
|
|
|
|
// calls before any work can be done, but the benefit is that the compiler
|
2002-10-29 23:17:05 +03:00
|
|
|
|
// enforces the rules. I can guarantee that textconfig.cc doesn't call any
|
- I've added lots of comments in siminterface.h, and tried to clean up
the terminology a bit. In particular, the term "gui" has started
to mean different things in different contexts, so I've defined
some more specific names for the parts of the user interface, and
updated comments and some variable names to reflect it. See
siminterface.h for a more complete description of all of these.
VGAW: VGA display window and toolbar buttons, the traditional Bochs
display which is ported to X, win32, MacOS X, etc. Implemented
in gui/gui.* and platform dependent gui/*.cc files.
CI: configuration interface that lets the user change settings such
as floppy disk image, ne2k settings, log options. The CI consists
of two parts: configuration user interface (CUI) which does the
actual rendering to the screen and handles key/mouse/menu events,
and the siminterface object.
CUI: configuration user interface. This handles the user interactions
that allow the user to configure Bochs. To actually change any
values it talks to the siminterface object. One implementation of
the CUI is the text-mode menus in gui/control.cc. Another
implementation is (will be) the wxWindows menus and dialogs in
gui/wxmain.cc.
siminterface: the glue between the CUI and the simulation code,
accessible throughout the code by the global variable
bx_simulator_interface_c *SIM;
Among other things, siminterface methods allow the simulator to ask the
CUI to display things or ask for user input, and allows the CUI
to query and modify variables in the simulation code.
GUI: Literally, "graphical user interface". Until the configuration menus
and wxWindows came along, everyone understood that "gui" referred to the
VGA display window and the toolbar buttons because that's all there
was. Now that we have the wxWindows code, which implements both the VGAW
and the CUI, while all other platforms implement only the VGAW, it's not
so clear. So, I'm trying to use VGAW, CI, and CUI consistently since
they are more specific.
control panel: This has been used as another name for the configuration
interface. "control panel" is also somewhat unspecific and it sounds
like it would be graphical with buttons and sliders, but our text-mode
thing is not graphical at all. I've replaced "control panel" with
"configuration interface" wherever I could find it. In configure script,
the --disable-control-panel option is still supported, but it politely
suggests that you use --disable-config-interface instead.
- clean up comments in siminterface,wx* code
- add comments and examples for bx_param_* and BxEvents
- remove some obsolete stuff: notify_*_args,
bx_simulator_interface_c::[sg]et_enabled() methods
- in siminterface.cc, move a few bx_real_sim_c methods to where they belong,
with the rest of the methods. No changes to the actual methods.
- remove some DOS ^M's which crept in and confused my editor.
2002-08-26 19:31:23 +04:00
|
|
|
|
// I/O device objects directly, for example, because the bx_devices symbol
|
|
|
|
|
// isn't even defined in this context.
|
|
|
|
|
//
|
2001-06-08 11:20:07 +04:00
|
|
|
|
|
2001-06-11 10:48:37 +04:00
|
|
|
|
#include "config.h"
|
|
|
|
|
|
2004-01-29 21:50:33 +03:00
|
|
|
|
#if BX_USE_TEXTCONFIG
|
|
|
|
|
|
2004-11-22 16:14:54 +03:00
|
|
|
|
#ifndef __QNXNTO__
|
2001-06-08 11:20:07 +04:00
|
|
|
|
extern "C" {
|
2004-11-22 16:14:54 +03:00
|
|
|
|
#endif
|
|
|
|
|
|
2001-06-08 11:20:07 +04:00
|
|
|
|
#include <stdio.h>
|
|
|
|
|
#include <ctype.h>
|
|
|
|
|
#include <string.h>
|
2001-06-10 00:01:12 +04:00
|
|
|
|
#include <assert.h>
|
2004-11-22 16:14:54 +03:00
|
|
|
|
|
|
|
|
|
#ifndef __QNXNTO__
|
2001-06-08 00:42:00 +04:00
|
|
|
|
}
|
2004-11-22 16:14:54 +03:00
|
|
|
|
#endif
|
|
|
|
|
|
2001-06-10 07:53:43 +04:00
|
|
|
|
#include "osdep.h"
|
2002-10-29 23:17:05 +03:00
|
|
|
|
#include "textconfig.h"
|
2001-06-08 11:20:07 +04:00
|
|
|
|
#include "siminterface.h"
|
2002-10-25 01:07:56 +04:00
|
|
|
|
#include "extplugin.h"
|
2003-05-22 00:33:24 +04:00
|
|
|
|
#ifdef WIN32
|
|
|
|
|
#include "win32dialog.h"
|
|
|
|
|
#endif
|
2001-06-08 11:20:07 +04:00
|
|
|
|
|
- I've added lots of comments in siminterface.h, and tried to clean up
the terminology a bit. In particular, the term "gui" has started
to mean different things in different contexts, so I've defined
some more specific names for the parts of the user interface, and
updated comments and some variable names to reflect it. See
siminterface.h for a more complete description of all of these.
VGAW: VGA display window and toolbar buttons, the traditional Bochs
display which is ported to X, win32, MacOS X, etc. Implemented
in gui/gui.* and platform dependent gui/*.cc files.
CI: configuration interface that lets the user change settings such
as floppy disk image, ne2k settings, log options. The CI consists
of two parts: configuration user interface (CUI) which does the
actual rendering to the screen and handles key/mouse/menu events,
and the siminterface object.
CUI: configuration user interface. This handles the user interactions
that allow the user to configure Bochs. To actually change any
values it talks to the siminterface object. One implementation of
the CUI is the text-mode menus in gui/control.cc. Another
implementation is (will be) the wxWindows menus and dialogs in
gui/wxmain.cc.
siminterface: the glue between the CUI and the simulation code,
accessible throughout the code by the global variable
bx_simulator_interface_c *SIM;
Among other things, siminterface methods allow the simulator to ask the
CUI to display things or ask for user input, and allows the CUI
to query and modify variables in the simulation code.
GUI: Literally, "graphical user interface". Until the configuration menus
and wxWindows came along, everyone understood that "gui" referred to the
VGA display window and the toolbar buttons because that's all there
was. Now that we have the wxWindows code, which implements both the VGAW
and the CUI, while all other platforms implement only the VGAW, it's not
so clear. So, I'm trying to use VGAW, CI, and CUI consistently since
they are more specific.
control panel: This has been used as another name for the configuration
interface. "control panel" is also somewhat unspecific and it sounds
like it would be graphical with buttons and sliders, but our text-mode
thing is not graphical at all. I've replaced "control panel" with
"configuration interface" wherever I could find it. In configure script,
the --disable-control-panel option is still supported, but it politely
suggests that you use --disable-config-interface instead.
- clean up comments in siminterface,wx* code
- add comments and examples for bx_param_* and BxEvents
- remove some obsolete stuff: notify_*_args,
bx_simulator_interface_c::[sg]et_enabled() methods
- in siminterface.cc, move a few bx_real_sim_c methods to where they belong,
with the rest of the methods. No changes to the actual methods.
- remove some DOS ^M's which crept in and confused my editor.
2002-08-26 19:31:23 +04:00
|
|
|
|
#define CI_PATH_LENGTH 512
|
2001-06-08 00:42:00 +04:00
|
|
|
|
|
2002-03-10 13:19:32 +03:00
|
|
|
|
#define BX_INSERTED 11
|
|
|
|
|
|
2006-02-19 18:43:03 +03:00
|
|
|
|
int do_menu2(const char *pname, bx_param_c *base);
|
2001-06-10 00:01:12 +04:00
|
|
|
|
/* functions for changing particular options */
|
2006-02-19 18:43:03 +03:00
|
|
|
|
void bx_config_interface_init();
|
|
|
|
|
int bx_read_rc(char *rc);
|
|
|
|
|
int bx_write_rc(char *rc);
|
|
|
|
|
void bx_log_options(int individual);
|
2001-06-08 00:42:00 +04:00
|
|
|
|
|
|
|
|
|
/******************************************************************/
|
|
|
|
|
/* lots of code stolen from bximage.c */
|
|
|
|
|
/* remove leading spaces, newline junk at end. returns pointer to
|
|
|
|
|
cleaned string, which is between s0 and the null */
|
|
|
|
|
char *
|
|
|
|
|
clean_string (char *s0)
|
|
|
|
|
{
|
|
|
|
|
char *s = s0;
|
|
|
|
|
char *ptr;
|
|
|
|
|
/* find first nonblank */
|
|
|
|
|
while (isspace (*s))
|
|
|
|
|
s++;
|
|
|
|
|
/* truncate string at first non-alphanumeric */
|
|
|
|
|
ptr = s;
|
|
|
|
|
while (isprint (*ptr))
|
|
|
|
|
ptr++;
|
|
|
|
|
*ptr = 0;
|
|
|
|
|
return s;
|
|
|
|
|
}
|
|
|
|
|
|
2002-06-26 18:42:35 +04:00
|
|
|
|
void
|
|
|
|
|
double_percent (char *s, int max_len)
|
|
|
|
|
{
|
- I've added lots of comments in siminterface.h, and tried to clean up
the terminology a bit. In particular, the term "gui" has started
to mean different things in different contexts, so I've defined
some more specific names for the parts of the user interface, and
updated comments and some variable names to reflect it. See
siminterface.h for a more complete description of all of these.
VGAW: VGA display window and toolbar buttons, the traditional Bochs
display which is ported to X, win32, MacOS X, etc. Implemented
in gui/gui.* and platform dependent gui/*.cc files.
CI: configuration interface that lets the user change settings such
as floppy disk image, ne2k settings, log options. The CI consists
of two parts: configuration user interface (CUI) which does the
actual rendering to the screen and handles key/mouse/menu events,
and the siminterface object.
CUI: configuration user interface. This handles the user interactions
that allow the user to configure Bochs. To actually change any
values it talks to the siminterface object. One implementation of
the CUI is the text-mode menus in gui/control.cc. Another
implementation is (will be) the wxWindows menus and dialogs in
gui/wxmain.cc.
siminterface: the glue between the CUI and the simulation code,
accessible throughout the code by the global variable
bx_simulator_interface_c *SIM;
Among other things, siminterface methods allow the simulator to ask the
CUI to display things or ask for user input, and allows the CUI
to query and modify variables in the simulation code.
GUI: Literally, "graphical user interface". Until the configuration menus
and wxWindows came along, everyone understood that "gui" referred to the
VGA display window and the toolbar buttons because that's all there
was. Now that we have the wxWindows code, which implements both the VGAW
and the CUI, while all other platforms implement only the VGAW, it's not
so clear. So, I'm trying to use VGAW, CI, and CUI consistently since
they are more specific.
control panel: This has been used as another name for the configuration
interface. "control panel" is also somewhat unspecific and it sounds
like it would be graphical with buttons and sliders, but our text-mode
thing is not graphical at all. I've replaced "control panel" with
"configuration interface" wherever I could find it. In configure script,
the --disable-control-panel option is still supported, but it politely
suggests that you use --disable-config-interface instead.
- clean up comments in siminterface,wx* code
- add comments and examples for bx_param_* and BxEvents
- remove some obsolete stuff: notify_*_args,
bx_simulator_interface_c::[sg]et_enabled() methods
- in siminterface.cc, move a few bx_real_sim_c methods to where they belong,
with the rest of the methods. No changes to the actual methods.
- remove some DOS ^M's which crept in and confused my editor.
2002-08-26 19:31:23 +04:00
|
|
|
|
char d[CI_PATH_LENGTH];
|
2002-06-26 18:42:35 +04:00
|
|
|
|
int i=0,j=0;
|
|
|
|
|
|
- I've added lots of comments in siminterface.h, and tried to clean up
the terminology a bit. In particular, the term "gui" has started
to mean different things in different contexts, so I've defined
some more specific names for the parts of the user interface, and
updated comments and some variable names to reflect it. See
siminterface.h for a more complete description of all of these.
VGAW: VGA display window and toolbar buttons, the traditional Bochs
display which is ported to X, win32, MacOS X, etc. Implemented
in gui/gui.* and platform dependent gui/*.cc files.
CI: configuration interface that lets the user change settings such
as floppy disk image, ne2k settings, log options. The CI consists
of two parts: configuration user interface (CUI) which does the
actual rendering to the screen and handles key/mouse/menu events,
and the siminterface object.
CUI: configuration user interface. This handles the user interactions
that allow the user to configure Bochs. To actually change any
values it talks to the siminterface object. One implementation of
the CUI is the text-mode menus in gui/control.cc. Another
implementation is (will be) the wxWindows menus and dialogs in
gui/wxmain.cc.
siminterface: the glue between the CUI and the simulation code,
accessible throughout the code by the global variable
bx_simulator_interface_c *SIM;
Among other things, siminterface methods allow the simulator to ask the
CUI to display things or ask for user input, and allows the CUI
to query and modify variables in the simulation code.
GUI: Literally, "graphical user interface". Until the configuration menus
and wxWindows came along, everyone understood that "gui" referred to the
VGA display window and the toolbar buttons because that's all there
was. Now that we have the wxWindows code, which implements both the VGAW
and the CUI, while all other platforms implement only the VGAW, it's not
so clear. So, I'm trying to use VGAW, CI, and CUI consistently since
they are more specific.
control panel: This has been used as another name for the configuration
interface. "control panel" is also somewhat unspecific and it sounds
like it would be graphical with buttons and sliders, but our text-mode
thing is not graphical at all. I've replaced "control panel" with
"configuration interface" wherever I could find it. In configure script,
the --disable-control-panel option is still supported, but it politely
suggests that you use --disable-config-interface instead.
- clean up comments in siminterface,wx* code
- add comments and examples for bx_param_* and BxEvents
- remove some obsolete stuff: notify_*_args,
bx_simulator_interface_c::[sg]et_enabled() methods
- in siminterface.cc, move a few bx_real_sim_c methods to where they belong,
with the rest of the methods. No changes to the actual methods.
- remove some DOS ^M's which crept in and confused my editor.
2002-08-26 19:31:23 +04:00
|
|
|
|
if (max_len>CI_PATH_LENGTH)
|
|
|
|
|
max_len=CI_PATH_LENGTH;
|
2002-06-26 18:42:35 +04:00
|
|
|
|
|
|
|
|
|
max_len--;
|
|
|
|
|
|
|
|
|
|
while((s[i]!=0)&&(j<max_len))
|
|
|
|
|
{
|
|
|
|
|
d[j++]=s[i];
|
|
|
|
|
if((s[i]=='%')&&(j<max_len))
|
|
|
|
|
{
|
|
|
|
|
d[j++]=s[i];
|
|
|
|
|
}
|
|
|
|
|
i++;
|
|
|
|
|
}
|
|
|
|
|
d[j]=0;
|
|
|
|
|
strcpy(s,d);
|
|
|
|
|
}
|
|
|
|
|
|
2001-06-08 00:42:00 +04:00
|
|
|
|
/* returns 0 on success, -1 on failure. The value goes into out. */
|
|
|
|
|
int
|
2001-06-18 18:11:55 +04:00
|
|
|
|
ask_uint (char *prompt, Bit32u min, Bit32u max, Bit32u the_default, Bit32u *out, int base)
|
|
|
|
|
{
|
2002-03-10 13:19:32 +03:00
|
|
|
|
Bit32u n = max + 1;
|
2001-06-18 18:11:55 +04:00
|
|
|
|
char buffer[1024];
|
|
|
|
|
char *clean;
|
|
|
|
|
int illegal;
|
|
|
|
|
assert (base==10 || base==16);
|
|
|
|
|
while (1) {
|
|
|
|
|
printf (prompt, the_default);
|
|
|
|
|
if (!fgets (buffer, sizeof(buffer), stdin))
|
|
|
|
|
return -1;
|
|
|
|
|
clean = clean_string (buffer);
|
|
|
|
|
if (strlen(clean) < 1) {
|
|
|
|
|
// empty line, use the default
|
|
|
|
|
*out = the_default;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
2001-06-19 18:55:34 +04:00
|
|
|
|
const char *format = (base==10) ? "%d" : "%x";
|
2001-06-18 18:11:55 +04:00
|
|
|
|
illegal = (1 != sscanf (buffer, format, &n));
|
|
|
|
|
if (illegal || n<min || n>max) {
|
|
|
|
|
printf ("Your choice (%s) was not an integer between %u and %u.\n\n",
|
|
|
|
|
clean, min, max);
|
|
|
|
|
} else {
|
|
|
|
|
// choice is okay
|
|
|
|
|
*out = n;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// identical to ask_uint, but uses signed comparisons
|
|
|
|
|
int
|
|
|
|
|
ask_int (char *prompt, Bit32s min, Bit32s max, Bit32s the_default, Bit32s *out)
|
2001-06-08 00:42:00 +04:00
|
|
|
|
{
|
|
|
|
|
int n = max + 1;
|
|
|
|
|
char buffer[1024];
|
|
|
|
|
char *clean;
|
|
|
|
|
int illegal;
|
|
|
|
|
while (1) {
|
2001-06-10 00:01:12 +04:00
|
|
|
|
printf (prompt, the_default);
|
2001-06-08 00:42:00 +04:00
|
|
|
|
if (!fgets (buffer, sizeof(buffer), stdin))
|
|
|
|
|
return -1;
|
|
|
|
|
clean = clean_string (buffer);
|
|
|
|
|
if (strlen(clean) < 1) {
|
|
|
|
|
// empty line, use the default
|
|
|
|
|
*out = the_default;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
illegal = (1 != sscanf (buffer, "%d", &n));
|
|
|
|
|
if (illegal || n<min || n>max) {
|
|
|
|
|
printf ("Your choice (%s) was not an integer between %d and %d.\n\n",
|
|
|
|
|
clean, min, max);
|
|
|
|
|
} else {
|
|
|
|
|
// choice is okay
|
|
|
|
|
*out = n;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
|
ask_menu (char *prompt, int n_choices, char *choice[], int the_default, int *out)
|
|
|
|
|
{
|
|
|
|
|
char buffer[1024];
|
|
|
|
|
char *clean;
|
|
|
|
|
int i;
|
|
|
|
|
*out = -1;
|
|
|
|
|
while (1) {
|
2001-06-10 00:01:12 +04:00
|
|
|
|
printf (prompt, choice[the_default]);
|
2001-06-08 00:42:00 +04:00
|
|
|
|
if (!fgets (buffer, sizeof(buffer), stdin))
|
|
|
|
|
return -1;
|
|
|
|
|
clean = clean_string (buffer);
|
|
|
|
|
if (strlen(clean) < 1) {
|
|
|
|
|
// empty line, use the default
|
|
|
|
|
*out = the_default;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
for (i=0; i<n_choices; i++) {
|
|
|
|
|
if (!strcmp (choice[i], clean)) {
|
|
|
|
|
// matched, return the choice number
|
|
|
|
|
*out = i;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
2002-10-25 01:07:56 +04:00
|
|
|
|
if (clean[0] != '?')
|
|
|
|
|
printf ("Your choice (%s) did not match any of the choices:\n", clean);
|
2001-06-08 00:42:00 +04:00
|
|
|
|
for (i=0; i<n_choices; i++) {
|
|
|
|
|
if (i>0) printf (", ");
|
|
|
|
|
printf ("%s", choice[i]);
|
|
|
|
|
}
|
|
|
|
|
printf ("\n");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int
|
2001-06-18 18:11:55 +04:00
|
|
|
|
ask_yn (char *prompt, Bit32u the_default, Bit32u *out)
|
2001-06-08 00:42:00 +04:00
|
|
|
|
{
|
|
|
|
|
char buffer[16];
|
|
|
|
|
char *clean;
|
2001-06-18 18:11:55 +04:00
|
|
|
|
*out = 1<<31;
|
2001-06-08 00:42:00 +04:00
|
|
|
|
while (1) {
|
2001-06-10 00:01:12 +04:00
|
|
|
|
// if there's a %s field, substitute in the default yes/no.
|
|
|
|
|
printf (prompt, the_default ? "yes" : "no");
|
2001-06-08 00:42:00 +04:00
|
|
|
|
if (!fgets (buffer, sizeof(buffer), stdin))
|
|
|
|
|
return -1;
|
|
|
|
|
clean = clean_string (buffer);
|
|
|
|
|
if (strlen(clean) < 1) {
|
|
|
|
|
// empty line, use the default
|
|
|
|
|
*out = the_default;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
switch (tolower(clean[0])) {
|
|
|
|
|
case 'y': *out=1; return 0;
|
|
|
|
|
case 'n': *out=0; return 0;
|
|
|
|
|
}
|
|
|
|
|
printf ("Please type either yes or no.\n");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2001-06-21 23:27:05 +04:00
|
|
|
|
// returns -1 on error (stream closed or something)
|
|
|
|
|
// returns 0 if default was taken
|
|
|
|
|
// returns 1 if value changed
|
2001-06-08 00:42:00 +04:00
|
|
|
|
int
|
|
|
|
|
ask_string (char *prompt, char *the_default, char *out)
|
|
|
|
|
{
|
|
|
|
|
char buffer[1024];
|
|
|
|
|
char *clean;
|
2001-06-20 18:01:39 +04:00
|
|
|
|
assert (the_default != out);
|
2001-06-08 00:42:00 +04:00
|
|
|
|
out[0] = 0;
|
2001-06-10 00:01:12 +04:00
|
|
|
|
printf (prompt, the_default);
|
2001-06-20 18:01:39 +04:00
|
|
|
|
if (fgets (buffer, sizeof(buffer), stdin) == NULL)
|
2001-06-08 00:42:00 +04:00
|
|
|
|
return -1;
|
|
|
|
|
clean = clean_string (buffer);
|
|
|
|
|
if (strlen(clean) < 1) {
|
|
|
|
|
// empty line, use the default
|
|
|
|
|
strcpy (out, the_default);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
strcpy (out, clean);
|
2001-06-21 23:27:05 +04:00
|
|
|
|
return 1;
|
2001-06-08 00:42:00 +04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/******************************************************************/
|
|
|
|
|
|
2001-06-10 00:01:12 +04:00
|
|
|
|
static char *startup_menu_prompt =
|
2001-12-08 21:06:12 +03:00
|
|
|
|
"------------------------------\n"
|
|
|
|
|
"Bochs Configuration: Main Menu\n"
|
|
|
|
|
"------------------------------\n"
|
|
|
|
|
"\n"
|
|
|
|
|
"This is the Bochs Configuration Interface, where you can describe the\n"
|
- clean up the command line argument parsing. Before, we had two slightly
different versions of the code for wxWindows and non-wxWindows and the GDB
stub did not accept any command line options at all.
- IMPORTANT CHANGE: the quick start option used to cause two things:
1) read the bochsrc immediately, 2) start simulation immediately without
going into the config interface. This has changed in a subtle way.
Now, we always try to read the bochsrc immediately. Then if the quick
start option is on, we start the simulation immediately.
- add "Restore Factory Default Configuration" in text config menu. It was
already there in wx. Now the default choice is always "5. Begin simulation"
and because the bochsrc is always read now, this works.
- When the user chooses "Read configuration file" from either text mode
or wx interfaces, reset all bochs parameters first, then read in the
new file. This means that every time you read a configuration file
you are starting from a consistent "blank slate".
- move much of the code from bx_do_text_config_interface into bx_init_main
so that wxWindows and non-wxWindows code uses the same logic. There was
only a tiny bit left in bx_do_text_config_interface so I eliminated it.
- move the "help" message into a separate function print_usage()
- detect all flags (cmdline args that start with -) in a loop, instead of
a big if/else. This makes it easy to add others.
- fix problem with Carbon gui, so that -psn arg gets ignored
- print usage if you type -h, --help, or if flags are not recognized
- code that called io->set_log_action (that sets the log action for all
devices) was only called if the configuration interface was on; I'm not
sure why. Now it is called all the time.
- the wxWindows equivalent of main() is called MyApp::OnInit. Now OnInit
and main() are very similar. They both call bx_init_siminterface, then
bx_init_main (and quit if it fails), then show the config interface if
quickstart is off, and then simulate.
- modified: main.cc gui/control.cc gui/wxmain.cc
2002-10-14 17:37:20 +04:00
|
|
|
|
"machine that you want to simulate. Bochs has already searched for a\n"
|
|
|
|
|
"configuration file (typically called bochsrc.txt) and loaded it if it\n"
|
|
|
|
|
"could be found. When you are satisfied with the configuration, go\n"
|
|
|
|
|
"ahead and start the simulation.\n"
|
2001-12-08 21:06:12 +03:00
|
|
|
|
"\n"
|
2002-08-27 20:27:57 +04:00
|
|
|
|
"You can also start bochs with the -q option to skip these menus.\n"
|
2002-06-20 19:43:09 +04:00
|
|
|
|
"\n"
|
- clean up the command line argument parsing. Before, we had two slightly
different versions of the code for wxWindows and non-wxWindows and the GDB
stub did not accept any command line options at all.
- IMPORTANT CHANGE: the quick start option used to cause two things:
1) read the bochsrc immediately, 2) start simulation immediately without
going into the config interface. This has changed in a subtle way.
Now, we always try to read the bochsrc immediately. Then if the quick
start option is on, we start the simulation immediately.
- add "Restore Factory Default Configuration" in text config menu. It was
already there in wx. Now the default choice is always "5. Begin simulation"
and because the bochsrc is always read now, this works.
- When the user chooses "Read configuration file" from either text mode
or wx interfaces, reset all bochs parameters first, then read in the
new file. This means that every time you read a configuration file
you are starting from a consistent "blank slate".
- move much of the code from bx_do_text_config_interface into bx_init_main
so that wxWindows and non-wxWindows code uses the same logic. There was
only a tiny bit left in bx_do_text_config_interface so I eliminated it.
- move the "help" message into a separate function print_usage()
- detect all flags (cmdline args that start with -) in a loop, instead of
a big if/else. This makes it easy to add others.
- fix problem with Carbon gui, so that -psn arg gets ignored
- print usage if you type -h, --help, or if flags are not recognized
- code that called io->set_log_action (that sets the log action for all
devices) was only called if the configuration interface was on; I'm not
sure why. Now it is called all the time.
- the wxWindows equivalent of main() is called MyApp::OnInit. Now OnInit
and main() are very similar. They both call bx_init_siminterface, then
bx_init_main (and quit if it fails), then show the config interface if
quickstart is off, and then simulate.
- modified: main.cc gui/control.cc gui/wxmain.cc
2002-10-14 17:37:20 +04:00
|
|
|
|
"1. Restore factory default configuration\n"
|
|
|
|
|
"2. Read options from...\n"
|
|
|
|
|
"3. Edit options\n"
|
|
|
|
|
"4. Save options to...\n"
|
|
|
|
|
"5. Begin simulation\n"
|
|
|
|
|
"6. Quit now\n"
|
2001-06-12 01:03:05 +04:00
|
|
|
|
"\n"
|
|
|
|
|
"Please choose one: [%d] ";
|
2001-06-10 00:01:12 +04:00
|
|
|
|
|
|
|
|
|
static char *startup_options_prompt =
|
2001-06-12 01:03:05 +04:00
|
|
|
|
"------------------\n"
|
|
|
|
|
"Bochs Options Menu\n"
|
|
|
|
|
"------------------\n"
|
|
|
|
|
"0. Return to previous menu\n"
|
|
|
|
|
"1. Log file: %s\n"
|
2002-06-26 18:42:35 +04:00
|
|
|
|
"2. Log prefix: %s\n"
|
2002-12-03 00:26:05 +03:00
|
|
|
|
"3. Debug log file: %s\n"
|
|
|
|
|
"4. Log options for all devices\n"
|
|
|
|
|
"5. Log options for individual devices\n"
|
2006-02-11 18:28:43 +03:00
|
|
|
|
"6. CPU options\n"
|
|
|
|
|
"7. Memory options\n"
|
2006-02-19 18:43:03 +03:00
|
|
|
|
"8. Clock & CMOS options\n"
|
2006-02-20 00:35:50 +03:00
|
|
|
|
"9. PCI options\n"
|
2006-02-22 00:35:09 +03:00
|
|
|
|
"10. Bochs Display & Interface options\n"
|
2006-02-22 22:18:29 +03:00
|
|
|
|
"11. Keyboard & Mouse options\n"
|
|
|
|
|
"12. Disk options\n"
|
2006-03-01 20:14:36 +03:00
|
|
|
|
"13. Serial & Parallel port options\n"
|
2006-03-02 23:13:14 +03:00
|
|
|
|
"14. Network card options\n"
|
|
|
|
|
"15. Sound Blaster 16 options\n"
|
2006-02-19 18:43:03 +03:00
|
|
|
|
"16. Other options\n"
|
2001-06-12 01:03:05 +04:00
|
|
|
|
"\n"
|
|
|
|
|
"Please choose one: [0] ";
|
2001-06-08 00:42:00 +04:00
|
|
|
|
|
2004-02-04 01:40:33 +03:00
|
|
|
|
#ifndef WIN32
|
2001-06-10 00:01:12 +04:00
|
|
|
|
static char *runtime_menu_prompt =
|
2001-06-12 01:03:05 +04:00
|
|
|
|
"---------------------\n"
|
|
|
|
|
"Bochs Runtime Options\n"
|
|
|
|
|
"---------------------\n"
|
2001-06-13 12:14:49 +04:00
|
|
|
|
"1. Floppy disk 0: %s\n"
|
|
|
|
|
"2. Floppy disk 1: %s\n"
|
2002-09-23 00:56:12 +04:00
|
|
|
|
"3. 1st CDROM: %s\n"
|
|
|
|
|
"4. 2nd CDROM: %s\n"
|
|
|
|
|
"5. 3rd CDROM: %s\n"
|
|
|
|
|
"6. 4th CDROM: %s\n"
|
|
|
|
|
"7. (not implemented)\n"
|
|
|
|
|
"8. Log options for all devices\n"
|
|
|
|
|
"9. Log options for individual devices\n"
|
2004-05-30 12:28:52 +04:00
|
|
|
|
"10. Instruction tracing: off (doesn't exist yet)\n"
|
|
|
|
|
"11. Misc runtime options\n"
|
|
|
|
|
"12. Continue simulation\n"
|
|
|
|
|
"13. Quit now\n"
|
2001-06-12 01:03:05 +04:00
|
|
|
|
"\n"
|
2004-05-30 12:28:52 +04:00
|
|
|
|
"Please choose one: [12] ";
|
2004-02-04 01:40:33 +03:00
|
|
|
|
#endif
|
2001-06-10 00:01:12 +04:00
|
|
|
|
|
|
|
|
|
#define NOT_IMPLEMENTED(choice) \
|
|
|
|
|
fprintf (stderr, "ERROR: choice %d not implemented\n", choice);
|
|
|
|
|
|
|
|
|
|
#define BAD_OPTION(menu,choice) \
|
- I've added lots of comments in siminterface.h, and tried to clean up
the terminology a bit. In particular, the term "gui" has started
to mean different things in different contexts, so I've defined
some more specific names for the parts of the user interface, and
updated comments and some variable names to reflect it. See
siminterface.h for a more complete description of all of these.
VGAW: VGA display window and toolbar buttons, the traditional Bochs
display which is ported to X, win32, MacOS X, etc. Implemented
in gui/gui.* and platform dependent gui/*.cc files.
CI: configuration interface that lets the user change settings such
as floppy disk image, ne2k settings, log options. The CI consists
of two parts: configuration user interface (CUI) which does the
actual rendering to the screen and handles key/mouse/menu events,
and the siminterface object.
CUI: configuration user interface. This handles the user interactions
that allow the user to configure Bochs. To actually change any
values it talks to the siminterface object. One implementation of
the CUI is the text-mode menus in gui/control.cc. Another
implementation is (will be) the wxWindows menus and dialogs in
gui/wxmain.cc.
siminterface: the glue between the CUI and the simulation code,
accessible throughout the code by the global variable
bx_simulator_interface_c *SIM;
Among other things, siminterface methods allow the simulator to ask the
CUI to display things or ask for user input, and allows the CUI
to query and modify variables in the simulation code.
GUI: Literally, "graphical user interface". Until the configuration menus
and wxWindows came along, everyone understood that "gui" referred to the
VGA display window and the toolbar buttons because that's all there
was. Now that we have the wxWindows code, which implements both the VGAW
and the CUI, while all other platforms implement only the VGAW, it's not
so clear. So, I'm trying to use VGAW, CI, and CUI consistently since
they are more specific.
control panel: This has been used as another name for the configuration
interface. "control panel" is also somewhat unspecific and it sounds
like it would be graphical with buttons and sliders, but our text-mode
thing is not graphical at all. I've replaced "control panel" with
"configuration interface" wherever I could find it. In configure script,
the --disable-control-panel option is still supported, but it politely
suggests that you use --disable-config-interface instead.
- clean up comments in siminterface,wx* code
- add comments and examples for bx_param_* and BxEvents
- remove some obsolete stuff: notify_*_args,
bx_simulator_interface_c::[sg]et_enabled() methods
- in siminterface.cc, move a few bx_real_sim_c methods to where they belong,
with the rest of the methods. No changes to the actual methods.
- remove some DOS ^M's which crept in and confused my editor.
2002-08-26 19:31:23 +04:00
|
|
|
|
do {fprintf (stderr, "ERROR: menu %d has no choice %d\n", menu, choice); \
|
2001-06-10 00:01:12 +04:00
|
|
|
|
assert (0); } while (0)
|
|
|
|
|
|
2004-02-04 01:40:33 +03:00
|
|
|
|
#ifndef WIN32
|
2006-02-26 22:11:20 +03:00
|
|
|
|
void build_runtime_options_prompt(char *format, char *buf, int size)
|
2001-06-13 12:14:49 +04:00
|
|
|
|
{
|
2006-02-26 22:11:20 +03:00
|
|
|
|
bx_list_c *floppyop;
|
|
|
|
|
bx_list_c *cdromop = NULL;
|
|
|
|
|
char pname[80];
|
2002-09-23 00:56:12 +04:00
|
|
|
|
char buffer[6][128];
|
2006-02-26 22:11:20 +03:00
|
|
|
|
|
2001-06-13 12:14:49 +04:00
|
|
|
|
for (int i=0; i<2; i++) {
|
2006-02-26 22:11:20 +03:00
|
|
|
|
sprintf(pname, "floppy.%d", i);
|
|
|
|
|
floppyop = (bx_list_c*) SIM->get_param(pname);
|
|
|
|
|
if (SIM->get_param_enum("devtype", floppyop)->get() == BX_FLOPPY_NONE)
|
2006-02-25 01:35:46 +03:00
|
|
|
|
strcpy(buffer[i], "(not present)");
|
2002-08-04 12:42:34 +04:00
|
|
|
|
else {
|
2006-02-26 22:11:20 +03:00
|
|
|
|
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_enum("status", floppyop)->get_selected());
|
|
|
|
|
if (!SIM->get_param_string("path", floppyop)->getptr()[0]) strcpy(buffer[i], "none");
|
2002-08-04 12:42:34 +04:00
|
|
|
|
}
|
2001-06-13 12:14:49 +04:00
|
|
|
|
}
|
2002-09-23 00:56:12 +04:00
|
|
|
|
|
|
|
|
|
// 4 cdroms supported at run time
|
|
|
|
|
int device;
|
|
|
|
|
for (Bit8u cdrom=0; cdrom<4; cdrom++) {
|
2006-02-26 22:11:20 +03:00
|
|
|
|
if (!SIM->get_cdrom_options(cdrom, &cdromop, &device) || !SIM->get_param_bool("present", cdromop)->get())
|
2002-09-23 00:56:12 +04:00
|
|
|
|
sprintf (buffer[2+cdrom], "(not present)");
|
|
|
|
|
else
|
|
|
|
|
sprintf (buffer[2+cdrom], "(%s on ata%d) %s, %s",
|
2006-02-26 22:11:20 +03:00
|
|
|
|
device&1?"slave":"master", device/2, SIM->get_param_string("path", cdromop)->getptr(),
|
|
|
|
|
(SIM->get_param_enum("status", cdromop)->get () == BX_INSERTED)? "inserted" : "ejected");
|
2002-09-23 00:56:12 +04:00
|
|
|
|
}
|
|
|
|
|
|
2006-02-26 22:11:20 +03:00
|
|
|
|
snprintf(buf, size, format, buffer[0], buffer[1], buffer[2],
|
|
|
|
|
buffer[3], buffer[4], buffer[5]);
|
2001-06-13 12:14:49 +04:00
|
|
|
|
}
|
2004-02-04 01:40:33 +03:00
|
|
|
|
#endif
|
2001-06-13 12:14:49 +04:00
|
|
|
|
|
2006-02-26 22:11:20 +03:00
|
|
|
|
int do_menu(bx_id id) {
|
|
|
|
|
bx_list_c *menu = (bx_list_c *)SIM->get_param(id);
|
2001-06-18 18:11:55 +04:00
|
|
|
|
while (1) {
|
2006-02-26 22:11:20 +03:00
|
|
|
|
menu->get_choice()->set(0);
|
|
|
|
|
int status = menu->text_ask(stdin, stderr);
|
2001-06-18 18:11:55 +04:00
|
|
|
|
if (status < 0) return status;
|
|
|
|
|
bx_param_num_c *choice = menu->get_choice();
|
2006-02-26 22:11:20 +03:00
|
|
|
|
if (choice->get() < 1)
|
|
|
|
|
return choice->get();
|
2001-06-18 18:11:55 +04:00
|
|
|
|
else {
|
2006-02-26 22:11:20 +03:00
|
|
|
|
int index = choice->get() - 1; // choosing 1 means list[0]
|
|
|
|
|
bx_param_c *chosen = menu->get(index);
|
2001-06-18 18:11:55 +04:00
|
|
|
|
assert (chosen != NULL);
|
2006-02-26 22:11:20 +03:00
|
|
|
|
if (chosen->get_enabled()) {
|
|
|
|
|
if (chosen->get_type() == BXT_LIST) {
|
|
|
|
|
if (chosen->get_id() < BXP_NEW_PARAM_ID) {
|
2006-02-19 18:43:03 +03:00
|
|
|
|
do_menu(chosen->get_id());
|
|
|
|
|
} else {
|
2006-02-26 22:11:20 +03:00
|
|
|
|
do_menu2(chosen->get_name(), chosen->get_parent());
|
2006-02-19 18:43:03 +03:00
|
|
|
|
}
|
2004-10-25 00:04:52 +04:00
|
|
|
|
} else {
|
2006-02-26 22:11:20 +03:00
|
|
|
|
chosen->text_ask(stdin, stderr);
|
2004-10-25 00:04:52 +04:00
|
|
|
|
}
|
2004-07-10 15:05:29 +04:00
|
|
|
|
}
|
2001-06-18 18:11:55 +04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2006-02-18 19:53:18 +03:00
|
|
|
|
int do_menu2(const char *pname, bx_param_c *base) {
|
|
|
|
|
bx_list_c *menu = (bx_list_c *)SIM->get_param(pname, base);
|
|
|
|
|
while (1) {
|
|
|
|
|
menu->get_choice()->set(0);
|
|
|
|
|
int status = menu->text_ask(stdin, stderr);
|
|
|
|
|
if (status < 0) return status;
|
|
|
|
|
bx_param_num_c *choice = menu->get_choice();
|
|
|
|
|
if (choice->get() < 1)
|
|
|
|
|
return choice->get();
|
|
|
|
|
else {
|
|
|
|
|
int index = choice->get() - 1; // choosing 1 means list[0]
|
|
|
|
|
bx_param_c *chosen = menu->get(index);
|
|
|
|
|
assert(chosen != NULL);
|
|
|
|
|
if (chosen->get_enabled()) {
|
|
|
|
|
if (chosen->get_type() == BXT_LIST) {
|
2006-02-26 22:11:20 +03:00
|
|
|
|
if (chosen->get_id() < BXP_NEW_PARAM_ID) {
|
2006-02-18 19:53:18 +03:00
|
|
|
|
do_menu(chosen->get_id());
|
|
|
|
|
} else {
|
|
|
|
|
do_menu2(chosen->get_name(), menu);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
chosen->text_ask(stdin, stderr);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2001-06-21 18:37:55 +04:00
|
|
|
|
void askparam (bx_id id)
|
|
|
|
|
{
|
|
|
|
|
bx_param_c *param = SIM->get_param (id);
|
|
|
|
|
param->text_ask (stdin, stderr);
|
|
|
|
|
}
|
|
|
|
|
|
- I've added lots of comments in siminterface.h, and tried to clean up
the terminology a bit. In particular, the term "gui" has started
to mean different things in different contexts, so I've defined
some more specific names for the parts of the user interface, and
updated comments and some variable names to reflect it. See
siminterface.h for a more complete description of all of these.
VGAW: VGA display window and toolbar buttons, the traditional Bochs
display which is ported to X, win32, MacOS X, etc. Implemented
in gui/gui.* and platform dependent gui/*.cc files.
CI: configuration interface that lets the user change settings such
as floppy disk image, ne2k settings, log options. The CI consists
of two parts: configuration user interface (CUI) which does the
actual rendering to the screen and handles key/mouse/menu events,
and the siminterface object.
CUI: configuration user interface. This handles the user interactions
that allow the user to configure Bochs. To actually change any
values it talks to the siminterface object. One implementation of
the CUI is the text-mode menus in gui/control.cc. Another
implementation is (will be) the wxWindows menus and dialogs in
gui/wxmain.cc.
siminterface: the glue between the CUI and the simulation code,
accessible throughout the code by the global variable
bx_simulator_interface_c *SIM;
Among other things, siminterface methods allow the simulator to ask the
CUI to display things or ask for user input, and allows the CUI
to query and modify variables in the simulation code.
GUI: Literally, "graphical user interface". Until the configuration menus
and wxWindows came along, everyone understood that "gui" referred to the
VGA display window and the toolbar buttons because that's all there
was. Now that we have the wxWindows code, which implements both the VGAW
and the CUI, while all other platforms implement only the VGAW, it's not
so clear. So, I'm trying to use VGAW, CI, and CUI consistently since
they are more specific.
control panel: This has been used as another name for the configuration
interface. "control panel" is also somewhat unspecific and it sounds
like it would be graphical with buttons and sliders, but our text-mode
thing is not graphical at all. I've replaced "control panel" with
"configuration interface" wherever I could find it. In configure script,
the --disable-control-panel option is still supported, but it politely
suggests that you use --disable-config-interface instead.
- clean up comments in siminterface,wx* code
- add comments and examples for bx_param_* and BxEvents
- remove some obsolete stuff: notify_*_args,
bx_simulator_interface_c::[sg]et_enabled() methods
- in siminterface.cc, move a few bx_real_sim_c methods to where they belong,
with the rest of the methods. No changes to the actual methods.
- remove some DOS ^M's which crept in and confused my editor.
2002-08-26 19:31:23 +04:00
|
|
|
|
int bx_config_interface (int menu)
|
2001-06-10 00:01:12 +04:00
|
|
|
|
{
|
2001-06-18 18:11:55 +04:00
|
|
|
|
Bit32u choice;
|
2001-06-10 00:01:12 +04:00
|
|
|
|
while (1) {
|
|
|
|
|
switch (menu)
|
|
|
|
|
{
|
- I've added lots of comments in siminterface.h, and tried to clean up
the terminology a bit. In particular, the term "gui" has started
to mean different things in different contexts, so I've defined
some more specific names for the parts of the user interface, and
updated comments and some variable names to reflect it. See
siminterface.h for a more complete description of all of these.
VGAW: VGA display window and toolbar buttons, the traditional Bochs
display which is ported to X, win32, MacOS X, etc. Implemented
in gui/gui.* and platform dependent gui/*.cc files.
CI: configuration interface that lets the user change settings such
as floppy disk image, ne2k settings, log options. The CI consists
of two parts: configuration user interface (CUI) which does the
actual rendering to the screen and handles key/mouse/menu events,
and the siminterface object.
CUI: configuration user interface. This handles the user interactions
that allow the user to configure Bochs. To actually change any
values it talks to the siminterface object. One implementation of
the CUI is the text-mode menus in gui/control.cc. Another
implementation is (will be) the wxWindows menus and dialogs in
gui/wxmain.cc.
siminterface: the glue between the CUI and the simulation code,
accessible throughout the code by the global variable
bx_simulator_interface_c *SIM;
Among other things, siminterface methods allow the simulator to ask the
CUI to display things or ask for user input, and allows the CUI
to query and modify variables in the simulation code.
GUI: Literally, "graphical user interface". Until the configuration menus
and wxWindows came along, everyone understood that "gui" referred to the
VGA display window and the toolbar buttons because that's all there
was. Now that we have the wxWindows code, which implements both the VGAW
and the CUI, while all other platforms implement only the VGAW, it's not
so clear. So, I'm trying to use VGAW, CI, and CUI consistently since
they are more specific.
control panel: This has been used as another name for the configuration
interface. "control panel" is also somewhat unspecific and it sounds
like it would be graphical with buttons and sliders, but our text-mode
thing is not graphical at all. I've replaced "control panel" with
"configuration interface" wherever I could find it. In configure script,
the --disable-control-panel option is still supported, but it politely
suggests that you use --disable-config-interface instead.
- clean up comments in siminterface,wx* code
- add comments and examples for bx_param_* and BxEvents
- remove some obsolete stuff: notify_*_args,
bx_simulator_interface_c::[sg]et_enabled() methods
- in siminterface.cc, move a few bx_real_sim_c methods to where they belong,
with the rest of the methods. No changes to the actual methods.
- remove some DOS ^M's which crept in and confused my editor.
2002-08-26 19:31:23 +04:00
|
|
|
|
case BX_CI_INIT:
|
|
|
|
|
bx_config_interface_init ();
|
2001-10-07 02:31:31 +04:00
|
|
|
|
return 0;
|
2002-10-25 01:07:56 +04:00
|
|
|
|
case BX_CI_START_SIMULATION: {
|
2002-11-01 18:19:48 +03:00
|
|
|
|
SIM->begin_simulation (bx_startup_flags.argc, bx_startup_flags.argv);
|
2002-10-25 01:07:56 +04:00
|
|
|
|
// we don't expect it to return, but if it does, quit
|
|
|
|
|
SIM->quit_sim(1);
|
|
|
|
|
break;
|
|
|
|
|
}
|
- I've added lots of comments in siminterface.h, and tried to clean up
the terminology a bit. In particular, the term "gui" has started
to mean different things in different contexts, so I've defined
some more specific names for the parts of the user interface, and
updated comments and some variable names to reflect it. See
siminterface.h for a more complete description of all of these.
VGAW: VGA display window and toolbar buttons, the traditional Bochs
display which is ported to X, win32, MacOS X, etc. Implemented
in gui/gui.* and platform dependent gui/*.cc files.
CI: configuration interface that lets the user change settings such
as floppy disk image, ne2k settings, log options. The CI consists
of two parts: configuration user interface (CUI) which does the
actual rendering to the screen and handles key/mouse/menu events,
and the siminterface object.
CUI: configuration user interface. This handles the user interactions
that allow the user to configure Bochs. To actually change any
values it talks to the siminterface object. One implementation of
the CUI is the text-mode menus in gui/control.cc. Another
implementation is (will be) the wxWindows menus and dialogs in
gui/wxmain.cc.
siminterface: the glue between the CUI and the simulation code,
accessible throughout the code by the global variable
bx_simulator_interface_c *SIM;
Among other things, siminterface methods allow the simulator to ask the
CUI to display things or ask for user input, and allows the CUI
to query and modify variables in the simulation code.
GUI: Literally, "graphical user interface". Until the configuration menus
and wxWindows came along, everyone understood that "gui" referred to the
VGA display window and the toolbar buttons because that's all there
was. Now that we have the wxWindows code, which implements both the VGAW
and the CUI, while all other platforms implement only the VGAW, it's not
so clear. So, I'm trying to use VGAW, CI, and CUI consistently since
they are more specific.
control panel: This has been used as another name for the configuration
interface. "control panel" is also somewhat unspecific and it sounds
like it would be graphical with buttons and sliders, but our text-mode
thing is not graphical at all. I've replaced "control panel" with
"configuration interface" wherever I could find it. In configure script,
the --disable-control-panel option is still supported, but it politely
suggests that you use --disable-config-interface instead.
- clean up comments in siminterface,wx* code
- add comments and examples for bx_param_* and BxEvents
- remove some obsolete stuff: notify_*_args,
bx_simulator_interface_c::[sg]et_enabled() methods
- in siminterface.cc, move a few bx_real_sim_c methods to where they belong,
with the rest of the methods. No changes to the actual methods.
- remove some DOS ^M's which crept in and confused my editor.
2002-08-26 19:31:23 +04:00
|
|
|
|
case BX_CI_START_MENU:
|
2001-06-10 00:01:12 +04:00
|
|
|
|
{
|
2002-11-09 17:12:10 +03:00
|
|
|
|
Bit32u default_choice;
|
|
|
|
|
switch (SIM->get_param_enum(BXP_BOCHS_START)->get ()) {
|
|
|
|
|
case BX_LOAD_START:
|
|
|
|
|
default_choice = 2; break;
|
|
|
|
|
case BX_EDIT_START:
|
|
|
|
|
default_choice = 3; break;
|
|
|
|
|
default:
|
|
|
|
|
default_choice = 5; break;
|
|
|
|
|
}
|
|
|
|
|
|
- clean up the command line argument parsing. Before, we had two slightly
different versions of the code for wxWindows and non-wxWindows and the GDB
stub did not accept any command line options at all.
- IMPORTANT CHANGE: the quick start option used to cause two things:
1) read the bochsrc immediately, 2) start simulation immediately without
going into the config interface. This has changed in a subtle way.
Now, we always try to read the bochsrc immediately. Then if the quick
start option is on, we start the simulation immediately.
- add "Restore Factory Default Configuration" in text config menu. It was
already there in wx. Now the default choice is always "5. Begin simulation"
and because the bochsrc is always read now, this works.
- When the user chooses "Read configuration file" from either text mode
or wx interfaces, reset all bochs parameters first, then read in the
new file. This means that every time you read a configuration file
you are starting from a consistent "blank slate".
- move much of the code from bx_do_text_config_interface into bx_init_main
so that wxWindows and non-wxWindows code uses the same logic. There was
only a tiny bit left in bx_do_text_config_interface so I eliminated it.
- move the "help" message into a separate function print_usage()
- detect all flags (cmdline args that start with -) in a loop, instead of
a big if/else. This makes it easy to add others.
- fix problem with Carbon gui, so that -psn arg gets ignored
- print usage if you type -h, --help, or if flags are not recognized
- code that called io->set_log_action (that sets the log action for all
devices) was only called if the configuration interface was on; I'm not
sure why. Now it is called all the time.
- the wxWindows equivalent of main() is called MyApp::OnInit. Now OnInit
and main() are very similar. They both call bx_init_siminterface, then
bx_init_main (and quit if it fails), then show the config interface if
quickstart is off, and then simulate.
- modified: main.cc gui/control.cc gui/wxmain.cc
2002-10-14 17:37:20 +04:00
|
|
|
|
if (ask_uint (startup_menu_prompt, 1, 6, default_choice, &choice, 10) < 0) return -1;
|
2001-06-10 00:01:12 +04:00
|
|
|
|
switch (choice) {
|
- clean up the command line argument parsing. Before, we had two slightly
different versions of the code for wxWindows and non-wxWindows and the GDB
stub did not accept any command line options at all.
- IMPORTANT CHANGE: the quick start option used to cause two things:
1) read the bochsrc immediately, 2) start simulation immediately without
going into the config interface. This has changed in a subtle way.
Now, we always try to read the bochsrc immediately. Then if the quick
start option is on, we start the simulation immediately.
- add "Restore Factory Default Configuration" in text config menu. It was
already there in wx. Now the default choice is always "5. Begin simulation"
and because the bochsrc is always read now, this works.
- When the user chooses "Read configuration file" from either text mode
or wx interfaces, reset all bochs parameters first, then read in the
new file. This means that every time you read a configuration file
you are starting from a consistent "blank slate".
- move much of the code from bx_do_text_config_interface into bx_init_main
so that wxWindows and non-wxWindows code uses the same logic. There was
only a tiny bit left in bx_do_text_config_interface so I eliminated it.
- move the "help" message into a separate function print_usage()
- detect all flags (cmdline args that start with -) in a loop, instead of
a big if/else. This makes it easy to add others.
- fix problem with Carbon gui, so that -psn arg gets ignored
- print usage if you type -h, --help, or if flags are not recognized
- code that called io->set_log_action (that sets the log action for all
devices) was only called if the configuration interface was on; I'm not
sure why. Now it is called all the time.
- the wxWindows equivalent of main() is called MyApp::OnInit. Now OnInit
and main() are very similar. They both call bx_init_siminterface, then
bx_init_main (and quit if it fails), then show the config interface if
quickstart is off, and then simulate.
- modified: main.cc gui/control.cc gui/wxmain.cc
2002-10-14 17:37:20 +04:00
|
|
|
|
case 1:
|
2002-11-15 16:26:15 +03:00
|
|
|
|
fprintf (stderr, "I reset all options back to their factory defaults.\n\n");
|
- clean up the command line argument parsing. Before, we had two slightly
different versions of the code for wxWindows and non-wxWindows and the GDB
stub did not accept any command line options at all.
- IMPORTANT CHANGE: the quick start option used to cause two things:
1) read the bochsrc immediately, 2) start simulation immediately without
going into the config interface. This has changed in a subtle way.
Now, we always try to read the bochsrc immediately. Then if the quick
start option is on, we start the simulation immediately.
- add "Restore Factory Default Configuration" in text config menu. It was
already there in wx. Now the default choice is always "5. Begin simulation"
and because the bochsrc is always read now, this works.
- When the user chooses "Read configuration file" from either text mode
or wx interfaces, reset all bochs parameters first, then read in the
new file. This means that every time you read a configuration file
you are starting from a consistent "blank slate".
- move much of the code from bx_do_text_config_interface into bx_init_main
so that wxWindows and non-wxWindows code uses the same logic. There was
only a tiny bit left in bx_do_text_config_interface so I eliminated it.
- move the "help" message into a separate function print_usage()
- detect all flags (cmdline args that start with -) in a loop, instead of
a big if/else. This makes it easy to add others.
- fix problem with Carbon gui, so that -psn arg gets ignored
- print usage if you type -h, --help, or if flags are not recognized
- code that called io->set_log_action (that sets the log action for all
devices) was only called if the configuration interface was on; I'm not
sure why. Now it is called all the time.
- the wxWindows equivalent of main() is called MyApp::OnInit. Now OnInit
and main() are very similar. They both call bx_init_siminterface, then
bx_init_main (and quit if it fails), then show the config interface if
quickstart is off, and then simulate.
- modified: main.cc gui/control.cc gui/wxmain.cc
2002-10-14 17:37:20 +04:00
|
|
|
|
SIM->reset_all_param ();
|
2002-11-15 17:38:57 +03:00
|
|
|
|
SIM->get_param_enum(BXP_BOCHS_START)->set(BX_EDIT_START);
|
- clean up the command line argument parsing. Before, we had two slightly
different versions of the code for wxWindows and non-wxWindows and the GDB
stub did not accept any command line options at all.
- IMPORTANT CHANGE: the quick start option used to cause two things:
1) read the bochsrc immediately, 2) start simulation immediately without
going into the config interface. This has changed in a subtle way.
Now, we always try to read the bochsrc immediately. Then if the quick
start option is on, we start the simulation immediately.
- add "Restore Factory Default Configuration" in text config menu. It was
already there in wx. Now the default choice is always "5. Begin simulation"
and because the bochsrc is always read now, this works.
- When the user chooses "Read configuration file" from either text mode
or wx interfaces, reset all bochs parameters first, then read in the
new file. This means that every time you read a configuration file
you are starting from a consistent "blank slate".
- move much of the code from bx_do_text_config_interface into bx_init_main
so that wxWindows and non-wxWindows code uses the same logic. There was
only a tiny bit left in bx_do_text_config_interface so I eliminated it.
- move the "help" message into a separate function print_usage()
- detect all flags (cmdline args that start with -) in a loop, instead of
a big if/else. This makes it easy to add others.
- fix problem with Carbon gui, so that -psn arg gets ignored
- print usage if you type -h, --help, or if flags are not recognized
- code that called io->set_log_action (that sets the log action for all
devices) was only called if the configuration interface was on; I'm not
sure why. Now it is called all the time.
- the wxWindows equivalent of main() is called MyApp::OnInit. Now OnInit
and main() are very similar. They both call bx_init_siminterface, then
bx_init_main (and quit if it fails), then show the config interface if
quickstart is off, and then simulate.
- modified: main.cc gui/control.cc gui/wxmain.cc
2002-10-14 17:37:20 +04:00
|
|
|
|
break;
|
|
|
|
|
case 2:
|
|
|
|
|
// Before reading a new configuration, reset every option to its
|
|
|
|
|
// original state.
|
|
|
|
|
SIM->reset_all_param ();
|
|
|
|
|
if (bx_read_rc (NULL) >= 0)
|
2002-11-09 17:12:10 +03:00
|
|
|
|
SIM->get_param_enum(BXP_BOCHS_START)->set(BX_RUN_START);
|
- clean up the command line argument parsing. Before, we had two slightly
different versions of the code for wxWindows and non-wxWindows and the GDB
stub did not accept any command line options at all.
- IMPORTANT CHANGE: the quick start option used to cause two things:
1) read the bochsrc immediately, 2) start simulation immediately without
going into the config interface. This has changed in a subtle way.
Now, we always try to read the bochsrc immediately. Then if the quick
start option is on, we start the simulation immediately.
- add "Restore Factory Default Configuration" in text config menu. It was
already there in wx. Now the default choice is always "5. Begin simulation"
and because the bochsrc is always read now, this works.
- When the user chooses "Read configuration file" from either text mode
or wx interfaces, reset all bochs parameters first, then read in the
new file. This means that every time you read a configuration file
you are starting from a consistent "blank slate".
- move much of the code from bx_do_text_config_interface into bx_init_main
so that wxWindows and non-wxWindows code uses the same logic. There was
only a tiny bit left in bx_do_text_config_interface so I eliminated it.
- move the "help" message into a separate function print_usage()
- detect all flags (cmdline args that start with -) in a loop, instead of
a big if/else. This makes it easy to add others.
- fix problem with Carbon gui, so that -psn arg gets ignored
- print usage if you type -h, --help, or if flags are not recognized
- code that called io->set_log_action (that sets the log action for all
devices) was only called if the configuration interface was on; I'm not
sure why. Now it is called all the time.
- the wxWindows equivalent of main() is called MyApp::OnInit. Now OnInit
and main() are very similar. They both call bx_init_siminterface, then
bx_init_main (and quit if it fails), then show the config interface if
quickstart is off, and then simulate.
- modified: main.cc gui/control.cc gui/wxmain.cc
2002-10-14 17:37:20 +04:00
|
|
|
|
break;
|
2002-11-09 17:12:10 +03:00
|
|
|
|
case 3:
|
|
|
|
|
bx_config_interface (BX_CI_START_OPTS);
|
|
|
|
|
SIM->get_param_enum(BXP_BOCHS_START)->set(BX_RUN_START);
|
|
|
|
|
break;
|
- clean up the command line argument parsing. Before, we had two slightly
different versions of the code for wxWindows and non-wxWindows and the GDB
stub did not accept any command line options at all.
- IMPORTANT CHANGE: the quick start option used to cause two things:
1) read the bochsrc immediately, 2) start simulation immediately without
going into the config interface. This has changed in a subtle way.
Now, we always try to read the bochsrc immediately. Then if the quick
start option is on, we start the simulation immediately.
- add "Restore Factory Default Configuration" in text config menu. It was
already there in wx. Now the default choice is always "5. Begin simulation"
and because the bochsrc is always read now, this works.
- When the user chooses "Read configuration file" from either text mode
or wx interfaces, reset all bochs parameters first, then read in the
new file. This means that every time you read a configuration file
you are starting from a consistent "blank slate".
- move much of the code from bx_do_text_config_interface into bx_init_main
so that wxWindows and non-wxWindows code uses the same logic. There was
only a tiny bit left in bx_do_text_config_interface so I eliminated it.
- move the "help" message into a separate function print_usage()
- detect all flags (cmdline args that start with -) in a loop, instead of
a big if/else. This makes it easy to add others.
- fix problem with Carbon gui, so that -psn arg gets ignored
- print usage if you type -h, --help, or if flags are not recognized
- code that called io->set_log_action (that sets the log action for all
devices) was only called if the configuration interface was on; I'm not
sure why. Now it is called all the time.
- the wxWindows equivalent of main() is called MyApp::OnInit. Now OnInit
and main() are very similar. They both call bx_init_siminterface, then
bx_init_main (and quit if it fails), then show the config interface if
quickstart is off, and then simulate.
- modified: main.cc gui/control.cc gui/wxmain.cc
2002-10-14 17:37:20 +04:00
|
|
|
|
case 4: bx_write_rc (NULL); break;
|
2002-10-25 01:07:56 +04:00
|
|
|
|
case 5: bx_config_interface (BX_CI_START_SIMULATION); break;
|
- clean up the command line argument parsing. Before, we had two slightly
different versions of the code for wxWindows and non-wxWindows and the GDB
stub did not accept any command line options at all.
- IMPORTANT CHANGE: the quick start option used to cause two things:
1) read the bochsrc immediately, 2) start simulation immediately without
going into the config interface. This has changed in a subtle way.
Now, we always try to read the bochsrc immediately. Then if the quick
start option is on, we start the simulation immediately.
- add "Restore Factory Default Configuration" in text config menu. It was
already there in wx. Now the default choice is always "5. Begin simulation"
and because the bochsrc is always read now, this works.
- When the user chooses "Read configuration file" from either text mode
or wx interfaces, reset all bochs parameters first, then read in the
new file. This means that every time you read a configuration file
you are starting from a consistent "blank slate".
- move much of the code from bx_do_text_config_interface into bx_init_main
so that wxWindows and non-wxWindows code uses the same logic. There was
only a tiny bit left in bx_do_text_config_interface so I eliminated it.
- move the "help" message into a separate function print_usage()
- detect all flags (cmdline args that start with -) in a loop, instead of
a big if/else. This makes it easy to add others.
- fix problem with Carbon gui, so that -psn arg gets ignored
- print usage if you type -h, --help, or if flags are not recognized
- code that called io->set_log_action (that sets the log action for all
devices) was only called if the configuration interface was on; I'm not
sure why. Now it is called all the time.
- the wxWindows equivalent of main() is called MyApp::OnInit. Now OnInit
and main() are very similar. They both call bx_init_siminterface, then
bx_init_main (and quit if it fails), then show the config interface if
quickstart is off, and then simulate.
- modified: main.cc gui/control.cc gui/wxmain.cc
2002-10-14 17:37:20 +04:00
|
|
|
|
case 6: SIM->quit_sim (1); return -1;
|
2001-06-10 00:01:12 +04:00
|
|
|
|
default: BAD_OPTION(menu, choice);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
- I've added lots of comments in siminterface.h, and tried to clean up
the terminology a bit. In particular, the term "gui" has started
to mean different things in different contexts, so I've defined
some more specific names for the parts of the user interface, and
updated comments and some variable names to reflect it. See
siminterface.h for a more complete description of all of these.
VGAW: VGA display window and toolbar buttons, the traditional Bochs
display which is ported to X, win32, MacOS X, etc. Implemented
in gui/gui.* and platform dependent gui/*.cc files.
CI: configuration interface that lets the user change settings such
as floppy disk image, ne2k settings, log options. The CI consists
of two parts: configuration user interface (CUI) which does the
actual rendering to the screen and handles key/mouse/menu events,
and the siminterface object.
CUI: configuration user interface. This handles the user interactions
that allow the user to configure Bochs. To actually change any
values it talks to the siminterface object. One implementation of
the CUI is the text-mode menus in gui/control.cc. Another
implementation is (will be) the wxWindows menus and dialogs in
gui/wxmain.cc.
siminterface: the glue between the CUI and the simulation code,
accessible throughout the code by the global variable
bx_simulator_interface_c *SIM;
Among other things, siminterface methods allow the simulator to ask the
CUI to display things or ask for user input, and allows the CUI
to query and modify variables in the simulation code.
GUI: Literally, "graphical user interface". Until the configuration menus
and wxWindows came along, everyone understood that "gui" referred to the
VGA display window and the toolbar buttons because that's all there
was. Now that we have the wxWindows code, which implements both the VGAW
and the CUI, while all other platforms implement only the VGAW, it's not
so clear. So, I'm trying to use VGAW, CI, and CUI consistently since
they are more specific.
control panel: This has been used as another name for the configuration
interface. "control panel" is also somewhat unspecific and it sounds
like it would be graphical with buttons and sliders, but our text-mode
thing is not graphical at all. I've replaced "control panel" with
"configuration interface" wherever I could find it. In configure script,
the --disable-control-panel option is still supported, but it politely
suggests that you use --disable-config-interface instead.
- clean up comments in siminterface,wx* code
- add comments and examples for bx_param_* and BxEvents
- remove some obsolete stuff: notify_*_args,
bx_simulator_interface_c::[sg]et_enabled() methods
- in siminterface.cc, move a few bx_real_sim_c methods to where they belong,
with the rest of the methods. No changes to the actual methods.
- remove some DOS ^M's which crept in and confused my editor.
2002-08-26 19:31:23 +04:00
|
|
|
|
case BX_CI_START_OPTS:
|
2001-06-10 00:01:12 +04:00
|
|
|
|
{
|
- I've added lots of comments in siminterface.h, and tried to clean up
the terminology a bit. In particular, the term "gui" has started
to mean different things in different contexts, so I've defined
some more specific names for the parts of the user interface, and
updated comments and some variable names to reflect it. See
siminterface.h for a more complete description of all of these.
VGAW: VGA display window and toolbar buttons, the traditional Bochs
display which is ported to X, win32, MacOS X, etc. Implemented
in gui/gui.* and platform dependent gui/*.cc files.
CI: configuration interface that lets the user change settings such
as floppy disk image, ne2k settings, log options. The CI consists
of two parts: configuration user interface (CUI) which does the
actual rendering to the screen and handles key/mouse/menu events,
and the siminterface object.
CUI: configuration user interface. This handles the user interactions
that allow the user to configure Bochs. To actually change any
values it talks to the siminterface object. One implementation of
the CUI is the text-mode menus in gui/control.cc. Another
implementation is (will be) the wxWindows menus and dialogs in
gui/wxmain.cc.
siminterface: the glue between the CUI and the simulation code,
accessible throughout the code by the global variable
bx_simulator_interface_c *SIM;
Among other things, siminterface methods allow the simulator to ask the
CUI to display things or ask for user input, and allows the CUI
to query and modify variables in the simulation code.
GUI: Literally, "graphical user interface". Until the configuration menus
and wxWindows came along, everyone understood that "gui" referred to the
VGA display window and the toolbar buttons because that's all there
was. Now that we have the wxWindows code, which implements both the VGAW
and the CUI, while all other platforms implement only the VGAW, it's not
so clear. So, I'm trying to use VGAW, CI, and CUI consistently since
they are more specific.
control panel: This has been used as another name for the configuration
interface. "control panel" is also somewhat unspecific and it sounds
like it would be graphical with buttons and sliders, but our text-mode
thing is not graphical at all. I've replaced "control panel" with
"configuration interface" wherever I could find it. In configure script,
the --disable-control-panel option is still supported, but it politely
suggests that you use --disable-config-interface instead.
- clean up comments in siminterface,wx* code
- add comments and examples for bx_param_* and BxEvents
- remove some obsolete stuff: notify_*_args,
bx_simulator_interface_c::[sg]et_enabled() methods
- in siminterface.cc, move a few bx_real_sim_c methods to where they belong,
with the rest of the methods. No changes to the actual methods.
- remove some DOS ^M's which crept in and confused my editor.
2002-08-26 19:31:23 +04:00
|
|
|
|
char prompt[CI_PATH_LENGTH];
|
|
|
|
|
char oldpath[CI_PATH_LENGTH];
|
2002-12-03 00:26:05 +03:00
|
|
|
|
char olddebuggerpath[CI_PATH_LENGTH];
|
- I've added lots of comments in siminterface.h, and tried to clean up
the terminology a bit. In particular, the term "gui" has started
to mean different things in different contexts, so I've defined
some more specific names for the parts of the user interface, and
updated comments and some variable names to reflect it. See
siminterface.h for a more complete description of all of these.
VGAW: VGA display window and toolbar buttons, the traditional Bochs
display which is ported to X, win32, MacOS X, etc. Implemented
in gui/gui.* and platform dependent gui/*.cc files.
CI: configuration interface that lets the user change settings such
as floppy disk image, ne2k settings, log options. The CI consists
of two parts: configuration user interface (CUI) which does the
actual rendering to the screen and handles key/mouse/menu events,
and the siminterface object.
CUI: configuration user interface. This handles the user interactions
that allow the user to configure Bochs. To actually change any
values it talks to the siminterface object. One implementation of
the CUI is the text-mode menus in gui/control.cc. Another
implementation is (will be) the wxWindows menus and dialogs in
gui/wxmain.cc.
siminterface: the glue between the CUI and the simulation code,
accessible throughout the code by the global variable
bx_simulator_interface_c *SIM;
Among other things, siminterface methods allow the simulator to ask the
CUI to display things or ask for user input, and allows the CUI
to query and modify variables in the simulation code.
GUI: Literally, "graphical user interface". Until the configuration menus
and wxWindows came along, everyone understood that "gui" referred to the
VGA display window and the toolbar buttons because that's all there
was. Now that we have the wxWindows code, which implements both the VGAW
and the CUI, while all other platforms implement only the VGAW, it's not
so clear. So, I'm trying to use VGAW, CI, and CUI consistently since
they are more specific.
control panel: This has been used as another name for the configuration
interface. "control panel" is also somewhat unspecific and it sounds
like it would be graphical with buttons and sliders, but our text-mode
thing is not graphical at all. I've replaced "control panel" with
"configuration interface" wherever I could find it. In configure script,
the --disable-control-panel option is still supported, but it politely
suggests that you use --disable-config-interface instead.
- clean up comments in siminterface,wx* code
- add comments and examples for bx_param_* and BxEvents
- remove some obsolete stuff: notify_*_args,
bx_simulator_interface_c::[sg]et_enabled() methods
- in siminterface.cc, move a few bx_real_sim_c methods to where they belong,
with the rest of the methods. No changes to the actual methods.
- remove some DOS ^M's which crept in and confused my editor.
2002-08-26 19:31:23 +04:00
|
|
|
|
char oldprefix[CI_PATH_LENGTH];
|
2002-06-26 18:42:35 +04:00
|
|
|
|
int retval;
|
|
|
|
|
|
- I've added lots of comments in siminterface.h, and tried to clean up
the terminology a bit. In particular, the term "gui" has started
to mean different things in different contexts, so I've defined
some more specific names for the parts of the user interface, and
updated comments and some variable names to reflect it. See
siminterface.h for a more complete description of all of these.
VGAW: VGA display window and toolbar buttons, the traditional Bochs
display which is ported to X, win32, MacOS X, etc. Implemented
in gui/gui.* and platform dependent gui/*.cc files.
CI: configuration interface that lets the user change settings such
as floppy disk image, ne2k settings, log options. The CI consists
of two parts: configuration user interface (CUI) which does the
actual rendering to the screen and handles key/mouse/menu events,
and the siminterface object.
CUI: configuration user interface. This handles the user interactions
that allow the user to configure Bochs. To actually change any
values it talks to the siminterface object. One implementation of
the CUI is the text-mode menus in gui/control.cc. Another
implementation is (will be) the wxWindows menus and dialogs in
gui/wxmain.cc.
siminterface: the glue between the CUI and the simulation code,
accessible throughout the code by the global variable
bx_simulator_interface_c *SIM;
Among other things, siminterface methods allow the simulator to ask the
CUI to display things or ask for user input, and allows the CUI
to query and modify variables in the simulation code.
GUI: Literally, "graphical user interface". Until the configuration menus
and wxWindows came along, everyone understood that "gui" referred to the
VGA display window and the toolbar buttons because that's all there
was. Now that we have the wxWindows code, which implements both the VGAW
and the CUI, while all other platforms implement only the VGAW, it's not
so clear. So, I'm trying to use VGAW, CI, and CUI consistently since
they are more specific.
control panel: This has been used as another name for the configuration
interface. "control panel" is also somewhat unspecific and it sounds
like it would be graphical with buttons and sliders, but our text-mode
thing is not graphical at all. I've replaced "control panel" with
"configuration interface" wherever I could find it. In configure script,
the --disable-control-panel option is still supported, but it politely
suggests that you use --disable-config-interface instead.
- clean up comments in siminterface,wx* code
- add comments and examples for bx_param_* and BxEvents
- remove some obsolete stuff: notify_*_args,
bx_simulator_interface_c::[sg]et_enabled() methods
- in siminterface.cc, move a few bx_real_sim_c methods to where they belong,
with the rest of the methods. No changes to the actual methods.
- remove some DOS ^M's which crept in and confused my editor.
2002-08-26 19:31:23 +04:00
|
|
|
|
retval = SIM->get_log_file (oldpath, CI_PATH_LENGTH);
|
2002-06-26 18:42:35 +04:00
|
|
|
|
assert (retval >= 0);
|
- I've added lots of comments in siminterface.h, and tried to clean up
the terminology a bit. In particular, the term "gui" has started
to mean different things in different contexts, so I've defined
some more specific names for the parts of the user interface, and
updated comments and some variable names to reflect it. See
siminterface.h for a more complete description of all of these.
VGAW: VGA display window and toolbar buttons, the traditional Bochs
display which is ported to X, win32, MacOS X, etc. Implemented
in gui/gui.* and platform dependent gui/*.cc files.
CI: configuration interface that lets the user change settings such
as floppy disk image, ne2k settings, log options. The CI consists
of two parts: configuration user interface (CUI) which does the
actual rendering to the screen and handles key/mouse/menu events,
and the siminterface object.
CUI: configuration user interface. This handles the user interactions
that allow the user to configure Bochs. To actually change any
values it talks to the siminterface object. One implementation of
the CUI is the text-mode menus in gui/control.cc. Another
implementation is (will be) the wxWindows menus and dialogs in
gui/wxmain.cc.
siminterface: the glue between the CUI and the simulation code,
accessible throughout the code by the global variable
bx_simulator_interface_c *SIM;
Among other things, siminterface methods allow the simulator to ask the
CUI to display things or ask for user input, and allows the CUI
to query and modify variables in the simulation code.
GUI: Literally, "graphical user interface". Until the configuration menus
and wxWindows came along, everyone understood that "gui" referred to the
VGA display window and the toolbar buttons because that's all there
was. Now that we have the wxWindows code, which implements both the VGAW
and the CUI, while all other platforms implement only the VGAW, it's not
so clear. So, I'm trying to use VGAW, CI, and CUI consistently since
they are more specific.
control panel: This has been used as another name for the configuration
interface. "control panel" is also somewhat unspecific and it sounds
like it would be graphical with buttons and sliders, but our text-mode
thing is not graphical at all. I've replaced "control panel" with
"configuration interface" wherever I could find it. In configure script,
the --disable-control-panel option is still supported, but it politely
suggests that you use --disable-config-interface instead.
- clean up comments in siminterface,wx* code
- add comments and examples for bx_param_* and BxEvents
- remove some obsolete stuff: notify_*_args,
bx_simulator_interface_c::[sg]et_enabled() methods
- in siminterface.cc, move a few bx_real_sim_c methods to where they belong,
with the rest of the methods. No changes to the actual methods.
- remove some DOS ^M's which crept in and confused my editor.
2002-08-26 19:31:23 +04:00
|
|
|
|
double_percent(oldpath,CI_PATH_LENGTH);
|
|
|
|
|
retval = SIM->get_log_prefix (oldprefix, CI_PATH_LENGTH);
|
2002-06-26 18:42:35 +04:00
|
|
|
|
assert (retval >= 0);
|
- I've added lots of comments in siminterface.h, and tried to clean up
the terminology a bit. In particular, the term "gui" has started
to mean different things in different contexts, so I've defined
some more specific names for the parts of the user interface, and
updated comments and some variable names to reflect it. See
siminterface.h for a more complete description of all of these.
VGAW: VGA display window and toolbar buttons, the traditional Bochs
display which is ported to X, win32, MacOS X, etc. Implemented
in gui/gui.* and platform dependent gui/*.cc files.
CI: configuration interface that lets the user change settings such
as floppy disk image, ne2k settings, log options. The CI consists
of two parts: configuration user interface (CUI) which does the
actual rendering to the screen and handles key/mouse/menu events,
and the siminterface object.
CUI: configuration user interface. This handles the user interactions
that allow the user to configure Bochs. To actually change any
values it talks to the siminterface object. One implementation of
the CUI is the text-mode menus in gui/control.cc. Another
implementation is (will be) the wxWindows menus and dialogs in
gui/wxmain.cc.
siminterface: the glue between the CUI and the simulation code,
accessible throughout the code by the global variable
bx_simulator_interface_c *SIM;
Among other things, siminterface methods allow the simulator to ask the
CUI to display things or ask for user input, and allows the CUI
to query and modify variables in the simulation code.
GUI: Literally, "graphical user interface". Until the configuration menus
and wxWindows came along, everyone understood that "gui" referred to the
VGA display window and the toolbar buttons because that's all there
was. Now that we have the wxWindows code, which implements both the VGAW
and the CUI, while all other platforms implement only the VGAW, it's not
so clear. So, I'm trying to use VGAW, CI, and CUI consistently since
they are more specific.
control panel: This has been used as another name for the configuration
interface. "control panel" is also somewhat unspecific and it sounds
like it would be graphical with buttons and sliders, but our text-mode
thing is not graphical at all. I've replaced "control panel" with
"configuration interface" wherever I could find it. In configure script,
the --disable-control-panel option is still supported, but it politely
suggests that you use --disable-config-interface instead.
- clean up comments in siminterface,wx* code
- add comments and examples for bx_param_* and BxEvents
- remove some obsolete stuff: notify_*_args,
bx_simulator_interface_c::[sg]et_enabled() methods
- in siminterface.cc, move a few bx_real_sim_c methods to where they belong,
with the rest of the methods. No changes to the actual methods.
- remove some DOS ^M's which crept in and confused my editor.
2002-08-26 19:31:23 +04:00
|
|
|
|
double_percent(oldprefix,CI_PATH_LENGTH);
|
2002-12-03 00:26:05 +03:00
|
|
|
|
retval = SIM->get_debugger_log_file (olddebuggerpath, CI_PATH_LENGTH);
|
|
|
|
|
assert (retval >= 0);
|
|
|
|
|
double_percent(olddebuggerpath,CI_PATH_LENGTH);
|
2002-06-26 18:42:35 +04:00
|
|
|
|
|
2002-12-03 00:26:05 +03:00
|
|
|
|
sprintf (prompt, startup_options_prompt, oldpath, oldprefix, olddebuggerpath);
|
2006-02-19 18:43:03 +03:00
|
|
|
|
if (ask_uint (prompt, 0, 16, 0, &choice, 10) < 0) return -1;
|
2001-06-10 00:01:12 +04:00
|
|
|
|
switch (choice) {
|
|
|
|
|
case 0: return 0;
|
2001-06-21 18:37:55 +04:00
|
|
|
|
case 1: askparam (BXP_LOG_FILENAME); break;
|
2002-06-26 18:42:35 +04:00
|
|
|
|
case 2: askparam (BXP_LOG_PREFIX); break;
|
2002-12-03 00:26:05 +03:00
|
|
|
|
case 3: askparam (BXP_DEBUGGER_LOG_FILENAME); break;
|
|
|
|
|
case 4: bx_log_options (0); break;
|
|
|
|
|
case 5: bx_log_options (1); break;
|
2006-02-18 19:53:18 +03:00
|
|
|
|
case 6: do_menu2("cpu", NULL); break;
|
2006-02-19 18:43:03 +03:00
|
|
|
|
case 7: do_menu(BXP_MENU_MEMORY); break;
|
|
|
|
|
case 8: do_menu2("clock_cmos", NULL); break;
|
2006-02-20 00:35:50 +03:00
|
|
|
|
case 9: do_menu2("pci", NULL); break;
|
2006-02-22 00:35:09 +03:00
|
|
|
|
case 10: do_menu2("display", NULL); break;
|
2006-02-22 22:18:29 +03:00
|
|
|
|
case 11: do_menu2("keyboard_mouse", NULL); break;
|
|
|
|
|
case 12: do_menu(BXP_MENU_DISK); break;
|
2006-03-01 20:14:36 +03:00
|
|
|
|
case 13: do_menu2("ports", NULL); break;
|
2006-03-02 23:13:14 +03:00
|
|
|
|
case 14: do_menu2("network", NULL); break;
|
2006-03-03 23:29:50 +03:00
|
|
|
|
case 15: do_menu2(BXPN_SB16, NULL); break;
|
2006-03-04 15:43:47 +03:00
|
|
|
|
case 16: do_menu2("misc", NULL); break;
|
2001-06-10 00:01:12 +04:00
|
|
|
|
default: BAD_OPTION(menu, choice);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
- I've added lots of comments in siminterface.h, and tried to clean up
the terminology a bit. In particular, the term "gui" has started
to mean different things in different contexts, so I've defined
some more specific names for the parts of the user interface, and
updated comments and some variable names to reflect it. See
siminterface.h for a more complete description of all of these.
VGAW: VGA display window and toolbar buttons, the traditional Bochs
display which is ported to X, win32, MacOS X, etc. Implemented
in gui/gui.* and platform dependent gui/*.cc files.
CI: configuration interface that lets the user change settings such
as floppy disk image, ne2k settings, log options. The CI consists
of two parts: configuration user interface (CUI) which does the
actual rendering to the screen and handles key/mouse/menu events,
and the siminterface object.
CUI: configuration user interface. This handles the user interactions
that allow the user to configure Bochs. To actually change any
values it talks to the siminterface object. One implementation of
the CUI is the text-mode menus in gui/control.cc. Another
implementation is (will be) the wxWindows menus and dialogs in
gui/wxmain.cc.
siminterface: the glue between the CUI and the simulation code,
accessible throughout the code by the global variable
bx_simulator_interface_c *SIM;
Among other things, siminterface methods allow the simulator to ask the
CUI to display things or ask for user input, and allows the CUI
to query and modify variables in the simulation code.
GUI: Literally, "graphical user interface". Until the configuration menus
and wxWindows came along, everyone understood that "gui" referred to the
VGA display window and the toolbar buttons because that's all there
was. Now that we have the wxWindows code, which implements both the VGAW
and the CUI, while all other platforms implement only the VGAW, it's not
so clear. So, I'm trying to use VGAW, CI, and CUI consistently since
they are more specific.
control panel: This has been used as another name for the configuration
interface. "control panel" is also somewhat unspecific and it sounds
like it would be graphical with buttons and sliders, but our text-mode
thing is not graphical at all. I've replaced "control panel" with
"configuration interface" wherever I could find it. In configure script,
the --disable-control-panel option is still supported, but it politely
suggests that you use --disable-config-interface instead.
- clean up comments in siminterface,wx* code
- add comments and examples for bx_param_* and BxEvents
- remove some obsolete stuff: notify_*_args,
bx_simulator_interface_c::[sg]et_enabled() methods
- in siminterface.cc, move a few bx_real_sim_c methods to where they belong,
with the rest of the methods. No changes to the actual methods.
- remove some DOS ^M's which crept in and confused my editor.
2002-08-26 19:31:23 +04:00
|
|
|
|
case BX_CI_RUNTIME:
|
2006-02-26 22:11:20 +03:00
|
|
|
|
{
|
|
|
|
|
bx_list_c *cdromop = NULL;
|
|
|
|
|
char pname[80];
|
2004-02-01 04:40:14 +03:00
|
|
|
|
#ifdef WIN32
|
2006-02-26 22:11:20 +03:00
|
|
|
|
choice = RuntimeOptionsDialog();
|
2004-02-01 04:40:14 +03:00
|
|
|
|
#else
|
2006-02-26 22:11:20 +03:00
|
|
|
|
char prompt[1024];
|
|
|
|
|
build_runtime_options_prompt(runtime_menu_prompt, prompt, 1024);
|
|
|
|
|
if (ask_uint(prompt, 1, BX_CI_RT_QUIT, BX_CI_RT_CONT, &choice, 10) < 0) return -1;
|
2004-02-01 04:40:14 +03:00
|
|
|
|
#endif
|
2006-02-26 22:11:20 +03:00
|
|
|
|
switch (choice) {
|
|
|
|
|
case BX_CI_RT_FLOPPYA:
|
|
|
|
|
if (SIM->get_param_enum(BXPN_FLOPPYA_DEVTYPE)->get() != BX_FLOPPY_NONE) do_menu2(BXPN_FLOPPYA, NULL);
|
|
|
|
|
break;
|
|
|
|
|
case BX_CI_RT_FLOPPYB:
|
|
|
|
|
if (SIM->get_param_enum(BXPN_FLOPPYB_DEVTYPE)->get() != BX_FLOPPY_NONE) do_menu2(BXPN_FLOPPYB, NULL);
|
|
|
|
|
break;
|
|
|
|
|
case BX_CI_RT_CDROM1:
|
|
|
|
|
case BX_CI_RT_CDROM2:
|
|
|
|
|
case BX_CI_RT_CDROM3:
|
|
|
|
|
case BX_CI_RT_CDROM4:
|
|
|
|
|
int device;
|
|
|
|
|
if (SIM->get_cdrom_options(choice - BX_CI_RT_CDROM1, &cdromop, &device) && SIM->get_param_bool("present", cdromop)->get()) {
|
|
|
|
|
// disable type selection
|
|
|
|
|
SIM->get_param("type", cdromop)->set_enabled(0);
|
|
|
|
|
SIM->get_param("model", cdromop)->set_enabled(0);
|
|
|
|
|
SIM->get_param("biosdetect", cdromop)->set_enabled(0);
|
|
|
|
|
cdromop->get_param_path(pname, 80);
|
|
|
|
|
do_menu2(pname, NULL);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case BX_CI_RT_IPS:
|
|
|
|
|
// not implemented yet because I would have to mess with
|
|
|
|
|
// resetting timers and pits and everything on the fly.
|
|
|
|
|
// askparam (BXP_IPS);
|
|
|
|
|
break;
|
|
|
|
|
case BX_CI_RT_LOGOPTS1: bx_log_options (0); break;
|
|
|
|
|
case BX_CI_RT_LOGOPTS2: bx_log_options (1); break;
|
|
|
|
|
case BX_CI_RT_INST_TR: NOT_IMPLEMENTED (choice); break;
|
|
|
|
|
case BX_CI_RT_MISC: do_menu (BXP_MENU_RUNTIME); break;
|
|
|
|
|
case BX_CI_RT_CONT: fprintf (stderr, "Continuing simulation\n"); return 0;
|
|
|
|
|
case BX_CI_RT_QUIT:
|
|
|
|
|
fprintf (stderr, "You chose quit on the configuration interface.\n");
|
|
|
|
|
bx_user_quit = 1;
|
|
|
|
|
SIM->quit_sim (1);
|
|
|
|
|
return -1;
|
|
|
|
|
default: fprintf (stderr, "Menu choice %d not implemented.\n", choice);
|
|
|
|
|
}
|
2001-06-10 00:01:12 +04:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
default:
|
2003-08-25 22:36:09 +04:00
|
|
|
|
fprintf (stderr, "Unknown config interface menu type.\n");
|
- I've added lots of comments in siminterface.h, and tried to clean up
the terminology a bit. In particular, the term "gui" has started
to mean different things in different contexts, so I've defined
some more specific names for the parts of the user interface, and
updated comments and some variable names to reflect it. See
siminterface.h for a more complete description of all of these.
VGAW: VGA display window and toolbar buttons, the traditional Bochs
display which is ported to X, win32, MacOS X, etc. Implemented
in gui/gui.* and platform dependent gui/*.cc files.
CI: configuration interface that lets the user change settings such
as floppy disk image, ne2k settings, log options. The CI consists
of two parts: configuration user interface (CUI) which does the
actual rendering to the screen and handles key/mouse/menu events,
and the siminterface object.
CUI: configuration user interface. This handles the user interactions
that allow the user to configure Bochs. To actually change any
values it talks to the siminterface object. One implementation of
the CUI is the text-mode menus in gui/control.cc. Another
implementation is (will be) the wxWindows menus and dialogs in
gui/wxmain.cc.
siminterface: the glue between the CUI and the simulation code,
accessible throughout the code by the global variable
bx_simulator_interface_c *SIM;
Among other things, siminterface methods allow the simulator to ask the
CUI to display things or ask for user input, and allows the CUI
to query and modify variables in the simulation code.
GUI: Literally, "graphical user interface". Until the configuration menus
and wxWindows came along, everyone understood that "gui" referred to the
VGA display window and the toolbar buttons because that's all there
was. Now that we have the wxWindows code, which implements both the VGAW
and the CUI, while all other platforms implement only the VGAW, it's not
so clear. So, I'm trying to use VGAW, CI, and CUI consistently since
they are more specific.
control panel: This has been used as another name for the configuration
interface. "control panel" is also somewhat unspecific and it sounds
like it would be graphical with buttons and sliders, but our text-mode
thing is not graphical at all. I've replaced "control panel" with
"configuration interface" wherever I could find it. In configure script,
the --disable-control-panel option is still supported, but it politely
suggests that you use --disable-config-interface instead.
- clean up comments in siminterface,wx* code
- add comments and examples for bx_param_* and BxEvents
- remove some obsolete stuff: notify_*_args,
bx_simulator_interface_c::[sg]et_enabled() methods
- in siminterface.cc, move a few bx_real_sim_c methods to where they belong,
with the rest of the methods. No changes to the actual methods.
- remove some DOS ^M's which crept in and confused my editor.
2002-08-26 19:31:23 +04:00
|
|
|
|
assert (menu >=0 && menu < BX_CI_N_MENUS);
|
2001-06-10 00:01:12 +04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2001-06-08 00:42:00 +04:00
|
|
|
|
|
|
|
|
|
static void bx_print_log_action_table ()
|
|
|
|
|
{
|
|
|
|
|
// just try to print all the prefixes first.
|
|
|
|
|
fprintf (stderr, "Current log settings:\n");
|
2003-07-28 17:55:53 +04:00
|
|
|
|
fprintf (stderr, " Debug Info Error Panic Pass\n");
|
|
|
|
|
fprintf (stderr, "ID Device Action Action Action Action Action\n");
|
|
|
|
|
fprintf (stderr, "---- --------- --------- --------- ---------- ---------- ----------\n");
|
2001-06-12 00:51:15 +04:00
|
|
|
|
int i, j, imax=SIM->get_n_log_modules ();
|
|
|
|
|
for (i=0; i<imax; i++) {
|
2003-07-28 17:55:53 +04:00
|
|
|
|
if (strcmp(SIM->get_prefix(i), "[ ]")) {
|
|
|
|
|
fprintf (stderr, "%3d. %s ", i, SIM->get_prefix (i));
|
|
|
|
|
for (j=0; j<SIM->get_max_log_level (); j++) {
|
|
|
|
|
fprintf (stderr, "%10s ", SIM->get_action_name (SIM->get_log_action (i, j)));
|
|
|
|
|
}
|
|
|
|
|
fprintf (stderr, "\n");
|
2001-06-08 00:42:00 +04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static char *log_options_prompt1 = "Enter the ID of the device to edit, or -1 to return: [-1] ";
|
2001-06-13 12:14:49 +04:00
|
|
|
|
static char *log_level_choices[] = { "ignore", "report", "ask", "fatal", "no change" };
|
|
|
|
|
static int log_level_n_choices_normal = 4;
|
2001-06-08 00:42:00 +04:00
|
|
|
|
|
2001-06-10 00:01:12 +04:00
|
|
|
|
void bx_log_options (int individual)
|
2001-06-08 00:42:00 +04:00
|
|
|
|
{
|
2001-06-10 00:01:12 +04:00
|
|
|
|
if (individual) {
|
|
|
|
|
int done = 0;
|
|
|
|
|
while (!done) {
|
|
|
|
|
bx_print_log_action_table ();
|
2001-06-18 18:11:55 +04:00
|
|
|
|
Bit32s id, level, action;
|
|
|
|
|
Bit32s maxid = SIM->get_n_log_modules ();
|
2001-06-10 00:01:12 +04:00
|
|
|
|
if (ask_int (log_options_prompt1, -1, maxid-1, -1, &id) < 0)
|
|
|
|
|
return;
|
|
|
|
|
if (id < 0) return;
|
|
|
|
|
fprintf (stderr, "Editing log options for the device %s\n", SIM->get_prefix (id));
|
|
|
|
|
for (level=0; level<SIM->get_max_log_level (); level++) {
|
|
|
|
|
char prompt[1024];
|
|
|
|
|
int default_action = SIM->get_log_action (id, level);
|
|
|
|
|
sprintf (prompt, "Enter action for %s event: [%s] ", SIM->get_log_level_name (level), SIM->get_action_name(default_action));
|
|
|
|
|
// don't show the no change choice (choices=3)
|
2001-06-13 12:14:49 +04:00
|
|
|
|
if (ask_menu (prompt, log_level_n_choices_normal, log_level_choices, default_action, &action)<0)
|
2001-06-10 00:01:12 +04:00
|
|
|
|
return;
|
|
|
|
|
SIM->set_log_action (id, level, action);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
// provide an easy way to set log options for all devices at once
|
2001-06-08 00:42:00 +04:00
|
|
|
|
bx_print_log_action_table ();
|
2001-06-10 00:01:12 +04:00
|
|
|
|
for (int level=0; level<SIM->get_max_log_level (); level++) {
|
2001-06-08 00:42:00 +04:00
|
|
|
|
char prompt[1024];
|
2001-06-10 00:01:12 +04:00
|
|
|
|
int action, default_action = 3; // default to no change
|
|
|
|
|
sprintf (prompt, "Enter action for %s event on all devices: [no change] ", SIM->get_log_level_name (level));
|
|
|
|
|
// do show the no change choice (choices=4)
|
2001-06-13 12:14:49 +04:00
|
|
|
|
if (ask_menu (prompt, log_level_n_choices_normal+1, log_level_choices, default_action, &action)<0)
|
2001-06-08 00:42:00 +04:00
|
|
|
|
return;
|
2001-06-10 00:01:12 +04:00
|
|
|
|
if (action < 3) {
|
2002-09-20 22:14:27 +04:00
|
|
|
|
SIM->set_default_log_action (level, action);
|
|
|
|
|
SIM->set_log_action (-1, level, action);
|
2001-06-10 00:01:12 +04:00
|
|
|
|
}
|
2001-06-08 00:42:00 +04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2001-06-10 00:01:12 +04:00
|
|
|
|
|
|
|
|
|
int bx_read_rc (char *rc)
|
|
|
|
|
{
|
|
|
|
|
if (rc && SIM->read_rc (rc) >= 0) return 0;
|
- I've added lots of comments in siminterface.h, and tried to clean up
the terminology a bit. In particular, the term "gui" has started
to mean different things in different contexts, so I've defined
some more specific names for the parts of the user interface, and
updated comments and some variable names to reflect it. See
siminterface.h for a more complete description of all of these.
VGAW: VGA display window and toolbar buttons, the traditional Bochs
display which is ported to X, win32, MacOS X, etc. Implemented
in gui/gui.* and platform dependent gui/*.cc files.
CI: configuration interface that lets the user change settings such
as floppy disk image, ne2k settings, log options. The CI consists
of two parts: configuration user interface (CUI) which does the
actual rendering to the screen and handles key/mouse/menu events,
and the siminterface object.
CUI: configuration user interface. This handles the user interactions
that allow the user to configure Bochs. To actually change any
values it talks to the siminterface object. One implementation of
the CUI is the text-mode menus in gui/control.cc. Another
implementation is (will be) the wxWindows menus and dialogs in
gui/wxmain.cc.
siminterface: the glue between the CUI and the simulation code,
accessible throughout the code by the global variable
bx_simulator_interface_c *SIM;
Among other things, siminterface methods allow the simulator to ask the
CUI to display things or ask for user input, and allows the CUI
to query and modify variables in the simulation code.
GUI: Literally, "graphical user interface". Until the configuration menus
and wxWindows came along, everyone understood that "gui" referred to the
VGA display window and the toolbar buttons because that's all there
was. Now that we have the wxWindows code, which implements both the VGAW
and the CUI, while all other platforms implement only the VGAW, it's not
so clear. So, I'm trying to use VGAW, CI, and CUI consistently since
they are more specific.
control panel: This has been used as another name for the configuration
interface. "control panel" is also somewhat unspecific and it sounds
like it would be graphical with buttons and sliders, but our text-mode
thing is not graphical at all. I've replaced "control panel" with
"configuration interface" wherever I could find it. In configure script,
the --disable-control-panel option is still supported, but it politely
suggests that you use --disable-config-interface instead.
- clean up comments in siminterface,wx* code
- add comments and examples for bx_param_* and BxEvents
- remove some obsolete stuff: notify_*_args,
bx_simulator_interface_c::[sg]et_enabled() methods
- in siminterface.cc, move a few bx_real_sim_c methods to where they belong,
with the rest of the methods. No changes to the actual methods.
- remove some DOS ^M's which crept in and confused my editor.
2002-08-26 19:31:23 +04:00
|
|
|
|
char oldrc[CI_PATH_LENGTH];
|
|
|
|
|
if (SIM->get_default_rc (oldrc, CI_PATH_LENGTH) < 0)
|
2001-06-11 10:35:18 +04:00
|
|
|
|
strcpy (oldrc, "none");
|
- I've added lots of comments in siminterface.h, and tried to clean up
the terminology a bit. In particular, the term "gui" has started
to mean different things in different contexts, so I've defined
some more specific names for the parts of the user interface, and
updated comments and some variable names to reflect it. See
siminterface.h for a more complete description of all of these.
VGAW: VGA display window and toolbar buttons, the traditional Bochs
display which is ported to X, win32, MacOS X, etc. Implemented
in gui/gui.* and platform dependent gui/*.cc files.
CI: configuration interface that lets the user change settings such
as floppy disk image, ne2k settings, log options. The CI consists
of two parts: configuration user interface (CUI) which does the
actual rendering to the screen and handles key/mouse/menu events,
and the siminterface object.
CUI: configuration user interface. This handles the user interactions
that allow the user to configure Bochs. To actually change any
values it talks to the siminterface object. One implementation of
the CUI is the text-mode menus in gui/control.cc. Another
implementation is (will be) the wxWindows menus and dialogs in
gui/wxmain.cc.
siminterface: the glue between the CUI and the simulation code,
accessible throughout the code by the global variable
bx_simulator_interface_c *SIM;
Among other things, siminterface methods allow the simulator to ask the
CUI to display things or ask for user input, and allows the CUI
to query and modify variables in the simulation code.
GUI: Literally, "graphical user interface". Until the configuration menus
and wxWindows came along, everyone understood that "gui" referred to the
VGA display window and the toolbar buttons because that's all there
was. Now that we have the wxWindows code, which implements both the VGAW
and the CUI, while all other platforms implement only the VGAW, it's not
so clear. So, I'm trying to use VGAW, CI, and CUI consistently since
they are more specific.
control panel: This has been used as another name for the configuration
interface. "control panel" is also somewhat unspecific and it sounds
like it would be graphical with buttons and sliders, but our text-mode
thing is not graphical at all. I've replaced "control panel" with
"configuration interface" wherever I could find it. In configure script,
the --disable-control-panel option is still supported, but it politely
suggests that you use --disable-config-interface instead.
- clean up comments in siminterface,wx* code
- add comments and examples for bx_param_* and BxEvents
- remove some obsolete stuff: notify_*_args,
bx_simulator_interface_c::[sg]et_enabled() methods
- in siminterface.cc, move a few bx_real_sim_c methods to where they belong,
with the rest of the methods. No changes to the actual methods.
- remove some DOS ^M's which crept in and confused my editor.
2002-08-26 19:31:23 +04:00
|
|
|
|
char newrc[CI_PATH_LENGTH];
|
2001-06-10 00:01:12 +04:00
|
|
|
|
while (1) {
|
2001-06-11 10:35:18 +04:00
|
|
|
|
if (ask_string ("\nWhat is the configuration file name?\nTo cancel, type 'none'. [%s] ", oldrc, newrc) < 0) return -1;
|
2002-08-07 11:24:32 +04:00
|
|
|
|
if (!strcmp (newrc, "none")) return -1;
|
2001-06-10 00:01:12 +04:00
|
|
|
|
if (SIM->read_rc (newrc) >= 0) return 0;
|
|
|
|
|
fprintf (stderr, "The file '%s' could not be found.\n", newrc);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2001-06-11 10:35:18 +04:00
|
|
|
|
int bx_write_rc (char *rc)
|
|
|
|
|
{
|
- I've added lots of comments in siminterface.h, and tried to clean up
the terminology a bit. In particular, the term "gui" has started
to mean different things in different contexts, so I've defined
some more specific names for the parts of the user interface, and
updated comments and some variable names to reflect it. See
siminterface.h for a more complete description of all of these.
VGAW: VGA display window and toolbar buttons, the traditional Bochs
display which is ported to X, win32, MacOS X, etc. Implemented
in gui/gui.* and platform dependent gui/*.cc files.
CI: configuration interface that lets the user change settings such
as floppy disk image, ne2k settings, log options. The CI consists
of two parts: configuration user interface (CUI) which does the
actual rendering to the screen and handles key/mouse/menu events,
and the siminterface object.
CUI: configuration user interface. This handles the user interactions
that allow the user to configure Bochs. To actually change any
values it talks to the siminterface object. One implementation of
the CUI is the text-mode menus in gui/control.cc. Another
implementation is (will be) the wxWindows menus and dialogs in
gui/wxmain.cc.
siminterface: the glue between the CUI and the simulation code,
accessible throughout the code by the global variable
bx_simulator_interface_c *SIM;
Among other things, siminterface methods allow the simulator to ask the
CUI to display things or ask for user input, and allows the CUI
to query and modify variables in the simulation code.
GUI: Literally, "graphical user interface". Until the configuration menus
and wxWindows came along, everyone understood that "gui" referred to the
VGA display window and the toolbar buttons because that's all there
was. Now that we have the wxWindows code, which implements both the VGAW
and the CUI, while all other platforms implement only the VGAW, it's not
so clear. So, I'm trying to use VGAW, CI, and CUI consistently since
they are more specific.
control panel: This has been used as another name for the configuration
interface. "control panel" is also somewhat unspecific and it sounds
like it would be graphical with buttons and sliders, but our text-mode
thing is not graphical at all. I've replaced "control panel" with
"configuration interface" wherever I could find it. In configure script,
the --disable-control-panel option is still supported, but it politely
suggests that you use --disable-config-interface instead.
- clean up comments in siminterface,wx* code
- add comments and examples for bx_param_* and BxEvents
- remove some obsolete stuff: notify_*_args,
bx_simulator_interface_c::[sg]et_enabled() methods
- in siminterface.cc, move a few bx_real_sim_c methods to where they belong,
with the rest of the methods. No changes to the actual methods.
- remove some DOS ^M's which crept in and confused my editor.
2002-08-26 19:31:23 +04:00
|
|
|
|
char oldrc[CI_PATH_LENGTH], newrc[CI_PATH_LENGTH];
|
2001-06-11 10:35:18 +04:00
|
|
|
|
if (rc == NULL) {
|
- I've added lots of comments in siminterface.h, and tried to clean up
the terminology a bit. In particular, the term "gui" has started
to mean different things in different contexts, so I've defined
some more specific names for the parts of the user interface, and
updated comments and some variable names to reflect it. See
siminterface.h for a more complete description of all of these.
VGAW: VGA display window and toolbar buttons, the traditional Bochs
display which is ported to X, win32, MacOS X, etc. Implemented
in gui/gui.* and platform dependent gui/*.cc files.
CI: configuration interface that lets the user change settings such
as floppy disk image, ne2k settings, log options. The CI consists
of two parts: configuration user interface (CUI) which does the
actual rendering to the screen and handles key/mouse/menu events,
and the siminterface object.
CUI: configuration user interface. This handles the user interactions
that allow the user to configure Bochs. To actually change any
values it talks to the siminterface object. One implementation of
the CUI is the text-mode menus in gui/control.cc. Another
implementation is (will be) the wxWindows menus and dialogs in
gui/wxmain.cc.
siminterface: the glue between the CUI and the simulation code,
accessible throughout the code by the global variable
bx_simulator_interface_c *SIM;
Among other things, siminterface methods allow the simulator to ask the
CUI to display things or ask for user input, and allows the CUI
to query and modify variables in the simulation code.
GUI: Literally, "graphical user interface". Until the configuration menus
and wxWindows came along, everyone understood that "gui" referred to the
VGA display window and the toolbar buttons because that's all there
was. Now that we have the wxWindows code, which implements both the VGAW
and the CUI, while all other platforms implement only the VGAW, it's not
so clear. So, I'm trying to use VGAW, CI, and CUI consistently since
they are more specific.
control panel: This has been used as another name for the configuration
interface. "control panel" is also somewhat unspecific and it sounds
like it would be graphical with buttons and sliders, but our text-mode
thing is not graphical at all. I've replaced "control panel" with
"configuration interface" wherever I could find it. In configure script,
the --disable-control-panel option is still supported, but it politely
suggests that you use --disable-config-interface instead.
- clean up comments in siminterface,wx* code
- add comments and examples for bx_param_* and BxEvents
- remove some obsolete stuff: notify_*_args,
bx_simulator_interface_c::[sg]et_enabled() methods
- in siminterface.cc, move a few bx_real_sim_c methods to where they belong,
with the rest of the methods. No changes to the actual methods.
- remove some DOS ^M's which crept in and confused my editor.
2002-08-26 19:31:23 +04:00
|
|
|
|
if (SIM->get_default_rc (oldrc, CI_PATH_LENGTH) < 0)
|
2001-06-11 10:35:18 +04:00
|
|
|
|
strcpy (oldrc, "none");
|
|
|
|
|
} else {
|
- I've added lots of comments in siminterface.h, and tried to clean up
the terminology a bit. In particular, the term "gui" has started
to mean different things in different contexts, so I've defined
some more specific names for the parts of the user interface, and
updated comments and some variable names to reflect it. See
siminterface.h for a more complete description of all of these.
VGAW: VGA display window and toolbar buttons, the traditional Bochs
display which is ported to X, win32, MacOS X, etc. Implemented
in gui/gui.* and platform dependent gui/*.cc files.
CI: configuration interface that lets the user change settings such
as floppy disk image, ne2k settings, log options. The CI consists
of two parts: configuration user interface (CUI) which does the
actual rendering to the screen and handles key/mouse/menu events,
and the siminterface object.
CUI: configuration user interface. This handles the user interactions
that allow the user to configure Bochs. To actually change any
values it talks to the siminterface object. One implementation of
the CUI is the text-mode menus in gui/control.cc. Another
implementation is (will be) the wxWindows menus and dialogs in
gui/wxmain.cc.
siminterface: the glue between the CUI and the simulation code,
accessible throughout the code by the global variable
bx_simulator_interface_c *SIM;
Among other things, siminterface methods allow the simulator to ask the
CUI to display things or ask for user input, and allows the CUI
to query and modify variables in the simulation code.
GUI: Literally, "graphical user interface". Until the configuration menus
and wxWindows came along, everyone understood that "gui" referred to the
VGA display window and the toolbar buttons because that's all there
was. Now that we have the wxWindows code, which implements both the VGAW
and the CUI, while all other platforms implement only the VGAW, it's not
so clear. So, I'm trying to use VGAW, CI, and CUI consistently since
they are more specific.
control panel: This has been used as another name for the configuration
interface. "control panel" is also somewhat unspecific and it sounds
like it would be graphical with buttons and sliders, but our text-mode
thing is not graphical at all. I've replaced "control panel" with
"configuration interface" wherever I could find it. In configure script,
the --disable-control-panel option is still supported, but it politely
suggests that you use --disable-config-interface instead.
- clean up comments in siminterface,wx* code
- add comments and examples for bx_param_* and BxEvents
- remove some obsolete stuff: notify_*_args,
bx_simulator_interface_c::[sg]et_enabled() methods
- in siminterface.cc, move a few bx_real_sim_c methods to where they belong,
with the rest of the methods. No changes to the actual methods.
- remove some DOS ^M's which crept in and confused my editor.
2002-08-26 19:31:23 +04:00
|
|
|
|
strncpy (oldrc, rc, CI_PATH_LENGTH);
|
2001-06-11 10:35:18 +04:00
|
|
|
|
}
|
|
|
|
|
while (1) {
|
|
|
|
|
if (ask_string ("Save configuration to what file? To cancel, type 'none'.\n[%s] ", oldrc, newrc) < 0) return -1;
|
|
|
|
|
if (!strcmp (newrc, "none")) return 0;
|
|
|
|
|
// try with overwrite off first
|
|
|
|
|
int status = SIM->write_rc (newrc, 0);
|
|
|
|
|
if (status >= 0) {
|
|
|
|
|
fprintf (stderr, "Wrote configuration to '%s'.\n", newrc);
|
|
|
|
|
return 0;
|
|
|
|
|
} else if (status == -2) {
|
|
|
|
|
// return code -2 indicates the file already exists, and overwrite
|
|
|
|
|
// confirmation is required.
|
2001-06-18 18:11:55 +04:00
|
|
|
|
Bit32u overwrite = 0;
|
2001-06-11 10:35:18 +04:00
|
|
|
|
char prompt[256];
|
|
|
|
|
sprintf (prompt, "Configuration file '%s' already exists. Overwrite it? [no] ", newrc);
|
|
|
|
|
if (ask_yn (prompt, 0, &overwrite) < 0) return -1;
|
|
|
|
|
if (!overwrite) continue; // if "no", start loop over, asking for a different file
|
|
|
|
|
// they confirmed, so try again with overwrite bit set
|
|
|
|
|
if (SIM->write_rc (newrc, 1) >= 0) {
|
|
|
|
|
fprintf (stderr, "Overwriting existing configuration '%s'.\n", newrc);
|
|
|
|
|
return 0;
|
|
|
|
|
} else {
|
|
|
|
|
fprintf (stderr, "Write failed to '%s'.\n", newrc);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2001-10-07 04:35:35 +04:00
|
|
|
|
char *log_action_ask_choices[] = { "cont", "alwayscont", "die", "abort", "debug" };
|
2004-01-17 11:36:29 +03:00
|
|
|
|
int log_action_n_choices = 4 + (BX_DEBUGGER||BX_GDBSTUB?1:0);
|
2001-06-11 18:03:35 +04:00
|
|
|
|
|
2002-04-18 04:22:20 +04:00
|
|
|
|
BxEvent *
|
- I've added lots of comments in siminterface.h, and tried to clean up
the terminology a bit. In particular, the term "gui" has started
to mean different things in different contexts, so I've defined
some more specific names for the parts of the user interface, and
updated comments and some variable names to reflect it. See
siminterface.h for a more complete description of all of these.
VGAW: VGA display window and toolbar buttons, the traditional Bochs
display which is ported to X, win32, MacOS X, etc. Implemented
in gui/gui.* and platform dependent gui/*.cc files.
CI: configuration interface that lets the user change settings such
as floppy disk image, ne2k settings, log options. The CI consists
of two parts: configuration user interface (CUI) which does the
actual rendering to the screen and handles key/mouse/menu events,
and the siminterface object.
CUI: configuration user interface. This handles the user interactions
that allow the user to configure Bochs. To actually change any
values it talks to the siminterface object. One implementation of
the CUI is the text-mode menus in gui/control.cc. Another
implementation is (will be) the wxWindows menus and dialogs in
gui/wxmain.cc.
siminterface: the glue between the CUI and the simulation code,
accessible throughout the code by the global variable
bx_simulator_interface_c *SIM;
Among other things, siminterface methods allow the simulator to ask the
CUI to display things or ask for user input, and allows the CUI
to query and modify variables in the simulation code.
GUI: Literally, "graphical user interface". Until the configuration menus
and wxWindows came along, everyone understood that "gui" referred to the
VGA display window and the toolbar buttons because that's all there
was. Now that we have the wxWindows code, which implements both the VGAW
and the CUI, while all other platforms implement only the VGAW, it's not
so clear. So, I'm trying to use VGAW, CI, and CUI consistently since
they are more specific.
control panel: This has been used as another name for the configuration
interface. "control panel" is also somewhat unspecific and it sounds
like it would be graphical with buttons and sliders, but our text-mode
thing is not graphical at all. I've replaced "control panel" with
"configuration interface" wherever I could find it. In configure script,
the --disable-control-panel option is still supported, but it politely
suggests that you use --disable-config-interface instead.
- clean up comments in siminterface,wx* code
- add comments and examples for bx_param_* and BxEvents
- remove some obsolete stuff: notify_*_args,
bx_simulator_interface_c::[sg]et_enabled() methods
- in siminterface.cc, move a few bx_real_sim_c methods to where they belong,
with the rest of the methods. No changes to the actual methods.
- remove some DOS ^M's which crept in and confused my editor.
2002-08-26 19:31:23 +04:00
|
|
|
|
config_interface_notify_callback (void *unused, BxEvent *event)
|
2001-06-11 18:03:35 +04:00
|
|
|
|
{
|
2002-04-18 04:22:20 +04:00
|
|
|
|
event->retcode = -1;
|
|
|
|
|
switch (event->type)
|
2001-06-11 18:03:35 +04:00
|
|
|
|
{
|
2002-04-18 04:22:20 +04:00
|
|
|
|
case BX_SYNC_EVT_TICK:
|
|
|
|
|
event->retcode = 0;
|
|
|
|
|
return event;
|
|
|
|
|
case BX_SYNC_EVT_ASK_PARAM:
|
2002-10-25 01:07:56 +04:00
|
|
|
|
event->u.param.param->text_ask (stdin, stderr);
|
2002-04-18 04:22:20 +04:00
|
|
|
|
return event;
|
- use setjmp() and longjmp() to quit the simulation thread cleanly.
I use setjmp() to save the context just before calling
bx_continue_after_config_interface(). Then, in
bx_real_sim_c:quit_sim, I use longjmp() to jump back to that context.
This happens in main.cc and in gui/wxmain.cc (wxWindows only).
I haven't tested with the debugger yet. Possibly with debugger
the quit longjmp() should jump back to the debugger prompt loop
instead of actually quitting the program.
- clean up BX_ASYNC_EVT_LOG_MSG implementation by creating a different,
synchronous event called BX_SYNC_EVT_LOG_ASK. The async event
could be used to simply tell the CI that an event has occurred,
for example if the user wanted to view the events on screen
(not implemented). The sync event is used when you want the user
to respond before the simulation can continue, such as a for the
"panic=ask" behavior.
- in wxmain.cc, move the updates to the Start,Stop,Pause,Resume menu
items into a separate method simStatusChanged(). This makes the code that
does important stuff more readable.
- remove wxMutexGuiEnter()/Leave() from MyFrame::OnSim2CuiEvent().
This method is an event handler called in the gui thread, so it
already has the gui lock. This call caused thread lock on my linux
box.
2002-08-27 22:11:13 +04:00
|
|
|
|
case BX_SYNC_EVT_LOG_ASK:
|
2001-06-11 18:03:35 +04:00
|
|
|
|
{
|
2002-04-18 04:22:20 +04:00
|
|
|
|
int level = event->u.logmsg.level;
|
2001-06-11 18:03:35 +04:00
|
|
|
|
fprintf (stderr, "========================================================================\n");
|
|
|
|
|
fprintf (stderr, "Event type: %s\n", SIM->get_log_level_name (level));
|
2002-04-18 04:22:20 +04:00
|
|
|
|
fprintf (stderr, "Device: %s\n", event->u.logmsg.prefix);
|
|
|
|
|
fprintf (stderr, "Message: %s\n\n", event->u.logmsg.msg);
|
2001-06-11 18:07:54 +04:00
|
|
|
|
fprintf (stderr, "A %s has occurred. Do you want to:\n", SIM->get_log_level_name (level));
|
2001-06-11 18:03:35 +04:00
|
|
|
|
fprintf (stderr, " cont - continue execution\n");
|
|
|
|
|
fprintf (stderr, " alwayscont - continue execution, and don't ask again.\n");
|
2002-04-18 04:22:20 +04:00
|
|
|
|
fprintf (stderr, " This affects only %s events from device %s\n", SIM->get_log_level_name (level), event->u.logmsg.prefix);
|
2001-06-11 18:03:35 +04:00
|
|
|
|
fprintf (stderr, " die - stop execution now\n");
|
2001-10-07 04:35:35 +04:00
|
|
|
|
fprintf (stderr, " abort - dump core %s\n",
|
|
|
|
|
BX_HAVE_ABORT ? "" : "(Disabled)");
|
2001-10-06 09:51:34 +04:00
|
|
|
|
#if BX_DEBUGGER
|
2001-10-06 12:45:18 +04:00
|
|
|
|
fprintf (stderr, " debug - continue and return to bochs debugger\n");
|
2001-10-06 09:51:34 +04:00
|
|
|
|
#endif
|
2004-01-17 11:36:29 +03:00
|
|
|
|
#if BX_GDBSTUB
|
|
|
|
|
fprintf (stderr, " debug - hand control to gdb\n");
|
|
|
|
|
#endif
|
|
|
|
|
|
2001-06-11 18:03:35 +04:00
|
|
|
|
int choice;
|
2001-10-07 04:35:35 +04:00
|
|
|
|
ask:
|
|
|
|
|
if (ask_menu ("Choose one of the actions above: [%s] ",
|
2001-10-06 09:51:34 +04:00
|
|
|
|
log_action_n_choices, log_action_ask_choices, 2, &choice) < 0)
|
2002-04-18 04:22:20 +04:00
|
|
|
|
event->retcode = -1;
|
2001-10-06 09:51:34 +04:00
|
|
|
|
// return 0 for continue, 1 for alwayscontinue, 2 for die, 3 for debug.
|
2003-10-24 19:39:57 +04:00
|
|
|
|
if (!BX_HAVE_ABORT && choice==BX_LOG_ASK_CHOICE_DUMP_CORE) goto ask;
|
2002-04-01 08:12:11 +04:00
|
|
|
|
fflush(stdout);
|
|
|
|
|
fflush(stderr);
|
2002-04-18 04:22:20 +04:00
|
|
|
|
event->retcode = choice;
|
2001-06-11 18:03:35 +04:00
|
|
|
|
}
|
2002-04-18 04:22:20 +04:00
|
|
|
|
return event;
|
- apply a patch I've been working on
- modified files: config.h.in cpu/init.cc debug/dbg_main.cc gui/control.cc
gui/siminterface.cc gui/siminterface.h gui/wxdialog.cc gui/wxdialog.h
gui/wxmain.cc gui/wxmain.h iodev/keyboard.cc
----------------------------------------------------------------------
Patch name: patch.wx-show-cpu2
Author: Bryce Denney
Date: Fri Sep 6 12:13:28 EDT 2002
Description:
Second try at implementing the "Debug:Show Cpu" and "Debug:Show
Keyboard" dialog with values that change as the simulation proceeds.
(Nobody gets to see the first try.) This is the first step toward
making something resembling a wxWindows debugger.
First, variables which are going to be visible in the CI must be
registered as parameters. For some variables, it might be acceptable
to change them from Bit32u into bx_param_num_c and access them only
with set/get methods, but for most variables it would be a horrible
pain and wreck performance.
To deal with this, I introduced the concept of a shadow parameter. A
normal parameter has its value stored inside the struct, but a shadow
parameter has only a pointer to the value. Shadow params allow you to
treat any variable as if it was a parameter, without having to change
its type and access it using get/set methods. Of course, a shadow
param's value is controlled by someone else, so it can change at any
time.
To demonstrate and test the registration of shadow parameters, I
added code in cpu/init.cc to register a few CPU registers and
code in iodev/keyboard.cc to register a few keyboard state values.
Now these parameters are visible in the Debug:Show CPU and
Debug:Show Keyboard dialog boxes.
The Debug:Show* dialog boxes are created by the ParamDialog class,
which already understands how to display each type of parameter,
including the new shadow parameters (because they are just a subclass
of a normal parameter class). I have added a ParamDialog::Refresh()
method, which rereads the value from every parameter that it is
displaying and changes the displayed value. At the moment, in the
Debug:Show CPU dialog, changing the values has no effect. However
this is trivial to add when it's time (just call CommitChanges!). It
wouldn't really make sense to change the values unless you have paused
the simulation, for example when single stepping with the debugger.
The Refresh() method must be called periodically or else the dialog
will show the initial values forever. At the moment, Refresh() is
called when the simulator sends an async event called
BX_ASYNC_EVT_REFRESH, created by a call to SIM->refresh_ci ().
Details:
- implement shadow parameter class for Bit32s, called bx_shadow_num_c.
implement shadow parameter class for Boolean, called bx_shadow_bool_c.
more to follow (I need one for every type!)
- now the simulator thread can request that the config interface refresh
its display. For now, the refresh event causes the CI to check every
parameter it is watching and change the display value. Later, it may
be worth the trouble to keep track of which parameters have actually
changed. Code in the simulator thread calls SIM->refresh_ci(), which
creates an async event called BX_ASYNC_EVT_REFRESH and sends it to
the config interface. When it arrives in the wxWindows gui thread,
it calls RefreshDialogs(), which calls the Refresh() method on any
dialogs that might need it.
- in the debugger, SIM->refresh_ci() is called before every prompt
is printed. Otherwise, the refresh would wait until the next
SIM->periodic(), which might be thousands of cycles. This way,
when you're single stepping, the dialogs update with every step.
- To improve performance, the CI has a flag (MyFrame::WantRefresh())
which tells whether it has any need for refresh events. If no
dialogs are showing that need refresh events, then no event is sent
between threads.
- add a few defaults to the param classes that affect the settings of
newly created parameters. When declaring a lot of params with
similar settings it's more compact to set the default for new params
rather than to change each one separately. default_text_format is
the printf format string for displaying numbers. default_base is
the default base for displaying numbers (0, 16, 2, etc.)
- I added to ParamDialog to make it able to display modeless dialog
boxes such as "Debug:Show CPU". The new Refresh() method queries
all the parameters for their current value and changes the value in
the wxWindows control. The ParamDialog class still needs a little
work; for example, if it's modal it should have Cancel/Ok buttons,
but if it's going to be modeless it should maybe have Apply (commit
any changes) and Close.
2002-09-06 20:43:26 +04:00
|
|
|
|
case BX_ASYNC_EVT_REFRESH:
|
2002-09-26 02:54:23 +04:00
|
|
|
|
case BX_ASYNC_EVT_DBG_MSG:
|
2002-10-25 01:07:56 +04:00
|
|
|
|
// The text mode interface does not use these events, so just ignore
|
|
|
|
|
// them.
|
|
|
|
|
return event;
|
2001-06-11 18:03:35 +04:00
|
|
|
|
default:
|
2002-04-18 04:22:20 +04:00
|
|
|
|
fprintf (stderr, "Control panel: notify callback called with event type %04x\n", event->type);
|
|
|
|
|
return event;
|
2001-06-11 18:03:35 +04:00
|
|
|
|
}
|
2002-04-18 04:22:20 +04:00
|
|
|
|
assert (0); // switch statement should return
|
2001-06-11 18:03:35 +04:00
|
|
|
|
}
|
|
|
|
|
|
- I've added lots of comments in siminterface.h, and tried to clean up
the terminology a bit. In particular, the term "gui" has started
to mean different things in different contexts, so I've defined
some more specific names for the parts of the user interface, and
updated comments and some variable names to reflect it. See
siminterface.h for a more complete description of all of these.
VGAW: VGA display window and toolbar buttons, the traditional Bochs
display which is ported to X, win32, MacOS X, etc. Implemented
in gui/gui.* and platform dependent gui/*.cc files.
CI: configuration interface that lets the user change settings such
as floppy disk image, ne2k settings, log options. The CI consists
of two parts: configuration user interface (CUI) which does the
actual rendering to the screen and handles key/mouse/menu events,
and the siminterface object.
CUI: configuration user interface. This handles the user interactions
that allow the user to configure Bochs. To actually change any
values it talks to the siminterface object. One implementation of
the CUI is the text-mode menus in gui/control.cc. Another
implementation is (will be) the wxWindows menus and dialogs in
gui/wxmain.cc.
siminterface: the glue between the CUI and the simulation code,
accessible throughout the code by the global variable
bx_simulator_interface_c *SIM;
Among other things, siminterface methods allow the simulator to ask the
CUI to display things or ask for user input, and allows the CUI
to query and modify variables in the simulation code.
GUI: Literally, "graphical user interface". Until the configuration menus
and wxWindows came along, everyone understood that "gui" referred to the
VGA display window and the toolbar buttons because that's all there
was. Now that we have the wxWindows code, which implements both the VGAW
and the CUI, while all other platforms implement only the VGAW, it's not
so clear. So, I'm trying to use VGAW, CI, and CUI consistently since
they are more specific.
control panel: This has been used as another name for the configuration
interface. "control panel" is also somewhat unspecific and it sounds
like it would be graphical with buttons and sliders, but our text-mode
thing is not graphical at all. I've replaced "control panel" with
"configuration interface" wherever I could find it. In configure script,
the --disable-control-panel option is still supported, but it politely
suggests that you use --disable-config-interface instead.
- clean up comments in siminterface,wx* code
- add comments and examples for bx_param_* and BxEvents
- remove some obsolete stuff: notify_*_args,
bx_simulator_interface_c::[sg]et_enabled() methods
- in siminterface.cc, move a few bx_real_sim_c methods to where they belong,
with the rest of the methods. No changes to the actual methods.
- remove some DOS ^M's which crept in and confused my editor.
2002-08-26 19:31:23 +04:00
|
|
|
|
void bx_config_interface_init () {
|
|
|
|
|
SIM->set_notify_callback (config_interface_notify_callback, NULL);
|
2001-06-11 18:03:35 +04:00
|
|
|
|
}
|
|
|
|
|
|
2001-06-18 18:11:55 +04:00
|
|
|
|
/////////////////////////////////////////////////////////////////////
|
|
|
|
|
// implement the text_* methods for bx_param types.
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
bx_param_num_c::text_print (FILE *fp)
|
|
|
|
|
{
|
2006-02-19 18:43:03 +03:00
|
|
|
|
if (get_long_format()) {
|
|
|
|
|
fprintf(fp, get_long_format(), get());
|
2001-06-18 18:11:55 +04:00
|
|
|
|
} else {
|
2001-06-21 18:37:55 +04:00
|
|
|
|
char *format = "%s: %d";
|
2001-06-18 18:11:55 +04:00
|
|
|
|
assert (base==10 || base==16);
|
2001-06-21 22:34:50 +04:00
|
|
|
|
if (base==16) format = "%s: 0x%x";
|
2006-02-18 19:53:18 +03:00
|
|
|
|
if (get_label()) {
|
|
|
|
|
fprintf(fp, format, get_label(), get());
|
|
|
|
|
} else {
|
|
|
|
|
fprintf(fp, format, get_name(), get());
|
|
|
|
|
}
|
2001-06-18 18:11:55 +04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2001-06-20 18:01:39 +04:00
|
|
|
|
void
|
|
|
|
|
bx_param_bool_c::text_print (FILE *fp)
|
|
|
|
|
{
|
2006-02-18 19:53:18 +03:00
|
|
|
|
if (get_format()) {
|
|
|
|
|
fprintf(fp, get_format(), get() ? "yes" : "no");
|
2001-06-21 18:37:55 +04:00
|
|
|
|
} else {
|
|
|
|
|
char *format = "%s: %s";
|
2006-02-18 19:53:18 +03:00
|
|
|
|
if (get_label()) {
|
|
|
|
|
fprintf(fp, format, get_label(), get() ? "yes" : "no");
|
|
|
|
|
} else {
|
|
|
|
|
fprintf(fp, format, get_name(), get() ? "yes" : "no");
|
|
|
|
|
}
|
2001-06-21 18:37:55 +04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
bx_param_enum_c::text_print (FILE *fp)
|
|
|
|
|
{
|
2006-02-18 19:53:18 +03:00
|
|
|
|
int n = get();
|
2001-06-21 18:37:55 +04:00
|
|
|
|
assert (n >= min && n <= max);
|
|
|
|
|
char *choice = choices[n - min];
|
2006-02-18 19:53:18 +03:00
|
|
|
|
if (get_format()) {
|
|
|
|
|
fprintf(fp, get_format(), choice);
|
2001-06-20 18:01:39 +04:00
|
|
|
|
} else {
|
2001-06-21 18:37:55 +04:00
|
|
|
|
char *format = "%s: %s";
|
2006-02-18 19:53:18 +03:00
|
|
|
|
if (get_label()) {
|
|
|
|
|
fprintf(fp, format, get_label(), choice);
|
|
|
|
|
} else {
|
|
|
|
|
fprintf(fp, format, get_name(), choice);
|
|
|
|
|
}
|
2001-06-20 18:01:39 +04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2001-06-18 18:11:55 +04:00
|
|
|
|
void
|
|
|
|
|
bx_param_string_c::text_print (FILE *fp)
|
|
|
|
|
{
|
2001-06-21 23:27:05 +04:00
|
|
|
|
char *value = getptr ();
|
|
|
|
|
int opts = options->get ();
|
- fixed up ParamDialog to correctly handle "trees" of parameters. A
bx_list_c can now be displayed as either a wxStaticBox with the
child parameters inside, or as a wxNotebook with each child
parameter in a separate tab. (The children can also be lists of
course.) The default display is the wxStaticBox type, but if you
set the option bit bx_list_c::USE_TAB_WINDOW in the list,
ParamDialog will use the wxNotebook display instead.
- to get the param trees working, I created a new struct
AddParamContext, which is passed to AddParam(). This struct is
critical when AddParam calls itself recursively to display lists
within lists.
- use the wxNotebook display feature for the ATA0,1,2,3 controller
dialog box. Now instead of being hundreds of pixels tall, it is
reasonable height with three different tabs. This fixed bug
#619074: "wx: ATA interface editor too tall" and was the whole
reason I started messing with this at all.
plus some minor cleanups
- when I added the enum constant bx_list_c::USE_TAB_WINDOW, I also
removed the BX_ prefix from all the other enum constants that are
used in parameter options in siminterface.cc. Since these constants
are enums within a class, there is no possibility of namespace
conflicts so the prefix is not needed.
- added wxADJUST_MINSIZE to all wxChoice controls, since that tells
wxWindows to adjust its size to the length of the longest string.
- instead of calling SetSize or SetSizeHints on every textcontrol with
a hardcoded width, I am using just two wxSize specifications for
everything: either normalTextSize or longTextSize.
- edit names of a few menus and params. For example now instead of
the tab saying "Master ATA device on channel 0" it will say
"First HD/CD on channel 0".
Modified Files:
main.cc gui/control.cc gui/gui.cc gui/siminterface.cc gui/siminterface.h
gui/wxdialog.cc gui/wxdialog.h gui/wxmain.cc
2002-10-06 06:37:28 +04:00
|
|
|
|
if (opts & RAW_BYTES) {
|
2001-06-21 23:27:05 +04:00
|
|
|
|
char buffer[1024];
|
|
|
|
|
buffer[0] = 0;
|
|
|
|
|
char sep_string[2];
|
|
|
|
|
sep_string[0] = separator;
|
|
|
|
|
sep_string[1] = 0;
|
|
|
|
|
for (int i=0; i<maxsize; i++) {
|
|
|
|
|
char eachbyte[16];
|
|
|
|
|
sprintf (eachbyte, "%s%02x", (i>0)?sep_string : "", (unsigned int)0xff&val[i]);
|
|
|
|
|
strncat (buffer, eachbyte, sizeof(buffer));
|
|
|
|
|
}
|
|
|
|
|
if (strlen (buffer) > sizeof(buffer)-4) {
|
|
|
|
|
assert (0); // raw byte print buffer is probably overflowing. increase the max or make it dynamic
|
|
|
|
|
}
|
|
|
|
|
value = buffer;
|
|
|
|
|
}
|
2006-02-18 19:53:18 +03:00
|
|
|
|
if (get_format()) {
|
|
|
|
|
fprintf(fp, get_format(), value);
|
2001-06-18 18:11:55 +04:00
|
|
|
|
} else {
|
2006-02-18 19:53:18 +03:00
|
|
|
|
if (get_label()) {
|
|
|
|
|
fprintf(fp, "%s: %s", get_label(), value);
|
|
|
|
|
} else {
|
|
|
|
|
fprintf(fp, "%s: %s", get_name(), value);
|
|
|
|
|
}
|
2001-06-18 18:11:55 +04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
bx_list_c::text_print (FILE *fp)
|
|
|
|
|
{
|
2001-06-21 18:37:55 +04:00
|
|
|
|
fprintf (fp, "%s: ", get_name ());
|
2001-06-18 18:11:55 +04:00
|
|
|
|
for (int i=0; i<size; i++) {
|
2001-06-21 18:37:55 +04:00
|
|
|
|
assert (list[i] != NULL);
|
|
|
|
|
if (list[i]->get_enabled ()) {
|
2003-08-31 12:34:29 +04:00
|
|
|
|
if ((i>0) && (options->get () & SERIES_ASK))
|
|
|
|
|
fprintf (fp, ", ");
|
2001-06-18 18:11:55 +04:00
|
|
|
|
list[i]->text_print (fp);
|
- fixed up ParamDialog to correctly handle "trees" of parameters. A
bx_list_c can now be displayed as either a wxStaticBox with the
child parameters inside, or as a wxNotebook with each child
parameter in a separate tab. (The children can also be lists of
course.) The default display is the wxStaticBox type, but if you
set the option bit bx_list_c::USE_TAB_WINDOW in the list,
ParamDialog will use the wxNotebook display instead.
- to get the param trees working, I created a new struct
AddParamContext, which is passed to AddParam(). This struct is
critical when AddParam calls itself recursively to display lists
within lists.
- use the wxNotebook display feature for the ATA0,1,2,3 controller
dialog box. Now instead of being hundreds of pixels tall, it is
reasonable height with three different tabs. This fixed bug
#619074: "wx: ATA interface editor too tall" and was the whole
reason I started messing with this at all.
plus some minor cleanups
- when I added the enum constant bx_list_c::USE_TAB_WINDOW, I also
removed the BX_ prefix from all the other enum constants that are
used in parameter options in siminterface.cc. Since these constants
are enums within a class, there is no possibility of namespace
conflicts so the prefix is not needed.
- added wxADJUST_MINSIZE to all wxChoice controls, since that tells
wxWindows to adjust its size to the length of the longest string.
- instead of calling SetSize or SetSizeHints on every textcontrol with
a hardcoded width, I am using just two wxSize specifications for
everything: either normalTextSize or longTextSize.
- edit names of a few menus and params. For example now instead of
the tab saying "Master ATA device on channel 0" it will say
"First HD/CD on channel 0".
Modified Files:
main.cc gui/control.cc gui/gui.cc gui/siminterface.cc gui/siminterface.h
gui/wxdialog.cc gui/wxdialog.h gui/wxmain.cc
2002-10-06 06:37:28 +04:00
|
|
|
|
if (!(options->get () & SERIES_ASK))
|
2001-06-21 18:37:55 +04:00
|
|
|
|
fprintf (fp, "\n");
|
|
|
|
|
}
|
2001-06-18 18:11:55 +04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
|
bx_param_num_c::text_ask (FILE *fpin, FILE *fpout)
|
|
|
|
|
{
|
|
|
|
|
fprintf (fpout, "\n");
|
|
|
|
|
int status;
|
|
|
|
|
char *prompt = get_ask_format ();
|
|
|
|
|
if (prompt == NULL) {
|
|
|
|
|
// default prompt, if they didn't set an ask format string
|
|
|
|
|
text_print (fpout);
|
2001-06-21 18:37:55 +04:00
|
|
|
|
fprintf (fpout, "\n");
|
2001-06-18 18:11:55 +04:00
|
|
|
|
prompt = "Enter new value: [%d] ";
|
|
|
|
|
if (base==16)
|
|
|
|
|
prompt = "Enter new value in hex: [%x] ";
|
|
|
|
|
}
|
|
|
|
|
Bit32u n = get ();
|
2005-06-07 00:14:50 +04:00
|
|
|
|
status = ask_uint (prompt, (Bit32u)min, (Bit32u)max, n, &n, base);
|
2001-06-18 18:11:55 +04:00
|
|
|
|
if (status < 0) return status;
|
|
|
|
|
set (n);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2001-06-20 18:01:39 +04:00
|
|
|
|
int
|
|
|
|
|
bx_param_bool_c::text_ask (FILE *fpin, FILE *fpout)
|
|
|
|
|
{
|
|
|
|
|
fprintf (fpout, "\n");
|
|
|
|
|
int status;
|
2006-02-18 19:53:18 +03:00
|
|
|
|
char *prompt = get_ask_format();
|
2002-09-03 05:09:46 +04:00
|
|
|
|
char buffer[512];
|
2001-06-20 18:01:39 +04:00
|
|
|
|
if (prompt == NULL) {
|
2006-02-18 19:53:18 +03:00
|
|
|
|
if (get_label() != NULL) {
|
|
|
|
|
sprintf(buffer, "%s? [%%s] ", get_label());
|
|
|
|
|
prompt = buffer;
|
|
|
|
|
} else {
|
|
|
|
|
// default prompt, if they didn't set an ask format or label string
|
|
|
|
|
sprintf(buffer, "%s? [%%s] ", get_name());
|
|
|
|
|
prompt = buffer;
|
|
|
|
|
}
|
2001-06-20 18:01:39 +04:00
|
|
|
|
}
|
2006-02-18 19:53:18 +03:00
|
|
|
|
Bit32u n = get();
|
|
|
|
|
status = ask_yn(prompt, n, &n);
|
2001-06-20 18:01:39 +04:00
|
|
|
|
if (status < 0) return status;
|
2006-02-18 19:53:18 +03:00
|
|
|
|
set(n);
|
2001-06-20 18:01:39 +04:00
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2001-06-21 18:37:55 +04:00
|
|
|
|
int
|
|
|
|
|
bx_param_enum_c::text_ask (FILE *fpin, FILE *fpout)
|
|
|
|
|
{
|
|
|
|
|
fprintf (fpout, "\n");
|
|
|
|
|
char *prompt = get_ask_format ();
|
|
|
|
|
if (prompt == NULL) {
|
|
|
|
|
// default prompt, if they didn't set an ask format string
|
|
|
|
|
fprintf (fpout, "%s = ", get_name ());
|
|
|
|
|
text_print (fpout);
|
|
|
|
|
fprintf (fpout, "\n");
|
|
|
|
|
prompt = "Enter new value: [%s] ";
|
|
|
|
|
}
|
2003-06-07 23:16:55 +04:00
|
|
|
|
Bit32s n = (Bit32s)(get () - min);
|
2005-06-07 00:14:50 +04:00
|
|
|
|
int status = ask_menu (prompt, (Bit32u)(max-min+1), choices, n, &n);
|
2001-06-21 18:37:55 +04:00
|
|
|
|
if (status < 0) return status;
|
2003-06-07 23:16:55 +04:00
|
|
|
|
n += (Bit32s)min;
|
2001-06-21 18:37:55 +04:00
|
|
|
|
set (n);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
2001-06-20 18:01:39 +04:00
|
|
|
|
|
2001-06-21 23:27:05 +04:00
|
|
|
|
int parse_raw_bytes (char *dest, char *src, int destsize, char separator)
|
|
|
|
|
{
|
2001-06-21 23:31:19 +04:00
|
|
|
|
//printf ("parsing src='%s'\n", src);
|
2001-06-21 23:27:05 +04:00
|
|
|
|
int i;
|
|
|
|
|
unsigned int n;
|
|
|
|
|
for (i=0; i<destsize; i++)
|
|
|
|
|
dest[i] = 0;
|
|
|
|
|
for (i=0; i<destsize; i++) {
|
|
|
|
|
while (*src == separator)
|
|
|
|
|
src++;
|
|
|
|
|
if (*src == 0) break;
|
|
|
|
|
// try to read a byte of hex
|
|
|
|
|
if (sscanf (src, "%02x", &n) == 1) {
|
|
|
|
|
dest[i] = n;
|
|
|
|
|
src+=2;
|
|
|
|
|
} else {
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2001-06-18 18:11:55 +04:00
|
|
|
|
int
|
|
|
|
|
bx_param_string_c::text_ask (FILE *fpin, FILE *fpout)
|
|
|
|
|
{
|
|
|
|
|
fprintf (fpout, "\n");
|
|
|
|
|
int status;
|
|
|
|
|
char *prompt = get_ask_format ();
|
|
|
|
|
if (prompt == NULL) {
|
|
|
|
|
// default prompt, if they didn't set an ask format string
|
|
|
|
|
text_print (fpout);
|
2001-06-21 18:37:55 +04:00
|
|
|
|
fprintf (fpout, "\n");
|
2001-06-18 18:11:55 +04:00
|
|
|
|
prompt = "Enter a new value, or press return for no change.\n";
|
|
|
|
|
}
|
2001-06-21 23:27:05 +04:00
|
|
|
|
while (1) {
|
|
|
|
|
char buffer[1024];
|
|
|
|
|
status = ask_string (prompt, getptr(), buffer);
|
|
|
|
|
if (status < 0) return status;
|
|
|
|
|
int opts = options->get ();
|
|
|
|
|
char buffer2[1024];
|
|
|
|
|
strcpy (buffer2, buffer);
|
- fixed up ParamDialog to correctly handle "trees" of parameters. A
bx_list_c can now be displayed as either a wxStaticBox with the
child parameters inside, or as a wxNotebook with each child
parameter in a separate tab. (The children can also be lists of
course.) The default display is the wxStaticBox type, but if you
set the option bit bx_list_c::USE_TAB_WINDOW in the list,
ParamDialog will use the wxNotebook display instead.
- to get the param trees working, I created a new struct
AddParamContext, which is passed to AddParam(). This struct is
critical when AddParam calls itself recursively to display lists
within lists.
- use the wxNotebook display feature for the ATA0,1,2,3 controller
dialog box. Now instead of being hundreds of pixels tall, it is
reasonable height with three different tabs. This fixed bug
#619074: "wx: ATA interface editor too tall" and was the whole
reason I started messing with this at all.
plus some minor cleanups
- when I added the enum constant bx_list_c::USE_TAB_WINDOW, I also
removed the BX_ prefix from all the other enum constants that are
used in parameter options in siminterface.cc. Since these constants
are enums within a class, there is no possibility of namespace
conflicts so the prefix is not needed.
- added wxADJUST_MINSIZE to all wxChoice controls, since that tells
wxWindows to adjust its size to the length of the longest string.
- instead of calling SetSize or SetSizeHints on every textcontrol with
a hardcoded width, I am using just two wxSize specifications for
everything: either normalTextSize or longTextSize.
- edit names of a few menus and params. For example now instead of
the tab saying "Master ATA device on channel 0" it will say
"First HD/CD on channel 0".
Modified Files:
main.cc gui/control.cc gui/gui.cc gui/siminterface.cc gui/siminterface.h
gui/wxdialog.cc gui/wxdialog.h gui/wxmain.cc
2002-10-06 06:37:28 +04:00
|
|
|
|
if (status == 1 && opts & RAW_BYTES) {
|
2001-06-21 23:27:05 +04:00
|
|
|
|
// copy raw hex into buffer
|
|
|
|
|
status = parse_raw_bytes (buffer, buffer2, maxsize, separator);
|
|
|
|
|
if (status < 0) {
|
|
|
|
|
fprintf (fpout, "Illegal raw byte format. I expected something like 3A%c03%c12%c...\n", separator, separator, separator);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
}
|
2002-12-12 21:31:20 +03:00
|
|
|
|
if (!equals (buffer))
|
|
|
|
|
set (buffer);
|
2001-06-21 23:27:05 +04:00
|
|
|
|
return 0;
|
|
|
|
|
}
|
2001-06-18 18:11:55 +04:00
|
|
|
|
}
|
|
|
|
|
|
2006-02-26 22:11:20 +03:00
|
|
|
|
int bx_list_c::text_ask(FILE *fpin, FILE *fpout)
|
2001-06-18 18:11:55 +04:00
|
|
|
|
{
|
2006-02-18 19:53:18 +03:00
|
|
|
|
bx_list_c *child;
|
|
|
|
|
|
2006-02-26 22:11:20 +03:00
|
|
|
|
char *my_title = title->getptr();
|
2001-06-18 18:11:55 +04:00
|
|
|
|
fprintf (fpout, "\n");
|
2001-06-21 18:37:55 +04:00
|
|
|
|
int i, imax = strlen (my_title);
|
2001-06-18 18:11:55 +04:00
|
|
|
|
for (i=0; i<imax; i++) fprintf (fpout, "-");
|
2001-06-21 18:37:55 +04:00
|
|
|
|
fprintf (fpout, "\n%s\n", my_title);
|
2001-06-18 18:11:55 +04:00
|
|
|
|
for (i=0; i<imax; i++) fprintf (fpout, "-");
|
2006-02-26 22:11:20 +03:00
|
|
|
|
fprintf(fpout, "\n");
|
- fixed up ParamDialog to correctly handle "trees" of parameters. A
bx_list_c can now be displayed as either a wxStaticBox with the
child parameters inside, or as a wxNotebook with each child
parameter in a separate tab. (The children can also be lists of
course.) The default display is the wxStaticBox type, but if you
set the option bit bx_list_c::USE_TAB_WINDOW in the list,
ParamDialog will use the wxNotebook display instead.
- to get the param trees working, I created a new struct
AddParamContext, which is passed to AddParam(). This struct is
critical when AddParam calls itself recursively to display lists
within lists.
- use the wxNotebook display feature for the ATA0,1,2,3 controller
dialog box. Now instead of being hundreds of pixels tall, it is
reasonable height with three different tabs. This fixed bug
#619074: "wx: ATA interface editor too tall" and was the whole
reason I started messing with this at all.
plus some minor cleanups
- when I added the enum constant bx_list_c::USE_TAB_WINDOW, I also
removed the BX_ prefix from all the other enum constants that are
used in parameter options in siminterface.cc. Since these constants
are enums within a class, there is no possibility of namespace
conflicts so the prefix is not needed.
- added wxADJUST_MINSIZE to all wxChoice controls, since that tells
wxWindows to adjust its size to the length of the longest string.
- instead of calling SetSize or SetSizeHints on every textcontrol with
a hardcoded width, I am using just two wxSize specifications for
everything: either normalTextSize or longTextSize.
- edit names of a few menus and params. For example now instead of
the tab saying "Master ATA device on channel 0" it will say
"First HD/CD on channel 0".
Modified Files:
main.cc gui/control.cc gui/gui.cc gui/siminterface.cc gui/siminterface.h
gui/wxdialog.cc gui/wxdialog.h gui/wxmain.cc
2002-10-06 06:37:28 +04:00
|
|
|
|
if (options->get () & SERIES_ASK) {
|
2001-06-21 18:37:55 +04:00
|
|
|
|
for (int i=0; i<size; i++) {
|
2005-11-06 12:11:09 +03:00
|
|
|
|
if (list[i]->get_enabled()) {
|
|
|
|
|
if (!SIM->get_init_done() || list[i]->get_runtime_param()) {
|
|
|
|
|
list[i]->text_ask (fpin, fpout);
|
|
|
|
|
}
|
|
|
|
|
}
|
2001-06-21 18:37:55 +04:00
|
|
|
|
}
|
|
|
|
|
} else {
|
- fixed up ParamDialog to correctly handle "trees" of parameters. A
bx_list_c can now be displayed as either a wxStaticBox with the
child parameters inside, or as a wxNotebook with each child
parameter in a separate tab. (The children can also be lists of
course.) The default display is the wxStaticBox type, but if you
set the option bit bx_list_c::USE_TAB_WINDOW in the list,
ParamDialog will use the wxNotebook display instead.
- to get the param trees working, I created a new struct
AddParamContext, which is passed to AddParam(). This struct is
critical when AddParam calls itself recursively to display lists
within lists.
- use the wxNotebook display feature for the ATA0,1,2,3 controller
dialog box. Now instead of being hundreds of pixels tall, it is
reasonable height with three different tabs. This fixed bug
#619074: "wx: ATA interface editor too tall" and was the whole
reason I started messing with this at all.
plus some minor cleanups
- when I added the enum constant bx_list_c::USE_TAB_WINDOW, I also
removed the BX_ prefix from all the other enum constants that are
used in parameter options in siminterface.cc. Since these constants
are enums within a class, there is no possibility of namespace
conflicts so the prefix is not needed.
- added wxADJUST_MINSIZE to all wxChoice controls, since that tells
wxWindows to adjust its size to the length of the longest string.
- instead of calling SetSize or SetSizeHints on every textcontrol with
a hardcoded width, I am using just two wxSize specifications for
everything: either normalTextSize or longTextSize.
- edit names of a few menus and params. For example now instead of
the tab saying "Master ATA device on channel 0" it will say
"First HD/CD on channel 0".
Modified Files:
main.cc gui/control.cc gui/gui.cc gui/siminterface.cc gui/siminterface.h
gui/wxdialog.cc gui/wxdialog.h gui/wxmain.cc
2002-10-06 06:37:28 +04:00
|
|
|
|
if (options->get () & SHOW_PARENT)
|
2001-06-21 18:37:55 +04:00
|
|
|
|
fprintf (fpout, "0. Return to previous menu\n");
|
|
|
|
|
for (int i=0; i<size; i++) {
|
|
|
|
|
assert (list[i] != NULL);
|
2006-02-21 00:29:13 +03:00
|
|
|
|
fprintf(fpout, "%d. ", i+1);
|
|
|
|
|
if (list[i]->get_enabled()) {
|
|
|
|
|
if (list[i]->get_type() == BXT_LIST) {
|
2006-02-18 19:53:18 +03:00
|
|
|
|
child = (bx_list_c*)list[i];
|
|
|
|
|
fprintf(fpout, "%s\n", child->get_title()->getptr());
|
2004-10-25 00:04:52 +04:00
|
|
|
|
} else {
|
2006-02-21 00:29:13 +03:00
|
|
|
|
if ((options->get() & SHOW_GROUP_NAME) && (list[i]->get_group() != NULL))
|
|
|
|
|
fprintf(fpout, "%s ", list[i]->get_group());
|
|
|
|
|
list[i]->text_print(fpout);
|
2006-02-18 19:53:18 +03:00
|
|
|
|
fprintf(fpout, "\n");
|
2004-10-25 00:04:52 +04:00
|
|
|
|
}
|
2006-02-21 00:29:13 +03:00
|
|
|
|
} else {
|
|
|
|
|
if (list[i]->get_type() == BXT_LIST) {
|
|
|
|
|
child = (bx_list_c*)list[i];
|
|
|
|
|
fprintf(fpout, "%s (disabled)\n", child->get_title()->getptr());
|
|
|
|
|
} else {
|
|
|
|
|
fprintf(fpout, "(disabled)\n");
|
|
|
|
|
}
|
|
|
|
|
}
|
2001-06-21 18:37:55 +04:00
|
|
|
|
}
|
2001-06-18 18:11:55 +04:00
|
|
|
|
fprintf (fpout, "\n");
|
2006-02-26 22:11:20 +03:00
|
|
|
|
Bit32u n = choice->get();
|
|
|
|
|
int min = (options->get() & SHOW_PARENT) ? 0 : 1;
|
2001-06-21 18:37:55 +04:00
|
|
|
|
int max = size;
|
2006-02-26 22:11:20 +03:00
|
|
|
|
int status = ask_uint("Please choose one: [%d] ", min, max, n, &n, 10);
|
2001-06-21 18:37:55 +04:00
|
|
|
|
if (status < 0) return status;
|
2006-02-26 22:11:20 +03:00
|
|
|
|
choice->set(n);
|
2001-06-21 18:37:55 +04:00
|
|
|
|
}
|
2001-06-18 18:11:55 +04:00
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2002-10-25 01:07:56 +04:00
|
|
|
|
static int ci_callback (void *userdata, ci_command_t command)
|
|
|
|
|
{
|
|
|
|
|
switch (command)
|
|
|
|
|
{
|
|
|
|
|
case CI_START:
|
|
|
|
|
bx_config_interface_init ();
|
2002-11-09 17:12:10 +03:00
|
|
|
|
if (SIM->get_param_enum(BXP_BOCHS_START)->get () == BX_QUICK_START)
|
2002-10-25 01:07:56 +04:00
|
|
|
|
bx_config_interface (BX_CI_START_SIMULATION);
|
2002-12-17 08:58:45 +03:00
|
|
|
|
else {
|
|
|
|
|
if (!SIM->test_for_text_console ())
|
|
|
|
|
return CI_ERR_NO_TEXT_CONSOLE;
|
2002-10-25 01:07:56 +04:00
|
|
|
|
bx_config_interface (BX_CI_START_MENU);
|
2002-12-17 08:58:45 +03:00
|
|
|
|
}
|
2002-10-25 01:07:56 +04:00
|
|
|
|
break;
|
|
|
|
|
case CI_RUNTIME_CONFIG:
|
|
|
|
|
bx_config_interface (BX_CI_RUNTIME);
|
|
|
|
|
break;
|
|
|
|
|
case CI_SHUTDOWN:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// if I can make things compile without this module linked in, then
|
|
|
|
|
// this file can become a plugin too.
|
|
|
|
|
int init_text_config_interface ()
|
|
|
|
|
{
|
2002-10-29 23:17:05 +03:00
|
|
|
|
//fprintf (stderr, "plugin_init for textconfig.cc\n");
|
|
|
|
|
SIM->register_configuration_interface ("textconfig", ci_callback, NULL);
|
2002-10-25 01:07:56 +04:00
|
|
|
|
return 0; // success
|
|
|
|
|
}
|
2004-01-29 21:50:33 +03:00
|
|
|
|
|
|
|
|
|
#endif
|