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

[Feature Request] Support in-game web browser #14637

Open Anuskuss opened 3 years ago

Anuskuss commented 3 years ago

It's definitely low priorty but I haven't seen a request for this yet so this is just a reminder. Basically some games (e.g. Yu-Gi-Oh! GX: Tag Force 2) let you open the web browser (in-game) to download stuff. Implementing this probably requires some kernel work (same as XMB).

anr2me commented 3 years ago

Is this something like WebView-like where the game shows the website within the game or it only open the URL on a browser app (ie. where the browser is part of VSH)?

Does it works on JPCSP HLE? we can use similar implementation if it worked there

ghost commented 3 years ago

Killzone Liberation and Fired Up also got this. It opens the PSP browser app from within the game. But I don't know if uses HTTP or HTTPS. It looks like most of the sites are down tho. Mega Man Powered Up also uses HTTPS and it still works though.

unknownbrackets commented 3 years ago

Are the pages this would show even still online?

I know at least a few are down now. The options here would be:

A separate problem is these options for each page:

Given the above, I really would say the best option is to shuttle to a native browser. Even then it may not work. Most official PSP demo pages or media/password/etc. pages that I'm aware of are gone now...

-[Unknown]

anr2me commented 3 years ago

When i choose Go to the website: image

It triggers these unimplemented syscalls: image The URL/URI might be part of sceUtilityHtmlViewerInitStart params..?

I wonder.. is this sceUtilityHtmlViewerInitStart something like a Dialog where the webview is inside the dialog or it simply fires up a different app (browser app)? If it didn't fires up a different app, the dialog probably use some sceHttp/sceHttps/sceSsl syscalls to create HTTP[S] Request and process the Response.

Of course firing up a native browser app is probably the simplest solution :) but it probably should use a custom user-agent and the ability to provide the game's cookies. Hoping for the server to detects the user-agent so they can returns PSP-compatible contents.

Edit: according to this, the parameters did contains URL and a lot of things (including DL/UL directory) http://psp.jim.sh/pspsdk-doc/structpspUtilityHtmlViewerParam.html

Anuskuss commented 3 years ago

Are the pages this would show even still online?

The website of that Yu-Gi-Oh! game isn't, but that doesn't mean we coudln't redirect it to a working one in the future.

Try to shuttle it into the native web browser, i.e. just open in a new window/app.

Well, it's not really about showing a website per se. In that Yu-Gi-Oh! game, it lets you download stuff by simply clicking on a link (I think it checks the extension to determine if it should download it or display it). How would that work with an external browser?

Pull in webkit or some other library directly, lots of hassle and work. Might allow using the same version as the PSP did, but might not even build on all platforms.

This makes the most sense although you would probably have to hack around it to get it to work on modern platforms. But that begs the question, why can't PPSSPP just emulate the browser PRX or the appropiate sceUtility* functions? Why bother with external software when the firmware already has all we need?

ghost commented 3 years ago

Pull in webkit or some other library directly, lots of hassle and work. Might allow using the same version as the PSP did, but might not even build on all platforms.

This makes the most sense although you would probably have to hack around it to get it to work on modern platforms. But that begs the question, why can't PPSSPP just emulate the browser PRX or the appropiate sceUtility* functions? Why bother with external software when the firmware already has all we need?

PPSSPP uses the HLE approach. If you want something that uses the prx and firmware you need to use JPCSP emulator.

Anuskuss commented 3 years ago

@MojoJojoDojo Read my question until the end.

or the appropiate sceUtility* functions?

unknownbrackets commented 3 years ago

The website of that Yu-Gi-Oh! game isn't, but that doesn't mean we coudln't redirect it to a working one in the future.

Well, it's not really about showing a website per se. In that Yu-Gi-Oh! game, it lets you download stuff by simply clicking on a link (I think it checks the extension to determine if it should download it or display it). How would that work with an external browser?

Pull in webkit or some other library directly, lots of hassle and work. Might allow using the same version as the PSP did, but might not even build on all platforms.

This makes the most sense although you would probably have to hack around it to get it to work on modern platforms.

This sounds like an exciting project that you've just announced. I know this would mean dedicating possibly months worth of nights and weekends, so that's why it doesn't sound exciting to me - but I'm glad you're so committed and willing to sink all your time into it.

Excited to hear about progress as you rebuild the websites and content for games that no longer have them and also integrate a browser, browsing UI, and everything else into PPSSPP - or try integrating kernel libraries just to learn how complex that is to deal with. It's going to be a long journey so I wish you a lot of luck in the most complex path that you've chosen. Please do keep us updated in your progress.

