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

Mi 5a TV (Android TV 11) unable to open files with PPSSPP #16865

Open
tausifj15 opened this issue Jan 30, 2023 · 52 comments
Open

Mi 5a TV (Android TV 11) unable to open files with PPSSPP #16865

tausifj15 opened this issue Jan 30, 2023 · 52 comments
Labels
Platform-specific (Android) Scoped Storage Related to scoped storage on Android
Milestone

Comments

@tausifj15
Copy link

What happens?

Ppsspp is not recognising games in mi tv 5a Android 11 kindly help i tried with pen drive too and internal storage

What should happen?

What are you using?

A smart tv brand mi 5a tv 2022 version

What hardware / device and operating system?

Mali g31 Mp2 Android 11

What graphics card (GPU) or mobile phone model?

It's an smart tv

@ghost
Copy link

ghost commented Jan 30, 2023

#11997 (comment)

@hrydgard
Copy link
Owner

Yeah, a lot of smart TVs don't implement the proper file browsing controls needed to support scoped storage. It's quite bizarre how that got through Google's Android certification (if it did).

@tausifj15
Copy link
Author

tausifj15 commented Jan 30, 2023 via email

@hrydgard
Copy link
Owner

PPSSPP 1.11 and earlier don't declare support for scoped storage, so Android 11 will let them do things without the dialogs and stuff.

Theoretically we could create special scoped-storage-free builds of the newer versions of PPSSPP too, but it would be quite a hassle..

@tausifj15
Copy link
Author

tausifj15 commented Jan 30, 2023 via email

@ghost
Copy link

ghost commented Feb 2, 2023

So it will take time? Right?

On Mon, 30 Jan, 2023, 9:46 pm Henrik Rydgård, @.> wrote: PPSSPP 1.11 and earlier don't declare support for scoped storage, so Android 11 will let them do things without the dialogs and stuff. Theoretically we could create special scoped-storage-free builds of the newer versions of PPSSPP too, but it would be quite a hassle.. — Reply to this email directly, view it on GitHub <#16865 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AE3MVBSWDFGB4R4USEXALXTWU7SODANCNFSM6AAAAAAUK7NDSA . You are receiving this because you authored the thread.Message ID: @.>

Stick to ppsspp v1.11 as a workaround.

@tausifj15
Copy link
Author

tausifj15 commented Feb 2, 2023 via email

@hrydgard hrydgard added the Scoped Storage Related to scoped storage on Android label May 15, 2023
@stzokev
Copy link

stzokev commented Aug 4, 2023

@hrydgard

Yeah, a lot of smart TVs don't implement the proper file browsing controls needed to support scoped storage. It's quite bizarre how that got through Google's Android certification (if it did).

@hrydgard SAF is not supported on Android TV by design (on purpose, not a bug). Therefore not only file picker is missing, but file.uri, required by most emulators, is not supported. The workaround would be to have a fallback to manually enter the uri as it was prior to v.1.11. For example I am currently using PPSSPP on CWGTV (Chromecast with Google TV) which is Android 12 and I am using v.1.10.3 successfully. All I do is enter the path to the SD card manually and done! Similar workaround is used for Retroarch. So it shouldn't be too much work for you to support this either by graceful fallback on these systems, or if you ask me even better to have 2 buttons - 1) Browse 2)Enter uri.

Regards and keep up the excellent work.

@hrydgard
Copy link
Owner

hrydgard commented Aug 4, 2023

@hrydgard

Yeah, a lot of smart TVs don't implement the proper file browsing controls needed to support scoped storage. It's quite bizarre how that got through Google's Android certification (if it did).

@hrydgard SAF is not supported on Android TV by design (on purpose, not a bug).

Weird then that it works on NVIDIA Shield, which is Android TV.

Therefore not only file picker is missing, but file.uri, required by most emulators, is not supported. The workaround would be to have a fallback to manually enter the uri as it was prior to v.1.11. For example I am currently using PPSSPP on CWGTV (Chromecast with Google TV) which is Android 12 and I am using v.1.10.3 successfully. All I do is enter the path to the SD card manually and done! Similar workaround is used for Retroarch. So it shouldn't be too much work for you to support this either by graceful fallback on these systems, or if you ask me even better to have 2 buttons - 1) Browse 2)Enter uri.

Regards and keep up the excellent work.

We could certainly add a field to manually enter the path. But how would most users find out the correct path to enter?

@stzokev
Copy link

stzokev commented Aug 4, 2023

