mirror of https://github.com/mgba-emu/mgba.git
Qt: Only disable swapInterval when fast-forwarding
This commit is contained in:
parent
c0e3db2bb4
commit
76acad90a6
|
@ -733,6 +733,7 @@ void PainterGL::start() {
|
||||||
m_buffer = nullptr;
|
m_buffer = nullptr;
|
||||||
m_active = true;
|
m_active = true;
|
||||||
m_started = true;
|
m_started = true;
|
||||||
|
swapInterval(1);
|
||||||
emit started();
|
emit started();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -763,15 +764,16 @@ void PainterGL::draw() {
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (m_swapInterval != !!sync->videoFrameWait) {
|
int wantSwap = sync->audioWait || sync->videoFrameWait;
|
||||||
swapInterval(!!sync->videoFrameWait);
|
if (m_swapInterval != wantSwap) {
|
||||||
|
swapInterval(wantSwap);
|
||||||
}
|
}
|
||||||
dequeue();
|
dequeue();
|
||||||
bool forceRedraw = true;
|
bool forceRedraw = true;
|
||||||
if (!m_delayTimer.isValid()) {
|
if (!m_delayTimer.isValid()) {
|
||||||
m_delayTimer.start();
|
m_delayTimer.start();
|
||||||
} else {
|
} else {
|
||||||
if (sync->audioWait || sync->videoFrameWait) {
|
if (wantSwap) {
|
||||||
while (m_delayTimer.nsecsElapsed() + OVERHEAD_NSEC < 1000000000 / sync->fpsTarget) {
|
while (m_delayTimer.nsecsElapsed() + OVERHEAD_NSEC < 1000000000 / sync->fpsTarget) {
|
||||||
QThread::usleep(500);
|
QThread::usleep(500);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1789,13 +1789,6 @@ void Window::setupMenu(QMenuBar* menubar) {
|
||||||
void Window::setupOptions() {
|
void Window::setupOptions() {
|
||||||
ConfigOption* videoSync = m_config->addOption("videoSync");
|
ConfigOption* videoSync = m_config->addOption("videoSync");
|
||||||
videoSync->connect([this](const QVariant& variant) {
|
videoSync->connect([this](const QVariant& variant) {
|
||||||
if (m_display) {
|
|
||||||
bool ok;
|
|
||||||
int interval = variant.toInt(&ok);
|
|
||||||
if (ok) {
|
|
||||||
m_display->swapInterval(interval);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
reloadConfig();
|
reloadConfig();
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue