Tool Ren'Py Alternative/ Second save location for RenPy 7.8.2 / 8.3.2 SDK in Android Ports

LightmanP

Well-Known Member
Modder
Game Developer
Oct 5, 2020
1,739
16,364
Is there a way to make it so that declining file permission doesn't close the app and just doesn't use the second location?
 

Wills747

Engaged Member
Dec 14, 2018
2,446
5,138
Is there a way to make it so that declining file permission doesn't close the app and just doesn't use the second location?
It currently shouldn't quit but will try and use the internal /data/ folder.
Going forward I'll try and make the app quit.
I'm also going to make a work around for Android 11 as it looks like I can't create top level folders. Only happens in Android 11, Android 10 and 12 are fine? Not sure when this changed but I can replicate it in Android studio emulator.
Anyways, long story short I'll be using /Documents/RenPy_Saves and moving(if exists) current game save folders to the new location.
Bit of a barstard but hopefully it ensures compatibility with any new Android releases in the future.
I'll start working on an update on the next few days.
 
  • Like
Reactions: LightmanP

KoGa3

Engaged Member
Modder
Donor
Aug 14, 2018
3,153
33,683
Found this post here by accident. I always wanted to integrate this function into my mod ports too, but my "coding skills" were far from sufficient to do so. Will definitely try it out, thanks a lot for this!
 
  • Like
Reactions: Wills747

nillamello

Member
Game Developer
Oct 11, 2018
198
602
Hi Wills, two things:
First, this is awesome; thank you so much for making this public!

Second, I've only just used your code for a version update and most people (myself included) are having no trouble at all, but some are experiencing the game crashing after the permission request (regardless of the choice made).

From the reports, it seems to be impacting some players on Android 11, but not all. I used the 7.4.10 ready-made install to make the apk. Do you have any ideas?
 

Wills747

Engaged Member
Dec 14, 2018
2,446
5,138
Hi Wills, two things:
First, this is awesome; thank you so much for making this public!

Second, I've only just used your code for a version update and most people (myself included) are having no trouble at all, but some are experiencing the game crashing after the permission request (regardless of the choice made).

From the reports, it seems to be impacting some players on Android 11, but not all. I used the 7.4.10 ready-made install to make the apk. Do you have any ideas?
First thing I would try is the 7.5.0.242n nightly I have posted, there's a number of fixes in there for Android and I've found it quite stable.
Just remember to copy your old keys from rapt.
And use the quick fix I posted - takes out some excess libs not needed in Android reducing the size by about 50Mb.
Can they provide a traceback.txt? It will be in the /android/data/com.game.name folder.
 

nillamello

Member
Game Developer
Oct 11, 2018
198
602
First thing I would try is the 7.5.0.242n nightly I have posted, there's a number of fixes in there for Android and I've found it quite stable.
Just remember to copy your old keys from rapt.
And use the quick fix I posted - takes out some excess libs not needed in Android reducing the size by about 50Mb.
Can they provide a traceback.txt? It will be in the /android/data/com.game.name folder.
So I managed to find a phone in the house with the proper android version to crash, so yay. The traceback from renpy 7.4.10 is:

You don't have permission to view the spoiler content. Log in or register now.
(this is after granting permission, and I did check to make sure that permissions were still granted)

I tried the nightly as you mentioned and it initially crashed as well (installed as an update to the previous), but when I checked the traceback, it was giving an error that the temp folder wasn't empty:

Full traceback:
File "renpy/bootstrap.py", line 331, in bootstrap
File "renpy/main.py", line 446, in main
File "renpy/main.py", line 364, in android_searchpath
OSError: [Errno 39] Directory not empty: '/storage/emulated/0/Android/data/com.domain.rewind/files/../../../../Documents/RenPy_Saves/com.domain.rewind/temp'

Deleting the temp folder and restarting the game fixed the crash and the saves are working properly.

I'm sending this build over to a few people who had the problem with the 7.4.10 version and hopefully they'll report success.
 

Wills747

Engaged Member
Dec 14, 2018
2,446
5,138
Any idea what was in the temp folder before you deleted it? I might look at ignoring that error tonight/over the weekend if it's possible.
 

Wills747

Engaged Member
Dec 14, 2018
2,446
5,138
Also, is that phone you had the crash on a Samsung? I've seen something similar on newer Android 11 and 12 on Samsung.
 

nillamello

Member
Game Developer
Oct 11, 2018
198
602
Also, is that phone you had the crash on a Samsung? I've seen something similar on newer Android 11 and 12 on Samsung.
The temp folder had save files. Seemed to be a total duplicate of the other folders, honestly. I don't recall if it was all of them, but nothing was missing when I deleted it.

Phone was indeed a Samsung s21.
 

Wills747

Engaged Member
Dec 14, 2018
2,446
5,138
The temp folder had save files. Seemed to be a total duplicate of the other folders, honestly. I don't recall if it was all of them, but nothing was missing when I deleted it.

Phone was indeed a Samsung s21.
Were you using Dual Save locations for your game as some point?
From what I can work out the initial 7.4.10 crash *appears* to be caused by the script trying to import from both stock and the old alternative locations.
The second nightly crash is likely caused by debris left over from the first one.
 

Arthas Menethil

Well-Known Member
Apr 7, 2019
1,174
785
There won't be a way for the files to be saved in the game/files/saves subfolder of the main game folder.
 

Wills747

Engaged Member
Dec 14, 2018
2,446
5,138
There won't be a way for the files to be saved in the game/files/saves subfolder of the main game folder.
Main game folder, as in "/data/data/user/0/com.game.name"? I have managed to use this space but it's not available to other apps unless you have root.
 

Arthas Menethil

Well-Known Member
Apr 7, 2019
1,174
785
I am asking if you can modify renpy.py , log.py , savelocation.py and main.py files.

So that when you save a game game it will be saved in this address for example ../../../../../Documents/RenPy_Saves/X/Games/Saves

X Game Name
 
Last edited:

Wills747

Engaged Member
Dec 14, 2018
2,446
5,138
I am asking if you can modify renpy.py , log.py , savelocation.py and main.py files.

So that when you save a game game it will be saved in this address for example ../../../../../Documents/RenPy_Saves/X/Games/Saves

X Game Name
Oh, yes that's quite possible. Not sure if there would be conflicts using game/saves folder though and if the game has been released already you would also need to write in script to move saves from existing location.