summaryrefslogtreecommitdiff
path: root/Source/Core/DolphinQt/CheatSearchWidget.cpp
diff options
context:
space:
mode:
authorDentomologist <dentomologist@gmail.com>2023-10-26 13:06:16 -0700
committerDentomologist <dentomologist@gmail.com>2023-10-30 12:58:38 -0700
commitfa7c969e154cf8c6d89c831bbe4ad88cb54c9ffb (patch)
tree718444b59cdd4f6e5560148bb662d9c23789c05e /Source/Core/DolphinQt/CheatSearchWidget.cpp
parent03f8ec09ebf1ede5335edc6c4acc598b04a8facc (diff)
CheatSearch: Use index range for ClonePartial
Specify the begin and end indices instead of filling a vector with all the indices which are continuous anyway.
Diffstat (limited to 'Source/Core/DolphinQt/CheatSearchWidget.cpp')
-rw-r--r--Source/Core/DolphinQt/CheatSearchWidget.cpp21
1 files changed, 4 insertions, 17 deletions
diff --git a/Source/Core/DolphinQt/CheatSearchWidget.cpp b/Source/Core/DolphinQt/CheatSearchWidget.cpp
index 1f9d226601..4e91f5ddcd 100644
--- a/Source/Core/DolphinQt/CheatSearchWidget.cpp
+++ b/Source/Core/DolphinQt/CheatSearchWidget.cpp
@@ -373,28 +373,15 @@ void CheatSearchWidget::OnNextScanClicked()
bool CheatSearchWidget::RefreshValues()
{
- const size_t result_count = m_session->GetResultCount();
- if (result_count == 0)
+ const size_t displayed_result_count = std::min(TABLE_MAX_ROWS, m_session->GetResultCount());
+ if (displayed_result_count == 0)
{
m_info_label_1->setText(tr("Cannot refresh without results."));
return false;
}
- const bool too_many_results = result_count > TABLE_MAX_ROWS;
- std::unique_ptr<Cheats::CheatSearchSessionBase> tmp;
- if (too_many_results)
- {
- std::vector<size_t> value_indices;
- value_indices.reserve(TABLE_MAX_ROWS);
- for (size_t i = 0; i < TABLE_MAX_ROWS; ++i)
- value_indices.push_back(i);
- tmp = m_session->ClonePartial(value_indices);
- }
- else
- {
- tmp = m_session->Clone();
- }
-
+ std::unique_ptr<Cheats::CheatSearchSessionBase> tmp =
+ m_session->ClonePartial(0, displayed_result_count);
tmp->SetFilterType(Cheats::FilterType::DoNotFilter);
const Cheats::SearchErrorCode error_code = [&tmp] {