Lime-3DS-Emulator icon indicating copy to clipboard operation
Lime-3DS-Emulator copied to clipboard

Install data in android/data/lime3ds

Open CristobalManga opened this issue 1 year ago • 3 comments
trafficstars

Is there an existing issue for this?

  • [X] I have searched the existing issues

What feature are you suggesting?

On many Android devices, the internal directory is limited. For example, moving a large number of files, be they photographs, etc., takes a long time.

When installing texture packs in internal memory, reading them is slow.

But for some reason, if the files are in android/data, these files have a fast read.

Why would this feature be useful?

For faster reading of the texture packs. Or maybe the cache, I don't know.

CristobalManga avatar Apr 19 '24 01:04 CristobalManga

Do you have any evidence you can cite for this actually providing a speed improvement? I can't think of any reason why it would

OpenSauce04 avatar Apr 19 '24 08:04 OpenSauce04

Since internal memory is generally limited, any application is affected. So, let me give an example using the games I'm playing right now. The first one is Half-Life, using the XASH application. This game has almost 2000 files, and the game loading time is extremely slow.

PIXEL 2

https://github.com/Lime3DS/Lime3DS/assets/78171867/baa183b4-849a-4911-b76b-c9e6b420739f

https://github.com/Lime3DS/Lime3DS/assets/78171867/77ac6bf1-22eb-4dbb-a39a-a07b3e6becf8

LG G8

https://github.com/Lime3DS/Lime3DS/assets/78171867/3ed2c8e9-1c12-4770-9dfb-54a9f4a8023e

https://github.com/Lime3DS/Lime3DS/assets/78171867/21e90964-eb0e-4ddf-a531-69e56a1639e0

From the file path selector, I can't select android/data because Android restricts access to that directory. That's why I manually write the path. But why does it work? Android allows access to android/data/app, but only if it's the same app trying to access that path. That's why the game only works in the android/data/hl directory.

The Half-Life setup was done on a Pixel 2 running Android 11, while the Quake 4 one was on an LG G8 also running Android 11. However, I can tell you that my LG G8 originally had Android 13, but I downgraded it to Android 11, thinking the issue was with the software. So, it seems to be a problem with future versions of Android as well.

In emulators, almost all of them encounter issues. For example, in PPSSPP, texture packs run slowly or experience a lot of flickering when stored in internal memory. However, when stored in android/data/ppsspp, there are no stutters. It's worth noting that this limitation of internal memory has been discussed on the PPSSPP GitHub. For some reason, this issue hasn't been as widely discussed in other emulators.

I remember reading in the Android documentation that this happens because Android encrypts all files in internal storage. However, it doesn't do the same with files in android/data. Just imagine if games like Mobile Legends were slow to read files in android/data, it would be a disadvantage for Android.

CristobalManga avatar Apr 21 '24 03:04 CristobalManga

So, what should be done? Well, it's like what PPSSPP does: choose to install the data in android/data or in the path of your choice, whether it's microSD or internal memory. But keep in mind that it will run slower in that path.

And for the future, adding the functionality for Lemon3DS to select files and move them to the path android/data/lemon3DS could be considered. Since Android is increasingly restricting access to that path for all file explorers, only the application itself will be able to access its path.

And that way, users could install their cheats or mods. Another functionality is to read texture packs in zip files, just like PPSSPP does. Moving 4000 images to that path is slow, really slow; it can even take hours. But when they're in a single file, the transfer is fast. Additionally, with Citra reading texture packs in zip files, people wouldn't need to unzip anything.

CristobalManga avatar Apr 21 '24 03:04 CristobalManga