mirror of https://github.com/mgba-emu/mgba.git
Qt: Fix savestate preview sizes with different scales (fixes #2560)
This commit is contained in:
parent
a4d1268db4
commit
7bd0e91735
1
CHANGES
1
CHANGES
|
@ -8,6 +8,7 @@ Emulation fixes:
|
|||
Other fixes:
|
||||
- Qt: Fix crash when attempting to use OpenGL 2.1 to 3.1 (fixes mgba.io/i/2794)
|
||||
- Qt: Disable sync while running scripts from main thread (fixes mgba.io/i/2738)
|
||||
- Qt: Fix savestate preview sizes with different scales (fixes mgba.io/i/2560)
|
||||
Misc:
|
||||
- GB Serialize: Add missing savestate support for MBC6 and NT (newer)
|
||||
- GBA: Improve detection of valid ELF ROMs
|
||||
|
|
|
@ -43,13 +43,12 @@ LoadSaveState::LoadSaveState(std::shared_ptr<CoreController> controller, QWidget
|
|||
m_slots[7] = m_ui.state8;
|
||||
m_slots[8] = m_ui.state9;
|
||||
|
||||
unsigned width, height;
|
||||
controller->thread()->core->desiredVideoDimensions(controller->thread()->core, &width, &height);
|
||||
QSize size = controller->screenDimensions();
|
||||
int i;
|
||||
for (i = 0; i < NUM_SLOTS; ++i) {
|
||||
loadState(i + 1);
|
||||
m_slots[i]->installEventFilter(this);
|
||||
m_slots[i]->setMaximumSize(width + 2, height + 2);
|
||||
m_slots[i]->setMaximumSize(size.width() + 2, size.height() + 2);
|
||||
connect(m_slots[i], &QAbstractButton::clicked, this, [this, i]() { triggerState(i + 1); });
|
||||
}
|
||||
|
||||
|
@ -199,11 +198,17 @@ void LoadSaveState::loadState(int slot) {
|
|||
QDateTime creation;
|
||||
QImage stateImage;
|
||||
|
||||
unsigned width, height;
|
||||
thread->core->desiredVideoDimensions(thread->core, &width, &height);
|
||||
QSize size = m_controller->screenDimensions();
|
||||
mStateExtdataItem item;
|
||||
if (mStateExtdataGet(&extdata, EXTDATA_SCREENSHOT, &item) && item.size >= static_cast<int32_t>(width * height * 4)) {
|
||||
stateImage = QImage((uchar*) item.data, width, height, QImage::Format_ARGB32).rgbSwapped();
|
||||
if (mStateExtdataGet(&extdata, EXTDATA_SCREENSHOT, &item)) {
|
||||
mStateExtdataItem dims;
|
||||
if (mStateExtdataGet(&extdata, EXTDATA_SCREENSHOT_DIMENSIONS, &dims) && dims.size == sizeof(uint16_t[2])) {
|
||||
size.setWidth(static_cast<uint16_t*>(dims.data)[0]);
|
||||
size.setHeight(static_cast<uint16_t*>(dims.data)[1]);
|
||||
}
|
||||
if (item.size >= static_cast<int32_t>(size.width() * size.height() * 4)) {
|
||||
stateImage = QImage((uchar*) item.data, size.width(), size.height(), QImage::Format_ARGB32).rgbSwapped();
|
||||
}
|
||||
}
|
||||
|
||||
if (mStateExtdataGet(&extdata, EXTDATA_META_TIME, &item) && item.size == sizeof(uint64_t)) {
|
||||
|
|
Loading…
Reference in New Issue