Skip to content
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

[Ad Hoc] Player leave detection #7331

Closed
vnctdj opened this issue Jan 14, 2015 · 10 comments
Closed

[Ad Hoc] Player leave detection #7331

vnctdj opened this issue Jan 14, 2015 · 10 comments

Comments

@vnctdj
Copy link
Contributor

vnctdj commented Jan 14, 2015

It seems that PPSSPP doesn't detect correctly when another player leave ad hoc / close his PPSSPP.
Here is an example :
There is 2 players in the Gathering Hall.
Player 1 close his PPSSPP.
The screen of player 2 still shows that player 1 is here, even if its debug log is showing that player 1 has disconnected.

When I enter the Gathering Hall :
enter
When I leave the Gathering Hall :
leave
And even this one that has appeared when I closed PPSSPP :
leave2

@tywald
Copy link
Contributor

tywald commented Feb 1, 2015

Still occurring in 1.0 and it happens a lot.
Another problem is that It says the guild hall is full when it isn't (all of them!). So you have to restart the emulator every time it happens.

It happens with at least Monster Hunter Freedom Unite and Monster Hunter Portable 3rd HD.

Edit
I think we will have more reports soon regarding this, like from http://forums.ppsspp.org/showthread.php?tid=14264&pid=101820#pid101820

"edit 3: Played a full monster hunter freedom unite quest, then exited the guild hall, then tried making something, came back to the guild hall and it was reporting all lobbies were full. then i quit."

@issuer
Copy link

issuer commented Feb 2, 2015

I was able to replicate this issue. It seems it only affects MH games for some reason.
Versions of PPSSPP 0.9.9.1 without the Ad hoc branch merge, used to display a Pop-up window in-game asking you if you would like to connect to another Gathering Hall instead of this error showing up (The room is full). Maybe a regression would help here, since it was working fine before.

@vnctdj
Copy link
Contributor Author

vnctdj commented Feb 2, 2015

@issuer If you are talking about this :
0
Then this has nothing to do with PPSSPP as it's an in-game option to show the list of Gathering Halls or not.

@tywald
Copy link
Contributor

tywald commented Feb 2, 2015

People in our Evolve group became annoyed with v1.0 and are going back to older versions to avoid this bug for now. They preferred to have the random crash in 0.9.9.1 as it wasn't as frequent, but still happened quite a bit.

Since v0.9.8-1396-ga1d359f it was randomly crashing (MHP3rd HD) as I wrote a while back #7237
Which was fixed when you added the new Ad Hoc branch in v0.9.9.1-1392-g1fa6710 but we got this bug now that is being discussed here.

I hope this will be resolved soon!

@hrydgard
Copy link
Owner

hrydgard commented Feb 2, 2015

Thanks for reporting, I'll see what I can do but it won't make it to the 1.0.1 quickfix release. It's quite hard to tell what's going on in these strange network protocols...

@issuer
Copy link

issuer commented Feb 2, 2015

@vnctdj No i wasn't talking about this. When you entered a GH and it was full it would show the error message (The room is full) just like 1.0 but it would show another pop-up window right after the error message, asking you if you would like to change to another GH and it worked if you did. This pop-up is nonpresent after the Ad hoc branch merge.

@vnctdj
Copy link
Contributor Author

vnctdj commented Feb 2, 2015

@issuer Oh OK, no problem then :) By the way, I have never seen the "room is full" message :/

@hrydgard If some debug logs or anything else can help, please let me know :)

@tywald
Copy link
Contributor

tywald commented Feb 2, 2015

@vnctdj are you playing with a lot of different people? It happens very frequently here at least, especially when you finish a quest, leave the GH to visit farm / change equipment and then come back.

There is also this issue where you can't see people unless they re enter the hall, even if they are inside. Most likely it is related to the "player leaving" not being properly detected as you said in the original post.

@vnctdj
Copy link
Contributor Author

vnctdj commented Feb 2, 2015

No, I don't play with a lot of different people. To be honest, it has been a very long time since I haven't played with a friend... I don't have enough time unfortunately :/
My tests are most of the time done between my PC and a virtual machine :)

@tywald
Copy link
Contributor

tywald commented Sep 12, 2016

I'm investigating this issue for MHP3rd(should also affect other MH games) and I set breakpoints in proAdhoc.cpp at line 1130 and 1140 but it never gets there.

When you join a GH and receive peer data it will call addFriend() as normal but when you disconnect it won't call deleteFriendByIP() so when 4 different users are added to "the list" it will fool the game thinking it's full when you try to join any other GH even if it's an empty one.

line 1129: else if (rx[0] == OPCODE_DISCONNECT) seems to always become false?

I don't know if I can solve it but I thought I would let you know what's happening at least. I guess AdamN knows more about this.

Here is a scenario that can trigger the bug.

  • GH3 has 3 users, GH20 has 1 user. Rest are empty.
  • join GH3, everything is fine (3 users added to the list).
  • disconnect, however the 3 users are still in the list!
  • join GH18, still fine, but the same 3 users are still in the list and still hasn't been removed.
  • disconnect
  • join GH3 again(assuming those 3 users are the same), still fine as no new users were added.
  • disconnect, the list still have those 3 users listed.
  • join GH20, it now says the GH is full (last user was added to the list right as you tried to join GH20 but unfortunately the list became full).
  • disconnect
  • join GH5, says it's full but GH5 is actually empty! It's because "the list" is now full and deleteFriendByIP() was never called.
  • ... (and so on) at this point you must restart the emulator to "flush" the list since the 4 users that were added aren't being removed as it should.

Edit*
Ok, I have a band-aid fix which is to uncomment the following two lines in sceNetAdhoc.cpp
1085: freeFriendsRecursive(friends);
1088: friends = NULL;

I don't know if this breaks anything but I guess this isn't the optimal solution, we want the "disconnect packet" code(line 1129-1155 in proAdhoc.cpp) to be used instead, I assume.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants