I’ve been playing a bit of Terraria on Android; extremely addictive and good fun. I was using the cloud-save functionality that backs up your game saves to Google Drive, and thought I’d be able to use this to sync between devices – I had to send my Galaxy Note 4 back for repair, so reverted to my old (smashed!) HTC One X; fired up Terraria only to find no cloud saves were found.. here’s how to get them back!
Rescuing Missing Cloud Saves
A bit of digging about in my Google Drive (not much digging really) showed up a new Terraria folder each new device I tried on. The Terraria folders include the following files:
If you can download these files somewhere on your pc (I’m using Linux, so these may not work for you if you’re not; you might be able to get it working with Cygwin though) then you can decode what’s inside them, then upload these back to the data folder on your phone so you can continue playing.
Let’s assume you’ve downloaded the 2 files from Google Drive myplayer.cs and MyWorld.csworld, and you’re doing everything on the linux command line
To decode the player (.cs) file:
# base64 -d myplayer.cs > myplayer.player
To decode the world (.csworld) file:
# base64 -d MyWorld.csworld | dd bs=1c skip=4 | python -c "import sys, zlib; sys.stdout.write(zlib.decompress(sys.stdin.read()))" > MyWorld.world
They’re basically base64 encoded; for the player file, that’s it – base64 decode and we’re done.
For the cloud world files, it’s only a little more complicated – it’s base64 encoded, has a 4 byte header which we can ignore, then a stream of zlib compressed data.
Once you’ve got your 2 new files, connect your phone via USB, make sure USB debugging is on and fire up the ADB (Android Debug Bridge) to push your updated files onto your device (this may require root):
# adb push MyWorld.world /data/data/com.and.games505.TerrariaPaid/files/ # adb push myplayer.player /data/data/com.and.games505.TerrariaPaid/files/
Fire up Terraria on your phone and you should see both your player file and the world. HOWEVER we’re not done yet…
Although the world appears in the “on-device game worlds” list, it’s still a cloudsave; so open up that savegame, save once, then quit. Now open up the cloudsave menu and you should see your game save there as a valid cloudsave again! At this point you should probably remove the “on-device” version as it’s not really a valid save (it’s because internally that file is a cloud save format, and I haven’t bothered to look into the differences!).
Fixing Broken Cloud Saves
One thing I noticed about the cloud saves was that occasionally they can get corrupted; rather than completely abandoning your progress, you can go to your Google Drive (only seems to work in desktop browser), find the save files then manage file Versions – this should then allow you to revert to a version you know worked; admittedly you’ll lose a little progress, but nowhere near as much as starting again!
Backing up your game saves
You can pull your working game saves from your phone too:
# adb pull /data/data/com.and.games505.TerrariaPaid/files/MyWorld.world # adb pull /data/data/com.and.games505.TerrariaPaid/files/myplayer.player
This will allow you to back them up somewhere safe, or even copy them to another device!