Your favorite Apple, iPhone, iPad, iOS, Jailbreak, and Cydia site.
05-23-2014, 08:59 AM #1Possible to fool an app to save/load progress data into non-default location?
I am wondering if it's possible to make an app save/load its save files in a location other than the default one (i.e. App name/Documents).
I have three games whose save files are compatible with each other. In other words, the three games are portions of what would otherwise be one big game, but divided into three separate apps. The save file itself is readable and writable by any of the three games without overwriting the progress from the other games. I confirmed this by moving the save file from the save location of one app to the other ones and vice versa.
If this is not clear, think of it this way. App A contains stages 1, 2 and 3 of a game, App B contains stages 4, 5 and 6 and App C contains stages 7, 8 and 9. The stages are independent of each other. When you run App A, you only see stages 1, 2 and 3, and it saves into its save file with respect to those stages. But the save file itself actually contains data on the rest of the stages, so that when you take the file that was just made by App A and move it to App B directory, App B will read and write progress data of stages 4, 5 and 6 without affecting stages 1, 2 and 3 progress data that's on the save file.
I hope this makes sense.
Now, onto what I want to do. What I am trying to do is to avoid this manual process of moving the save file every time I play one game and then play another game. I want to be able to play one game, let it save, quit, and then play another game. Instead of each of Apps A, B and C making its own save (each of which will contain progress data for only the respective games), I want them to save and load into and from one common location, so that I will have a single save file that contains progress data from all three games.
I just tried creating a symbolic link using the original save data directory name, but the App didn't recognize that as a valid location.
Is there a more advanced method or some kind of way to achieve this?
Thanks for reading such a long-winded question. Much appreciated.
Last edited by tonkoris; 05-23-2014 at 09:13 AM.
05-25-2014, 05:30 AM #2
WOW, almost 300 views in 2 days and no reply!
By the time this post is approved by a mod it will be over 300.
There are at least a handful of people that know the answer.
OK, you were on the right path with symlinks, but you have to watch out for owner/group ownership and read/write permission. That's where you went wrong.
Creating symlinks with iFile is the easiest way, however you are the "root" user when working with iFile ("root" user has full file system access), therefore your symlinks, newly created directories copied file etc all will have "root" ownership!
You have to create a new directory in, lets say, /var/mobile/Documents, and call it Games, then copy your games data file into /var/mobile/Documents/Games.
Check with iFile what ownership and read/write permission the original app/Documents folder/files have (back them up to be save).
Now delete all appA, appB and appC Documents folders.
Next copy the /var/mobile/Documents/Games folder AFTER you set the same ownership and read/write permissions for the Games folder as you had for the original app/Documents folders.
Then use iFile's "Create Link" option to create a symlink in the games's app folder, rename the Games folder to Documents and check the ownership and read/write permissions again.
Do that for all 3 game apps.
Now all 3 games should be able to read and write to just one file in one folder.
@ Simon NOT double account, just a new account as the previous ones are dead, hence new user without any other active account.
05-26-2014, 07:53 PM #3
Thank you so much for helping out. I really appreciate it. But there are parts of your instructions that I don't understand.
05-27-2014, 02:16 AM #4
I will explain it in a bit more detail from the step where you created the new /var/mobile/Documents/Games folder with the games data file in that folder.
You set the ownership of that /var/mobile/Documents/Games folder and the included games data file, just enable the "Apply hierarchically" in iFile when you change the ownership of the Games folder, which will then also apply the ownership and permissions you set for the Games folder to the games data file inside that Games folder.
OK, ownership is "mobile" for owner and group and permission is read/write/execute (can't go wrong with this setting) for all 3 (owner, group and world).
Next go to /var/mobile/Documents and copy the Games folder. Then go to Game A into the Game A app folder (where the Documents folder was before you deleted that one), here you "Create Link" so that you now have Game A app folder/Games/game data file. Because the Game A will look in its Documents folder for the games data file you need to rename the symlinked Games folder (game A appfolder/Games) into Documents, so that you again have a Game A app folder/Documents/game data folder.
Now, because you created a symlink with iFile symlink as "root", you need to check the ownership/permission of that symlink (now it is Game A app folder/Documents/games data file), it might have the right ownership/permission or it might not in which case you have to change it to "mobile" and read/write/execute.
So, basically you have a /var/mobile/Documents/Games folder with a games data file in it that has owner/group "mobile" with read/write/execute permission for owner, group and world.
You also have now a Game A app folder/Documents folder with a games data file in it, but this Documents folder is a symlink to /var/mobile/Documents/Games.
Do you see the logic in this?
Now you have to do the same for Game B and Game C.
Copy the /var/mobile/Documents/Games folder, "Create Link" in Game B/C app folder, remane the symlinked Games folder into Documents so you have Game B/C app folder/Documents with the game data file in it.
I agree that it is not easy to understand the first time you are doing this and you have to read it a few times to see the logic in it. It took me a while to do a similar thing where some independent webclip tweaks use one database, but each webclip tweak creates/reads its own database folder and only by using symlinks was I able to make sure that all the webclip tweaks were using just one and the same database.
If you still get stuck or have any question, please ask. I try to help as much as I can.
The Following User Says Thank You to WhatDoIknow For This Useful Post: