Removed reference to textconfig.cc from win32dialog.cc. Added switching config

interface to textconfig if the selected gui has a builtin console in
SIM->set_init_done(). This is required on Windows for the rfb and vncsrv guis.
Cleaned up the textconfig code.
This commit is contained in:
Volker Ruppert 2021-03-17 16:11:05 +00:00
parent 130be4e7bb
commit 4d6f1039c7
5 changed files with 45 additions and 54 deletions

View File

@ -28,6 +28,7 @@
#include "iodev.h"
#include "bx_debug/debug.h"
#include "virt_timer.h"
#include "textconfig.h"
bx_simulator_interface_c *SIM = NULL;
logfunctions *siminterface_log = NULL;
@ -71,8 +72,8 @@ class bx_real_sim_c : public bx_simulator_interface_c {
void *ci_callback_data;
rt_conf_entry_t *rt_conf_entries;
addon_option_t *addon_options;
int init_done;
int enabled;
bool init_done;
bool enabled;
// save context to jump to if we must quit unexpectedly
jmp_buf *quit_context;
int exit_code;
@ -84,8 +85,8 @@ public:
bx_real_sim_c();
virtual ~bx_real_sim_c() {}
virtual void set_quit_context(jmp_buf *context) { quit_context = context; }
virtual int get_init_done() { return init_done; }
virtual int set_init_done(int n) { init_done = n; return 0;}
virtual bool get_init_done() { return init_done; }
virtual int set_init_done(bool n);
virtual void reset_all_param();
// new param methods
virtual bx_param_c *get_param(const char *pname, bx_param_c *base=NULL);
@ -373,6 +374,19 @@ bx_real_sim_c::bx_real_sim_c()
addon_options = NULL;
}
int bx_real_sim_c::set_init_done(bool n)
{
if (n) {
if (bx_gui->has_gui_console()) {
if (strcmp(registered_ci_name, "textconfig") != 0) {
init_text_config_interface();
}
}
}
init_done = n;
return 0;
}
void bx_real_sim_c::reset_all_param()
{
bx_reset_options();
@ -852,17 +866,11 @@ void bx_real_sim_c::register_configuration_interface(
int bx_real_sim_c::configuration_interface(const char *ignore, ci_command_t command)
{
bx_param_enum_c *ci_param = SIM->get_param_enum(BXPN_SEL_CONFIG_INTERFACE);
const char *name = ci_param->get_selected();
if (!ci_callback) {
BX_PANIC(("no configuration interface was loaded"));
return -1;
}
if (strcmp(name, registered_ci_name) != 0) {
BX_PANIC(("siminterface does not support loading one configuration interface and then calling another"));
return -1;
}
if (!strcmp(name, "wx"))
if (!strcmp(registered_ci_name, "wx"))
wxsel = 1;
else
wxsel = 0;

View File

@ -585,8 +585,8 @@ public:
bx_simulator_interface_c() {}
virtual ~bx_simulator_interface_c() {}
virtual void set_quit_context(jmp_buf *context) {}
virtual int get_init_done() { return 0; }
virtual int set_init_done(int n) {return 0;}
virtual bool get_init_done() { return 0; }
virtual int set_init_done(bool n) {return 0;}
virtual void reset_all_param() {}
// new param methods
virtual bx_param_c *get_param(const char *pname, bx_param_c *base=NULL) {return NULL;}

View File

@ -51,7 +51,6 @@ extern "C" {
#include "osdep.h"
#include "bx_debug/debug.h"
#include "param_names.h"
#include "textconfig.h"
#include "logio.h"
#include "paramtree.h"
#include "siminterface.h"
@ -66,8 +65,28 @@ extern "C" {
#define bx_fgets fgets
#endif
enum {
BX_CI_START_MENU,
BX_CI_START_OPTS,
BX_CI_START_SIMULATION,
BX_CI_RUNTIME,
BX_CI_N_MENUS
};
enum {
BX_CI_RT_FLOPPYA = 1,
BX_CI_RT_FLOPPYB,
BX_CI_RT_CDROM,
BX_CI_RT_LOGOPTS1,
BX_CI_RT_LOGOPTS2,
BX_CI_RT_USB,
BX_CI_RT_MISC,
BX_CI_RT_SAVE_CFG,
BX_CI_RT_CONT,
BX_CI_RT_QUIT
};
/* functions for changing particular options */
void bx_text_config_interface_init();
int bx_read_rc(char *rc);
int bx_write_rc(char *rc);
void bx_plugin_ctrl();
@ -422,9 +441,6 @@ int bx_text_config_interface(int menu)
char sr_path[CI_PATH_LENGTH];
while (1) {
switch (menu) {
case BX_CI_INIT:
bx_text_config_interface_init();
return 0;
case BX_CI_START_SIMULATION:
SIM->begin_simulation(bx_startup_flags.argc, bx_startup_flags.argv);
// we don't expect it to return, but if it does, quit
@ -740,7 +756,7 @@ const char *log_action_ask_choices[] = { "cont", "alwayscont", "die", "abort", "
int log_action_n_choices = 4 + (BX_DEBUGGER||BX_GDBSTUB?1:0);
BxEvent *
config_interface_notify_callback(void *unused, BxEvent *event)
textconfig_notify_callback(void *unused, BxEvent *event)
{
event->retcode = -1;
switch (event->type)
@ -800,11 +816,6 @@ ask:
assert(0); // switch statement should return
}
void bx_text_config_interface_init()
{
SIM->set_notify_callback(config_interface_notify_callback, NULL);
}
/////////////////////////////////////////////////////////////////////
// implement the text_* methods for bx_param types.
@ -1077,7 +1088,6 @@ static int ci_callback(void *userdata, ci_command_t command)
switch (command)
{
case CI_START:
bx_text_config_interface_init();
if (SIM->get_param_enum(BXPN_BOCHS_START)->get() == BX_QUICK_START)
bx_text_config_interface(BX_CI_START_SIMULATION);
else {
@ -1100,6 +1110,7 @@ static int ci_callback(void *userdata, ci_command_t command)
int init_text_config_interface()
{
SIM->register_configuration_interface("textconfig", ci_callback, NULL);
SIM->set_notify_callback(textconfig_notify_callback, NULL);
return 0; // success
}

View File

@ -2,7 +2,7 @@
// $Id$
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2009-2017 The Bochs Project
// Copyright (C) 2009-2021 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
@ -22,29 +22,6 @@
#if BX_USE_TEXTCONFIG
enum {
BX_CI_INIT,
BX_CI_START_MENU,
BX_CI_START_OPTS,
BX_CI_START_SIMULATION,
BX_CI_RUNTIME,
BX_CI_N_MENUS
};
enum {
BX_CI_RT_FLOPPYA = 1,
BX_CI_RT_FLOPPYB,
BX_CI_RT_CDROM,
BX_CI_RT_LOGOPTS1,
BX_CI_RT_LOGOPTS2,
BX_CI_RT_USB,
BX_CI_RT_MISC,
BX_CI_RT_SAVE_CFG,
BX_CI_RT_CONT,
BX_CI_RT_QUIT
};
int init_text_config_interface();
int bx_text_config_interface(int menu);
#endif

View File

@ -25,7 +25,6 @@
#include "gui.h"
#include "win32res.h"
#include "win32paramdlg.h"
#include "textconfig.h"
#if BX_USE_WIN32CONFIG
@ -713,10 +712,6 @@ static int win32_ci_callback(void *userdata, ci_command_t command)
#endif
return -1;
}
#if BX_USE_TEXTCONFIG
} else {
bx_text_config_interface(BX_CI_RUNTIME);
#endif
}
break;
case CI_SHUTDOWN: