Debugger/MemorySearch: search for byte array instead of converting byte array to string

This commit is contained in:
solid1353 2023-07-16 18:45:49 +03:00 committed by Connor McLaughlin
parent 8362e6f435
commit 68865a2bca
1 changed files with 4 additions and 4 deletions

View File

@ -582,7 +582,7 @@ static std::vector<u32> searchWorker(DebugInterface* cpu, u32 start, u32 end, T
return hitAddresses;
}
static std::vector<u32> searchWorkerString(DebugInterface* cpu, u32 start, u32 end, std::string value)
static std::vector<u32> searchWorkerByteArray(DebugInterface* cpu, u32 start, u32 end, QByteArray value)
{
std::vector<u32> hitAddresses;
for (u32 addr = start; addr < end; addr += 1)
@ -590,7 +590,7 @@ static std::vector<u32> searchWorkerString(DebugInterface* cpu, u32 start, u32 e
bool hit = true;
for (size_t i = 0; i < value.length(); i++)
{
if (static_cast<char>(cpu->read8(addr + i)) != value[i])
if (cpu->read8(addr + i) != value[i])
{
hit = false;
break;
@ -624,9 +624,9 @@ std::vector<u32> startWorker(DebugInterface* cpu, int type, u32 start, u32 end,
case 5:
return searchWorker<double>(cpu, start, end, value.toDouble());
case 6:
return searchWorkerString(cpu, start, end, value.toStdString());
return searchWorkerByteArray(cpu, start, end, value.toUtf8());
case 7:
return searchWorkerString(cpu, start, end, QByteArray::fromHex(value.toUtf8()).toStdString());
return searchWorkerByteArray(cpu, start, end, QByteArray::fromHex(value.toUtf8()));
default:
Console.Error("Debugger: Unknown type when doing memory search!");
break;