jpd002 / Play-

Play! - PlayStation2 Emulator
http://purei.org
Other
2.04k stars 248 forks source link

Play! Doesn't read the SD Card on android #850

Closed saintbepis closed 4 years ago

Dragon20C commented 4 years ago

it should, works on my device make sure the sd card is formatted correctly

saintbepis commented 4 years ago

It is, all of my other emulators recognize my SD card but for some reason this one doesn't

iamtuck3r commented 4 years ago

Which Android version are you running? Mine's doing the same thing on a Galaxy Tab S6 running v9. The SD card is a 128GB SanDisk and it was formatted by the tablet itself. Gave the application Read/Write permissions in settings and it just doesn't recognize the SD card.

saintbepis commented 4 years ago

Which Android version are you running? Mine's doing the same thing on a Galaxy Tab S6 running v9. The SD card is a 128GB SanDisk and it was formatted by the tablet itself. Gave the application Read/Write permissions in settings and it just doesn't recognize the SD card.

I'm running a samsung galaxy 9+ with android 10 (snapdragon variant) and a 256 Samsung sd card

iamtuck3r commented 4 years ago

Just to make sure that was the issue I transferred an .iso to my local downloads folder and it appeared immediately so local is fine as a work-around but I don't want to suck up too much space on the tablet and have about 80-90GB of ROMS on the SD card.

jpd002 commented 4 years ago

If any of you have the Android SDK, could you run adb shell mount and show us the output?

iamtuck3r commented 4 years ago

I'll see what I can come up with. Not very experienced with the dev kit but I'll give it a whirl and see what I can get for you.

iamtuck3r commented 4 years ago

Not sure if this is exactly what you were looking for? I downloaded the ADB Platform Tools and ran the command after trying fruitlessly through the SDK.

