diff --git a/src/duckstation-qt/cheatmanagerdialog.cpp b/src/duckstation-qt/cheatmanagerdialog.cpp index cefa7f981..e558fc773 100644 --- a/src/duckstation-qt/cheatmanagerdialog.cpp +++ b/src/duckstation-qt/cheatmanagerdialog.cpp @@ -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(); diff --git a/src/duckstation-qt/cheatmanagerdialog.ui b/src/duckstation-qt/cheatmanagerdialog.ui index 5bbc57044..45790b4f3 100644 --- a/src/duckstation-qt/cheatmanagerdialog.ui +++ b/src/duckstation-qt/cheatmanagerdialog.ui @@ -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>