From 5c688b2d2b18d07576410c8082483df9630b7851 Mon Sep 17 00:00:00 2001 From: aldelaro5 Date: Fri, 11 May 2018 16:38:32 -0400 Subject: [PATCH] Qt/debugger: Don't update the symbols list unnecessarily It only needs to be updated when we changes the symbols, not every time the code widget updates and it does take a while to update them so this fixes some delay when updating the code window. --- Source/Core/DolphinQt2/Debugger/CodeWidget.cpp | 3 +-- Source/Core/DolphinQt2/Debugger/CodeWidget.h | 2 +- Source/Core/DolphinQt2/MainWindow.cpp | 6 ++++++ Source/Core/DolphinQt2/MenuBar.cpp | 12 ++++++------ Source/Core/DolphinQt2/MenuBar.h | 3 +++ 5 files changed, 17 insertions(+), 9 deletions(-) diff --git a/Source/Core/DolphinQt2/Debugger/CodeWidget.cpp b/Source/Core/DolphinQt2/Debugger/CodeWidget.cpp index 060494c0c8..8c644e7375 100644 --- a/Source/Core/DolphinQt2/Debugger/CodeWidget.cpp +++ b/Source/Core/DolphinQt2/Debugger/CodeWidget.cpp @@ -147,7 +147,7 @@ void CodeWidget::ConnectWidgets() connect(m_search_address, &QLineEdit::textChanged, this, &CodeWidget::OnSearchAddress); connect(m_search_symbols, &QLineEdit::textChanged, this, &CodeWidget::OnSearchSymbols); - connect(m_symbols_list, &QListWidget::itemSelectionChanged, this, &CodeWidget::OnSelectSymbol); + connect(m_symbols_list, &QListWidget::itemClicked, this, &CodeWidget::OnSelectSymbol); connect(m_callstack_list, &QListWidget::itemSelectionChanged, this, &CodeWidget::OnSelectCallstack); connect(m_function_calls_list, &QListWidget::itemSelectionChanged, this, @@ -252,7 +252,6 @@ void CodeWidget::Update() Symbol* symbol = g_symbolDB.GetSymbolFromAddr(m_code_view->GetAddress()); UpdateCallstack(); - UpdateSymbols(); m_code_view->Update(); m_code_view->setFocus(); diff --git a/Source/Core/DolphinQt2/Debugger/CodeWidget.h b/Source/Core/DolphinQt2/Debugger/CodeWidget.h index ccc783bae6..70e2168b1c 100644 --- a/Source/Core/DolphinQt2/Debugger/CodeWidget.h +++ b/Source/Core/DolphinQt2/Debugger/CodeWidget.h @@ -36,6 +36,7 @@ public: void SetAddress(u32 address, CodeViewWidget::SetAddressUpdate update); void Update(); + void UpdateSymbols(); signals: void BreakpointsChanged(); void RequestPPCComparison(u32 addr); @@ -44,7 +45,6 @@ private: void CreateWidgets(); void ConnectWidgets(); void UpdateCallstack(); - void UpdateSymbols(); void UpdateFunctionCalls(Symbol* symbol); void UpdateFunctionCallers(Symbol* symbol); diff --git a/Source/Core/DolphinQt2/MainWindow.cpp b/Source/Core/DolphinQt2/MainWindow.cpp index c6949ee5cf..3571724da7 100644 --- a/Source/Core/DolphinQt2/MainWindow.cpp +++ b/Source/Core/DolphinQt2/MainWindow.cpp @@ -340,6 +340,12 @@ void MainWindow::ConnectMenuBar() connect(m_game_list, &GameList::SelectionChanged, m_menu_bar, &MenuBar::SelectionChanged); connect(this, &MainWindow::ReadOnlyModeChanged, m_menu_bar, &MenuBar::ReadOnlyModeChanged); connect(this, &MainWindow::RecordingStatusChanged, m_menu_bar, &MenuBar::RecordingStatusChanged); + + // Symbols + connect(m_menu_bar, &MenuBar::NotifySymbolsUpdated, [this] { + m_code_widget->UpdateSymbols(); + m_code_widget->Update(); + }); } void MainWindow::ConnectHotkeys() diff --git a/Source/Core/DolphinQt2/MenuBar.cpp b/Source/Core/DolphinQt2/MenuBar.cpp index 7ffe83eecb..7d4e46ceba 100644 --- a/Source/Core/DolphinQt2/MenuBar.cpp +++ b/Source/Core/DolphinQt2/MenuBar.cpp @@ -1020,13 +1020,13 @@ void MenuBar::ClearSymbols() return; g_symbolDB.Clear(); - Host_NotifyMapLoaded(); + emit NotifySymbolsUpdated(); } void MenuBar::GenerateSymbolsFromAddress() { PPCAnalyst::FindFunctions(0x80000000, 0x81800000, &g_symbolDB); - Host_NotifyMapLoaded(); + emit NotifySymbolsUpdated(); } void MenuBar::GenerateSymbolsFromSignatureDB() @@ -1048,7 +1048,7 @@ void MenuBar::GenerateSymbolsFromSignatureDB() tr("'%1' not found, no symbol names generated").arg(QString::fromStdString(TOTALDB))); } - Host_NotifyMapLoaded(); + emit NotifySymbolsUpdated(); } void MenuBar::GenerateSymbolsFromRSO() @@ -1067,7 +1067,7 @@ void MenuBar::GenerateSymbolsFromRSO() if (rso_chain.Load(static_cast(address))) { rso_chain.Apply(&g_symbolDB); - Host_NotifyMapLoaded(); + emit NotifySymbolsUpdated(); } else { @@ -1101,7 +1101,7 @@ void MenuBar::LoadSymbolMap() } HLE::PatchFunctions(); - Host_NotifyMapLoaded(); + emit NotifySymbolsUpdated(); } void MenuBar::SaveSymbolMap() @@ -1123,7 +1123,7 @@ void MenuBar::LoadOtherSymbolMap() g_symbolDB.LoadMap(file.toStdString()); HLE::PatchFunctions(); - Host_NotifyMapLoaded(); + emit NotifySymbolsUpdated(); } void MenuBar::SaveSymbolMapAs() diff --git a/Source/Core/DolphinQt2/MenuBar.h b/Source/Core/DolphinQt2/MenuBar.h index fb2f2b9d4b..8998c8f3d5 100644 --- a/Source/Core/DolphinQt2/MenuBar.h +++ b/Source/Core/DolphinQt2/MenuBar.h @@ -102,6 +102,9 @@ signals: void RecordingStatusChanged(bool recording); void ReadOnlyModeChanged(bool read_only); + // Synbols + void NotifySymbolsUpdated(); + private: void OnEmulationStateChanged(Core::State state);