mirror of
https://github.com/melonDS-emu/melonDS.git
synced 2024-11-14 13:27:41 -07:00
lock framebuffer stuff to prevent conflicts when reiniting the core or changing the renderer
This commit is contained in:
parent
9c8f229fed
commit
e3e561da3f
@ -1340,6 +1340,7 @@ bool EmuInstance::updateConsole(UpdateConsoleNDSArgs&& _ndsargs, UpdateConsoleGB
|
||||
args = &(*dsiargs);
|
||||
}
|
||||
|
||||
renderLock.lock();
|
||||
if ((!nds) || (consoleType != nds->ConsoleType))
|
||||
{
|
||||
NDS::Current = nullptr;
|
||||
@ -1387,6 +1388,7 @@ bool EmuInstance::updateConsole(UpdateConsoleNDSArgs&& _ndsargs, UpdateConsoleGB
|
||||
dsi->EjectGBACart();
|
||||
}
|
||||
}
|
||||
renderLock.unlock();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -150,6 +150,8 @@ public:
|
||||
void touchScreen(int x, int y);
|
||||
void releaseScreen();
|
||||
|
||||
QMutex renderLock;
|
||||
|
||||
private:
|
||||
static int lastSep(const std::string& path);
|
||||
std::string getAssetPath(bool gba, const std::string& configpath, const std::string& ext, const std::string& file);
|
||||
|
@ -231,6 +231,7 @@ void EmuThread::run()
|
||||
// update render settings if needed
|
||||
if (videoSettingsDirty)
|
||||
{
|
||||
emuInstance->renderLock.lock();
|
||||
if (useOpenGL)
|
||||
{
|
||||
emuInstance->setVSyncGL(true);
|
||||
@ -246,6 +247,7 @@ void EmuThread::run()
|
||||
updateRenderer();
|
||||
|
||||
videoSettingsDirty = false;
|
||||
emuInstance->renderLock.unlock();
|
||||
}
|
||||
|
||||
// process input and hotkeys
|
||||
|
@ -779,6 +779,7 @@ void ScreenPanelNative::paintEvent(QPaintEvent* event)
|
||||
|
||||
if (emuThread->emuIsActive())
|
||||
{
|
||||
emuInstance->renderLock.lock();
|
||||
auto nds = emuInstance->getNDS();
|
||||
|
||||
assert(nds != nullptr);
|
||||
@ -801,6 +802,7 @@ void ScreenPanelNative::paintEvent(QPaintEvent* event)
|
||||
painter.setTransform(screenTrans[i]);
|
||||
painter.drawImage(screenrc, screen[screenKind[i]]);
|
||||
}
|
||||
emuInstance->renderLock.unlock();
|
||||
}
|
||||
|
||||
osdUpdate();
|
||||
|
Loading…
Reference in New Issue
Block a user