C:\Windows\AdbPlatformTools>adb shell mount /dev/root on / type ext4 (ro,seclabel,relatime,block_validity,discard,delalloc,barrier,user_xattr,acl,i_version) tmpfs on /dev type tmpfs (rw,seclabel,nosuid,relatime,size=2611388k,nr_inodes=652847,mode=755) devpts on /dev/pts type devpts (rw,seclabel,relatime,mode=600,ptmxmode=000) proc on /proc type proc (rw,relatime,gid=3009,hidepid=2) sysfs on /sys type sysfs (rw,seclabel,relatime) selinuxfs on /sys/fs/selinux type selinuxfs (rw,relatime) tmpfs on /mnt type tmpfs (rw,seclabel,nosuid,nodev,noexec,relatime,size=2611388k,nr_inodes=652847,mode=755,gid=1000) /dev/block/dm-1 on /product type ext4 (ro,seclabel,relatime,block_validity,discard,delalloc,barrier,user_xattr,acl,i_version) /dev/block/dm-2 on /vendor type ext4 (ro,seclabel,relatime,block_validity,discard,delalloc,barrier,user_xattr,acl,i_version) none on /dev/memcg type cgroup (rw,relatime,memory) none on /acct type cgroup (rw,nosuid,nodev,noexec,relatime,cpuacct) debugfs on /sys/kernel/debug type debugfs (rw,seclabel,relatime) none on /dev/stune type cgroup (rw,nosuid,nodev,noexec,relatime,schedtune) none on /config type configfs (rw,nosuid,nodev,noexec,relatime) tmpfs on /mnt/secure type tmpfs (rw,seclabel,relatime,size=2611388k,nr_inodes=652847,mode=700) tmpfs on /mnt/secure/asec type tmpfs (rw,seclabel,relatime,size=2611388k,nr_inodes=652847,mode=700) none on /dev/cpuctl type cgroup (rw,nosuid,nodev,noexec,relatime,cpu) none on /dev/cpuset type cgroup (rw,nosuid,nodev,noexec,relatime,cpuset,noprefix,release_agent=/sbin/cpuset_release_agent) cg2_bpf on /dev/cg2_bpf type cgroup2 (rw,nosuid,nodev,noexec,relatime) bpf on /sys/fs/bpf type bpf (rw,nosuid,nodev,noexec,relatime) pstore on /sys/fs/pstore type pstore (rw,seclabel,nosuid,nodev,noexec,relatime) tracefs on /sys/kernel/debug/tracing type tracefs (rw,seclabel,relatime) /dev/block/sda23 on /keydata type ext4 (rw,seclabel,nosuid,nodev,noatime,journal_checksum,noauto_da_alloc,i_version) /dev/block/sda22 on /keyrefuge type ext4 (rw,seclabel,nosuid,nodev,noatime,journal_checksum,noauto_da_alloc,i_version) /dev/block/sda27 on /cache type ext4 (rw,seclabel,nosuid,nodev,noatime,journal_checksum,noauto_da_alloc,i_version) /dev/block/sda5 on /mnt/vendor/persist type ext4 (rw,seclabel,nosuid,nodev,noatime,journal_checksum,noauto_da_alloc,i_version) /dev/block/sda18 on /vendor/dsp type ext4 (ro,seclabel,nosuid,nodev,relatime,i_version,data=ordered) /dev/block/sda6 on /mnt/vendor/efs type ext4 (rw,seclabel,nosuid,nodev,noatime,journal_checksum,noauto_da_alloc,i_version) /dev/block/sda9 on /efs type ext4 (rw,seclabel,nosuid,nodev,noatime,journal_checksum,noauto_da_alloc,i_version) /dev/block/sda16 on /vendor/firmware_mnt type vfat (ro,context=u:object_r:firmware_file:s0,relatime,gid=1000,fmask=0337,dmask=0227,codepage=437,iocharset=iso8859-1,shortname=lower,errors=remount-ro) /dev/block/sda17 on /vendor/firmware-modem type vfat (ro,context=u:object_r:firmware_file:s0,relatime,gid=1000,fmask=0337,dmask=0227,codepage=437,iocharset=iso8859-1,shortname=lower,errors=remount-ro) /dev/block/sda15 on /dqmdbg type ext4 (rw,seclabel,nosuid,nodev,noatime,journal_checksum,noauto_da_alloc,i_version) /dev/block/sda29 on /omr type ext4 (rw,seclabel,nosuid,nodev,noatime,journal_checksum,noauto_da_alloc,i_version) tmpfs on /storage type tmpfs (rw,seclabel,nosuid,nodev,noexec,relatime,size=2611388k,nr_inodes=652847,mode=755,gid=1000) /dev/block/sda30 on /data type f2fs (rw,lazytime,seclabel,nosuid,nodev,noatime,background_gc=on,discard,no_heap,user_xattr,inline_xattr,acl,inline_data,inline_dentry,extent_cache,mode=adaptive,active_logs=6,reserve_root=12800,reserve_core=10240,resuid=0,resgid=5678,usrquota,grpquota,alloc_mode=default,fsync_mode=nobarrier) none on /dev/freezer type cgroup (rw,relatime,freezer) adb on /dev/usb-ffs/adb type functionfs (rw,relatime) /data/knox/secure_fs/enc_media on /mnt/shell/enc_emulated type sdcardfs (rw,nosuid,nodev,noexec,noatime,fsuid=1000,fsgid=1000,gid=9997,multiuser,derive_gid,default_normal,reserved=20MB) /data/media on /mnt/runtime/default/emulated type sdcardfs (rw,nosuid,nodev,noexec,noatime,fsuid=1023,fsgid=1023,gid=1015,multiuser,mask=6,derive_gid,default_normal,reserved=20MB) /data/media on /storage/emulated type sdcardfs (rw,nosuid,nodev,noexec,noatime,fsuid=1023,fsgid=1023,gid=1015,multiuser,mask=6,derive_gid,default_normal,reserved=20MB) /data/media on /mnt/runtime/read/emulated type sdcardfs (rw,nosuid,nodev,noexec,noatime,fsuid=1023,fsgid=1023,gid=9997,multiuser,mask=23,derive_gid,default_normal,reserved=20MB) /data/media on /mnt/runtime/write/emulated type sdcardfs (rw,nosuid,nodev,noexec,noatime,fsuid=1023,fsgid=1023,gid=9997,multiuser,mask=7,derive_gid,default_normal,reserved=20MB) /dev/block/vold/public:179,1 on /mnt/media_rw/1C2A-62AC type sdfat (rw,nosuid,nodev,noatime,fs=exfat,uid=1023,gid=1023,fmask=0007,dmask=0007,allow_utime=0020,codepage=cp437,iocharset=iso8859-1,utf8,namecase=0,adj_req,symlink=0,bps=512,errors=remount-ro) /dev/block/vold/public:179,1 on /mnt/secure/asec type sdfat (rw,nosuid,nodev,noatime,fs=exfat,uid=1023,gid=1023,fmask=0007,dmask=0007,allow_utime=0020,codepage=cp437,iocharset=iso8859-1,utf8,namecase=0,adj_req,symlink=0,bps=512,errors=remount-ro) /mnt/media_rw/1C2A-62AC on /mnt/runtime/default/1C2A-62AC type sdcardfs (rw,nosuid,nodev,noexec,noatime,fsuid=1023,fsgid=1023,gid=1015,mask=6) /mnt/media_rw/1C2A-62AC on /storage/1C2A-62AC type sdcardfs (rw,nosuid,nodev,noexec,noatime,fsuid=1023,fsgid=1023,gid=1015,mask=6) /mnt/media_rw/1C2A-62AC on /mnt/runtime/read/1C2A-62AC type sdcardfs (rw,nosuid,nodev,noexec,noatime,fsuid=1023,fsgid=1023,gid=9997,mask=18) /mnt/media_rw/1C2A-62AC on /mnt/runtime/write/1C2A-62AC type sdcardfs (rw,nosuid,nodev,noexec,noatime,fsuid=1023,fsgid=1023,gid=9997,mask=18)

