Improvements and cleanups for the textconfig runtime menu
- added menu item for saving configuration - use existing cdrom runtime menu instead of hardcoded items - some code cleanups after cdrom option changes
This commit is contained in:
parent
85f548250e
commit
11571f0ecf
@ -25,6 +25,7 @@ Changes after 2.6.2 (updated Dec 16, 2013):
|
||||
- Added support to specify the initial time for 'clock' option in ctime(3) string format
|
||||
- Added support for the LTDL_LIBRARY_PATH variable with MSVC plugins
|
||||
- All SB16 / ES1370 are now changable at runtime
|
||||
- textconfig: added menu item for saving configuration
|
||||
|
||||
- I/O Devices
|
||||
- Networking
|
||||
|
@ -115,7 +115,6 @@ public:
|
||||
virtual int set_log_prefix(const char *prefix);
|
||||
virtual int get_debugger_log_file(char *path, int len);
|
||||
virtual int set_debugger_log_file(const char *path);
|
||||
virtual int get_cdrom_options(int drive, bx_list_c **out, int *device = NULL);
|
||||
virtual int hdimage_get_mode(const char *mode);
|
||||
virtual void set_notify_callback(bxevent_handler func, void *arg);
|
||||
virtual void get_notify_callback(bxevent_handler *func, void **arg);
|
||||
@ -485,28 +484,6 @@ int bx_real_sim_c::set_debugger_log_file(const char *path)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int bx_real_sim_c::get_cdrom_options(int level, bx_list_c **out, int *where)
|
||||
{
|
||||
char pname[80];
|
||||
|
||||
for (Bit8u channel=0; channel<BX_MAX_ATA_CHANNEL; channel++) {
|
||||
for (Bit8u device=0; device<2; device++) {
|
||||
sprintf(pname, "ata.%d.%s", channel, (device==0)?"master":"slave");
|
||||
bx_list_c *devlist = (bx_list_c*) SIM->get_param(pname);
|
||||
if (SIM->get_param_enum("type", devlist)->get() == BX_ATA_DEVICE_CDROM) {
|
||||
if (level==0) {
|
||||
*out = devlist;
|
||||
if (where != NULL) *where = (channel * 2) + device;
|
||||
return 1;
|
||||
} else {
|
||||
level--;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
const char *floppy_devtype_names[] = { "none", "5.25\" 360K", "5.25\" 1.2M", "3.5\" 720K", "3.5\" 1.44M", "3.5\" 2.88M", NULL };
|
||||
const char *floppy_type_names[] = { "none", "1.2M", "1.44M", "2.88M", "720K", "360K", "160K", "180K", "320K", "auto", NULL };
|
||||
int floppy_type_n_sectors[] = { -1, 80*2*15, 80*2*18, 80*2*36, 80*2*9, 40*2*9, 40*1*8, 40*1*9, 40*2*8, -1 };
|
||||
|
@ -672,7 +672,6 @@ public:
|
||||
virtual int set_log_prefix(char *prefix) {return -1;}
|
||||
virtual int get_debugger_log_file(char *path, int len) {return -1;}
|
||||
virtual int set_debugger_log_file(char *path) {return -1;}
|
||||
virtual int get_cdrom_options(int drive, bx_list_c **out, int *where = NULL) {return -1;}
|
||||
virtual int hdimage_get_mode(const char *mode) {return -1;}
|
||||
|
||||
// The CI calls set_notify_callback to register its event handler function.
|
||||
|
@ -318,20 +318,16 @@ static const char *runtime_menu_prompt =
|
||||
"---------------------\n"
|
||||
"1. Floppy disk 0: %s\n"
|
||||
"2. Floppy disk 1: %s\n"
|
||||
"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"
|
||||
"10. Instruction tracing: off (doesn't exist yet)\n"
|
||||
"11. USB runtime options\n"
|
||||
"12. Misc runtime options\n"
|
||||
"13. Continue simulation\n"
|
||||
"14. Quit now\n"
|
||||
"3. CDROM runtime options\n"
|
||||
"4. Log options for all devices\n"
|
||||
"5. Log options for individual devices\n"
|
||||
"6. USB runtime options\n"
|
||||
"7. Misc runtime options\n"
|
||||
"8. Save configuration\n"
|
||||
"9. Continue simulation\n"
|
||||
"10. Quit now\n"
|
||||
"\n"
|
||||
"Please choose one: [13] ";
|
||||
"Please choose one: [9] ";
|
||||
|
||||
static const char *plugin_ctrl_prompt =
|
||||
"\n-----------------------\n"
|
||||
@ -353,7 +349,6 @@ static const char *plugin_ctrl_prompt =
|
||||
void build_runtime_options_prompt(const char *format, char *buf, int size)
|
||||
{
|
||||
bx_list_c *floppyop;
|
||||
bx_list_c *cdromop = NULL;
|
||||
char pname[80];
|
||||
char buffer[6][128];
|
||||
|
||||
@ -370,19 +365,7 @@ void build_runtime_options_prompt(const char *format, char *buf, int size)
|
||||
}
|
||||
}
|
||||
|
||||
// 4 cdroms supported at run time
|
||||
int device;
|
||||
for (Bit8u cdrom=0; cdrom<4; cdrom++) {
|
||||
if (!SIM->get_cdrom_options(cdrom, &cdromop, &device))
|
||||
sprintf(buffer[2+cdrom], "(not present)");
|
||||
else
|
||||
sprintf(buffer[2+cdrom], "(%s on ata%d) %s, %s",
|
||||
device&1?"slave":"master", device/2, SIM->get_param_string("path", cdromop)->getptr(),
|
||||
(SIM->get_param_enum("status", cdromop)->get_selected()));
|
||||
}
|
||||
|
||||
snprintf(buf, size, format, buffer[0], buffer[1], buffer[2],
|
||||
buffer[3], buffer[4], buffer[5]);
|
||||
snprintf(buf, size, format, buffer[0], buffer[1]);
|
||||
}
|
||||
|
||||
int do_menu(const char *pname)
|
||||
@ -507,8 +490,6 @@ int bx_config_interface(int menu)
|
||||
break;
|
||||
case BX_CI_RUNTIME:
|
||||
{
|
||||
bx_list_c *cdromop = NULL;
|
||||
char pname[80];
|
||||
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;
|
||||
@ -519,26 +500,14 @@ int bx_config_interface(int menu)
|
||||
case BX_CI_RT_FLOPPYB:
|
||||
if (SIM->get_param_enum(BXPN_FLOPPYB_DEVTYPE)->get() != BX_FDD_NONE) do_menu(BXPN_FLOPPYB);
|
||||
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)) {
|
||||
cdromop->get_param_path(pname, 80);
|
||||
do_menu(pname);
|
||||
}
|
||||
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(BXPN_IPS);
|
||||
break;
|
||||
case BX_CI_RT_CDROM: do_menu(BXPN_MENU_RUNTIME_CDROM); 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_USB: do_menu(BXPN_MENU_RUNTIME_USB); break;
|
||||
case BX_CI_RT_MISC: do_menu(BXPN_MENU_RUNTIME_MISC); break;
|
||||
case BX_CI_RT_SAVE_CFG:
|
||||
bx_write_rc(NULL);
|
||||
break;
|
||||
case BX_CI_RT_CONT:
|
||||
SIM->update_runtime_options();
|
||||
fprintf(stderr, "Continuing simulation\n");
|
||||
|
@ -2,7 +2,7 @@
|
||||
// $Id$
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2009 The Bochs Project
|
||||
// Copyright (C) 2009-2013 The Bochs Project
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
@ -26,11 +26,6 @@ enum {
|
||||
BX_CI_INIT,
|
||||
BX_CI_START_MENU,
|
||||
BX_CI_START_OPTS,
|
||||
BX_CI_START_OPTS_MEM,
|
||||
BX_CI_START_OPTS_INTERFACE,
|
||||
BX_CI_START_OPTS_DISK,
|
||||
BX_CI_START_OPTS_SOUND,
|
||||
BX_CI_START_OPTS_MISC,
|
||||
BX_CI_START_SIMULATION,
|
||||
BX_CI_RUNTIME,
|
||||
BX_CI_N_MENUS
|
||||
@ -39,16 +34,12 @@ enum {
|
||||
enum {
|
||||
BX_CI_RT_FLOPPYA = 1,
|
||||
BX_CI_RT_FLOPPYB,
|
||||
BX_CI_RT_CDROM1,
|
||||
BX_CI_RT_CDROM2,
|
||||
BX_CI_RT_CDROM3,
|
||||
BX_CI_RT_CDROM4,
|
||||
BX_CI_RT_IPS,
|
||||
BX_CI_RT_CDROM,
|
||||
BX_CI_RT_LOGOPTS1,
|
||||
BX_CI_RT_LOGOPTS2,
|
||||
BX_CI_RT_INST_TR,
|
||||
BX_CI_RT_USB,
|
||||
BX_CI_RT_MISC,
|
||||
BX_CI_RT_SAVE_CFG,
|
||||
BX_CI_RT_CONT,
|
||||
BX_CI_RT_QUIT
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user