Tutorial Ren'Py Completed Ren’Py 8.5.2: Easier Mods, Saves, and External File Access

LizexF

New Member
Jun 9, 2021
2
0
102
Hey everyone, I made some important changes to the PythonSDLActivity.java file in Ren’Py 8.5.2 that improve file management, mod compatibility, and save persistence, keeping everything seamless for the user, along with a few other small improvements. Here’s what’s new:

⚠ Note: To apply these changes, you need to replace the file located at
rapt/prototype/renpyandroid/src/main/java/org/renpy/android/PythonSDLActivity.java
and add the MANAGE_EXTERNAL_STORAGE permission in your AndroidManifest.xml.

1 - Changed the game’s default storage location
Previously, all game files were stored in the private folder (Android/data/<package_name>/files), which limited external access and meant everything would be deleted when the app was uninstalled.
Now, the game automatically creates a folder inside the Documents directory (Documents/<package_name>), with two subfolders:

• saves → for save files

• game → for .rpy, .rpyc, .rpa files, and game content like movies, images, videos, etc.


2 - MANAGE_EXTERNAL_STORAGE permission (Scoped Storage / Full File Access)
This permission is needed for the game to use the public Documents folder and for users to add mods or other files to the game folder.

• When the game starts, it checks if the permission has been granted.

• If yes, the game runs normally.

• If not, the user is automatically directed to the Android settings screen to grant it, and the game continues normally after returning.

• If the user chooses not to grant the permission, the game will still work using the default private folder, so nothing breaks.
Note: this permission is only used to access/manage files in the public game folder and nothing else.


3 - Automatic folder creation
When the game starts, it checks if the folder structure exists, and creates it automatically if it doesn’t. This ensures each game has its own separate folder, preventing file mix-ups or potential bugs between different games.


4 - Logs and information files
The game generates .txt log files in the root of the game folder (Documents or private), recording device info, permissions, and file paths. This helps with debugging and lets users know exactly where everything is stored.


5 - Mod and large APK compatibility
The game folder now allows users to manually add .rpy, .rpyc, and .rpa files. This helps bypass the 2GB APK limit in Ren’Py and makes it easier to use mods.


Summary
These changes make the game’s file management more flexible, transparent, and persistent, keeping the MANAGE_EXTERNAL_STORAGE permission optional so the game continues to work even without it.