Changed type of VGA extension option to bx_param_enum_c. Additional choices are
added from plugins list.
This commit is contained in:
parent
24bccc8efb
commit
2e44a5c8bf
@ -47,6 +47,7 @@
|
|||||||
|
|
||||||
|
|
||||||
const char **display_library_list;
|
const char **display_library_list;
|
||||||
|
const char **vga_extension_list;
|
||||||
int bochsrc_include_level = 0;
|
int bochsrc_include_level = 0;
|
||||||
|
|
||||||
#define LOG_THIS genlog->
|
#define LOG_THIS genlog->
|
||||||
@ -62,12 +63,11 @@ static Bit64s bx_param_handler(bx_param_c *param, bool set, Bit64s val)
|
|||||||
{
|
{
|
||||||
char pname[BX_PATHNAME_LEN];
|
char pname[BX_PATHNAME_LEN];
|
||||||
Bit8u device;
|
Bit8u device;
|
||||||
//Bit8u channel;
|
Bit64s oldval;
|
||||||
|
|
||||||
bx_list_c *base = (bx_list_c*) param->get_parent();
|
bx_list_c *base = (bx_list_c*) param->get_parent();
|
||||||
base->get_param_path(pname, BX_PATHNAME_LEN);
|
base->get_param_path(pname, BX_PATHNAME_LEN);
|
||||||
if (!strncmp(pname, "ata.", 4)) {
|
if (!strncmp(pname, "ata.", 4)) {
|
||||||
// channel = pname[4] - '0';
|
|
||||||
if (!strcmp(base->get_name(), "master")) {
|
if (!strcmp(base->get_name(), "master")) {
|
||||||
device = 0;
|
device = 0;
|
||||||
} else {
|
} else {
|
||||||
@ -90,7 +90,19 @@ static Bit64s bx_param_handler(bx_param_c *param, bool set, Bit64s val)
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
param->get_param_path(pname, BX_PATHNAME_LEN);
|
param->get_param_path(pname, BX_PATHNAME_LEN);
|
||||||
if ((!strcmp(pname, BXPN_FLOPPYA_TYPE)) ||
|
if (!strcmp(pname, BXPN_VGA_EXTENSION)) {
|
||||||
|
if (set) {
|
||||||
|
oldval = ((bx_param_enum_c*)param)->get();
|
||||||
|
if (val != oldval) {
|
||||||
|
if (oldval >= BX_VGA_EXTENSION_OTHER) {
|
||||||
|
PLUG_unload_opt_plugin(((bx_param_enum_c*)param)->get_selected());
|
||||||
|
}
|
||||||
|
if (val >= BX_VGA_EXTENSION_OTHER) {
|
||||||
|
PLUG_load_vga_plugin(((bx_param_enum_c*)param)->get_choice(val));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if ((!strcmp(pname, BXPN_FLOPPYA_TYPE)) ||
|
||||||
(!strcmp(pname, BXPN_FLOPPYB_TYPE))) {
|
(!strcmp(pname, BXPN_FLOPPYB_TYPE))) {
|
||||||
if (set) {
|
if (set) {
|
||||||
if (val == BX_FLOPPY_AUTO) {
|
if (val == BX_FLOPPY_AUTO) {
|
||||||
@ -135,17 +147,6 @@ const char *bx_param_string_handler(bx_param_string_c *param, bool set,
|
|||||||
val = oldval;
|
val = oldval;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (!strcmp(pname, BXPN_VGA_EXTENSION)) {
|
|
||||||
if (set) {
|
|
||||||
if ((strlen(oldval) > 0) && (strcmp(oldval, "none") && strcmp(oldval, "vbe") &&
|
|
||||||
strcmp(oldval, "cirrus"))) {
|
|
||||||
PLUG_unload_opt_plugin(oldval);
|
|
||||||
}
|
|
||||||
if ((strlen(val) > 0) && (strcmp(val, "none") && strcmp(val, "vbe") &&
|
|
||||||
strcmp(val, "cirrus"))) {
|
|
||||||
PLUG_load_vga_plugin(val);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
BX_PANIC(("bx_param_string_handler called with unknown parameter '%s'", pname));
|
BX_PANIC(("bx_param_string_handler called with unknown parameter '%s'", pname));
|
||||||
}
|
}
|
||||||
@ -302,6 +303,21 @@ void bx_init_displaylib_list()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void bx_init_vgaext_list()
|
||||||
|
{
|
||||||
|
Bit8u i, count = 0;
|
||||||
|
|
||||||
|
count = PLUG_get_plugins_count(PLUGTYPE_VGA);
|
||||||
|
vga_extension_list = (const char**) malloc((count + 4) * sizeof(char*));
|
||||||
|
vga_extension_list[0] = "none";
|
||||||
|
vga_extension_list[1] = "vbe";
|
||||||
|
vga_extension_list[2] = "cirrus";
|
||||||
|
for (i = 0; i < count; i++) {
|
||||||
|
vga_extension_list[i + 3] = PLUG_get_plugin_name(PLUGTYPE_VGA, i);
|
||||||
|
}
|
||||||
|
vga_extension_list[count + 3] = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
void bx_init_options()
|
void bx_init_options()
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
@ -977,13 +993,15 @@ void bx_init_options()
|
|||||||
5);
|
5);
|
||||||
vga_update_freq->set_ask_format ("Type a new value for VGA update frequency: [%d] ");
|
vga_update_freq->set_ask_format ("Type a new value for VGA update frequency: [%d] ");
|
||||||
|
|
||||||
bx_param_string_c *vga_extension = new bx_param_string_c(display,
|
bx_init_vgaext_list();
|
||||||
"vga_extension",
|
bx_param_enum_c *vga_extension = new bx_param_enum_c(display,
|
||||||
"VGA Extension",
|
"vga_extension",
|
||||||
"Name of the VGA extension",
|
"VGA Extension",
|
||||||
"none", BX_PATHNAME_LEN);
|
"Name of the VGA extension",
|
||||||
vga_extension->set_handler(bx_param_string_handler);
|
vga_extension_list,
|
||||||
vga_extension->set_initial_val("vbe");
|
BX_VGA_EXTENSION_VBE,
|
||||||
|
BX_VGA_EXTENSION_NONE);
|
||||||
|
vga_extension->set_handler(bx_param_handler);
|
||||||
display->set_options(display->SHOW_PARENT);
|
display->set_options(display->SHOW_PARENT);
|
||||||
|
|
||||||
static const char *ddc_mode_list[] = {
|
static const char *ddc_mode_list[] = {
|
||||||
@ -2780,7 +2798,7 @@ static int parse_line_formatted(const char *context, int num_params, char *param
|
|||||||
}
|
}
|
||||||
for (i=1; i<num_params; i++) {
|
for (i=1; i<num_params; i++) {
|
||||||
if (!strncmp(params[i], "extension=", 10)) {
|
if (!strncmp(params[i], "extension=", 10)) {
|
||||||
SIM->get_param_string(BXPN_VGA_EXTENSION)->set(¶ms[i][10]);
|
SIM->get_param_enum(BXPN_VGA_EXTENSION)->set_by_name(¶ms[i][10]);
|
||||||
} else if (!strncmp(params[i], "update_freq=", 12)) {
|
} else if (!strncmp(params[i], "update_freq=", 12)) {
|
||||||
SIM->get_param_num(BXPN_VGA_UPDATE_FREQUENCY)->set(atol(¶ms[i][12]));
|
SIM->get_param_num(BXPN_VGA_UPDATE_FREQUENCY)->set(atol(¶ms[i][12]));
|
||||||
} else if (!strncmp(params[i], "realtime=", 9)) {
|
} else if (!strncmp(params[i], "realtime=", 9)) {
|
||||||
@ -3364,7 +3382,7 @@ int bx_write_configuration(const char *rc, int overwrite)
|
|||||||
}
|
}
|
||||||
fprintf(fp, "\n");
|
fprintf(fp, "\n");
|
||||||
fprintf(fp, "vga: extension=%s, update_freq=%u, realtime=%u, ddc=%s",
|
fprintf(fp, "vga: extension=%s, update_freq=%u, realtime=%u, ddc=%s",
|
||||||
SIM->get_param_string(BXPN_VGA_EXTENSION)->getptr(),
|
SIM->get_param_enum(BXPN_VGA_EXTENSION)->get_selected(),
|
||||||
SIM->get_param_num(BXPN_VGA_UPDATE_FREQUENCY)->get(),
|
SIM->get_param_num(BXPN_VGA_UPDATE_FREQUENCY)->get(),
|
||||||
SIM->get_param_bool(BXPN_VGA_REALTIME)->get(),
|
SIM->get_param_bool(BXPN_VGA_REALTIME)->get(),
|
||||||
SIM->get_param_enum(BXPN_DDC_MODE)->get_selected());
|
SIM->get_param_enum(BXPN_DDC_MODE)->get_selected());
|
||||||
|
@ -459,6 +459,13 @@ enum {
|
|||||||
BX_RUN_START
|
BX_RUN_START
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum {
|
||||||
|
BX_VGA_EXTENSION_NONE,
|
||||||
|
BX_VGA_EXTENSION_VBE,
|
||||||
|
BX_VGA_EXTENSION_CIRRUS,
|
||||||
|
BX_VGA_EXTENSION_OTHER
|
||||||
|
};
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
BX_DDC_MODE_DISABLED,
|
BX_DDC_MODE_DISABLED,
|
||||||
BX_DDC_MODE_BUILTIN,
|
BX_DDC_MODE_BUILTIN,
|
||||||
|
@ -111,8 +111,9 @@ void bx_devices_c::init(BX_MEM_C *newmem)
|
|||||||
unsigned max_pci_slots = BX_N_PCI_SLOTS;
|
unsigned max_pci_slots = BX_N_PCI_SLOTS;
|
||||||
#endif
|
#endif
|
||||||
unsigned i, argc;
|
unsigned i, argc;
|
||||||
|
Bit8u vga_ext_id;
|
||||||
const char def_name[] = "Default";
|
const char def_name[] = "Default";
|
||||||
const char *vga_ext, *options;
|
const char *options;
|
||||||
char *argv[16];
|
char *argv[16];
|
||||||
|
|
||||||
BX_DEBUG(("Init $Id$"));
|
BX_DEBUG(("Init $Id$"));
|
||||||
@ -239,14 +240,14 @@ void bx_devices_c::init(BX_MEM_C *newmem)
|
|||||||
PLUG_load_plugin(dma, PLUGTYPE_CORE);
|
PLUG_load_plugin(dma, PLUGTYPE_CORE);
|
||||||
PLUG_load_plugin(pic, PLUGTYPE_CORE);
|
PLUG_load_plugin(pic, PLUGTYPE_CORE);
|
||||||
PLUG_load_plugin(pit, PLUGTYPE_CORE);
|
PLUG_load_plugin(pit, PLUGTYPE_CORE);
|
||||||
vga_ext = SIM->get_param_string(BXPN_VGA_EXTENSION)->getptr();
|
vga_ext_id = (Bit8u)SIM->get_param_enum(BXPN_VGA_EXTENSION)->get();
|
||||||
if (!strcmp(vga_ext, "cirrus")) {
|
if (vga_ext_id == BX_VGA_EXTENSION_CIRRUS) {
|
||||||
#if BX_SUPPORT_CLGD54XX
|
#if BX_SUPPORT_CLGD54XX
|
||||||
PLUG_load_plugin(svga_cirrus, PLUGTYPE_CORE);
|
PLUG_load_plugin(svga_cirrus, PLUGTYPE_CORE);
|
||||||
#else
|
#else
|
||||||
BX_PANIC(("Bochs is not compiled with Cirrus support"));
|
BX_PANIC(("Bochs is not compiled with Cirrus support"));
|
||||||
#endif
|
#endif
|
||||||
} else if (!strcmp(vga_ext, "vbe") || !strcmp(vga_ext, "none")) {
|
} else if (vga_ext_id <= BX_VGA_EXTENSION_VBE) {
|
||||||
PLUG_load_plugin(vga, PLUGTYPE_CORE);
|
PLUG_load_plugin(vga, PLUGTYPE_CORE);
|
||||||
} else if (pluginVgaDevice == &stubVga) {
|
} else if (pluginVgaDevice == &stubVga) {
|
||||||
BX_PANIC(("No VGA compatible display adapter present"));
|
BX_PANIC(("No VGA compatible display adapter present"));
|
||||||
|
@ -87,7 +87,7 @@ bool bx_vga_c::init_vga_extension(void)
|
|||||||
BX_VGA_THIS vbe.dac_8bit = 0;
|
BX_VGA_THIS vbe.dac_8bit = 0;
|
||||||
BX_VGA_THIS vbe.ddc_enabled = 0;
|
BX_VGA_THIS vbe.ddc_enabled = 0;
|
||||||
BX_VGA_THIS vbe.base_address = 0x0000;
|
BX_VGA_THIS vbe.base_address = 0x0000;
|
||||||
if (!strcmp(BX_VGA_THIS vgaext->getptr(), "vbe")) {
|
if (BX_VGA_THIS vga_ext_id == BX_VGA_EXTENSION_VBE) {
|
||||||
BX_VGA_THIS put("BXVGA");
|
BX_VGA_THIS put("BXVGA");
|
||||||
for (addr=VBE_DISPI_IOPORT_INDEX; addr<=VBE_DISPI_IOPORT_DATA; addr++) {
|
for (addr=VBE_DISPI_IOPORT_INDEX; addr<=VBE_DISPI_IOPORT_DATA; addr++) {
|
||||||
DEV_register_ioread_handler(this, vbe_read_handler, addr, "vga video", 7);
|
DEV_register_ioread_handler(this, vbe_read_handler, addr, "vga video", 7);
|
||||||
|
@ -85,7 +85,7 @@ void bx_vgacore_c::init(void)
|
|||||||
{
|
{
|
||||||
unsigned x,y;
|
unsigned x,y;
|
||||||
|
|
||||||
BX_VGA_THIS vgaext = SIM->get_param_string(BXPN_VGA_EXTENSION);
|
BX_VGA_THIS vga_ext_id = (Bit8u)SIM->get_param_enum(BXPN_VGA_EXTENSION)->get();
|
||||||
BX_VGA_THIS pci_enabled = 0;
|
BX_VGA_THIS pci_enabled = 0;
|
||||||
|
|
||||||
BX_VGA_THIS init_standard_vga();
|
BX_VGA_THIS init_standard_vga();
|
||||||
|
@ -266,7 +266,7 @@ protected:
|
|||||||
int timer_id;
|
int timer_id;
|
||||||
bool update_realtime;
|
bool update_realtime;
|
||||||
bool vsync_realtime;
|
bool vsync_realtime;
|
||||||
bx_param_string_c *vgaext;
|
Bit8u vga_ext_id;
|
||||||
bool pci_enabled;
|
bool pci_enabled;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user