But that begs the question, why can't PPSSPP just emulate the browser PRX or the appropiate sceUtility* functions? Why bother with external software when the firmware already has all we need?

It turns out, operating systems don't really like exposing the details of the networking hardware to random applications and want to do their job - managing it and handling the drivers. So you're talking about implementing a lot of complicated stuff. Again, glad you're so excited about this as it sounds terribly complicated and - to a less excited person like me - terribly pointless given the websites are gone. I'm glad someone with such passion as you is at the helm of this new and important endeavor.

-[Unknown]

Anuskuss commented 3 years ago

Excited to hear about progress as you rebuild the websites and content for games that no longer have them

I know this was meant to be sarcastic, but I did actually write a little PHP to try to restore the online functionality in Yu-Gi-Oh! Tag Force 2. By hijacking the DNS and redirecting it to my web server, I'm able to download the original files directly onto my PSP. It's obviously not a full-on replica, but archiving this and making it accessible for future generations (thanks to projects like PS2 Rewired) is still cool nonetheless.

ghost commented 3 years ago

There are some web servers that are still alive and working I presume. Would be worth it for them at least. Like I said I only know 1 game but maybe there are more that work. Maybe exploring it will help understand how it works as well.

ghost commented 3 years ago

This is kinda relevant so I will post it here: https://psp-archive.github.io/apps/tls-port-interview.html

EclipseKnight commented 1 year ago

I'd like to express my interest in this feature as well. I've been curious about this for several years now. My exact use case revolves around the Monster hunter games which utilize this for downloading event quests and content for the game. However, others and I have made efforts to create modernized versions of these sites with additional content and use cases. They work fine on the physical hardware of course. However, since the main audience is PPSSPP users it is pointless.

Any updated status or efforts on this would be great to know.

hrydgard commented 1 year ago

Could you link to one of these sites, to see how complex it is? It's possible we could do a hyper-minimal integrated web browser that just display texts with links and nothing more, for the purposes of downloads - though still, implementing the PSP's browser API might be a huge undertaking, not sure though, haven't really looked into it. The sceHttp and sceNetInet stuff are probably also a lot of work.

Bringing in any kind of existing other web browser is a huge pain and will hinder development in lots of ways due to codebase bloat and so on. Or at least I don't know any good solutions. It doesn't look like this can be practically made to work by just launching Edge or Chrome with a hyperlink.

One other issue is that PPSSPP's http client doesn't support SSL. Though that's separately something that probably should be worked on...

All this for one game, too - I don't know any other games that have a use for a browser.

GrenderG commented 1 year ago

Here you go @hrydgard

http://crusader.capcom.co.jp/psp/MHP3rd/DL_TOP.PHP

http://viper.capcom.co.jp/psp/MHP2G/DL_TOP.PHP http://viper.capcom.co.jp/psp/MHP2GPAL/DL_TOP.PHP http://viper.capcom.co.jp/psp/MHP2GUSA/DL_TOP.PHP

http://skyhawk.capcom.co.jp/psp/MHP2/DL_TOP.PHP http://skyhawk.capcom.co.jp/psp/MHP2PAL/DL_TOP.PHP http://skyhawk.capcom.co.jp/psp/MHP2USA/DL_TOP.PHP

Please keep in mind that you need the following User-Agents to be able to access them (in the same order as the list above):

"Capcom Portable Browser v1.4 for MonsterHunterPortable3rd"
"Capcom Portable Browser v1.3 for MH_Portable_2nd_G"
"Capcom Portable Browser v1.2 for MH2nd_Portable"
GrenderG commented 1 year ago

For the sake of completionism there's also http://corsair.capcom.co.jp/psp/MHPSP/DL_TOP.PHP with User-Agent "Capcom Portable Browser v1.0 for MH_Portable" (event quest download is offline since 2014 but the site is still up).

Bonus (Poka Poka Airu Village): http://raptor.capcom.co.jp/services/pokapoka/DLCListAES.dat http://strike-raptor.capcom.co.jp/services/pokapokaG/DLCListAES.dat

With these User-Agents:

"Capcom Browser Services for PokaPoka_Airu"
"Capcom Browser Services v1.1 for PokaPoka_Airu_G"
hrydgard commented 1 year ago

Thanks, great to have those listed. That said, unlikely I'll get around to working on this near term - so many other priorities!

anr2me commented 1 year ago

I've tried to implement some sceHttp* syscalls recently and it worked quite well for Mega Man Powered Up, but i only tested it to download some custom maps, not sure whether uploading custom map will works too or not tho (was having difficulty designing my own map as i keep failing at placing the boss location, thus unable to test uploading the map). Fortunately that game doesn't use sceUtilityHtmlViewer* syscalls, thus the page are rendered by the game. The game doesn't use HTTPS either (not sure whether HTTPS will be required for uploading custom map or not).

