11 changes: 9 additions & 2 deletions Source/Core/DolphinQt/Debugger/MemoryWidget.cpp
Expand Up @@ -215,9 +215,13 @@ void MemoryWidget::CreateWidgets()
m_row_length_combo->addItem(tr("8 Bytes"), 8);
m_row_length_combo->addItem(tr("16 Bytes"), 16);

m_row_length_combo->setCurrentIndex(2);
m_dual_check = new QCheckBox(tr("Dual View"));

displaytype_layout->addWidget(m_display_combo);
displaytype_layout->addWidget(m_align_combo);
displaytype_layout->addWidget(m_row_length_combo);
displaytype_layout->addWidget(m_dual_check);

// MBP options
auto* bp_group = new QGroupBox(tr("Memory breakpoint options"));
Expand Down Expand Up @@ -318,6 +322,8 @@ void MemoryWidget::ConnectWidgets()
&MemoryWidget::OnDisplayChanged);
}

connect(m_dual_check, &QCheckBox::toggled, this, &MemoryWidget::OnDisplayChanged);

for (auto* radio : {m_bp_read_write, m_bp_read_only, m_bp_write_only})
connect(radio, &QRadioButton::toggled, this, &MemoryWidget::OnBPTypeChanged);

Expand Down Expand Up @@ -431,19 +437,20 @@ void MemoryWidget::OnDisplayChanged()
const auto type = static_cast<MemoryViewWidget::Type>(m_display_combo->currentData().toInt());
int bytes_per_row = m_row_length_combo->currentData().toInt();
int alignment;
bool dual_view = m_dual_check->isChecked();

if (type == MemoryViewWidget::Type::Double && bytes_per_row == 4)
bytes_per_row = 8;

// Alignment: First (fixed) option equals bytes per row. 'currentData' is correct for other
// options. Type-based must be calculated in memoryviewwidget and is left at 0. No alignment is
// options. Type-based must be calculated in memoryviewwidget and is left at 0. "No alignment" is
// equivalent to a value of 1.
if (m_align_combo->currentIndex() == 0)
alignment = bytes_per_row;
else
alignment = m_align_combo->currentData().toInt();

m_memory_view->SetDisplay(type, bytes_per_row, alignment);
m_memory_view->SetDisplay(type, bytes_per_row, alignment, dual_view);

SaveSettings();
}
Expand Down
1 change: 1 addition & 0 deletions Source/Core/DolphinQt/Debugger/MemoryWidget.h
Expand Up @@ -98,6 +98,7 @@ class MemoryWidget : public QDockWidget
QComboBox* m_display_combo;
QComboBox* m_align_combo;
QComboBox* m_row_length_combo;
QCheckBox* m_dual_check;
QPushButton* m_set_value;
QPushButton* m_from_file;
QPushButton* m_dump_mram;
Expand Down