I'm very green to ADP and the SDK so I apologize if this isn't the correct output you're looking for. I went through the SDK and created a virtual device mirroring my tablet as much as possible. I created a 10GB partition and a 10GB virtual SD card. After installing the Play! app it picked up the game both on the SD card and the main storage. Maybe it's something to do with Samsung's way of mounting the SD card? I see both of us having problems are running Galaxy devices on v9+

Zer0xFF commented 4 years ago

Few things to do 1st, i assume you tried the rescan option in the settings? because the emu only does a full scan at 1st boot, then only checks directories that contains ISO, to avoid long scan time with every boot, doing that will force a full rescan again.

if you did that try this adb shell ls /storage/1C2A-62AC no need to post output, as it might contain private sdcard content (if any), but can you confirm this shows the content of your sdcard? or if it fails?

I checked, my dad's huawai phone a while back with sdcard, it worked fine, so it's likely a samaung thing.

iamtuck3r commented 4 years ago

Yeah I've tried doing just the rescan and then also completely uninstalling the app, reinstalling, then having it scan again to no avail.

Yeah it's showing two folders (no personal data, fresh SD card with nothing but ROMS on it): C:\Windows\AdbPlatformTools>adb shell ls /storage/1C2A-62AC Android ROMS ls: /storage/1C2A-62AC/.android_secure: Permission denied

I'm presuming the .android_secure is the secure storage area. ROMS and Android are the only two folders on the SD card currently

In an effort to keep things organized I placed them all in a folder structure. I'll move an .iso to the root of the SD card and see if that works.

Update: Even the root of the SD card still doesn't show up on the scan. I'm using the same .iso for all of this just to make sure troubleshooting is consistent. Is there a way to manually configure a directory?

jpd002 commented 4 years ago

@Zer0xFF could it be because of sdcardfs? We don’t seem to be checking for that in the regular expression.

https://github.com/jpd002/Play-/blob/9fe2dec624be58e9075b1c26e0affae7643041a0/Source/ui_android/java/com/virtualapplications/play/database/GameIndexer.java#L20

Zer0xFF commented 4 years ago

from what i can tell from just looking at the code, it shouldnt since we're picking the sdfat path and replacing it with the sdcardfs anyway here https://github.com/jpd002/Play-/blob/956991c07958294e69cedd123c14c7083a886ea5/Source/ui_android/java/com/virtualapplications/play/database/GameIndexer.java#L64 I know you added few exception handler, but could it still be failing accessing the secure directory?

