mirror of https://github.com/mgba-emu/mgba.git
Qt: Memory view readability fixes
This commit is contained in:
parent
c021267ce6
commit
7ac49be6df
|
@ -49,7 +49,7 @@ MemoryModel::MemoryModel(QWidget* parent)
|
||||||
|
|
||||||
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||||
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
|
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
|
||||||
m_margins = QMargins(metrics.width("FFFFFF ") + 4, m_cellHeight + 1, metrics.width(" AAAAAAAAAAAAAAAA") + 3, 0);
|
m_margins = QMargins(metrics.width("0FFFFFF0 ") + 4, m_cellHeight + 1, metrics.width(" AAAAAAAAAAAAAAAA") + 3, 0);
|
||||||
|
|
||||||
connect(verticalScrollBar(), &QSlider::sliderMoved, [this](int position) {
|
connect(verticalScrollBar(), &QSlider::sliderMoved, [this](int position) {
|
||||||
m_top = position;
|
m_top = position;
|
||||||
|
@ -93,7 +93,7 @@ void MemoryModel::paintEvent(QPaintEvent* event) {
|
||||||
int height = (viewport()->size().height() - m_cellHeight) / m_cellHeight;
|
int height = (viewport()->size().height() - m_cellHeight) / m_cellHeight;
|
||||||
for (int y = 0; y < height; ++y) {
|
for (int y = 0; y < height; ++y) {
|
||||||
int yp = m_cellHeight * y + m_margins.top();
|
int yp = m_cellHeight * y + m_margins.top();
|
||||||
QString data = QString("%0").arg(y + m_top + m_base / 16, 6, 16, c0).toUpper();
|
QString data = QString("%0").arg((y + m_top) * 16 + m_base, 8, 16, c0).toUpper();
|
||||||
painter.drawText(QRectF(QPointF(0, yp), QSizeF(m_margins.left(), m_cellHeight)), Qt::AlignHCenter, data);
|
painter.drawText(QRectF(QPointF(0, yp), QSizeF(m_margins.left(), m_cellHeight)), Qt::AlignHCenter, data);
|
||||||
for (int x = 0; x < 16; ++x) {
|
for (int x = 0; x < 16; ++x) {
|
||||||
uint8_t b = m_cpu->memory.load8(m_cpu, (y + m_top) * 16 + x + m_base, nullptr);
|
uint8_t b = m_cpu->memory.load8(m_cpu, (y + m_top) * 16 + x + m_base, nullptr);
|
||||||
|
|
|
@ -42,8 +42,8 @@ void MemoryView::setIndex(int index) {
|
||||||
{ "VRAM", BASE_VRAM, SIZE_VRAM },
|
{ "VRAM", BASE_VRAM, SIZE_VRAM },
|
||||||
{ "OAM", BASE_OAM, SIZE_OAM },
|
{ "OAM", BASE_OAM, SIZE_OAM },
|
||||||
{ "ROM", BASE_CART0, SIZE_CART0 },
|
{ "ROM", BASE_CART0, SIZE_CART0 },
|
||||||
{ "ROM (WS1)", BASE_CART1, SIZE_CART1 },
|
{ "ROM WS1", BASE_CART1, SIZE_CART1 },
|
||||||
{ "ROM (WS2)", BASE_CART2, SIZE_CART2 },
|
{ "ROM WS2", BASE_CART2, SIZE_CART2 },
|
||||||
{ "SRAM", BASE_CART_SRAM, SIZE_CART_SRAM },
|
{ "SRAM", BASE_CART_SRAM, SIZE_CART_SRAM },
|
||||||
};
|
};
|
||||||
const auto& info = indexInfo[index];
|
const auto& info = indexInfo[index];
|
||||||
|
|
Loading…
Reference in New Issue