ThexXTURBOXx / CookieClickerMobileWiki

The Cookie Clicker Mobile Wiki
http://nmexis.me/CookieClickerMobileWiki/
7 stars 4 forks source link

Restoring the backup doesn't do anything in the game #5

Closed SolsticeSpectrum closed 8 months ago

SolsticeSpectrum commented 8 months ago

When I try following the guide on the wiki and modify the json to add some heavenly chips for example and then restore the backup, it has no effect. I run the game afterwards and nothing changed. I also tried disabling wifi in case it somehow pulls data from server as a sort of cheating counter measure.

ThexXTURBOXx commented 8 months ago

This is a known issue - it is related to adb backup and adb restore being deprecated. On some devices, they are sort of "disabled". I have noticed this already years ago with a few Samsung devices, but even Huawei and Xiaomi are also already affected by this. There is sadly not much you can do about it - except trying out other backup solutions.

SolsticeSpectrum commented 8 months ago

@ThexXTURBOXx Editting alpha save is however much easier. You just export the save, run it through base64 decoder, modify it and encode it back to base64 and import it back.

ThexXTURBOXx commented 8 months ago

Yes, but that has become an option only a few patches ago. The wiki documented the procedure one had to go through when this was not possible yet. Nowadays, yes, the export save feature is very simple to use

SolsticeSpectrum commented 8 months ago

@ThexXTURBOXx what would be the other backup solutions?

ThexXTURBOXx commented 8 months ago

See here: https://nmexis.me/CookieClickerMobileWiki/saveediting

Also, I have noticed a few people saying that apparently Google Drive automatically has a backup in some cases

SolsticeSpectrum commented 8 months ago

Btw just to clarify since I'm reading on the internet that for people who don't have adb backup available, it doesn't open any dialog. For me on Huawei it does open the dialog and it kinda works. But after confirming restore in the dialog. The app isn't affected. Aka it seems that adb backup is only partially functional on my device. I can backup but I can't restore even tho the dialog for restore does open and it does say: Restoring...

I'll try Hellium, I hope it doesn't require root

SolsticeSpectrum commented 8 months ago

@ThexXTURBOXx Helium does work somehow even tho it essentially uses adb backup/restore. Only if I do it through PC, I can only backup but not restore. If I do adb restore manually the same prompt appears but it doesn't work. For Helium it works tho.

SolsticeSpectrum commented 8 months ago

@ThexXTURBOXx Okay I found the issue. adb restore does work at least on my device. I tried just backing up, spending cookies and restoring. No extracting. And it works like a charm. So the issue must be in the way I pack the files back to backup file. These are the commands I do

adb backup org.dashnet.cookieclicker
java -jar abe-all.jar unpack backup.ab backup.tar
tar -xvf backup.tar

Now left with apps folder I modify the save file nano apps/org.dashnet.cookieclicker/f/CookieClickerSave.txt And then I restore using these commands

tar -cvf backup.tar apps/
java -jar abe-all.jar pack backup.tar backup.ab
adb restore backup.ab

Maybe the tar command is wrong? Or there's something wrong with abe-all.jar. The thing is that the dialog doesn't throw any errors, that's why I thought it just doesn't work. Helium can detect failure and does say that the operation failed.

SolsticeSpectrum commented 8 months ago

I also tried hex editing the ab file with running backup with -nocompress first but that also breaks it. Even tho I changed only single number which should technically work. Basically if I try to edit the backup file, the restore will fail.

SolsticeSpectrum commented 8 months ago

@ThexXTURBOXx Okay I managed to hex edit the file. It turns out the save file data is in the backup file multiple times. I had to edit the number for each iteration in the file, after restoring I finally successfully modified the number of cookies. So to round things up. Somewhere in the process of unpacking the files and packing them back, the backup file gets corrupted and breaks. Only hex editing is viable but I obviously can't change length of any value unless I modify the headers too.

ThexXTURBOXx commented 8 months ago

Ah, now I see your mistake. The backup file is considered invalid if you are modifying the order of the files within the tar. Only with a specific order it is still valid, which my CookieClickerMobileToolbox tries to achieve. Maybe it broke at some point, but when I coded and tried it some time ago, it worked fine. This is most likely the issue here

SolsticeSpectrum commented 8 months ago

@ThexXTURBOXx I haven't tried the toolbox and I had no idea that the tar has to keep specific order. That's kinda dumb but whatever. I'll try your toolbox next.

ThexXTURBOXx commented 8 months ago

Just to let you know: I have added further instructions for newer versions from v7.2 on to the Wiki and marked the old instructions as such. Now, the save editing page should be up-to-date again. I have also noted that the Cookie Clicker Mobile Toolbox works on some devices, but not on others.