-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Adhoc] Fix multiplayer issue on MGS:PW due to detecting an incorrect source port on incoming data #14140
Conversation
Won't all the delays and giving more time in the code cause more desyncs? |
It's only delayed when creating the socket, most games doesn't create new socket during game play, |
Core/HLE/sceNetAdhoc.cpp
Outdated
@@ -7263,6 +7283,10 @@ int matchingInputThread(int matchingId) // TODO: The MatchingInput thread is usi | |||
|
|||
// Ignore Incoming Trash Data | |||
} | |||
else if (recvresult == 0 && rxbuflen > 0) { | |||
WARN_LOG(SCENET, "InputLoop[%d]: Unknown Port[%s:%u] (Recved=%i, Length=%i)", matchingId, mac2str(&sendermac).c_str(), senderport, recvresult, rxbuflen); | |||
host->NotifyUserMessage(std::string("Data from incorrect Port detected [") + mac2str(&sendermac) + std::string("]:") + std::to_string(senderport) + std::string(" -> ") + std::to_string(context->port), 1.0, 0x0080ff); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add translate of "Data from incorrect Port detected"
Updated with translate |
…cause port issue when wrapped to 1024 or lower on android)
Okay this seems to fix the issue some how... can't find any documentation on such |
Core/HLE/sceNetAdhoc.cpp
Outdated
WARN_LOG(SCENET, "InputLoop[%d]: Unknown Port[%s:%u] (Recved=%i, Length=%i)", matchingId, mac2str(&sendermac).c_str(), senderport, recvresult, rxbuflen); | ||
host->NotifyUserMessage(std::string(n->T("Data from incorrect Port")) + std::string(" [") + mac2str(&sendermac) + std::string("]:") + std::to_string(senderport) + std::string(" -> ") + std::to_string(context->port), 1.0, 0x0080ff); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wacky indentation here :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oops sorry
…om an incorrect port, progressing any further may ended with connection issue. Players will need to wait until the port detected correctly before progressing any further (may takes a few more seconds)
…ADDR_ANY. Seems to fix hrydgard#14130
Ready to go? |
yes, i think so. |
Note: Apparently "Data from incorrect port" message can also occurred on Windows vs Windows http://forums.ppsspp.org/showthread.php?tid=27580 |
I have one guy on Android that keeps getting me to get the incorrect port error every time. |
The wrong source port issue happened on PDP socket which is connection-less (not sure about PTP, since it connection-oriented it probably didn't matter as long it can get connected), and AdhocMatching is using PDP under-the-hood, so i only shows the error message on games that use AdhocMatching because i know on AdhocMatching both side (host & client) should use the same port for communication. So games that doesn't use AdhocMatching but use PDP socket might also have similar issue but not being reported/shown, because we don't know which port it supposed to came from as it varies on each game, and not all game use the same port for sending and receiving. PS: This PR probably didn't solve this issue yet and i'm planning to remove some part of of the code which may not be useful (ie. trying to send an empty data to port 0 hoping for the socket to be bound to the correct interface sooner) |
Fix multiplayer issue on MGS:PW due to detecting an incorrect source port on incoming data
May not be the best solution since i haven't really figured out what actually happening, but fix #14130 most of the time, although i'm still getting a wrong port detected once but seems to happen very rarely now.
PS: In the case AdhocMatching detecting an incorrect port, players will see an orange message on screen saying "Data from incorrect Port detected [MAC address]: SourcePort -> DestPort" where SourcePort is the wrong one and supposed to be the same with DestPort.
If this message appeared, players just need to wait until the port detected correctly and this message no longer appeared (may takes a few seconds or more before it gets detected correctly), otherwise progressing any further will cause communication issue.
This issue may also happened on other games too, since many games are using PDP/UDP.
Test builds:
Win32&64: https://www.dropbox.com/s/2t3mtdhb0f045cn/PPSSPP_1.11-testbuild_Win32x64.zip?dl=0
Android(ARMv7): https://www.dropbox.com/s/b41bm43mtn1gpnn/PPSSPP_1.11-testbuild_ARMv7.apk?dl=0