Weird then that it works on NVIDIA Shield, which is Android TV.

Android TV != Google TV. Most Android TV boxes out there are almost identical in specs using low powered Amlogic SOC with 2GB and very little storage. Nvidia Shield was not in this category from the get go. It's even the only one I know of that is running a x64bit version of Android TV, compared to all others which run x32bit due to the low resources.

We could certainly add a field to manually enter the path. But how would most users find out the correct path to enter?

As mentioned above storage for these tv boxes is usually extremely low and PSP images require space. So whoever wants to emulate on such device has already equipped with external storage where roms would be. On the Chromecast the path is visible via a file manager like X-Plore (probably many more) and is like so: "/storage/F490-1404/roms" where F490-1404 is a random number for each USB storage, but persisted across restarts.

@hrydgard
Copy link
Owner

hrydgard commented Aug 4, 2023

OK, that makes sense. I'm going to add a simple "Enter Path" button and only show it on Android TV, so at least power users can use it.

hrydgard added a commit that referenced this issue Aug 4, 2023
See issue #16865 for why this is important on some crippled Android
devices.
@hrydgard
Copy link
Owner

hrydgard commented Aug 4, 2023

I have added such a button now, please test.

@stzokev
Copy link

stzokev commented Aug 4, 2023

I have added such a button now, please test.

Oh wow, thanks for taking this at heart. Unfortunately it doesn't seem to work. While it shows the changed path at the top left corner and I can navigate the folders of the external storage now, it doesn't recognize or look for PSP games and therefore it doesn't list them. I can see in settings that the Change Memory stick folder still point to the internal storage and not the path I've set via the new button. I also see that the app now created folder structure inside the PSP folder with my games i.e. another PSP folder with GAME/SAVEDATA/SYSTEM/TEXTURES/PPSSPP_STATE. I tried moving some of the games in the GAME folder, but it doesn't seem to recognize them either. Let me know if you need logs/videos anything to help you if the above is not enough and thanks again!

@hrydgard
Copy link
Owner

hrydgard commented Aug 5, 2023

That sounds bizarre, if it lets you navigate and show folders, it should also show files. I guess some other restriction is there... I don't know. Can you take some screenshot or video just to confirm that I'm understanding things right?

What popular devices are like this? Or rather, what's a good cheap one, currently being sold, that I can buy to replicate this situation?

@stzokev
Copy link

stzokev commented Aug 5, 2023

The Walmart Onn is the cheapest $19 but is US only, for Europe that would be the HD version of the Chromecast with Google TV which is usually around 30 euro. Any Xiaomi Mi Box and Amazon Firestick device would also be cheap and has the same limitation. You can see the workaround I am using with v1.10.3 in this video https://youtu.be/Jy-HlXPEIsI?t=679

Here is a screenshot from v1.10.3 where I see my games and [here is a video](https://photos.app.goo.gl/mhzTCZVBHASx8bAU7 with last nights version where it doesn't pickup the games.

@stzokev
Copy link

stzokev commented Aug 10, 2023

@hrydgard Did you have a chance to see the video and get an idea? Or you want to buy such device and test directly?

@hrydgard
Copy link
Owner

I'm getting the Chromecast shortly.

@hrydgard
Copy link
Owner

Hm, so I got the Chromecast HD. Haven't set it up yet, but noticed that is has no port for sd cards (not really unexpected) and the USB needs to be plugged in all the time to give it power. How are you guys connecting any external storage to it?

@stzokev
Copy link

stzokev commented Aug 11, 2023

Using USB C hub with power delivery, so the power goes to it and it powers the Chromecast. Then I have 2 USB ssds, one for internal and one for external storage. You would need at least 8w power adapter in order to compensate for the hub and ssds. Just for the sake of you testing this however, you should be fine copying a single small game into the Chromecast internal storage .

@hrydgard
Copy link
Owner

That sounds a bit complicated, I wonder how many people bother...

Can you link to such a USB-C hub on Amazon or something, and what are USB SSDs, regular USB drives?

@stzokev
Copy link

stzokev commented Aug 12, 2023

Nothing complicated, here is my setup - https://ibb.co/vcrH7Sd And yes, USB ssds attached to USB C hub. It needs to be power delivery hub. You can use thumb drive/flashdrive instead of ssds for your test purpose. Or if you just don't want to bother, let me know how I can help with logs or other means. You keep new builds coming and I'll keep testing until we have it working. I don't think it needs much (if at all) work, as you already had this working in 1.10.3 version

@hrydgard
Copy link
Owner

Ah I didn't realize how common those power hubs have become for laptops. Ordered a cheapo one, and I'll just plug some USB storage sticks into it, let's see how it goes.

@stzokev
Copy link

stzokev commented Aug 13, 2023

Yes, very common due to the limited number of ports on modern laptops which only strive to be as thin as possible. I was never able to get an SD card or MicroSD card working with the Chromecast, although the same work when I plug the hub to a laptop. So using usb ssd or usb stick is your best option.

@stzokev
Copy link

stzokev commented Aug 20, 2023

@hrydgard Anything I can test yet? :) Just joking, really appreciate you trying to work this one out!