iamtuck3r commented 4 years ago

Hey guys, might have found something that works. I think it's a Samsung thing, but I just formatted an extra 64GB SD Card I had laying around on my PC as exFAT and gave it a drive letter through disk management. I figured the tablet was doing something weird when formatting the card and that might be it. When I started the virtual device in the SDK I remember it giving me a choice to either format as removable storage or as permanent storage for the tablet. Samsung's UI doesn't ask that for some reason and just formats the card. I'm verifying with another SD card I have laying around but I think that might solve the issue as the app now read the only .iso I had on there.

Update: 64GB SD card is working. Formatted it on Windows using exFAT and gave it a drive label. The only way the ROMs don't get detected is if they are not on the root of the SD card. If they're in a folder of any sort it won't detect them.

I tried the exact same thing with the 128GB SD card and both in a folder and on the root of the SD card are not working.

iamtuck3r commented 4 years ago

Putting this in a new entry. So I found a way to have the 128GB recognized, it gets weird:

1) The card has to be formatted on the PC as exFAT and have a drive label (for transferring files) 2) The ROMs have to be on the root of the card 3) Once the tablet has the SD card inserted, nothing else can be done to it. Essentially, for me to want Play! to recognize any other ROMs, I'd have to re-perform steps 1 and 2.

Taking the SD card out, transferring another ROM, then putting it back into the tablet only results in Play! recognizing the original ROMs from the first transfer. Nothing else. Even after rescanning the issue persists. The same goes with trying to transfer ROMs from the PC to the tablet via USB.

jpd002 commented 4 years ago

Thanks for the update @iamtuck3r.

I found https://github.com/reicast/reicast-emulator/commit/91c7417c22deb1232ef328531ed39a93d398d459#diff-0dad580efc53cb81383e4853bb728ffe. Not sure this is exactly the fix, but I'll try it.

EDIT: Nevermind, we already do that. Continuing the investigation.

jpd002 commented 4 years ago

Hi again @iamtuck3r.

I've built a special version of the emulator with some logging: https://s3.us-east-2.amazonaws.com/playbuilds/75a8131b/Play-release.apk.

This will log everything that happens in the scanning process. A file named bootables.log will be available in the Play Data Files folder.

Can you run that and show us the relevant parts regarding the SD card path? Thanks!

jpd002 commented 4 years ago

