From f777c01c5d2a23632b592de679445192c892fc66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Lam?= Date: Fri, 28 Jul 2017 12:37:21 +0800 Subject: [PATCH 1/2] WX/Debugger: Clean up event handling Boot to Pause and Automatic Start are not JIT or CPU menu items, so they are supposed to be handled by OnCPUMode. --- Source/Core/DolphinWX/Debugger/CodeWindow.cpp | 8 ++------ Source/Core/DolphinWX/Debugger/CodeWindow.h | 3 +++ Source/Core/DolphinWX/Debugger/CodeWindowFunctions.cpp | 10 ++++++++++ Source/Core/DolphinWX/Globals.h | 5 +++-- 4 files changed, 18 insertions(+), 8 deletions(-) diff --git a/Source/Core/DolphinWX/Debugger/CodeWindow.cpp b/Source/Core/DolphinWX/Debugger/CodeWindow.cpp index c1e10e248e..7c4c6de534 100644 --- a/Source/Core/DolphinWX/Debugger/CodeWindow.cpp +++ b/Source/Core/DolphinWX/Debugger/CodeWindow.cpp @@ -123,6 +123,8 @@ CCodeWindow::CCodeWindow(CFrame* parent, wxWindowID id, const wxPoint& position, Bind(wxEVT_MENU, &CCodeWindow::OnJitMenu, this, IDM_CLEAR_CODE_CACHE, IDM_SEARCH_INSTRUCTION); Bind(wxEVT_MENU, &CCodeWindow::OnSymbolsMenu, this, IDM_CLEAR_SYMBOLS, IDM_PATCH_HLE_FUNCTIONS); Bind(wxEVT_MENU, &CCodeWindow::OnProfilerMenu, this, IDM_PROFILE_BLOCKS, IDM_WRITE_PROFILE); + Bind(wxEVT_MENU, &CCodeWindow::OnBootToPauseSelected, this, IDM_BOOT_TO_PAUSE); + Bind(wxEVT_MENU, &CCodeWindow::OnAutomaticStartSelected, this, IDM_AUTOMATIC_START); // Toolbar Bind(wxEVT_MENU, &CCodeWindow::OnCodeStep, this, IDM_STEP, IDM_GOTOPC); @@ -483,12 +485,6 @@ void CCodeWindow::OnCPUMode(wxCommandEvent& event) case IDM_INTERPRETER: PowerPC::SetMode(event.IsChecked() ? PowerPC::CoreMode::Interpreter : PowerPC::CoreMode::JIT); break; - case IDM_BOOT_TO_PAUSE: - SConfig::GetInstance().bBootToPause = event.IsChecked(); - return; - case IDM_AUTOMATIC_START: - SConfig::GetInstance().bAutomaticStart = event.IsChecked(); - return; case IDM_JIT_OFF: SConfig::GetInstance().bJITOff = event.IsChecked(); break; diff --git a/Source/Core/DolphinWX/Debugger/CodeWindow.h b/Source/Core/DolphinWX/Debugger/CodeWindow.h index 76024eb1d4..8a43ebcedf 100644 --- a/Source/Core/DolphinWX/Debugger/CodeWindow.h +++ b/Source/Core/DolphinWX/Debugger/CodeWindow.h @@ -133,6 +133,9 @@ private: void OnJitMenu(wxCommandEvent& event); void OnProfilerMenu(wxCommandEvent& event); + void OnBootToPauseSelected(wxCommandEvent& event); + void OnAutomaticStartSelected(wxCommandEvent& event); + void OnSymbolListChange(wxCommandEvent& event); void OnCallstackListChange(wxCommandEvent& event); void OnCallersListChange(wxCommandEvent& event); diff --git a/Source/Core/DolphinWX/Debugger/CodeWindowFunctions.cpp b/Source/Core/DolphinWX/Debugger/CodeWindowFunctions.cpp index 7bc7f07210..7214ec26b9 100644 --- a/Source/Core/DolphinWX/Debugger/CodeWindowFunctions.cpp +++ b/Source/Core/DolphinWX/Debugger/CodeWindowFunctions.cpp @@ -505,6 +505,16 @@ void CCodeWindow::OnChangeFont(wxCommandEvent& event) // TODO: Send event to all panels that tells them to reload the font when it changes. } +void CCodeWindow::OnBootToPauseSelected(wxCommandEvent& event) +{ + SConfig::GetInstance().bBootToPause = event.IsChecked(); +} + +void CCodeWindow::OnAutomaticStartSelected(wxCommandEvent& event) +{ + SConfig::GetInstance().bAutomaticStart = event.IsChecked(); +} + // Toggle windows wxPanel* CCodeWindow::GetUntypedPanel(int id) const diff --git a/Source/Core/DolphinWX/Globals.h b/Source/Core/DolphinWX/Globals.h index 0ade18f159..d85d5add8e 100644 --- a/Source/Core/DolphinWX/Globals.h +++ b/Source/Core/DolphinWX/Globals.h @@ -208,8 +208,6 @@ enum // -------------------- // CPU Mode IDM_INTERPRETER, - IDM_AUTOMATIC_START, - IDM_BOOT_TO_PAUSE, IDM_JIT_NO_BLOCK_CACHE, IDM_JIT_NO_BLOCK_LINKING, // JIT IDM_JIT_OFF, @@ -223,7 +221,10 @@ enum IDM_JIT_FP_OFF, IDM_JIT_P_OFF, IDM_JIT_SR_OFF, + IDM_FONT_PICKER, + IDM_AUTOMATIC_START, + IDM_BOOT_TO_PAUSE, // Symbols IDM_CLEAR_SYMBOLS, From 23ae756192131938e189c491c01c952c5287736b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Lam?= Date: Fri, 28 Jul 2017 12:33:50 +0800 Subject: [PATCH 2/2] WX: Automatically pause the core for the JIT menu items Removes the need to manually pause the core, select the menu item and then unpause. --- Source/Core/DolphinWX/Debugger/CodeWindow.cpp | 86 ++++++++++--------- Source/Core/DolphinWX/FrameTools.cpp | 26 +++--- 2 files changed, 57 insertions(+), 55 deletions(-) diff --git a/Source/Core/DolphinWX/Debugger/CodeWindow.cpp b/Source/Core/DolphinWX/Debugger/CodeWindow.cpp index 7c4c6de534..4f14da7302 100644 --- a/Source/Core/DolphinWX/Debugger/CodeWindow.cpp +++ b/Source/Core/DolphinWX/Debugger/CodeWindow.cpp @@ -480,48 +480,50 @@ void CCodeWindow::UpdateCallstack() // CPU Mode and JIT Menu void CCodeWindow::OnCPUMode(wxCommandEvent& event) { - switch (event.GetId()) - { - case IDM_INTERPRETER: - PowerPC::SetMode(event.IsChecked() ? PowerPC::CoreMode::Interpreter : PowerPC::CoreMode::JIT); - break; - case IDM_JIT_OFF: - SConfig::GetInstance().bJITOff = event.IsChecked(); - break; - case IDM_JIT_LS_OFF: - SConfig::GetInstance().bJITLoadStoreOff = event.IsChecked(); - break; - case IDM_JIT_LSLXZ_OFF: - SConfig::GetInstance().bJITLoadStorelXzOff = event.IsChecked(); - break; - case IDM_JIT_LSLWZ_OFF: - SConfig::GetInstance().bJITLoadStorelwzOff = event.IsChecked(); - break; - case IDM_JIT_LSLBZX_OFF: - SConfig::GetInstance().bJITLoadStorelbzxOff = event.IsChecked(); - break; - case IDM_JIT_LSF_OFF: - SConfig::GetInstance().bJITLoadStoreFloatingOff = event.IsChecked(); - break; - case IDM_JIT_LSP_OFF: - SConfig::GetInstance().bJITLoadStorePairedOff = event.IsChecked(); - break; - case IDM_JIT_FP_OFF: - SConfig::GetInstance().bJITFloatingPointOff = event.IsChecked(); - break; - case IDM_JIT_I_OFF: - SConfig::GetInstance().bJITIntegerOff = event.IsChecked(); - break; - case IDM_JIT_P_OFF: - SConfig::GetInstance().bJITPairedOff = event.IsChecked(); - break; - case IDM_JIT_SR_OFF: - SConfig::GetInstance().bJITSystemRegistersOff = event.IsChecked(); - break; - } + Core::RunAsCPUThread([&event] { + switch (event.GetId()) + { + case IDM_INTERPRETER: + PowerPC::SetMode(event.IsChecked() ? PowerPC::CoreMode::Interpreter : PowerPC::CoreMode::JIT); + break; + case IDM_JIT_OFF: + SConfig::GetInstance().bJITOff = event.IsChecked(); + break; + case IDM_JIT_LS_OFF: + SConfig::GetInstance().bJITLoadStoreOff = event.IsChecked(); + break; + case IDM_JIT_LSLXZ_OFF: + SConfig::GetInstance().bJITLoadStorelXzOff = event.IsChecked(); + break; + case IDM_JIT_LSLWZ_OFF: + SConfig::GetInstance().bJITLoadStorelwzOff = event.IsChecked(); + break; + case IDM_JIT_LSLBZX_OFF: + SConfig::GetInstance().bJITLoadStorelbzxOff = event.IsChecked(); + break; + case IDM_JIT_LSF_OFF: + SConfig::GetInstance().bJITLoadStoreFloatingOff = event.IsChecked(); + break; + case IDM_JIT_LSP_OFF: + SConfig::GetInstance().bJITLoadStorePairedOff = event.IsChecked(); + break; + case IDM_JIT_FP_OFF: + SConfig::GetInstance().bJITFloatingPointOff = event.IsChecked(); + break; + case IDM_JIT_I_OFF: + SConfig::GetInstance().bJITIntegerOff = event.IsChecked(); + break; + case IDM_JIT_P_OFF: + SConfig::GetInstance().bJITPairedOff = event.IsChecked(); + break; + case IDM_JIT_SR_OFF: + SConfig::GetInstance().bJITSystemRegistersOff = event.IsChecked(); + break; + } - // Clear the JIT cache to enable these changes - JitInterface::ClearCache(); + // Clear the JIT cache to enable these changes + JitInterface::ClearCache(); + }); } void CCodeWindow::OnJitMenu(wxCommandEvent& event) @@ -533,7 +535,7 @@ void CCodeWindow::OnJitMenu(wxCommandEvent& event) break; case IDM_CLEAR_CODE_CACHE: - JitInterface::ClearCache(); + Core::RunAsCPUThread(JitInterface::ClearCache); break; case IDM_SEARCH_INSTRUCTION: diff --git a/Source/Core/DolphinWX/FrameTools.cpp b/Source/Core/DolphinWX/FrameTools.cpp index c98297a421..77d7fe00d4 100644 --- a/Source/Core/DolphinWX/FrameTools.cpp +++ b/Source/Core/DolphinWX/FrameTools.cpp @@ -237,18 +237,18 @@ void CFrame::BindDebuggerMenuBarUpdateEvents() Bind(wxEVT_UPDATE_UI, &CFrame::OnUpdateInterpreterMenuItem, this, IDM_INTERPRETER); - Bind(wxEVT_UPDATE_UI, &WxEventUtils::OnEnableIfCorePaused, IDM_JIT_OFF); - Bind(wxEVT_UPDATE_UI, &WxEventUtils::OnEnableIfCorePaused, IDM_JIT_LS_OFF); - Bind(wxEVT_UPDATE_UI, &WxEventUtils::OnEnableIfCorePaused, IDM_JIT_LSLXZ_OFF); - Bind(wxEVT_UPDATE_UI, &WxEventUtils::OnEnableIfCorePaused, IDM_JIT_LSLWZ_OFF); - Bind(wxEVT_UPDATE_UI, &WxEventUtils::OnEnableIfCorePaused, IDM_JIT_LSLBZX_OFF); - Bind(wxEVT_UPDATE_UI, &WxEventUtils::OnEnableIfCorePaused, IDM_JIT_LSF_OFF); - Bind(wxEVT_UPDATE_UI, &WxEventUtils::OnEnableIfCorePaused, IDM_JIT_LSP_OFF); - Bind(wxEVT_UPDATE_UI, &WxEventUtils::OnEnableIfCorePaused, IDM_JIT_FP_OFF); - Bind(wxEVT_UPDATE_UI, &WxEventUtils::OnEnableIfCorePaused, IDM_JIT_I_OFF); - Bind(wxEVT_UPDATE_UI, &WxEventUtils::OnEnableIfCorePaused, IDM_JIT_P_OFF); - Bind(wxEVT_UPDATE_UI, &WxEventUtils::OnEnableIfCorePaused, IDM_JIT_SR_OFF); - Bind(wxEVT_UPDATE_UI, &WxEventUtils::OnEnableIfCorePaused, IDM_CLEAR_CODE_CACHE); + Bind(wxEVT_UPDATE_UI, &WxEventUtils::OnEnableIfCoreRunning, IDM_JIT_OFF); + Bind(wxEVT_UPDATE_UI, &WxEventUtils::OnEnableIfCoreRunning, IDM_JIT_LS_OFF); + Bind(wxEVT_UPDATE_UI, &WxEventUtils::OnEnableIfCoreRunning, IDM_JIT_LSLXZ_OFF); + Bind(wxEVT_UPDATE_UI, &WxEventUtils::OnEnableIfCoreRunning, IDM_JIT_LSLWZ_OFF); + Bind(wxEVT_UPDATE_UI, &WxEventUtils::OnEnableIfCoreRunning, IDM_JIT_LSLBZX_OFF); + Bind(wxEVT_UPDATE_UI, &WxEventUtils::OnEnableIfCoreRunning, IDM_JIT_LSF_OFF); + Bind(wxEVT_UPDATE_UI, &WxEventUtils::OnEnableIfCoreRunning, IDM_JIT_LSP_OFF); + Bind(wxEVT_UPDATE_UI, &WxEventUtils::OnEnableIfCoreRunning, IDM_JIT_FP_OFF); + Bind(wxEVT_UPDATE_UI, &WxEventUtils::OnEnableIfCoreRunning, IDM_JIT_I_OFF); + Bind(wxEVT_UPDATE_UI, &WxEventUtils::OnEnableIfCoreRunning, IDM_JIT_P_OFF); + Bind(wxEVT_UPDATE_UI, &WxEventUtils::OnEnableIfCoreRunning, IDM_JIT_SR_OFF); + Bind(wxEVT_UPDATE_UI, &WxEventUtils::OnEnableIfCoreRunning, IDM_CLEAR_CODE_CACHE); Bind(wxEVT_UPDATE_UI, &WxEventUtils::OnEnableIfCoreInitialized, IDM_SEARCH_INSTRUCTION); Bind(wxEVT_UPDATE_UI, &WxEventUtils::OnEnableIfCoreInitialized, IDM_CLEAR_SYMBOLS); @@ -1111,7 +1111,7 @@ void CFrame::OnRescanGameList(wxCommandEvent& WXUNUSED(event)) void CFrame::OnUpdateInterpreterMenuItem(wxUpdateUIEvent& event) { - WxEventUtils::OnEnableIfCorePaused(event); + WxEventUtils::OnEnableIfCoreRunning(event); if (GetMenuBar()->FindItem(IDM_INTERPRETER)->IsChecked()) return;