Open
Conversation
Add a few more flags in the GAME structs (both .biq and .sav) Some comments and observations on the data structures Fix bug(?) where if the player number is 0 in the biq file, certain dynamic parts have also 0 length
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR in short:
Add version info for .biq and .sav files.
Add a few more flags in the GAME structs (both .biq and .sav)
Some comments and observations on the data structures
Fix bug(?) where if the player number is 0 in the biq file, certain dynamic parts have also 0 length
I came across this .sav file, where it was clear that some data had either uninitialized values (usually in the form of -842150451 which is 0xCDCDCDCD in hex), or had plain wrong values, but the save progressed normally in the original civ3 game.
What I tracked it down to was that, even with an unmodified conquests.biq file, if you start a game choosing Quick Start certain values in the binary where "missing", notably the dynamic parts in the .biq GAME struct, which contain a) the ids of the civs in game and b) their alliance statuses.
That caused the whole reading of the binary to be offset by some amount, which I think is constant regardless of settings (4 bytes * 31 players (ids) + 4 bytes * 31 players (alliances)), resulting in junk data after that point in the corresponding GAME struct.
It also seems that the game at this point also assigns some default values, regardless of what it's loading from, so for example, the plague name might be "Plague" in the conquests.biq, or even absent if it's a PTW file, but upon inspection after loading, the plague name has the value "Black Death", which seems to be hadcoded in the game exe itself (found using Ghidra).
Tha flags/comments and the version are bonuses that I came across/added during the investigation.
Ah, almost forgot, Quintillus' editor source code was a big help to be able to identify biq and sav versions, as well as the decompression tool