Started preparing USB debugger support for wxWidgets (Windows port).

Toolbar button for USB debugger is now available in wxWidgets, but currently
causes a panic. Moving USB debugger related code from gui.cc and win32config.cc
to siminterface.cc is required to support it in wx.
This commit is contained in:
Volker Ruppert 2024-06-16 19:01:29 +02:00
parent 533e2f7c76
commit 7abf471f06
5 changed files with 24 additions and 2 deletions

View File

@ -389,6 +389,9 @@ bx_real_sim_c::bx_real_sim_c()
bxevent_callback_data = NULL;
ci_callback = NULL;
ci_callback_data = NULL;
#if BX_USE_WIN32USBDEBUG
usbi_callback = NULL;
#endif
is_sim_thread_func = NULL;
bx_debug_gui = 0;
bx_log_viewer = 0;

View File

@ -119,7 +119,8 @@ typedef enum {
BX_TOOLBAR_SNAPSHOT,
BX_TOOLBAR_CONFIG,
BX_TOOLBAR_MOUSE_EN,
BX_TOOLBAR_USER
BX_TOOLBAR_USER,
BX_TOOLBAR_USB_DEBUG
} bx_toolbar_buttons;
// normally all action choices are available for all event types. The exclude

View File

@ -1064,7 +1064,7 @@ void bx_wx_gui_c::specific_init(int argc, char **argv, unsigned headerbar_y)
new_gfx_api = 1;
new_text_api = 1;
dialog_caps = BX_GUI_DLG_USER | BX_GUI_DLG_SNAPSHOT | BX_GUI_DLG_SAVE_RESTORE;
dialog_caps = BX_GUI_DLG_USER | BX_GUI_DLG_SNAPSHOT | BX_GUI_DLG_SAVE_RESTORE | BX_GUI_DLG_USB;
}
void bx_wx_gui_c::handle_events(void)
@ -1084,6 +1084,7 @@ void bx_wx_gui_c::handle_events(void)
case BX_TOOLBAR_PASTE: paste_handler(); break;
case BX_TOOLBAR_SNAPSHOT: tb_button = 3; break;
case BX_TOOLBAR_USER: tb_button = 4; break;
case BX_TOOLBAR_USB_DEBUG: tb_button = 5; break;
default:
wxLogDebug (wxT ("unknown toolbar id %d"), event_queue[i].u.toolbar.button);
}
@ -1193,6 +1194,9 @@ void bx_wx_gui_c::handle_events(void)
} else if (tb_button == 4) {
// userbutton_handler() also calls a dialog.
userbutton_handler();
} else if (tb_button == 5) {
// usb_handler() also calls a dialog.
usb_handler();
}
}

View File

@ -93,6 +93,9 @@
//#include "bitmaps/configbutton.xpm"
#include "bitmaps/userbutton.xpm"
#include "bitmaps/saverestore.xpm"
#if BX_USE_WIN32USBDEBUG
#include "bitmaps/usb.xpm"
#endif
#ifdef __WXGTK__
#include "icon_bochs.xpm"
#endif
@ -344,6 +347,9 @@ BEGIN_EVENT_TABLE(MyFrame, wxFrame)
EVT_TOOL(ID_Toolbar_Snapshot, MyFrame::OnToolbarClick)
EVT_TOOL(ID_Toolbar_Mouse_en, MyFrame::OnToolbarClick)
EVT_TOOL(ID_Toolbar_User, MyFrame::OnToolbarClick)
#if BX_USE_WIN32USBDEBUG
EVT_TOOL(ID_Toolbar_USB_Debug, MyFrame::OnToolbarClick)
#endif
END_EVENT_TABLE()
@ -447,6 +453,9 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size,
BX_ADD_TOOL(ID_Toolbar_Snapshot, snapshot_xpm, wxT("Save screen snapshot"));
BX_ADD_TOOL(ID_Toolbar_Mouse_en, mouse_xpm, wxT("Enable mouse capture\nThere is also a shortcut for this: a CTRL key + the middle mouse button."));
BX_ADD_TOOL(ID_Toolbar_User, userbutton_xpm, wxT("Keyboard shortcut"));
#if BX_USE_WIN32USBDEBUG
BX_ADD_TOOL(ID_Toolbar_USB_Debug, usb_xpm, wxT("USB Debugger"));
#endif
bxToolBar->Realize();
UpdateToolBar(false);
@ -862,6 +871,9 @@ void MyFrame::UpdateToolBar(bool simPresent)
} else {
bxToolBar->SetToolShortHelp(ID_Toolbar_SaveRestore, wxT("Restore simulation state"));
}
#if BX_USE_WIN32USBDEBUG
bxToolBar->EnableTool(ID_Toolbar_USB_Debug, simPresent);
#endif
}
void MyFrame::OnStartSim(wxCommandEvent& event)
@ -1271,6 +1283,7 @@ void MyFrame::OnToolbarClick(wxCommandEvent& event)
case ID_Toolbar_Snapshot: which = BX_TOOLBAR_SNAPSHOT; break;
case ID_Toolbar_Mouse_en: panel->ToggleMouse(true); break;
case ID_Toolbar_User: which = BX_TOOLBAR_USER; break;
case ID_Toolbar_USB_Debug: which = BX_TOOLBAR_USB_DEBUG; break;
default:
wxLogError(wxT("unknown toolbar id %d"), id);
}

View File

@ -85,6 +85,7 @@ enum
ID_Toolbar_Mouse_en,
ID_Toolbar_User,
ID_Toolbar_SaveRestore,
ID_Toolbar_USB_Debug,
// dialog box: LogMsgAskDialog
ID_Continue,
ID_Die,