Qt: Dropping multiplayer windows works more cleanly now

This commit is contained in:
Jeffrey Pfau 2015-09-16 00:34:24 -07:00
parent 822df237a3
commit 4d24b16735
4 changed files with 17 additions and 0 deletions

View File

@ -27,6 +27,7 @@ Misc:
- Qt: Add 'Apply' button to settings window
- Qt: Prevent savestate window from opening while in multiplayer
- Qt: Disable menu items in multiplayer that don't make sense to have enabled
- Qt: Dropping multiplayer windows works more cleanly now
0.3.0: (2015-08-16)
Features:

View File

@ -64,6 +64,20 @@ void MultiplayerController::detachGame(GameController* controller) {
emit gameDetached();
}
int MultiplayerController::playerId(GameController* controller) {
MutexLock(&m_lockstep.mutex);
int id = -1;
for (int i = 0; i < m_lockstep.attached; ++i) {
GBAThread* thread = controller->thread();
if (thread->sioDrivers.multiplayer == &m_lockstep.players[i]->d) {
id = i;
break;
}
}
MutexUnlock(&m_lockstep.mutex);
return id;
}
int MultiplayerController::attached() {
int num;
MutexLock(&m_lockstep.mutex);

View File

@ -27,6 +27,7 @@ public:
void detachGame(GameController*);
int attached();
int playerId(GameController*);
signals:
void gameAttached();

View File

@ -279,6 +279,7 @@ void Window::multiplayerChanged() {
attached = multiplayer->attached();
connect(multiplayer, SIGNAL(gameAttached()), this, SLOT(multiplayerChanged()));
connect(multiplayer, SIGNAL(gameDetached()), this, SLOT(multiplayerChanged()));
m_playerId = multiplayer->playerId(m_controller);
}
if (m_controller->isLoaded()) {
for (QAction* action : m_nonMpActions) {