all repos — mgba @ db69256ce9f247969ee3194a35b70f7bda52ab52

mGBA Game Boy Advance Emulator

Core: Separate guessing width and type
Vicki Pfau vi@endrift.com
Sat, 14 Oct 2017 17:22:48 -0700
commit

db69256ce9f247969ee3194a35b70f7bda52ab52

parent

8385869652605c3a6f147134bda3c9ea9b220134

3 files changed, 38 insertions(+), 22 deletions(-)

jump to
M src/core/mem-search.csrc/core/mem-search.c

@@ -137,9 +137,9 @@

// 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 @@ mCoreMemorySearchResultsClear(&tmp);

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 @@

// 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 @@ mCoreMemorySearchResultsClear(&tmp);

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);
M src/platform/qt/MemorySearch.cppsrc/platform/qt/MemorySearch.cpp

@@ -61,6 +61,9 @@ }

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) {
M src/platform/qt/MemorySearch.uisrc/platform/qt/MemorySearch.ui

@@ -114,6 +114,19 @@ </property>

</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 @@ <string notr="true">width</string>

</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 @@ <string notr="true">width</string>

</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 @@ <bool>true</bool>

</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 @@ <string notr="true">op</string>

</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 @@ <string notr="true">op</string>

</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 @@ <string notr="true">op</string>

</attribute> </widget> </item> - <item row="15" column="1"> + <item row="16" column="1"> <widget class="QRadioButton" name="opDelta"> <property name="enabled"> <bool>false</bool>