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
11.01k stars 2.15k forks source link

Gamesharing support #14625

Open ghost opened 3 years ago

ghost commented 3 years ago

What happens?

Games that only got GameSharing support won't work and show an error So far the only GameSharing only game I found is Pipe Mania Picture of the menu and error: image image I really tried to find an ad-hoc option but there is none. I think you can count Gamesharing only games on 1 hand though.

What should happen?

They should progress further and let you play.

What are you using?

What hardware / device and operating system? OS: Windows 10 CPU:Intel 8550U What graphics card (GPU) or mobile phone model? GPU:Radeon 530

Which game or games?

ULUS10359

Checklist

Games that are affected:

ghost commented 3 years ago

I really tried to find the ad-hoc option here but it seems to be none. So there are a few games that got Gamesharing only, Will update here if I find more ofc.

There are 2 emulators that I know that emulate a similar feature called Download Play and these are MelonDS (for Nintendo DS) and Citra(for 3DS). Both use a LLE approach though. There is also mgba that emulate something called Single Pak over link cable that is also somewhat similar.

anr2me commented 3 years ago

GameSharing on PSP is pretty straightforward, it uses AdhocMatching for transferring the data, which under-the-hood is using PDP socket, but we will need to create a small homebrew on the client side to download the data, in a similar-way to the one on VSH. But not sure whether that downloaded data need to be installed first (ie. similar to GameData Install) or can be loaded/booted directly (assuming it was downloaded to RAM or temporary storage instead of permanently installed)

The homebrew part shouldn't be complicated, it just need to initialize and update the GameSharing Dialog while waiting for the result, while the actual data handling will be on the Dialog implementation (which is on HLE). But not sure whether the current unofficial PSP SDK support AdhocMatching library or not.

However, with the current AdhocMatching implementation that was based on the legacy pro-online, it will probably only stable on LAN due to faked ACK on data transfer, since it uses PDP (UDP) the chance for packets to get lost over the internet will be high, and faking the ACK will certainly cause problem/desync.

ghost commented 3 years ago

Tbh you have a very low chance to get Download Play to work on on the other emulators over the internet so I am not suprised. On Citra you need sub 20 ms to even get it to conenct. Would be nice if all the ad-hoc parts were in place still and you can use localhost tho. You could always use parsec etc.

ghost commented 3 years ago

Thought about it recently but even if it worked online it will probably be gray/shady/illegal because you are basically transferring game/ISO data to the other player while they should get no access to it normally. It's fine for Sony because its theirs implementation but less so for PPSSPP I guess (that's something Citra also was afraid of). As I understand it

anr2me commented 3 years ago

Gamesharing will only transfer a portion of the game (usually only the multiplayer part) instead of the whole game, for a full ISO sharing PPSSPP already have Remote Disc feature LOL

However, with the way how Gamesharing worked it will probably takes a longer time to transfer the data compared to Remote Disc, due to high overhead on the gamesharing implementation.

unknownbrackets commented 3 years ago

I never used the gamesharing feature, since I'm a single player person, but I'm surprised if it used PDP/UDP with no validation at all - presumably it sent something the receiver could validate before executing, at least? Even with adhoc I'd expect some packets to fail sometimes, especially outdoors...

Obviously, remote disc streaming is not designed for use over the Internet and would probably perform badly for that. I know you're joking, just noting that in case someone tries it - you'll have problems. The point is, gamesharing is implemented in a way that's even worse when used over the Internet.

-[Unknown]

ghost commented 3 years ago

I never used the gamesharing feature, since I'm a single player person, but I'm surprised if it used PDP/UDP with no validation at all - presumably it sent something the receiver could validate before executing, at least? Even with adhoc I'd expect some packets to fail sometimes, especially outdoors...

Obviously, remote disc streaming is not designed for use over the Internet and would probably perform badly for that. I know you're joking, just noting that in case someone tries it - you'll have problems. The point is, gamesharing is implemented in a way that's even worse when used over the Internet.

-[Unknown]

Actually l if you are a single player person that feature is also for you because it also transfers single player demos on some games lol : https://www.lifewire.com/psp-games-with-gameshare-2792549 I guess thats why i thought it could be shady tho. BTW even on xlink you cant use gamesharing it wont work currently.

