Qt: Disable sync while running scripts from main thread (fixes #2738)

This commit is contained in:
Vicki Pfau 2023-01-27 19:32:27 -08:00
parent dbffb46c4e
commit 6d8060034f
2 changed files with 13 additions and 2 deletions

View File

@ -7,6 +7,7 @@ Emulation fixes:
- GBA Video: Disable BG target 1 blending when OBJ blending (fixes mgba.io/i/2722)
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)
Misc:
- GB Serialize: Add missing savestate support for MBC6 and NT (newer)
- GBA: Improve detection of valid ELF ROMs

View File

@ -5,6 +5,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "scripting/ScriptingController.h"
#include "AudioProcessor.h"
#include "CoreController.h"
#include "scripting/ScriptingTextBuffer.h"
#include "scripting/ScriptingTextBufferModel.h"
@ -73,11 +74,20 @@ bool ScriptingController::load(VFileDevice& vf, const QString& name) {
}
QByteArray utf8 = name.toUtf8();
CoreController::Interrupter interrupter(m_controller);
if (m_controller) {
m_controller->setSync(false);
m_controller->unpaused();
}
bool ok = true;
if (!m_activeEngine->load(m_activeEngine, utf8.constData(), vf) || !m_activeEngine->run(m_activeEngine)) {
emit error(QString::fromUtf8(m_activeEngine->getError(m_activeEngine)));
return false;
ok = false;
}
return true;
if (m_controller && m_controller->isPaused()) {
m_controller->setSync(true);
m_controller->paused();
}
return ok;
}
void ScriptingController::clearController() {