diff --git a/src/core/mem-search.c b/src/core/mem-search.c index dbe8f94e6..4f007d9ef 100644 --- a/src/core/mem-search.c +++ b/src/core/mem-search.c @@ -137,9 +137,9 @@ static size_t _searchGuess(const void* mem, size_t size, const struct mCoreMemor // Decimal: value = strtoll(params->valueStr, &end, 10); if (end && !end[0]) { - if (value > 0x10000) { + if ((params->width == -1 && value > 0x10000) || params->width == 4) { found += _search32(mem, size, block, value, params->op, out, limit ? limit - found : 0); - } else if (value > 0x100) { + } else if ((params->width == -1 && value > 0x100) || params->width == 2) { found += _search16(mem, size, block, value, params->op, out, limit ? limit - found : 0); } else { found += _search8(mem, size, block, value, params->op, out, limit ? limit - found : 0); @@ -151,9 +151,9 @@ static size_t _searchGuess(const void* mem, size_t size, const struct mCoreMemor value /= 10; divisor *= 10; - if (value > 0x10000) { + if ((params->width == -1 && value > 0x10000) || params->width == 4) { found += _search32(mem, size, block, value, params->op, &tmp, limit ? limit - found : 0); - } else if (value > 0x100) { + } else if ((params->width == -1 && value > 0x100) || params->width == 2) { found += _search16(mem, size, block, value, params->op, &tmp, limit ? limit - found : 0); } else { found += _search8(mem, size, block, value, params->op, &tmp, limit ? limit - found : 0); @@ -170,9 +170,9 @@ static size_t _searchGuess(const void* mem, size_t size, const struct mCoreMemor // Hex: value = strtoll(params->valueStr, &end, 16); if (end && !end[0]) { - if (value > 0x10000) { + if ((params->width == -1 && value > 0x10000) || params->width == 4) { found += _search32(mem, size, block, value, params->op, out, limit ? limit - found : 0); - } else if (value > 0x100) { + } else if ((params->width == -1 && value > 0x100) || params->width == 2) { found += _search16(mem, size, block, value, params->op, out, limit ? limit - found : 0); } else { found += _search8(mem, size, block, value, params->op, out, limit ? limit - found : 0); @@ -184,9 +184,9 @@ static size_t _searchGuess(const void* mem, size_t size, const struct mCoreMemor value >>= 4; divisor <<= 4; - if (value > 0x10000) { + if ((params->width == -1 && value > 0x10000) || params->width == 4) { found += _search32(mem, size, block, value, params->op, &tmp, limit ? limit - found : 0); - } else if (value > 0x100) { + } else if ((params->width == -1 && value > 0x100) || params->width == 2) { found += _search16(mem, size, block, value, params->op, &tmp, limit ? limit - found : 0); } else { found += _search8(mem, size, block, value, params->op, &tmp, limit ? limit - found : 0); diff --git a/src/platform/qt/MemorySearch.cpp b/src/platform/qt/MemorySearch.cpp index 934d20573..4ff967da5 100644 --- a/src/platform/qt/MemorySearch.cpp +++ b/src/platform/qt/MemorySearch.cpp @@ -61,6 +61,9 @@ bool MemorySearch::createParams(mCoreMemorySearchParams* params) { if (m_ui.bits32->isChecked()) { params->width = 4; } + if (m_ui.bitsGuess->isChecked()) { + params->width = -1; + } if (m_ui.numHex->isChecked()) { uint32_t v = m_ui.value->text().toUInt(&ok, 16); if (ok) { diff --git a/src/platform/qt/MemorySearch.ui b/src/platform/qt/MemorySearch.ui index 4fc18176b..4e8649e42 100644 --- a/src/platform/qt/MemorySearch.ui +++ b/src/platform/qt/MemorySearch.ui @@ -114,6 +114,19 @@ + + + Guess + + + true + + + width + + + + 1 Byte (8-bit) @@ -123,7 +136,7 @@ - + 2 Bytes (16-bit) @@ -133,34 +146,34 @@ - + 4 Bytes (32-bit) - true + false width - + Qt::Horizontal - + Number type - + Guess @@ -170,35 +183,35 @@ - + Decimal - + Hexadecimal - + Qt::Horizontal - + Compare - + Equal @@ -211,7 +224,7 @@ - + Greater @@ -221,7 +234,7 @@ - + Less @@ -231,7 +244,7 @@ - + false