RetroArch icon indicating copy to clipboard operation
RetroArch copied to clipboard

AppleTV files emptied

Open ghost opened this issue 1 year ago • 6 comments

Turned off my AppleTV for the evening & found that after turning it back on & opening RetroArch, my downloads folder was completely empty as if the app has cleared itself

ghost avatar May 19 '24 00:05 ghost

Yeah, that's just part of what tvOS does, unfortunately.

hizzlekizzle avatar May 19 '24 01:05 hizzlekizzle

Thanks for the response. Also spoke to someone about it on Discord. Shitty limitation we have on the AppleTV, I suppose I'll just stick to my Batocera PC setup for now until I can get it to run properly on the MacBook.

HCat86 avatar May 20 '24 13:05 HCat86

Dear Team, firstly, thank you so much for this work. It's awesome.

Off the back of this, I've created script to backup and even two-way sync file. Hopefully helpful to some: https://github.com/blaz0r/AppleTV-RetroArch-Sync

blaz0r avatar Jan 02 '25 14:01 blaz0r

Another idea is cloud kit. This would be my vote for a “sanctioned” way to solve this problem

https://developer.apple.com/library/archive/documentation/General/Conceptual/AppleTV_PG/iCloudStorage.html

mlfarrell avatar Jan 19 '25 23:01 mlfarrell

I have been poking around at exactly how to solve this problem for a long time, and CloudKit runs into the same three problems that all network access does:

  1. Can't always download just one file
  2. Can't use standard Unix paths/C file system calls
  3. Can't sync everything

(There's actually a fourth problem that CloudKit would avoid, which is "don't accidentally become a piracy tool". It's why loading content files directly over HTTP or adding URLs to playlists is nearly a non-starter.)

  1. Can't always download just one file

One example would be disc images in bin/cue format, and downloading just one of them doesn't work; all of the relevant files need to be downloaded. For some cores like DOSBox, it's really hard to know which files are going to be needed ahead of time, without just running the core. Which brings us to....

  1. Can't use standard Unix paths/C file system calls

In order to access the files on iCloud, the CloudKit APIs must be used. However, not every core uses the libretro vfs that the frontend provides; there are some that when they are compiled for Apple devices will assume that means they can use standard file system calls, and for the most part they're right, until the files start being served over CloudKit.

So if we might need any and all of the files and we can't know which files we'll need, we could just download all the files?

  1. Can't sync everything

Although there are probably many users whose libraries are small enough that this isn't a concern, it doesn't take much to make this a worrying proposition. Each of my PS1 chd files is about 300MB. Downloading gigs of data every time the OS decides to delete it is not a polite thing to do.

There's actually a fourth problem on tvOS, which is that CloudKit does not have access to iCloud Drive; it only has access to the application storage area, which is not really a file system in the traditional sense. This isn't typically a problem for small files or relatively small amounts of data, but it's not really designed to be used as a store for huge amounts of data in large files. It's something that could perhaps reasonably be tuned if the other issues didn't make it so challenging.

warmenhoven avatar Jan 20 '25 05:01 warmenhoven

I appreciate all the effort you put in this.

Was fun to be able to try it off the AppleTV for the time, though!

Thank you!

HCat86 avatar Jan 20 '25 21:01 HCat86