GrenderG commented 1 year ago

The Monster Hunter PSP games are also using like an in-game browser (in fact it looks the same as the in-game browser for the Monster Hunter PS2 games). They don't use HTTPS either.

By the way, @hrydgard, JPCSP (PSP emulator written in Java) has it working if you want to take a look: https://github.com/jpcsp/jpcsp image

anr2me commented 1 year ago

I did a quick test on Monster Hunter using sceHttp i was working on (which apparently my codes didn't get corrupted due to bad sectors issue i had recently), and i was able to download some event quest (grayed one was successfully downloaded) image Unfortunately, my approach in handling httpTemplate, httpConnection, and httpRequest was a bit different than JPCSP, so i'll need to rewrite it and use similar method with JPCSP (which is more make sense) before making the PR (minus the built-in web viewer of course, as it's too complex)

PS: will probably took awhile before i can use my laptop for working on anything again, due to bad sector issue and the laptop display also flickering a lot (backlight issue) and getting worse each day.

jcchikikomori commented 1 year ago

Are the pages this would show even still online?

I know at least a few are down now. The options here would be:

  • Try to shuttle it into the native web browser, i.e. just open in a new window/app.
  • Try to integrate with a platform API to render the browser. Lots of work to get all platforms working. Some pages, even if up, might render wrong.
  • Pull in webkit or some other library directly, lots of hassle and work. Might allow using the same version as the PSP did, but might not even build on all platforms.

A separate problem is these options for each page:

  • The pages may no longer be available at the URLs in the games. I know this is true of some games.
  • The pages may still be available, but broken due to the host. I've heard this is true for at least one game.
  • The page may still be available, but render badly in modern web software.
  • The pages may work fine but lead to other complexities, like choosing what to do with downloaded photos, videos, music, etc.

Given the above, I really would say the best option is to shuttle to a native browser. Even then it may not work. Most official PSP demo pages or media/password/etc. pages that I'm aware of are gone now...

-[Unknown]

I thought so as well. Also, putting a web browser inside the emulator would be an out of scope feature, and it's also a potential security risk.

EclipseKnight commented 1 year ago

Are the pages this would show even still online? I know at least a few are down now. The options here would be:

  • Try to shuttle it into the native web browser, i.e. just open in a new window/app.
  • Try to integrate with a platform API to render the browser. Lots of work to get all platforms working. Some pages, even if up, might render wrong.
  • Pull in webkit or some other library directly, lots of hassle and work. Might allow using the same version as the PSP did, but might not even build on all platforms.

A separate problem is these options for each page:

  • The pages may no longer be available at the URLs in the games. I know this is true of some games.
  • The pages may still be available, but broken due to the host. I've heard this is true for at least one game.
  • The page may still be available, but render badly in modern web software.
  • The pages may work fine but lead to other complexities, like choosing what to do with downloaded photos, videos, music, etc.

Given the above, I really would say the best option is to shuttle to a native browser. Even then it may not work. Most official PSP demo pages or media/password/etc. pages that I'm aware of are gone now... -[Unknown]

I thought so as well. Also, putting a web browser inside the emulator would be an out of scope feature, and it's also a potential security risk.

There are many security risks to particular features already implemented in PPSSPP, such as remote debugging. I believe for sake of preservation this browser should be an optional feature that can be enabled by the end user. At least that is how I view this. Otherwise forks will just be made to implement the browser.

LunaMoo commented 1 year ago

Otherwise forks will just be made to implement the browser.

You're free to do soo, that's exactly how open source projects like PPSSPP work, when a niche feature is desired by someone and most other people doesn't care at all about it, that person should fork the project, work on that desired-by-him-feature and then optionally open a pull request when it's done if he feels his code is good enough and the feature can benefit others as well.

Most of the time through if a feature that most people don't care about, a feature that doesn't even work anymore on the real device - is requiring a lot of work to be implemented, person desiring it doesn't even bother learning how to implement it.

anr2me commented 1 year ago

@Anuskuss / @GrenderG / @EclipseKnight Could you try the artifacts from https://github.com/hrydgard/ppsspp/actions/runs/6005697265?pr=18003 And see whether it works properly on the games that you know use sceHttp syscalls (i only tested it on a few games), games that use sceUtilityHtmlViewer syscalls might not works properly tho as it's not implemented (yet?).

Let us know if you found a game that doesn't use sceUtilityHtmlViewer but doesn't work properly either.