@hrydgard
Copy link
Owner

No updates yet, sorry. I did recently receive the USB hub thingy I ordered.

@stzokev
Copy link

stzokev commented Sep 20, 2023

I would try this shortly, but I want to remind you that "a way to access folders by entering a path on Chromecast" exists and works on PPSSPP v1.10.3. I've provided video and screenshots here: #16865 (comment). I am not aware of the underlying changes you did since v.1.11 forward, but surely something that existed and worked could be re-implemented?
The suggested workaround (if it works, I tried with different file manager before and it didn't) has a great weakness - it assumes every new person that installs PPSSPP on Android TV knows about it. Which as you might guess, would not be the case.

@hrydgard
Copy link
Owner

Yes, but since v1.10.3, we have had to update which version of Android we "target", which imposes these new restrictions on us. This is probably why it doesn't work anymore - the restriction is imposed by the OS since we have declared that we target a newer version of Android. And, we can't just "target" an old version - that blocks us from uploading on the play store, since there's now a minimum allowed OS version to target.

The suggested workaround indeed has that weakness, which is why I will try to write some code that detects the situation and tells the user what to do. I don't see another way, due to Google's massive f**k-up - no other word for it.

@stzokev
Copy link

stzokev commented Sep 20, 2023

Yes, it's Google to blame on this one, no question about it. But if it is the target version that breaks entering the path, how does it work for Retroarch? Would it be easy for you to create a test build v1.10.3 with the new "target" so we can test whether this indeed breaks it?
I did try your workaround and it works. It is even simpler than going through Load... button every time. The File Manager+ has file association and if you navigate to your PSP games and click on them, it directly opens them in PPSSPP.

@stzokev
Copy link

stzokev commented Sep 20, 2023

Is Recent games being cleared up after some time if a game hasn't been launched in a month for example? Also would upgrading to newer PPSSPP versions retain the Recent list or this has to be done everytime?

@tausifj15
Copy link
Author

tausifj15 commented Sep 20, 2023 via email

@hrydgard
Copy link
Owner

hrydgard commented Sep 20, 2023

@stzokev You can make your own builds of PPSSPP - in android/build.gradle, just set targetSdkVersion to, well, I guess 28 or something instead of the current obligatory 33. That said, this might lead to other problems.

I'm not going to maintain multiple separate builds with different target version, i'm not looking to add more work to my already big burden of maintenance and testing...

Regarding how it works with RetroArch, I'm not sure - is that a play-store-installed version? If not, it might be that they use a lower target.

@stzokev
Copy link

stzokev commented Sep 20, 2023

I was not suggesting that you maintain separate builds, just wanted us to test if your guess that it is the target sdk version at fault is correct. Regarding Retroarch - I am not using their play store version because it is pretty old, but I can confirm the workaround worked on that version as well. Can you answer on the above: "Is Recent games being cleared up after some time if a game hasn't been launched in a month for example? Also would upgrading to newer PPSSPP versions retain the Recent list or this has to be done everytime?"

@hrydgard
Copy link
Owner

hrydgard commented Sep 20, 2023

I don't believe the recent list will be invalidated by an upgrade, and it certainly won't be cleared after a month. Sorry I missed answering that.

Can you explain to me how you find the path to the sd card for the retroarch workaround? I don't see it in any of the file managers.

@stzokev
Copy link

stzokev commented Sep 20, 2023

You manually add rgui_browser_directory = "/storage/F490-1404/roms" to the retroarch.cfg which is available in the RetroArch folder on Internal storage. Once this is done, when you go to Import Content -> Scan Directory, the path you entered would be available for scan and you can navigate and scan your games.
As for Recent games, unfortunately it just got cleared. I've installed your latest 1.16.2 version from yesterday and started 4-5 games with the workaround. Then exited and watched some youtube. I just started ppsspp again and recent list is empty :(

@hrydgard
Copy link
Owner

But how do you get the path F490-1404?

Hm, that's weird, I don't know what would be clearing the list. Maybe the file permissions don't last very long :(

@stzokev
Copy link

stzokev commented Sep 20, 2023

F490-1404 is the autogenerated name for the usb dongle connected to the hub i.e. the external storage. It would be a different name in your case. You can see it with a program like X-plore File Manager

@stzokev
Copy link

stzokev commented Sep 20, 2023

Is this possible to implement: once the user presses Load.. and navigates to a game, PPSSPP to "discover" if there are other games in the same folder location and offer/suggest to the user: Multiple games found in the same location, would you like to load them? It seems like a bug to me that a game is not entered into the Games list, but only to Recent list. For example I used the same workaround (it's Select a File instead of Load...) for M64Plus FZ Emulator and it adds the game to the Game Library directly. This would be the correct behavior IMHO. Offering to scan the folder from where a game is loaded would be a very nice touch.

@stzokev
Copy link

stzokev commented Sep 20, 2023

Hm, that's weird, I don't know what would be clearing the list. Maybe the file permissions don't last very long :(

Chromecast restart also does NOT persist the recent list. In M64Plus FZ Emulator however, both games and recent are persisted.

@unknownbrackets
Copy link
Collaborator

If you want behavior related to folders, there's an ini setting to make the folder view the default. You can pin folders there and the experience can be very similar to recent if you keep all your games in a folder. You can use subfolders to categorize them.

There's also a button from that tab to open a folder. Basically to do everything you requested for the Recent tab to do. Why change the recent tab into the Games tab when the Games tab already exists?

Personally I find folder "scanning" to be a very weird misfeature of many emulators. It's a behavior I've only seen in certain emulators and music players. To me it seems far more natural, and I would imagine for most people who haven't used some other messy-to-use emulator, to simply open a folder. The normal way - you know, how every other app works. I guess that's less exciting than making you go into some corner of settings to open a different folder, and calling opening a folder "scanning" it. Sounds like it's doing neato emulation stuff. Plus we wouldn't get to reinvent categorization and file organization if we just used the operating system's built in way. So boring.

As for settings getting lost, what's likely happening is this:

  • PPSSPP keeps a history of the last N games you played, without time limit, in an ini file.
  • On startup, PPSSPP checks if it can still access those game files. If it has lost access, it removes them from the list (this is intended to remove deleted games from the list.)
  • Android, to protect your privacy, automatically revokes access to files periodically. So if you granted PPSSPP access to a file on 2023-09-01, and then it's 2023-10-01, Android will remove access to protect you from nefarious apps that steal your information in the background after a seemingly innocent file request.
  • It's possible that some devices, such as Chromecast, may not even persist access grants between restarts.

Possibly we should just not remove items from the recent list and instead show an error or permissions prompt if you try to access them. Which is a bit unfortunate.

Keeping to the Games tab instead on such devices is probably much simpler, although I think the current folder and pinned folders are also forgotten if they are not accessible on startup.

-[Unknown]

@stzokev
Copy link

stzokev commented Sep 23, 2023

If you want behavior related to folders, there's an ini setting to make the folder view the default. You can pin folders there and the experience can be very similar to recent if you keep all your games in a folder. You can use subfolders to categorize them.

There's also a button from that tab to open a folder. Basically to do everything you requested for the Recent tab to do. Why change the recent tab into the Games tab when the Games tab already exists?

Thanks for your feedback, unfortunately I do not think I understand this part specifically. And let me say that all of my comments are just ideas and thoughts on what I think could be a better user experience. Of course you guys as devs have your view on how the app should look and behave and that is not a bad thing at all. Quite on the contrary I like how the app looks and behaves in normal environment when things work, it is unfortunately Google have chosen to impose those limitations for these kind of devices. When I initially hijacked this thread I did a bit of reading and I really thought that just having a way to manually set the path to the Games folder would be enough. Since then I did a bit of more reading and discussing with other helpful people and I think I was too optimistic. As I understand things now (might still be wrong), SAF is not just a way to file/folder pick. It's the thing that grants you the permissions to read those files in the first place. That is why I believe navigating to the correct path does not list the games in the folder like it did with legacy permissions in 1.10.3, because it wouldn't give the app permission to access them. Retroarch works because it still uses the legacy permissions since their app hasn't been updated since 2021 or so and their nightly builds are probably not modified to comply with the new listing requirements. As for M64Plus FZ Emulator, adding games to Library when picked 1 by 1 is a nice workaround, but even that would have its limitation for period of time and as I understand Google only allows for 128 files an app can work with before they start revoking them

@hrydgard hrydgard changed the title Mi 5a tv Android 11 doesn't ppsspp app unable to open file Mi 5a TV (Android TV 11) unable to open files with PPSSPP Oct 26, 2023
@Joai27373
Copy link

O que acontece?

Ppsspp não está reconhecendo jogos no mi tv 5a Android 11 por favor me ajudem, tentei com pen drive também e armazenamento interno

O que deveria acontecer?

O que você está usando?

Uma marca de smart tv mi 5a tv versão 2022

Qual hardware/dispositivo e sistema operacional?

Mali g31 Mp2 Android 11

Qual placa gráfica (GPU) ou modelo de celular?

É uma smart tv

ola estou com um problema na mi stick 4k ela está dando erro na hora de decidir escolher manualmente o armazenamento e não tá reconhecendo os jogos no pendrive. isso porque tô usando a versão nativa do app baixado da playstore.

@Joai27373
Copy link

Joai27373 commented Dec 10, 2023

usando a versão 1.10.3 não tem mas o erro porém ainda não lê os jogos na mi stick ele reconhece o pendrive mas o jogo não aparece, o jogo está no formato .iso

TRANSLATION:

using version 1.10.3 there is no error but it still doesn't read the games on the mi stick it recognizes the pendrive but the game doesn't appear, the game is in .iso format

@hispanico957
Copy link

hispanico957 commented Jan 9, 2024

For my experience this problem is related on version of Android, Others emu as Dolphin show same problem.
For your infromation i think that the problem it concerns the use of the Android file explorer which does not allow (privacy) reading from USB sticks or external disks. 
From the tests I have done, this does not happen for example with RetroArch emu which in fact does not use the Android explorer but its own explorer to search for the path of the games and this problem does not arise.

I try also this little trick
https://www.aftvnews.com/how-to-grant-allow-all-the-time-full-file-storage-access-permission-for-any-app-in-fire-os-8-on-the-2nd-gen-fire-tv-stick-4k-4k-max/
but not solve

Kira

@davidhedlund
Copy link

davidhedlund commented Feb 5, 2024

@stzokev

I am currently using PPSSPP on CWGTV (Chromecast with Google TV) which is Android 12 and I am using v.1.10.3 successfully. All I do is enter the path to the SD card manually and done!

That is partially working for me on Chromecast with Google TV (HD). The directories are displayed in the USB flash drive which is great, but the games are not listed.

@stzokev
Copy link

stzokev commented Feb 5, 2024

@davidhedlund Not sure what is different on your end, except the fact that I use the 4k version of Chromecast. Anyway I no longer use the old version because the newer versions offer better performance. Yes, you cannot see the games in PPSSPP, but you can navigate to your roms via file manager in the USB flash drive and when you select a rom it would open directly in PPSSPP (there is Intent class registered). So yeah, not the best experience, but does it work - yes

@davidhedlund
Copy link

@davidhedlund Not sure what is different on your end, except the fact that I use the 4k version of Chromecast. Anyway I no longer use the old version because the newer versions offer better performance. Yes, you cannot see the games in PPSSPP, but you can navigate to your roms via file manager in the USB flash drive and when you select a rom it would open directly in PPSSPP (there is Intent class registered). So yeah, not the best experience, but does it work - yes

I'm glad that it works for you, but the roms (the .iso files) are not listed for me.

@stzokev
Copy link

stzokev commented Feb 9, 2024

@davidhedlund I think you misunderstood my explanation. They are not listed in the last version of PPSSPP for me either. The workaround I use is start the games from file manager directly, I am using X-plore. Try it you would see it works.

@sum2012
Copy link
Collaborator

sum2012 commented Feb 10, 2024

Just fyi ( Original reporter in http://c.tieba.baidu.com/p/8880500610 10 th /floor )
Android TV (海信电视) error
2

@davidhedlund
Copy link

@davidhedlund I think you misunderstood my explanation. They are not listed in the last version of PPSSPP for me either. The workaround I use is start the games from file manager directly, I am using X-plore. Try it you would see it works.

Ah, that works. I can play PSP games from PPSSPP now! Thank you very much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Platform-specific (Android) Scoped Storage Related to scoped storage on Android
Projects
None yet
Development

No branches or pull requests

8 participants