Qt: Properly cap number of attached players by platform (fixes #2807)

This commit is contained in:
Vicki Pfau 2023-02-09 00:08:45 -08:00
parent 7e624c6857
commit b9a950fee7
2 changed files with 9 additions and 4 deletions

View File

@ -10,6 +10,7 @@ Other fixes:
- Core: Allow sending thread requests to a crashed core (fixes mgba.io/i/2784)
- 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)
- Qt: Properly cap number of attached players by platform (fixes mgba.io/i/2807)
Misc:
- Qt: Include wayland QPA in AppImage (fixes mgba.io/i/2796)
- Qt: Stop eating boolean action key events (fixes mgba.io/i/2636)

View File

@ -214,10 +214,6 @@ MultiplayerController::~MultiplayerController() {
}
bool MultiplayerController::attachGame(CoreController* controller) {
if (m_lockstep.attached == MAX_GBAS) {
return false;
}
if (m_lockstep.attached == 0) {
switch (controller->platform()) {
#ifdef M_CORE_GBA
@ -243,6 +239,10 @@ bool MultiplayerController::attachGame(CoreController* controller) {
switch (controller->platform()) {
#ifdef M_CORE_GBA
case mPLATFORM_GBA: {
if (m_lockstep.attached >= MAX_GBAS) {
return false;
}
GBA* gba = static_cast<GBA*>(thread->core->board);
GBASIOLockstepNode* node = new GBASIOLockstepNode;
@ -259,6 +259,10 @@ bool MultiplayerController::attachGame(CoreController* controller) {
#endif
#ifdef M_CORE_GB
case mPLATFORM_GB: {
if (m_lockstep.attached >= 2) {
return false;
}
GB* gb = static_cast<GB*>(thread->core->board);
GBSIOLockstepNode* node = new GBSIOLockstepNode;