mmatyas / pegasus-frontend

A cross platform, customizable graphical frontend for launching emulators and managing your game collection.
http://pegasus-frontend.org
Other
1.29k stars 117 forks source link

[Android] PPSSPP and Mupen64PlusFZ can't find ROMs that are launched from Pegasus #915

Closed SoumyBhow closed 2 years ago

SoumyBhow commented 2 years ago

Hi, and thanks for reporting errors! You can help us locating the bug even more by providing detailed information in the sections below:

The issue

When launching a ROM from Pegasus to PPSSPP or Mupen64PlusFZ on Android, the emulators can't find the ROM. I'm assuming that this is due to SAF restrictions. Perhaps if Pegasus can select the metadata.txt files with the SAF file picker then this could be fixed?

Screenshot_20211203-002522844

System info

OnePlus 7 Pro Android 11

Pegasus version

version alpha15-85-gfff1a5b2

Pegasus log

lastrun.log

mmatyas commented 2 years ago

Hm it seems PPSSPP not longer supports opening files directly by file paths? I wonder what other methods they support for telling the location of a particular game.

SoumyBhow commented 2 years ago

I think it's due to Storage Access Framework. There's also this suggestion from the Mupen64PlusFZ for DIG about the same thing: https://digdroid.com/forums/discussion/comment/2340#Comment_2340

I'm thinking would it be possible for Pegasus to use SAF to load the metadata.txt files?

SoumyBhow commented 2 years ago

Thanks for the update. But now I'm having trouble setting this up. I tried changing {file.path} for {file.uri} in my PPSSPP metadata file but it still gives an error (unknown file type). Is there something I'm missing? Screenshot_20211213-135155995

mmatyas commented 2 years ago

Oh, you're fast! Yes, {file.uri} should be used on Android, which should return a valid content URI, created by the OS.

Unfortunately, the URI support in PPSSPP seems to be pretty basic at the moment: it only supports one particular file provider source (com.android.externalstorage.documents) and only it it matches one particular format (see https://github.com/hrydgard/ppsspp/blob/ff887b0f11920f569b664415849613e09328d8d5/android/jni/AndroidContentURI.h#L10). I believe this is a limitation in PPSSPP, rather than Pegasus, but if it turns out to be a common issue with apps, I think it can be fine tuned.

Gamesirvictim commented 2 years ago

You know Arc browser developer solved this problem. Now PPSSPP, mupen64, dolphin and redream working on it for Android 11 . I think Yaba sanshro will be supported soon.

SoumyBhow commented 2 years ago

I've tried PPSSPP, AetherSX2 and Mupen64PlusFZ. None of them work. Though Mupen64PlusFZ did launch a single game at first before it stopped working so I have no idea what's up with that. And AetherSX2 only boots to the BIOS. At this point I think it's best to use the regular documents provider for this...

mmatyas commented 2 years ago

Well I was experimenting a bit more with content URIs, but Android doesn't let me send path opening requests disguised as com.android.externalstorage.documents (I'm running into security issues). It seems this provider is only allowed when you manually select a file in a file picker, apparently can't be automated ("Applications cannot use a documents provider directly; [...] which requires a user to actively navigate and select documents", according to the Android docs)

Gamesirvictim commented 2 years ago

Why not asking Arc browser or mupen64 developer for help. I think they will help pegasus developer to solve this problem.

mmatyas commented 2 years ago

Ok, I think I have a working prototype now, but will take a few days to make it pretty.

Gamesirvictim commented 2 years ago

Great work

SoumyBhow commented 2 years ago

Okay so I've been testing out some things and so far almost everything works after the latest update of Pegasus. Merely PPSSPP and Mupen64PlusFZ don't work yet. I've tried out Arc Browser just to compare how it works and I believe it has the proper approach. It uses a seperate app as a SAF proxy which is used to give permission to directories via the documents provider thing. In Arc, PPSSPP and Mupen64PlusFZ do work. I understand that this may ruin the user experience but I sincerely believe this is the proper method to solve this issue once and for all. The spoofing document URIs doesn't work completely. Perhaps when the user selects the metadata.txt files then the SAF explorer can be used?

mmatyas commented 2 years ago

I'm thinking about adding a menu option for managing accessible directories; using SAF only for the metadata wouldn't be enough, because they can refer to files in different directories that their own. And, as far as I see, I cannot ask access for multiple directories at once, it has to be selected by the Android explorer thing one by one.

SoumyBhow commented 2 years ago

A menu like that might just work. As long as Pegasus somehow has access to the same sub directories I think it should work. And I don't think the one by one thing is going to be a major issue. After all the metadata files are also selected one by one (unless I missed something lol). Still I appreciate you still looking over this issue. Many thanks!

SoumyBhow commented 2 years ago

Yep this new update fixes everything. Mupen, PPSSPP and Aethersx2 all work now. Thank you so much! Closing this issue.

haxwagon commented 2 years ago

@SoumyBhow , I still get this error in PPSSPP with Alpha16. Can you post your PPSSPP config? Fwiw I have mupen working. Still working on PPSSPP and redream

SoumyBhow commented 2 years ago

@SoumyBhow , I still get this error in PPSSPP with Alpha16. Can you post your PPSSPP config? Fwiw I have mupen working. Still working on PPSSPP and redream

The Alphas don't work for me either. I'm using the stable version from March 28