hrydgard / ppsspp

A PSP emulator for Android, Windows, Mac and Linux, written in C++. Want to contribute? Join us on Discord at https://discord.gg/5NJB6dD or just send pull requests / issues. For discussion use the forums at forums.ppsspp.org.
https://www.ppsspp.org
Other
10.79k stars 2.12k forks source link

Legend Of The Dragon freezes on Waiting for other players message - 1.11.3 #14557

Open ghost opened 3 years ago

ghost commented 3 years ago

Hi,me again,found bug and wanted to report it

What happens?

Game freezes on that message,with sound still playing in background I also looked at logs,and it spams sceNetAdHocDiscoverGetStatus

What should happen?

Game should proceed fine without any issues

What are you using?

Android PC

(i tried switching host \ client,nothing helped)

What hardware / device and operating system?

Android - PowerVR GE8320 Windows - 8.0

What graphics card (GPU) or mobile phone model?

PowerVR GE8320 Intel (R) HD Graphics

What PPSSPP version (standalone/official), and did it work before?

1.11.3

Which game or games?

ULUS10250 Legend Of The Dragon USA

Checklist

anr2me commented 3 years ago

We currently doesn't have sceNetAdHocDiscover* HLE being implemented i think (i don't even know what it's supposed to be used for), so that's probably the reason it's waiting forever, probably waiting for a state change or a callback.

I will try to make that function to return an error later, so the game won't stuck waiting forever, but the multiplayer itself will probably fails if this game relies on sceNetAdhocDiscover* syscalls.

anr2me commented 3 years ago

Hmm.. sceNetAdhocDiscover* probably have a dialog which triggered by sceNetAdhocDiscoverInitStart and updated by sceNetAdhocDiscoverUodate, but this game probably hiding the dialog since it doesn't shows up when i tested it with JPCSP+prx files, while JPCSP HLE only faking the result after delaying it for 2000 ms.

One of the field in the parameters struct seems to be group name, so this Discover thing probably tried to find someone else in that group, but i didn't see it use anything like sceNetAdhocctlScan internally... i wonder what it's suppose to do while waiting...

sceNetAdhocDiscoverInitStart netAdhocDiscoverParam=0x08A903F8(SceNetAdhocDiscoverParam unknown1=0x00000000, groupName='NkFree', unknown2=0x0000003C, result=0x00000000)
sceNetAdhocDiscoverInitStart returning 0x0
...
sceNetAdhocDiscoverGetStatus returning 0x1
...
sceNetAdhocDiscoverUpdate returning 0x9F4E430
...
sceNetAdhocDiscoverStop returning 0x0 <-- triggered when pressing the Cancel button
...
sceNetAdhocDiscoverGetStatus returning 0x2
...
sceNetAdhocDiscoverTerm returning 0x0

Btw, anyone know any other games that use sceNetAdhocDiscover syscalls? i'm curious how the dialog looks like :D in case one of them didn't hide the dialog

Also, does games that use sceNetAdhocDiscover worked with PRO-online client on PSP? because i don't think the pro-online Adhoc Server is implementing this discover thing...

anr2me commented 3 years ago

It seems simply returning an error on sceNetAdhocDiscoverInitStart nor sceNetAdhocDiscoverGetStatus won't make the game shows an error on screen, and it will still be repeatedly trying to "Discover" :( i guess we will need to implement this Discover thing to prevent this game from stuck forever unable to cancel and go back to main menu... image

Edit: returning 2 on sceNetAdhocDiscoverGetStatus will trigger the game to use sceNetAdhocctlGetPeerList but because it never create/join a group, the peer list will be empty and the game still stuck trying to "Discover", so there is a possibility that this "Discover" thing supposed to create/join a group internally.

When i tried to decompile pspnet_adhoc_discover.prx it does imports these functions (which related to group):

/*
 * Imports from library: sceNetAdhocctl
 */
extern int sceNetAdhocctlScan ();
extern int sceNetAdhocctlDisconnect ();
extern int sceNetAdhocctlJoin (int arg1);
extern int sceNetAdhocctlGetScanInfo (int arg1, int arg2);
extern int sceNetAdhocctlGetPeerList (int arg1, int arg2);
extern int sceNetAdhocctlCreate (int arg1);
ghost commented 3 years ago

Lord Of Arcana also uses it function apparently and if I am not mistaken that game still got issues too with PPSSPP. Basing it on this post : https://forums.ppsspp.org/showthread.php?tid=1461

