mirror of https://github.com/mgba-emu/mgba.git
Qt: Add tile range selection to tile viewer, modernize layout (closes #2455)
This commit is contained in:
parent
cf06497456
commit
751ab434f4
1
CHANGES
1
CHANGES
|
@ -55,6 +55,7 @@ Misc:
|
||||||
- Qt: Add optional emulation-related information on reset (closes mgba.io/i/1780)
|
- Qt: Add optional emulation-related information on reset (closes mgba.io/i/1780)
|
||||||
- Qt: Add QOpenGLWidget cross-thread codepath for macOS (fixes mgba.io/i/1754)
|
- Qt: Add QOpenGLWidget cross-thread codepath for macOS (fixes mgba.io/i/1754)
|
||||||
- Qt: Enable -b for Boot BIOS menu option (fixes mgba.io/i/2074)
|
- Qt: Enable -b for Boot BIOS menu option (fixes mgba.io/i/2074)
|
||||||
|
- Qt: Add tile range selection to tile viewer (closes mgba.io/i/2455)
|
||||||
- Windows: Attach to console if present
|
- Windows: Attach to console if present
|
||||||
|
|
||||||
0.9.3: (2021-12-17)
|
0.9.3: (2021-12-17)
|
||||||
|
|
|
@ -29,6 +29,9 @@ TileView::TileView(std::shared_ptr<CoreController> controller, QWidget* parent)
|
||||||
connect(m_ui.tiles, &TilePainter::needsRedraw, this, [this]() {
|
connect(m_ui.tiles, &TilePainter::needsRedraw, this, [this]() {
|
||||||
updateTiles(true);
|
updateTiles(true);
|
||||||
});
|
});
|
||||||
|
connect(m_ui.tilesSelector, qOverload<int>(&QButtonGroup::buttonClicked), this, [this]() {
|
||||||
|
updateTiles(true);
|
||||||
|
});
|
||||||
connect(m_ui.paletteId, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this, &TileView::updatePalette);
|
connect(m_ui.paletteId, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this, &TileView::updatePalette);
|
||||||
|
|
||||||
switch (m_controller->platform()) {
|
switch (m_controller->platform()) {
|
||||||
|
@ -39,6 +42,9 @@ TileView::TileView(std::shared_ptr<CoreController> controller, QWidget* parent)
|
||||||
#endif
|
#endif
|
||||||
#ifdef M_CORE_GB
|
#ifdef M_CORE_GB
|
||||||
case mPLATFORM_GB:
|
case mPLATFORM_GB:
|
||||||
|
m_ui.tilesBg->setEnabled(false);
|
||||||
|
m_ui.tilesObj->setEnabled(false);
|
||||||
|
m_ui.tilesBoth->setEnabled(false);
|
||||||
m_ui.palette256->setEnabled(false);
|
m_ui.palette256->setEnabled(false);
|
||||||
m_ui.tile->setBoundary(1024, 0, 0);
|
m_ui.tile->setBoundary(1024, 0, 0);
|
||||||
break;
|
break;
|
||||||
|
@ -107,8 +113,18 @@ TileView::TileView(std::shared_ptr<CoreController> controller, QWidget* parent)
|
||||||
#ifdef M_CORE_GBA
|
#ifdef M_CORE_GBA
|
||||||
void TileView::updateTilesGBA(bool force) {
|
void TileView::updateTilesGBA(bool force) {
|
||||||
if (m_ui.palette256->isChecked()) {
|
if (m_ui.palette256->isChecked()) {
|
||||||
|
if (m_ui.tilesBg->isChecked()) {
|
||||||
|
m_ui.tiles->setTileCount(1024);
|
||||||
|
} else if (m_ui.tilesObj->isChecked()) {
|
||||||
|
m_ui.tiles->setTileCount(512);
|
||||||
|
} else {
|
||||||
m_ui.tiles->setTileCount(1536);
|
m_ui.tiles->setTileCount(1536);
|
||||||
mTileCache* cache = mTileCacheSetGetPointer(&m_cacheSet->tiles, 1);
|
}
|
||||||
|
mTileCache* cache;
|
||||||
|
int objOffset = 1024;
|
||||||
|
if (!m_ui.tilesObj->isChecked()) {
|
||||||
|
objOffset = 0;
|
||||||
|
cache = mTileCacheSetGetPointer(&m_cacheSet->tiles, 1);
|
||||||
for (int i = 0; i < 1024; ++i) {
|
for (int i = 0; i < 1024; ++i) {
|
||||||
const color_t* data = mTileCacheGetTileIfDirty(cache, &m_tileStatus[16 * i], i, 0);
|
const color_t* data = mTileCacheGetTileIfDirty(cache, &m_tileStatus[16 * i], i, 0);
|
||||||
if (data) {
|
if (data) {
|
||||||
|
@ -117,18 +133,31 @@ void TileView::updateTilesGBA(bool force) {
|
||||||
m_ui.tiles->setTile(i, mTileCacheGetTile(cache, i, 0));
|
m_ui.tiles->setTile(i, mTileCacheGetTile(cache, i, 0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
if (!m_ui.tilesBg->isChecked()) {
|
||||||
cache = mTileCacheSetGetPointer(&m_cacheSet->tiles, 3);
|
cache = mTileCacheSetGetPointer(&m_cacheSet->tiles, 3);
|
||||||
for (int i = 1024; i < 1536; ++i) {
|
for (int i = 1024; i < 1536; ++i) {
|
||||||
const color_t* data = mTileCacheGetTileIfDirty(cache, &m_tileStatus[16 * i], i - 1024, 0);
|
const color_t* data = mTileCacheGetTileIfDirty(cache, &m_tileStatus[16 * i], i - 1024, 0);
|
||||||
if (data) {
|
if (data) {
|
||||||
m_ui.tiles->setTile(i, data);
|
m_ui.tiles->setTile(i - objOffset, data);
|
||||||
} else if (force) {
|
} else if (force) {
|
||||||
m_ui.tiles->setTile(i, mTileCacheGetTile(cache, i - 1024, 0));
|
m_ui.tiles->setTile(i - objOffset, mTileCacheGetTile(cache, i - 1024, 0));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
mTileCache* cache = mTileCacheSetGetPointer(&m_cacheSet->tiles, 0);
|
if (m_ui.tilesBg->isChecked()) {
|
||||||
|
m_ui.tiles->setTileCount(2048);
|
||||||
|
} else if (m_ui.tilesObj->isChecked()) {
|
||||||
|
m_ui.tiles->setTileCount(1024);
|
||||||
|
} else {
|
||||||
m_ui.tiles->setTileCount(3072);
|
m_ui.tiles->setTileCount(3072);
|
||||||
|
}
|
||||||
|
mTileCache* cache;
|
||||||
|
int objOffset = 2048;
|
||||||
|
if (!m_ui.tilesObj->isChecked()) {
|
||||||
|
objOffset = 0;
|
||||||
|
cache = mTileCacheSetGetPointer(&m_cacheSet->tiles, 0);
|
||||||
for (int i = 0; i < 2048; ++i) {
|
for (int i = 0; i < 2048; ++i) {
|
||||||
const color_t* data = mTileCacheGetTileIfDirty(cache, &m_tileStatus[16 * i], i, m_paletteId);
|
const color_t* data = mTileCacheGetTileIfDirty(cache, &m_tileStatus[16 * i], i, m_paletteId);
|
||||||
if (data) {
|
if (data) {
|
||||||
|
@ -137,13 +166,16 @@ void TileView::updateTilesGBA(bool force) {
|
||||||
m_ui.tiles->setTile(i, mTileCacheGetTile(cache, i, m_paletteId));
|
m_ui.tiles->setTile(i, mTileCacheGetTile(cache, i, m_paletteId));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
if (!m_ui.tilesBg->isChecked()) {
|
||||||
cache = mTileCacheSetGetPointer(&m_cacheSet->tiles, 2);
|
cache = mTileCacheSetGetPointer(&m_cacheSet->tiles, 2);
|
||||||
for (int i = 2048; i < 3072; ++i) {
|
for (int i = 2048; i < 3072; ++i) {
|
||||||
const color_t* data = mTileCacheGetTileIfDirty(cache, &m_tileStatus[16 * i], i - 2048, m_paletteId);
|
const color_t* data = mTileCacheGetTileIfDirty(cache, &m_tileStatus[16 * i], i - 2048, m_paletteId);
|
||||||
if (data) {
|
if (data) {
|
||||||
m_ui.tiles->setTile(i, data);
|
m_ui.tiles->setTile(i - objOffset, data);
|
||||||
} else if (force) {
|
} else if (force) {
|
||||||
m_ui.tiles->setTile(i, mTileCacheGetTile(cache, i - 2048, m_paletteId));
|
m_ui.tiles->setTile(i - objOffset, mTileCacheGetTile(cache, i - 2048, m_paletteId));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,30 +6,20 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>748</width>
|
<width>680</width>
|
||||||
<height>823</height>
|
<height>450</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Tiles</string>
|
<string>Tiles</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout" rowstretch="0,0,0,1,0,0,0,0" columnstretch="0,1">
|
<layout class="QGridLayout" name="gridLayout" rowstretch="0,0,1,0" columnstretch="0,0,1">
|
||||||
<item row="5" column="0">
|
|
||||||
<widget class="QPushButton" name="exportOne">
|
|
||||||
<property name="text">
|
|
||||||
<string>Export Selected</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="7" column="0">
|
|
||||||
<widget class="QPushButton" name="exportAll">
|
|
||||||
<property name="text">
|
|
||||||
<string>Export All</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<layout class="QFormLayout" name="formLayout">
|
<widget class="QGroupBox" name="groupBox_2">
|
||||||
|
<property name="title">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<layout class="QFormLayout" name="formLayout_2">
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QSpinBox" name="paletteId">
|
<widget class="QSpinBox" name="paletteId">
|
||||||
<property name="maximum">
|
<property name="maximum">
|
||||||
|
@ -38,13 +28,27 @@
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="1">
|
<item row="0" column="1">
|
||||||
|
<widget class="QLabel" name="label_3">
|
||||||
|
<property name="text">
|
||||||
|
<string>Palette</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0" colspan="2">
|
||||||
<widget class="QCheckBox" name="palette256">
|
<widget class="QCheckBox" name="palette256">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>256 colors</string>
|
<string>256 colors</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0">
|
<item row="2" column="0" colspan="2">
|
||||||
|
<widget class="Line" name="line">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="0">
|
||||||
<widget class="QSpinBox" name="magnification">
|
<widget class="QSpinBox" name="magnification">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
|
@ -63,14 +67,14 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="1">
|
<item row="3" column="1">
|
||||||
<widget class="QLabel" name="label_2">
|
<widget class="QLabel" name="label_2">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Magnification</string>
|
<string>Magnification</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="0">
|
<item row="4" column="0">
|
||||||
<widget class="QSpinBox" name="tilesPerRow">
|
<widget class="QSpinBox" name="tilesPerRow">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
|
@ -86,14 +90,14 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="1">
|
<item row="4" column="1">
|
||||||
<widget class="QLabel" name="label">
|
<widget class="QLabel" name="label">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Tiles per row</string>
|
<string>Tiles per row</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="1">
|
<item row="5" column="0" colspan="2">
|
||||||
<widget class="QCheckBox" name="tileFit">
|
<widget class="QCheckBox" name="tileFit">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Fit to window</string>
|
<string>Fit to window</string>
|
||||||
|
@ -104,21 +108,86 @@
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="0">
|
<item row="0" column="1" rowspan="2">
|
||||||
<spacer name="verticalSpacer">
|
<widget class="QGBA::AssetTile" name="tile"/>
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Vertical</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>0</width>
|
|
||||||
<height>0</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="1" rowspan="8">
|
<item row="1" column="0">
|
||||||
|
<widget class="QGroupBox" name="groupBox">
|
||||||
|
<property name="title">
|
||||||
|
<string>Displayed tiles</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
|
<item>
|
||||||
|
<widget class="QRadioButton" name="tilesBg">
|
||||||
|
<property name="text">
|
||||||
|
<string>Only BG tiles</string>
|
||||||
|
</property>
|
||||||
|
<attribute name="buttonGroup">
|
||||||
|
<string notr="true">tilesSelector</string>
|
||||||
|
</attribute>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QRadioButton" name="tilesObj">
|
||||||
|
<property name="text">
|
||||||
|
<string>Only OBJ tiles</string>
|
||||||
|
</property>
|
||||||
|
<attribute name="buttonGroup">
|
||||||
|
<string notr="true">tilesSelector</string>
|
||||||
|
</attribute>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QRadioButton" name="tilesBoth">
|
||||||
|
<property name="text">
|
||||||
|
<string>Both</string>
|
||||||
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<attribute name="buttonGroup">
|
||||||
|
<string notr="true">tilesSelector</string>
|
||||||
|
</attribute>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="0" colspan="2">
|
||||||
|
<layout class="QGridLayout" name="gridLayout_2">
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QPushButton" name="copyOne">
|
||||||
|
<property name="text">
|
||||||
|
<string>Copy Selected</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QPushButton" name="exportOne">
|
||||||
|
<property name="text">
|
||||||
|
<string>Export Selected</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QPushButton" name="copyAll">
|
||||||
|
<property name="text">
|
||||||
|
<string>Copy All</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QPushButton" name="exportAll">
|
||||||
|
<property name="text">
|
||||||
|
<string>Export All</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="2" rowspan="4">
|
||||||
<widget class="QScrollArea" name="scrollArea">
|
<widget class="QScrollArea" name="scrollArea">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Minimum" vsizetype="Expanding">
|
<sizepolicy hsizetype="Minimum" vsizetype="Expanding">
|
||||||
|
@ -137,7 +206,7 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>480</width>
|
<width>441</width>
|
||||||
<height>768</height>
|
<height>768</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
|
@ -183,23 +252,6 @@
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0">
|
|
||||||
<widget class="QGBA::AssetTile" name="tile"/>
|
|
||||||
</item>
|
|
||||||
<item row="4" column="0">
|
|
||||||
<widget class="QPushButton" name="copyOne">
|
|
||||||
<property name="text">
|
|
||||||
<string>Copy Selected</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="6" column="0">
|
|
||||||
<widget class="QPushButton" name="copyAll">
|
|
||||||
<property name="text">
|
|
||||||
<string>Copy All</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<customwidgets>
|
<customwidgets>
|
||||||
|
@ -219,6 +271,21 @@
|
||||||
</slots>
|
</slots>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
</customwidgets>
|
</customwidgets>
|
||||||
|
<tabstops>
|
||||||
|
<tabstop>paletteId</tabstop>
|
||||||
|
<tabstop>palette256</tabstop>
|
||||||
|
<tabstop>magnification</tabstop>
|
||||||
|
<tabstop>tilesPerRow</tabstop>
|
||||||
|
<tabstop>tileFit</tabstop>
|
||||||
|
<tabstop>tilesBg</tabstop>
|
||||||
|
<tabstop>tilesObj</tabstop>
|
||||||
|
<tabstop>tilesBoth</tabstop>
|
||||||
|
<tabstop>copyOne</tabstop>
|
||||||
|
<tabstop>copyAll</tabstop>
|
||||||
|
<tabstop>exportOne</tabstop>
|
||||||
|
<tabstop>exportAll</tabstop>
|
||||||
|
<tabstop>scrollArea</tabstop>
|
||||||
|
</tabstops>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections>
|
<connections>
|
||||||
<connection>
|
<connection>
|
||||||
|
@ -270,4 +337,7 @@
|
||||||
</hints>
|
</hints>
|
||||||
</connection>
|
</connection>
|
||||||
</connections>
|
</connections>
|
||||||
|
<buttongroups>
|
||||||
|
<buttongroup name="tilesSelector"/>
|
||||||
|
</buttongroups>
|
||||||
</ui>
|
</ui>
|
||||||
|
|
Loading…
Reference in New Issue