Failure to Decompress Game Data

Afforess

The White Wizard
Joined
Jul 31, 2007
Messages
12,239
Location
Austin, Texas
I re-organized (read: rewrote) most of my changes to RevDCM source code, to make it cleaner and to move new functions to the bottom of the code, instead of scattered everywhere.

When I was re-ordering the Read/Write functions, I made sure to keep them in the same relative locations and in the same order, but despite my best efforts, I got a Failure to Decompress Game Data error when I try to open saves.

I went and commented out the pairs of Read/Write functions in CvInfos, CvCity, and CvPlayer (Those were the main files I changed with Read/Write functions), one by one, and at the end, I had commented out every single non-firaxis code in the read/write sections, but I still got a the same error.

So, my question is, are there other factors that also affect save game integrity? Are the safe delete array calls in a particular order? Are there other calls that must be in order as well?
 
and at the end, I had commented out every single non-firaxis code in the read/write sections, but I still got a the same error.

Are you very sure? If the read and write calls are all in exactly the same order, I don't see how this error can occur. One hack way to double check may be:

1. Copy CvInfos.cpp into a new file, say read.tmp, and delete all the functions except the various read() functions.
2. Copy CvInfos.cpp into another new file, say write.tmp, and delete all the functions except the write functions.
3. In write.tmp, global search and replace the write function to read.
4. Compare the two files, using winmerge or diff or whatever you want.
 
Since I hadn't asked before, just to be CERTAIN that we aren't facing a "oops" moment here... you are trying to load saves which you JUST made with the current compile, right? (ie - open game, SHIFT+F5, SHIFT+F8, error)
 
Are you very sure? If the read and write calls are all in exactly the same order, I don't see how this error can occur. One hack way to double check may be:

1. Copy CvInfos.cpp into a new file, say read.tmp, and delete all the functions except the various read() functions.
2. Copy CvInfos.cpp into another new file, say write.tmp, and delete all the functions except the write functions.
3. In write.tmp, global search and replace the write function to read.
4. Compare the two files, using winmerge or diff or whatever you want.
I'm doing this right now. It seems to work fine for boolean/integers, but it's pretty useless for arrays, which I have a lot of...

Since I hadn't asked before, just to be CERTAIN that we aren't facing a "oops" moment here... you are trying to load saves which you JUST made with the current compile, right? (ie - open game, SHIFT+F5, SHIFT+F8, error)

Yes, I create a new custom game, save it, and try to reload my save.

Edit:

I also checked to make sure that I did not smash Firaxis code by accident, by winmerging with an older copy, but it seems that is not the cause either.
 
I'm doing this right now. It seems to work fine for boolean/integers, but it's pretty useless for arrays, which I have a lot of...

I guess it comes closer if you delete the SAFE_DELETE_ARRAY lines and lines with " new ". One common error might be writing M number of items but reading N number, for example by accidentally using a different GC.getNumSomethingTypes.
 
I finally fixed this. Tip: if you count the number of read tags, and then the number of write tags, and they are not equal, you have an issue.
 
I finally fixed this. Tip: if you count the number of read tags, and then the number of write tags, and they are not equal, you have an issue.

That is a good tip, but you knew you had a problem because of the uncompress failure message. Did you track it down by simply repeating the visual inspection over again?
 
That is a good tip, but you knew you had a problem because of the uncompress failure message. Did you track it down by simply repeating the visual inspection over again?

Yes, but I had edited 4 different files read/write calls, including most of CvInfos, so it was a big search. I found the error in CvPlayer, I accidentally removed a read but not the write portion. So it's useful for multiple files...
 
One way to maintain your sanity while coding is to make small changes between testing. Instead of reordering the read/write code for four classes, do one at a time and save/load a game after doing each class.
 
Top Bottom