So, I tried this myself on an Android emulator and I kinda have a similar result (can't find any disc images).

Here's what I get in my bootables.log:

Entering ScanBootables(path = '/storage/emulated/0', recursive = 1);
Caught an exception while trying to list directory: No such file or directory: '/storage/emulated/0'
Exiting ScanBootables(path = '/storage/emulated/0', recursive = 1);

Also, the version from 2017 in the weekly builds section on the official web site can find the disc image without problem. That version was using the Java code.

Dunno why it thinks /storage/emulated/0 doesn't exist. I was reading ghc_filesystem's code and I wonder if opendir returns ENOENT somehow? Maybe there's a bug in there?

iamtuck3r commented 4 years ago

The log file was pretty long, I created a directory on the SD card named 'PlayStation 2' but nowhere in the logs was it finding it through the search function.

This was without doing my little format trick. Let me format the SD card on my PC first, then try to recreate it the exact same way and see what happens.

iamtuck3r commented 4 years ago

Ok, the first test with a freshly formatted card showed both ISO files, one which was placed on the root of the SD card and the other in a folder called 'TESTING'. I've only included the end of the logs as the rest was internal storage.

Entering ScanBootables(path = '/storage/388F-19FD', recursive = 1); Checking '/storage/388F-19FD/System Volume Information'... is directory. Entering ScanBootables(path = '/storage/388F-19FD/System Volume Information', recursive = 1); Checking '/storage/388F-19FD/System Volume Information/WPSettings.dat'... registering... result = 0 Checking '/storage/388F-19FD/System Volume Information/IndexerVolumeGuid'... registering... result = 0 Exiting ScanBootables(path = '/storage/388F-19FD/System Volume Information', recursive = 1); Checking '/storage/388F-19FD/TESTING'... is directory. Entering ScanBootables(path = '/storage/388F-19FD/TESTING', recursive = 1); Checking '/storage/388F-19FD/TESTING/Sly Cooper and the Thievius Raccoonus (USA).iso'... registering... result = 1 Exiting ScanBootables(path = '/storage/388F-19FD/TESTING', recursive = 1); Checking '/storage/388F-19FD/Kingdom Hearts (USA).iso'... registering... result = 1 Caught an exception while trying to list directory: Permission denied: '/storage/388F-19FD/.android_secure' Exiting ScanBootables(path = '/storage/388F-19FD', recursive = 1);

With the SD card still in the tablet I transferred over another ISO to the root, and another ISO to the folder. I deleted the .log to get a fresh copy and ran a rescan in the app. This time it only scanned the SD card and output this tidbit.

Entering ScanBootables(path = '/storage/388F-19FD', recursive = 0); Checking '/storage/388F-19FD/System Volume Information'... registering... result = 0 Checking '/storage/388F-19FD/TESTING'... registering... result = 0 Checking '/storage/388F-19FD/Kingdom Hearts (USA).iso'... registering... result = 1 Caught an exception while trying to list directory: Permission denied: '/storage/388F-19FD/.android_secure' Exiting ScanBootables(path = '/storage/388F-19FD', recursive = 0); Entering ScanBootables(path = '/storage/388F-19FD/TESTING', recursive = 0); Checking '/storage/388F-19FD/TESTING/Sly Cooper and the Thievius Raccoonus (USA).iso'... registering... result = 1 Checking '/storage/388F-19FD/TESTING/Dot Hack Part 1 - Infection (USA) (En,Ja).iso'... registering...

For some reason it didn't pick up the ISO that I added to the root of the card though...

jpd002 commented 4 years ago

Thanks again for testing! I see what you are getting some exceptions from your log and I'm guessing that's what aborts the scanning process abruptly.

I saw something similar when testing on a Android emulator on my end. I've tried an alternate way of scanning the contents of the directory and it seems to fix it on my end.

Could you try it and let me know if you have any luck? Thanks!

https://s3.us-east-2.amazonaws.com/playbuilds/fe08f0bc/Play-release.apk

iamtuck3r commented 4 years ago

Well hot damn, looks like you nailed it. I transferred 2 games, one to a folder and one to the root and it recognized both! (FF7 on root, Tales of Legendia in folder)

Entering ScanBootables(path = '/storage/388F-19FD', recursive = 0); Checking '/storage/388F-19FD/System Volume Information'... registering... result = 0 Checking '/storage/388F-19FD/TESTING'... registering... result = 0 Checking '/storage/388F-19FD/Kingdom Hearts (USA).iso'... registering... result = 1 Checking '/storage/388F-19FD/.android_secure'... failed to get status: Permission denied. Checking '/storage/388F-19FD/Android'... registering... result = 0 Checking '/storage/388F-19FD/.mtp'... registering... result = 0 Checking '/storage/388F-19FD/Final Fantasy X (USA).iso'... registering... result = 1 Checking '/storage/388F-19FD/APK'... registering... result = 0 Checking '/storage/388F-19FD/Final Fantasy XII (USA).iso'... registering... result = 1 Exiting ScanBootables(path = '/storage/388F-19FD', recursive = 0); Entering ScanBootables(path = '/storage/388F-19FD/TESTING', recursive = 0); Checking '/storage/388F-19FD/TESTING/Sly Cooper and the Thievius Raccoonus (USA).iso'... registering... result = 1 Checking '/storage/388F-19FD/TESTING/Dot Hack Part 1 - Infection (USA) (En,Ja).iso'... registering... result = 1 Checking '/storage/388F-19FD/TESTING/Tales of Legendia (UNDUB).iso'... registering... result = 1 Exiting ScanBootables(path = '/storage/388F-19FD/TESTING', recursive = 0);

jpd002 commented 4 years ago

Awesome!! Thank you very much for testing again! Very appreciated!