From f41cfd70abdb6851566f8a97435ceec273285354 Mon Sep 17 00:00:00 2001 From: Arisotura Date: Sun, 4 Sep 2022 02:00:12 +0200 Subject: [PATCH] fix some of the shittiness when trying to connect more than two players --- src/Wifi.cpp | 8 +++++--- src/frontend/qt_sdl/LocalMP.cpp | 3 ++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/Wifi.cpp b/src/Wifi.cpp index 3d99fc1f..234f7268 100644 --- a/src/Wifi.cpp +++ b/src/Wifi.cpp @@ -1407,7 +1407,9 @@ bool CheckRX(int type) // 0=regular 1=MP replies 2=MP host frames *(u16*)&RXBuffer[6] = txrate; *(u16*)&RXBuffer[8] = framelen; - if (((framectl & 0x00FF) == 0x0010) && timestamp) + bool macgood = (RXBuffer[12 + 4] & 0x01) || MACEqual(&RXBuffer[12 + 4], (u8*)&IOPORT(W_MACAddr0)); + + if (((framectl & 0x00FF) == 0x0010) && timestamp && macgood) { // if receiving an association response: get the sync value from the host @@ -1425,7 +1427,7 @@ bool CheckRX(int type) // 0=regular 1=MP replies 2=MP host frames RXTimestamp = 0; StartRX(); } - else if (((framectl & 0x00FF) == 0x00C0) && timestamp && IsMPClient) + else if (((framectl & 0x00FF) == 0x00C0) && timestamp && macgood && IsMPClient) { IsMPClient = false; NextSync = 0; @@ -1433,7 +1435,7 @@ bool CheckRX(int type) // 0=regular 1=MP replies 2=MP host frames RXTimestamp = 0; StartRX(); } - else if (IsMPClient) + else if (macgood && IsMPClient) { // if we are being a MP client, we need to delay this frame until we reach the // timestamp it came with diff --git a/src/frontend/qt_sdl/LocalMP.cpp b/src/frontend/qt_sdl/LocalMP.cpp index 0ef7aca3..99bfc41b 100644 --- a/src/frontend/qt_sdl/LocalMP.cpp +++ b/src/frontend/qt_sdl/LocalMP.cpp @@ -555,7 +555,8 @@ u16 RecvReplies(u8* packets, u64 timestamp, u16 aidmask) } myinstmask |= (1 << pktheader.SenderID); - if ((myinstmask & curinstmask) == curinstmask) + if (((myinstmask & curinstmask) == curinstmask) || + ((ret & aidmask) == aidmask)) { // all the clients have sent their reply