Qt/CheatManager: Add preset address ranges

This commit is contained in:
Connor McLaughlin 2020-10-21 22:26:24 +10:00
parent 13aa5e0554
commit b6a8da34fe
2 changed files with 46 additions and 0 deletions

View File

@ -2,6 +2,8 @@
#include "cheatcodeeditordialog.h"
#include "common/assert.h"
#include "common/string_util.h"
#include "core/bus.h"
#include "core/cpu_core.h"
#include "core/system.h"
#include "qthostinterface.h"
#include "qtutils.h"
@ -12,6 +14,7 @@
#include <QtWidgets/QMessageBox>
#include <QtWidgets/QTreeWidgetItemIterator>
#include <array>
#include <utility>
static QString formatHexValue(u32 value)
{
@ -92,6 +95,23 @@ void CheatManagerDialog::connectUi()
address = value.toUInt(nullptr, 16);
m_scanner.SetEndAddress(static_cast<PhysicalMemoryAddress>(address));
});
connect(m_ui.scanPresetRange, QOverload<int>::of(&QComboBox::currentIndexChanged), [this](int index) {
if (index == 0)
{
m_ui.scanStartAddress->setText(formatHexValue(0));
m_ui.scanEndAddress->setText(formatHexValue(Bus::RAM_SIZE));
}
else if (index == 1)
{
m_ui.scanStartAddress->setText(formatHexValue(CPU::DCACHE_LOCATION));
m_ui.scanEndAddress->setText(formatHexValue(CPU::DCACHE_LOCATION + CPU::DCACHE_SIZE));
}
else
{
m_ui.scanStartAddress->setText(formatHexValue(Bus::BIOS_BASE));
m_ui.scanEndAddress->setText(formatHexValue(Bus::BIOS_BASE + Bus::BIOS_SIZE));
}
});
connect(m_ui.scanNewSearch, &QPushButton::clicked, [this]() {
m_scanner.Search();
updateResults();

View File

@ -370,6 +370,32 @@
<item row="6" column="1">
<widget class="QLineEdit" name="scanEndAddress"/>
</item>
<item row="7" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Preset Range:</string>
</property>
</widget>
</item>
<item row="7" column="1">
<widget class="QComboBox" name="scanPresetRange">
<item>
<property name="text">
<string>RAM</string>
</property>
</item>
<item>
<property name="text">
<string>Scratchpad</string>
</property>
</item>
<item>
<property name="text">
<string>BIOS</string>
</property>
</item>
</widget>
</item>
</layout>
</widget>
</item>