mirror of https://github.com/mgba-emu/mgba.git
Core: Separate guessing width and type
This commit is contained in:
parent
8385869652
commit
db69256ce9
|
@ -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);
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -114,6 +114,19 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QRadioButton" name="bitsGuess">
|
||||
<property name="text">
|
||||
<string>Guess</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<attribute name="buttonGroup">
|
||||
<string notr="true">width</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QRadioButton" name="bits8">
|
||||
<property name="text">
|
||||
<string>1 Byte (8-bit)</string>
|
||||
|
@ -123,7 +136,7 @@
|
|||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<item row="6" column="1">
|
||||
<widget class="QRadioButton" name="bits16">
|
||||
<property name="text">
|
||||
<string>2 Bytes (16-bit)</string>
|
||||
|
@ -133,34 +146,34 @@
|
|||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<item row="7" column="1">
|
||||
<widget class="QRadioButton" name="bits32">
|
||||
<property name="text">
|
||||
<string>4 Bytes (32-bit)</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<attribute name="buttonGroup">
|
||||
<string notr="true">width</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0" colspan="2">
|
||||
<item row="8" column="0" colspan="2">
|
||||
<widget class="Line" name="line_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
<item row="9" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Number type</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="1">
|
||||
<item row="9" column="1">
|
||||
<widget class="QRadioButton" name="numGuess">
|
||||
<property name="text">
|
||||
<string>Guess</string>
|
||||
|
@ -170,35 +183,35 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="1">
|
||||
<item row="10" column="1">
|
||||
<widget class="QRadioButton" name="numDec">
|
||||
<property name="text">
|
||||
<string>Decimal</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="1">
|
||||
<item row="11" column="1">
|
||||
<widget class="QRadioButton" name="numHex">
|
||||
<property name="text">
|
||||
<string>Hexadecimal</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="0" colspan="2">
|
||||
<item row="12" column="0" colspan="2">
|
||||
<widget class="Line" name="line_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="12" column="0">
|
||||
<item row="13" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Compare</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="12" column="1">
|
||||
<item row="13" column="1">
|
||||
<widget class="QRadioButton" name="opEqual">
|
||||
<property name="text">
|
||||
<string>Equal</string>
|
||||
|
@ -211,7 +224,7 @@
|
|||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="13" column="1">
|
||||
<item row="14" column="1">
|
||||
<widget class="QRadioButton" name="opGreater">
|
||||
<property name="text">
|
||||
<string>Greater</string>
|
||||
|
@ -221,7 +234,7 @@
|
|||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="14" column="1">
|
||||
<item row="15" column="1">
|
||||
<widget class="QRadioButton" name="opLess">
|
||||
<property name="text">
|
||||
<string>Less</string>
|
||||
|
@ -231,7 +244,7 @@
|
|||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="15" column="1">
|
||||
<item row="16" column="1">
|
||||
<widget class="QRadioButton" name="opDelta">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
|
|
Loading…
Reference in New Issue