all repos — mgba @ 4d24b16735001b96dcee2bebc49560185f969b03

mGBA Game Boy Advance Emulator

Qt: Dropping multiplayer windows works more cleanly now
Jeffrey Pfau jeffrey@endrift.com
Wed, 16 Sep 2015 00:34:24 -0700
commit

4d24b16735001b96dcee2bebc49560185f969b03

parent

822df237a3e927e3dec634b5f2db71aedf155081

M CHANGESCHANGES

@@ -27,6 +27,7 @@ - Libretro: Use anonymous memory mappers for large blocks of memory

- 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:
M src/platform/qt/MultiplayerController.cppsrc/platform/qt/MultiplayerController.cpp

@@ -64,6 +64,20 @@ controller->threadContinue();

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);
M src/platform/qt/MultiplayerController.hsrc/platform/qt/MultiplayerController.h

@@ -27,6 +27,7 @@ bool attachGame(GameController*);

void detachGame(GameController*); int attached(); + int playerId(GameController*); signals: void gameAttached();
M src/platform/qt/Window.cppsrc/platform/qt/Window.cpp

@@ -279,6 +279,7 @@ if (multiplayer) {

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) {