anr2me commented 3 years ago

Lord Of Arcana also uses it function apparently and if I am not mistaken that game still got issues too with PPSSPP. Basing it on this post : https://forums.ppsspp.org/showthread.php?tid=1461

Thanks, Lord of Arcana does seems to import sceNetAdhocDiscover library on one of it's module, but it never actually use it so far (since multiplayer worked even without implementing it), unless there are other part of the game that use sceNetAdhocDiscover but nobody aware of it yet... may be a different multiplayer mode... Or may be the game devs were using it on prototype but later changed it to a better method of "discovery" but didn't remove the old & unused code (which is more makes sense if multiplayer worked without it)

Edit: Found another game that might be using it (probably on prototype) which is Gods Eater Burst, based on this logs i found on internet https://pastebin.com/x4abmmDE

ghost commented 2 years ago

If it could be useful here is a memory dump from a PSP trying to connect: MEMDUMP0.zip

anr2me commented 2 years ago

@MojoJojoDojo could you make a video of Multiplayer with Legend of the Dragon on PSP? i couldn't find it on youtube.

I wanted to know how it supposed to look like when someone else is connecting too.. will there be grayed dialog appeared like on some games (ie. showing "connecting..please wait") or the "waiting for other player to connect" simply disappear. JPCSP HLE didn't implement the dialog visually, and the LLE didn't work either (sceNetAdhocDiscoverUpdate keeps returning 0x9F43F30, which is not part of the param's content passed in sceNetAdhocDiscoverInitStart so not sure what is this pointer supposed to belong to, may be an internal reusable buffer?)

Btw, both players suppose to choose "Versus" menu, am i right? since i can't host/join in the menu.

PS: According to this report https://report.ppsspp.org/logs/kind/1124 there a few more games that use AdhocDiscover, including games that are known to work like Dissidia 012 and Monster Hunter 2nd, i wonder why they worked even with a non-working AdhocDiscover syscalls...

anr2me commented 2 years ago

PR https://github.com/hrydgard/ppsspp/pull/14950 should be able to cancel the waiting process properly, similar to JPCSP LLE, but i haven't figured out how to make it successful to the inner menu, since JPCSP LLE didn't work either :( so i can't find a clue how the flow should go.

If the main purpose of AdhocDiscover is just to find someone to play with (the text on the messagebox feels like that), and based on the imported functions from sceNetAdhocctl library, i might have a clue how the flow should go, the hard part is when there are data that need to be returned or filled outside of the standard return/result value.

ghost commented 2 years ago

@MojoJojoDojo could you make a video of Multiplayer with Legend of the Dragon on PSP? i couldn't find it on youtube.

I wanted to know how it supposed to look like when someone else is connecting too.. will there be grayed dialog appeared like on some games (ie. showing "connecting..please wait") or the "waiting for other player to connect" simply disappear. JPCSP HLE didn't implement the dialog visually, and the LLE didn't work either (sceNetAdhocDiscoverUpdate keeps returning 0x9F43F30, which is not part of the param's content passed in sceNetAdhocDiscoverInitStart so not sure what is this pointer supposed to belong to, may be an internal reusable buffer?)

Btw, both players suppose to choose "Versus" menu, am i right? since i can't host/join in the menu.

PS: According to this report https://report.ppsspp.org/logs/kind/1124 there a few more games that use AdhocDiscover, including games that are known to work like Dissidia 012 and Monster Hunter 2nd, i wonder why they worked even with a non-working AdhocDiscover syscalls...

it doesnt work over xlink kai and its stuck on the same message as on PPSSPP lol. You won't see any other message as well.

anr2me commented 2 years ago

Yeah, i guess so, since you're using xlink kai with JPCSP instead of another PSP right? :D Anyway, my PR can at least avoid freezing the game for infinity, the only things that need to be implemented is each steps within sceNetAdhocDiscoverUpdate and there are so many steps in it based on the decompiled prx, so i'll probably use my own method (similar to the steps on NetconfDialog)

ghost commented 2 years ago

No i used it with another PSP over xlink kai and not JPCSP lol.

ghost commented 2 years ago

It could be that adhocdiscovery sends the info with beacon frames. It means it wont work on either xlink or adhoc party because they dont support tunneling beacon frame data. It's prolly similar to gamemode or something.