hrydgard commented 3 years ago

I don't think gamesharing like that is any more dodgy than it would be using it between two real PSPs, assuming one user owns the game. Should be fine. At least if you're in the same country :P Disclaimer: Not a lawyer...

The bigger concern as Unknown says is that it's not designed to be used across the internet so it's possible that games assume small latencies or something, although I guess that goes for adhoc in general too...

ghost commented 2 years ago

Well throught out xlink we found out it does kinda work over the internet. At least it completes the download but if the game ssid switches it might disconnect afterwards lol . Well if it works on hardware in theory it could work on emulator too

unknownbrackets commented 2 years ago

Well if it works on hardware in theory it could work on emulator too

The hardware didn't do it over the Internet, it did it over peer to peer ad-hoc connections. There's a big difference. When two devices are physically near each other, the wireless signal between them is typically fairly predictable (certain devices, such as a microwave oven can interfere, though.) The Internet is far less predictable.

When you communicate over the internet (including reading this comment), it's like sending and receiving messages in bottles across the open sea. They move in various high speed currents, and random stranger sea captains push your bottle along in the direction it hopefully ought to go. It all works fairly well, but it's not uncommon for a bottle to get broken or lost - that just happens. And there's a whole system to manage this and resend the bottle if it happens.

That's only a problem of the internet. If you're communicating with a friend, you'll just toss the bottle into their hands and wait for them to toss it back. So you may not even setup any complicated rules around how you'll retry if someone loses the message along the way. It's not a problem you have.

That might seem like a strange analogy, but it really is how internet packets work. "TCP" is actually a rulebook on how to handle lost messages. "UDP" (what this game uses) is when you just transfer things fast and loose.

TCP has its downsides - for example, recent HTTP protocols are abandoning it - because it adds overhead. People are writing new rulebooks that are more sophisticated. But UDP alone, without any extra rules, is direct and error prone.

-[Unknown]

ghost commented 2 years ago

I mean it was tried over Xlink Kai which is a way to tunnel communication over the internet from ad-hoc BTW Sony themselves made a way an app on PS3 that tunnels adhoc communication called Adhoc Party that works over the internet and most games work fine there as well... Someone tried Gamesharing on Adhoc Party and it also worked fine.

I am talking about a connection of 200+ ms too. Its not as sensitive as I thought it is.

unknownbrackets commented 2 years ago

I never used Adhoc Party, but my assumption is that it probably tunneled communication through a single or handful of ports using TCP, or else used UDP with its own custom rulebook. I don't remember anyone having to use VPNs or complaining about widespread firewall issues when using Adhoc Party back in the day.

-[Unknown]

anr2me commented 2 years ago

Yes, i think Adhoc Party is something like VPN where everyone using Adhoc Party can see each other (similar to VPN), which means it's being tunneled.

Well the only way to find out whether it's tunneled or not is by checking the ports being forwarded on your router and play a game with known ports, so if these known ports that supposed to be used by that game are not being forwarded like it normally do on pro-online, it means the packets are being tunneled. Or if the ports being forwarded on your router didn't changed with whatever games you're playing, that also means the packets are being tunneled, since different games usually use different ports (except for sequel titles may be)

Anyway, GameSharing is using AdhocMatching under the hood (based on the logs from JPCSP+prx with VSH), so we'll need to fix issue on AdhocMatching first before implementing GameSharing.

Btw, based on this video https://www.youtube.com/watch?v=C_eszqU_zMw It seems GameSharing is only used to download a small portion of the game code (probably a single module) and then launched and download additional files from it.

ghost commented 2 years ago

The only thing I know that it seems like different games got different netcodes for gamesharing as well. So one game could be more stable over the internet while others not and disconnect mid download, and also the download could be very very slow over the internet. Games that share single player/multiplayer demos seems to work the best. It seems like Adhoc Party handles it the best so far if you use it too.

ghost commented 2 years ago

Looks like all the Buzz games are either Gamesharing only or got an online mode to play over PSN lol. How I did not notice until now.