diff --git a/src/wx/panel.cpp b/src/wx/panel.cpp index 6cb6652b..a843c4b8 100644 --- a/src/wx/panel.cpp +++ b/src/wx/panel.cpp @@ -59,6 +59,7 @@ GameArea::GameArea() Bind(WX_THREAD_REQUEST_DRAWFRAME, &GameArea::RequestDrawFrame, this); Bind(WX_THREAD_REQUEST_UPDATESTATUSBAR, &GameArea::RequestUpdateStatusBar, this); Bind(WX_THREAD_REQUEST_GBPRINTER, &GameArea::ShowPrinter, this); + Bind(WX_THREAD_REQUEST_UPDATELOG, &GameArea::RequestUpdateLog, this); #endif } @@ -1211,7 +1212,6 @@ void GameArea::RequestDrawFrame(wxThreadEvent& WXUNUSED(event)) void GameArea::RequestUpdateStatusBar(wxThreadEvent& event) { - //wxCriticalSectionLocker lock(MainFrame::emulationCS); MainFrame* f = wxGetApp().frame; int speed = event.GetPayload(); int frames = event.GetExtraLong(); // should probably use payload too @@ -1234,6 +1234,24 @@ void GameArea::RequestUpdateStatusBar(wxThreadEvent& event) wxGetApp().frame->SetStatusText(s, 1); } + +void GameArea::UpdateLog() +{ + wxQueueEvent(this, new wxThreadEvent(WX_THREAD_REQUEST_UPDATELOG)); +} + +void GameArea::RequestUpdateLog(wxThreadEvent& WXUNUSED(event)) +{ +#ifndef NO_THREAD_MAINLOOP + wxCriticalSectionLocker lock(MainFrame::emulationCS); +#endif + LogDialog* d = wxGetApp().frame->logdlg; + + if (d && d->IsShown()) { + d->Update(); + } +} + #endif // NO_THREAD_MAINLOOP void GameArea::DestroyDrawingPanel() diff --git a/src/wx/sys.cpp b/src/wx/sys.cpp index 2f502cce..da38457d 100644 --- a/src/wx/sys.cpp +++ b/src/wx/sys.cpp @@ -1287,12 +1287,15 @@ void log(const char* defaultMsg, ...) wxGetApp().log.append(msg); if (wxGetApp().IsMainLoopRunning()) { +#ifndef NO_THREAD_MAINLOOP + wxGetApp().frame->GetPanel()->UpdateLog(); +#else LogDialog* d = wxGetApp().frame->logdlg; if (d && d->IsShown()) { d->Update(); } - - systemScreenMessage(msg); +#endif + //systemScreenMessage(msg); } } diff --git a/src/wx/wxvbam.h b/src/wx/wxvbam.h index 0e5bf1a7..d2169a4d 100644 --- a/src/wx/wxvbam.h +++ b/src/wx/wxvbam.h @@ -511,6 +511,7 @@ wxDEFINE_EVENT(WX_THREAD_REQUEST_UPDATEDRAWPANEL, wxThreadEvent); wxDEFINE_EVENT(WX_THREAD_REQUEST_DRAWFRAME, wxThreadEvent); wxDEFINE_EVENT(WX_THREAD_REQUEST_UPDATESTATUSBAR, wxThreadEvent); wxDEFINE_EVENT(WX_THREAD_REQUEST_GBPRINTER, wxThreadEvent); +wxDEFINE_EVENT(WX_THREAD_REQUEST_UPDATELOG, wxThreadEvent); #endif // NO_THREAD_MAINLOOP class GameArea : public wxPanel, public HiDPIAware @@ -533,6 +534,8 @@ public: void RequestStatusBar(int speed, int frames); void RequestGBPrinter(uint16_t*, uint16_t**, int, int, int*, int*); void ShowPrinter(wxThreadEvent&); + void RequestUpdateLog(wxThreadEvent&); + void UpdateLog(); #endif void DestroyDrawingPanel();