Some changes for wxBochs.

- Read configuration: set working directory to path of selected bochsrc.
- Don't link with readline library if Bochs with debugger is compiled with wx only.
- Set initial window size to 640x480 to make all toolbar buttons visible.
This commit is contained in:
Volker Ruppert 2024-06-29 17:47:05 +02:00
parent 41a7f241ed
commit 69215cb1e0
3 changed files with 12 additions and 2 deletions

3
bochs/configure vendored
View File

@ -26405,6 +26405,9 @@ printf "%s\n" "wxWidgets" >&6; }
printf "%s\n" "#define BX_USE_TEXTCONFIG 0" >>confdefs.h
printf "%s\n" "#define HAVE_LIBREADLINE 0" >>confdefs.h
READLINE_LIB=""
else
if test "$DEFAULT_GUI" = win32; then
printf "%s\n" "#define BX_DEFAULT_CONFIG_INTERFACE \"win32config\"" >>confdefs.h

View File

@ -2842,6 +2842,8 @@ if test "$display_libs" = " wxWidgets"; then
AC_DEFINE(BX_DEFAULT_CONFIG_INTERFACE, "wx")
AC_DEFINE(BX_DEFAULT_DISPLAY_LIBRARY, "wx")
AC_DEFINE(BX_USE_TEXTCONFIG, 0)
AC_DEFINE(HAVE_LIBREADLINE, 0)
READLINE_LIB=""
else
if test "$DEFAULT_GUI" = win32; then
AC_DEFINE(BX_DEFAULT_CONFIG_INTERFACE, "win32config")

View File

@ -71,6 +71,7 @@
#endif
#include <wx/image.h>
#include <wx/clipbrd.h>
#include <wx/filename.h>
#include "osdep.h" // workarounds for missing stuff
#include "gui/paramtree.h" // config parameter tree
@ -244,7 +245,7 @@ bool MyApp::OnInit()
// simulation begins. This is responsible for displaying any error
// dialogs during bochsrc and command line processing.
SIM->set_notify_callback(&MyApp::DefaultCallback, this);
MyFrame *frame = new MyFrame(wxT("Bochs x86 Emulator"), wxPoint(50,50), wxSize(450,340), wxMINIMIZE_BOX | wxSYSTEM_MENU | wxCAPTION);
MyFrame *frame = new MyFrame(wxT("Bochs x86 Emulator"), wxPoint(50,50), wxSize(640,480), wxMINIMIZE_BOX | wxSYSTEM_MENU | wxCAPTION);
theFrame = frame; // hack alert
frame->Show(TRUE);
SetTopWindow(frame);
@ -497,10 +498,14 @@ void MyFrame::OnConfigNew(wxCommandEvent& WXUNUSED(event))
void MyFrame::OnConfigRead(wxCommandEvent& WXUNUSED(event))
{
char bochsrc[512];
wxString fullName, workDir;
long style = wxFD_OPEN;
wxFileDialog *fdialog = new wxFileDialog(this, wxT("Read configuration"), wxT(""), wxT(""), wxT("*.*"), style);
if (fdialog->ShowModal() == wxID_OK) {
strncpy(bochsrc, fdialog->GetPath().mb_str(wxConvUTF8), sizeof(bochsrc) - 1);
fullName = fdialog->GetPath();
wxFileName::SplitPath(fullName, &workDir, NULL, NULL);
wxSetWorkingDirectory(workDir);
strncpy(bochsrc, fullName.mb_str(wxConvUTF8), sizeof(bochsrc) - 1);
bochsrc[sizeof(bochsrc) - 1] = '\0';
SIM->reset_all_param();
SIM->read_rc(bochsrc);