mirror of
https://github.com/melonDS-emu/melonDS.git
synced 2024-11-14 13:27:41 -07:00
correctly propagate video settings changes to all windows
This commit is contained in:
parent
e576538268
commit
6d345cc1ea
@ -241,12 +241,12 @@ void EmuInstance::deleteAllWindows()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void EmuInstance::broadcastCommand(int cmd)
|
void EmuInstance::broadcastCommand(int cmd, QVariant param)
|
||||||
{
|
{
|
||||||
broadcastInstanceCommand(cmd, instanceID);
|
broadcastInstanceCommand(cmd, param, instanceID);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EmuInstance::handleCommand(int cmd)
|
void EmuInstance::handleCommand(int cmd, QVariant& param)
|
||||||
{
|
{
|
||||||
switch (cmd)
|
switch (cmd)
|
||||||
{
|
{
|
||||||
@ -265,6 +265,10 @@ void EmuInstance::handleCommand(int cmd)
|
|||||||
windowList[i]->loadRecentFilesMenu(true);
|
windowList[i]->loadRecentFilesMenu(true);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
/*case InstCmd_UpdateVideoSettings:
|
||||||
|
mainWindow->updateVideoSettings(param.value<bool>());
|
||||||
|
break;*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,8 +92,8 @@ public:
|
|||||||
Config::Table& getGlobalConfig() { return globalCfg; }
|
Config::Table& getGlobalConfig() { return globalCfg; }
|
||||||
Config::Table& getLocalConfig() { return localCfg; }
|
Config::Table& getLocalConfig() { return localCfg; }
|
||||||
|
|
||||||
void broadcastCommand(int cmd);
|
void broadcastCommand(int cmd, QVariant param = QVariant());
|
||||||
void handleCommand(int cmd);
|
void handleCommand(int cmd, QVariant& param);
|
||||||
|
|
||||||
std::string instanceFileSuffix();
|
std::string instanceFileSuffix();
|
||||||
|
|
||||||
|
@ -2147,14 +2147,11 @@ void MainWindow::onEmuReset()
|
|||||||
|
|
||||||
void MainWindow::onUpdateVideoSettings(bool glchange)
|
void MainWindow::onUpdateVideoSettings(bool glchange)
|
||||||
{
|
{
|
||||||
if (windowID != 0)
|
// if we have a parent window: pass the message over to the parent
|
||||||
{
|
// the topmost parent takes care of updating all the windows
|
||||||
MainWindow* parentwin = (MainWindow*)parentWidget();
|
MainWindow* parentwin = (MainWindow*)parentWidget();
|
||||||
if (parentwin)
|
if (parentwin)
|
||||||
parentwin->onUpdateVideoSettings(glchange);
|
return parentwin->onUpdateVideoSettings(glchange);
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool hadOGL = hasOGL;
|
bool hadOGL = hasOGL;
|
||||||
if (glchange)
|
if (glchange)
|
||||||
@ -2170,18 +2167,33 @@ void MainWindow::onUpdateVideoSettings(bool glchange)
|
|||||||
if (glchange)
|
if (glchange)
|
||||||
{
|
{
|
||||||
if (hasOGL) emuThread->initContext(windowID);
|
if (hasOGL) emuThread->initContext(windowID);
|
||||||
|
}
|
||||||
|
|
||||||
if (windowID == 0)
|
// update any child windows we have
|
||||||
{
|
|
||||||
auto childwins = findChildren<MainWindow *>(nullptr, Qt::FindDirectChildrenOnly);
|
auto childwins = findChildren<MainWindow *>(nullptr, Qt::FindDirectChildrenOnly);
|
||||||
for (auto child: childwins)
|
for (auto child: childwins)
|
||||||
{
|
{
|
||||||
if (hadOGL) emuThread->deinitContext(child->windowID);
|
// child windows may belong to a different instance
|
||||||
|
// in that case we need to signal their thread appropriately
|
||||||
|
auto thread = child->getEmuInstance()->getEmuThread();
|
||||||
|
|
||||||
|
if (glchange)
|
||||||
|
{
|
||||||
|
if (hadOGL) thread->deinitContext(child->windowID);
|
||||||
child->createScreenPanel();
|
child->createScreenPanel();
|
||||||
if (hasOGL) emuThread->initContext(child->windowID);
|
}
|
||||||
|
|
||||||
|
if (child->getWindowID() == 0)
|
||||||
|
thread->updateVideoSettings();
|
||||||
|
|
||||||
|
if (glchange)
|
||||||
|
{
|
||||||
|
if (hasOGL) thread->initContext(child->windowID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (glchange)
|
||||||
|
{
|
||||||
emuThread->emuUnpause();
|
emuThread->emuUnpause();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -135,6 +135,7 @@ public:
|
|||||||
void updateMPInterface(melonDS::MPInterfaceType type);
|
void updateMPInterface(melonDS::MPInterfaceType type);
|
||||||
|
|
||||||
void loadRecentFilesMenu(bool loadcfg);
|
void loadRecentFilesMenu(bool loadcfg);
|
||||||
|
//void updateVideoSettings(bool glchange);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void keyPressEvent(QKeyEvent* event) override;
|
void keyPressEvent(QKeyEvent* event) override;
|
||||||
|
@ -168,14 +168,14 @@ int numEmuInstances()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void broadcastInstanceCommand(int cmd, int sourceinst)
|
void broadcastInstanceCommand(int cmd, QVariant& param, int sourceinst)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < kMaxEmuInstances; i++)
|
for (int i = 0; i < kMaxEmuInstances; i++)
|
||||||
{
|
{
|
||||||
if (i == sourceinst) continue;
|
if (i == sourceinst) continue;
|
||||||
if (!emuInstances[i]) continue;
|
if (!emuInstances[i]) continue;
|
||||||
|
|
||||||
emuInstances[i]->handleCommand(cmd);
|
emuInstances[i]->handleCommand(cmd, param);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,6 +37,7 @@ enum
|
|||||||
InstCmd_Unpause,
|
InstCmd_Unpause,
|
||||||
|
|
||||||
InstCmd_UpdateRecentFiles,
|
InstCmd_UpdateRecentFiles,
|
||||||
|
//InstCmd_UpdateVideoSettings,
|
||||||
};
|
};
|
||||||
|
|
||||||
class MelonApplication : public QApplication
|
class MelonApplication : public QApplication
|
||||||
@ -58,7 +59,7 @@ void deleteEmuInstance(int id);
|
|||||||
void deleteAllEmuInstances(int first = 0);
|
void deleteAllEmuInstances(int first = 0);
|
||||||
int numEmuInstances();
|
int numEmuInstances();
|
||||||
|
|
||||||
void broadcastInstanceCommand(int cmd, int sourceinst);
|
void broadcastInstanceCommand(int cmd, QVariant& param, int sourceinst);
|
||||||
|
|
||||||
void setMPInterface(melonDS::MPInterfaceType type);
|
void setMPInterface(melonDS::MPInterfaceType type);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user