From 69215cb1e0ed18defbe86f8defc3cd7b1e62f5b8 Mon Sep 17 00:00:00 2001 From: Volker Ruppert Date: Sat, 29 Jun 2024 17:47:05 +0200 Subject: [PATCH] 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. --- bochs/configure | 3 +++ bochs/configure.ac | 2 ++ bochs/gui/wxmain.cc | 9 +++++++-- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/bochs/configure b/bochs/configure index 02dc6dc6d..0da04d9e0 100755 --- a/bochs/configure +++ b/bochs/configure @@ -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 diff --git a/bochs/configure.ac b/bochs/configure.ac index ff608bee2..ef25b31ae 100644 --- a/bochs/configure.ac +++ b/bochs/configure.ac @@ -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") diff --git a/bochs/gui/wxmain.cc b/bochs/gui/wxmain.cc index c5c253ee2..0e4d315df 100644 --- a/bochs/gui/wxmain.cc +++ b/bochs/gui/wxmain.cc @@ -71,6 +71,7 @@ #endif #include #include +#include #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);