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

Infrastructure Mode compatibility issues #19850

Open
hrydgard opened this issue Jan 10, 2025 · 8 comments
Open

Infrastructure Mode compatibility issues #19850

hrydgard opened this issue Jan 10, 2025 · 8 comments

Comments

@hrydgard
Copy link
Owner

hrydgard commented Jan 10, 2025

Let's collect remaining problems here, will update the website accordingly after the release of 1.19.

The most interesting thing to note is if a game doesn't work on Windows but works on other platforms or vice versa, sometimes those bugs are not too hard to fix.

Android seems to work just like Linux, not too surprisingly.

Medal of Honor: Heroes:

Twisted Metal

  • Need a savegame from console to get started, then it works. Said to be OSK related?

Wipeout Pulse

  • Works, except for a texture issue
  • Also, breaks if proAdhoc server is set to localhost! Not sure how to solve this one regarding UX...

Wipeout Pure (browser)

Not really infrastructure mode, but good test case for sceHttp as it has a browser. The current implementation fails to resolve and enters a loop of netconf init.

Driver '76

Driver 76 works now, tested on Windows vs Linux, and Windows vs Android.

But players need to connect to Adhoc Server, because this game didn't try to connect to any AP but connects to adhoc instead, thus couldn't get any valid IP and can only use IP list provided by adhoc server.

@anr2me
Copy link
Collaborator

anr2me commented Jan 10, 2025

Driver 76 works now, tested on Windows vs Linux, and Windows vs Android.

But players need to connect to Adhoc Server, because this game didn't try to connect to any AP but connects to adhoc instead, thus couldn't get any valid IP and can only use IP list provided by adhoc server.

PS: We probably need to dump the content of sceNetApctlGetInfo from a real PSP without initializing Apctl to get the correct data (in case it have a valid IP after initializing Adhocctl, since we currently returning IP 0.0.0.0 when not connected to any AP)

@Nemoumbra
Copy link
Contributor

Patapon 3 requires NpMatching2, which is not even enabled (the loader recognizes the nids, but stores the module for later resolving anyway). It is also most likely not operational.

@hrydgard
Copy link
Owner Author

hrydgard commented Jan 10, 2025

For the MOHH on Windows issue, I suspect this is part of the problem:

58:49:091 user_main    W[SCENET]: HLE\sceNetInet.cpp:425 UNTESTED sceNetInetSocket(2, 3, 1) at 08a8cb54
58:49:091 user_main    D[SCENET]: HLE\sceNetInet.cpp:426 Socket: Domain = AF_INET, Type = SOCK_RAW, Protocol = IPPROTO_ICMP
58:49:092 user_main    D[SCENET]: HLE\sceNetInet.cpp:443 1=sceNetInetSocket(2, 3, 1)
58:49:092 user_main    W[SCENET]: HLE\sceNetInet.cpp:447 UNTESTED sceNetInetSetsockopt(1, 0, 2, 09ffed00, 4) at 08a8cbb0
58:49:092 user_main    D[SCENET]: HLE\sceNetInet.cpp:455 SockOpt: Level = IPPROTO_IP, OptName = IP_HDRINCL, OptValue = 1
58:49:092 user_main    E[SCENET]: HLE\sceNetInet.cpp:506 ffffffff=sceNetInetSetsockopt(1, 0, 2, 09ffed00, 4): errno = 10013
58:49:092 user_main    D[SCENET]: HLE\sceNetInet.cpp:508 -1=sceNetInetSetsockopt(1, 0, 2, 09ffed00, 4)

It seems to set up its own socket (1) to do ICMP pings, by setting the IP_HDRINCL on a socket. Windows doesn't seem to like it very much, as it fails. IP_HDRINCL means that it wants to write the IP header itself... Not sure if this is just not allowed? It might be that this requires admin permissions. Maybe we can fool the game into thinking it succeeds somehow.

We do get online for like 1 or 2 frames then we get kicked off, seemingly in conjunction with this socket being used.

@hrydgard
Copy link
Owner Author

hrydgard commented Jan 10, 2025

Actually on Mac it fails earlier!

56:59:511              W[SCENET]: HLE/sceNetInet.cpp:425 UNTESTED sceNetInetSocket(2, 3, 1) at 08a8cb54
56:59:511              D[SCENET]: HLE/sceNetInet.cpp:426 Socket: Domain = AF_INET, Type = SOCK_RAW, Protocol = IPPROTO_ICMP
56:59:511              E[SCENET]: HLE/sceNetInet.cpp:431 ffffffff=sceNetInetSocket(2, 3, 1): errno = 1
56:59:535              W[SCENET]: HLE/sceNetInet.cpp:425 UNTESTED sceNetInetSocket(2, 2, 0) at 08a8cb54
56:59:535              D[SCENET]: HLE/sceNetInet.cpp:426 Socket: Domain = AF_INET, Type = SOCK_DGRAM, Protocol = IPPROTO_UNSPEC (DEFAULT?)
56:59:535              D[SCENET]: HLE/sceNetInet.cpp:443 1=sceNetInetSocket(2, 2, 0)

Can't create a raw socket at all there. Maybe that's the way...

OK, tried simulating this behavior, no luck :/

@anr2me
Copy link
Collaborator

anr2me commented Jan 11, 2025

Yeah, in order to create a raw socket need admin/sudo.
Also, it's not possible to create a raw socket on Android as i remembered, at least from a normal app.

May be it gets disconnected after 2 frames because it couldn't send the ping packet to keepalive.

@anr2me
Copy link
Collaborator

anr2me commented Jan 11, 2025

Running PPSSPP as admin on windows doesn't shows any error during raw socket creation, so i guess it wasn't the main culprit (at least on Windows)
image

@anr2me
Copy link
Collaborator

anr2me commented Jan 11, 2025

Also, breaks if proAdhoc server is set to localhost! Not sure how to solve this one regarding UX...

If proAdhoc server set to localhost and built-in adhoc server is enabled, it will be treated as multiple-instance, thus games that tried to bind all interface (0.0.0.0/255.255.255.255) will only be bound to a specific localhost address (which doesn't have any access to other network interface, including the internet).

So, when playing over the internet, the proAdhocServer address should be set to a public server, and when playing on LAN/VPN it should be set to the intended LAN IP.

Also, since we are currently enforcing infra to connect to adhoc (group: INFRA) built-in adhoc server may need to be enabled too when playing on LAN, otherwise it will shows connection error.

We probably need to selectively this borrowing adhoc server to be enabled on certain condition only, so it won't affect online infrastructure multiplayer, since it can shows a "failed to connect to adhoc server" error (if there is no server) which will prevent from progressing.
May be added an new networking setting (ie. "Infra use AdHoc Grouping") to enable/disable this function, since only a small number of games needed this, we can disable it by default.

PS: Relevant codes regarding this borrowing adhoc is by searching for the word "Adhoc" within sceNetInet.cpp, and also search the word "Borrowing AdhocServer" within sceNet.cpp

@anr2me
Copy link
Collaborator

anr2me commented Jan 11, 2025

Btw, the mapped socket id supposed to be the same isn't, regardless the platform?

But MoH on Windows seems to have socket id = 3 (the socket used after resolving), while on Linux the id is 2

Windows:
image

Linux:
image

Edit: i see why it have different id, because one of the socket creation failed (errno = 1 / EPERM (Operation not permitted)) on linux
Linux:
image

While they're successful on Windows:
image

Edit2: Nevermind, it gets id = 3 too when i ran PPSSPPSDL with sudo, i guess it was the raw socket thing

Btw, where is the ppsspp.ini when running as sudo? seems to be at a different location

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

3 participants