MCPcopy Create free account
hub / github.com/PCSX2/pcsx2 / searchWorkerByteArray

Function searchWorkerByteArray

pcsx2-qt/Debugger/Memory/MemorySearchView.cpp:350–389  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

348}
349
350static void searchWorkerByteArray(DebugInterface* cpu, SearchType searchType, SearchComparison searchComparison, std::vector<SearchResult>& searchResults, u32 start, u32 end, QByteArray searchValue)
351{
352 const bool isSearchingRange = searchResults.size() <= 0;
353 if (isSearchingRange)
354 {
355 for (u32 addr = start; addr < end; addr += 1)
356 {
357 if (!cpu->isValidAddress(addr))
358 continue;
359 if (handleArraySearchComparison(cpu, searchComparison, addr, nullptr, searchValue))
360 {
361 searchResults.push_back(MemorySearchView::SearchResult(addr, searchValue, searchType));
362 addr += searchValue.length() - 1;
363 }
364 }
365 }
366 else
367 {
368 auto removeIt = std::remove_if(searchResults.begin(), searchResults.end(), [searchComparison, searchType, searchValue, cpu](SearchResult& searchResult) -> bool {
369 const u32 addr = searchResult.getAddress();
370 if (!cpu->isValidAddress(addr))
371 return true;
372
373 const bool doesMatch = handleArraySearchComparison(cpu, searchComparison, addr, &searchResult, searchValue);
374 if (doesMatch)
375 {
376 QByteArray matchValue;
377 if (searchComparison == SearchComparison::Equals)
378 matchValue = searchValue;
379 else if (searchComparison == SearchComparison::NotChanged)
380 matchValue = searchResult.getArrayValue();
381 else
382 matchValue = readArrayAtAddress(cpu, addr, searchValue.length() - 1);
383 searchResult = MemorySearchView::SearchResult(addr, matchValue, searchType);
384 }
385 return !doesMatch;
386 });
387 searchResults.erase(removeIt, searchResults.end());
388 }
389}
390
391std::vector<SearchResult> startWorker(DebugInterface* cpu, const SearchType type, const SearchComparison comparison, std::vector<SearchResult> searchResults, u32 start, u32 end, QString value, int base)
392{

Callers 1

startWorkerFunction · 0.85

Calls 12

SearchResultClass · 0.85
readArrayAtAddressFunction · 0.85
isValidAddressMethod · 0.80
getArrayValueMethod · 0.80
sizeMethod · 0.45
push_backMethod · 0.45
lengthMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
getAddressMethod · 0.45
eraseMethod · 0.45

Tested by

no test coverage detected