Fixing saves which have the in-game log crash

Dresden

Emperor
Joined
Jul 10, 2008
Messages
1,081
Even though the SimCutie color file is no longer in BUG, I still see occasional SGs that report the crash. I have wanted for awhile to make a little utility program that you could just run a save through that would fix the problem but I can't find any documentation on the basics of civ4 save editing and got no response from one of the utility authors whom I PMed for assistance.

However, tonight I was struck with inspiration and decided to write a fix that operated from within the game itself. In this case a custom DLL (based off of Official 3.17) that provides a new function CvGame::fixLog() which is exposed to Python. This function goes through the Replay log and all the player message logs, resetting any out-of-range colors to white. Source is available on request (i.e. I'm too lazy to package and post it until someone actually asks.)

This has worked on a test of ONE broken save since that's all I had handy and I haven't yet gotten confirmation from anyone else, but I feel pertty confident so I'm posting it now. ;) The save I tested with was from shyuhe-5 and I'm hoping the players there can give me additional confirmation since I posted the (hopefully) fixed save back to their topic.

If someone else has a broken save they'd like fixed, please post it or link it here and I'll run it through. Alternatively if anyone is adventurous enough to want to try the fix themselves this is what you need:
  • BTS version 3.17 installed
  • A BTS 3.17 save with the problem that does not have Locked Modified Assets set
  • The chipotle setup in your INI so you can access the Python console
  • Something that opens RAR files since that's my default compression format :p
  • The DLL attached to this post
  • You should also not have the SimCutie CIV4ColorVals.xml file installed since that'd render the fix useless. ;)

Instructions:
  1. Backup your current CvGameCoreDLL.dll to someplace safe.
  2. Install the attached DLL to your BTS Assets folder.
  3. Launch the game and load the problem save.
  4. Type "~" to launch the Python console; make sure you see the Python version number and ">>" prompt.
    1223348938.jpg
  5. Enter the following into the console and hit enter:
    Code:
    CyGame().fixLog()
  6. You should see an in-game confirmation message that looks something like this:
    1223348909.jpg
  7. Close the console (with "~" or "`"), cross your fingers, and open the log.

If all goes well, you can resave, quit BTS, and reinstall your old DLL. The save should now be fixed and the problem gone. If I get further positive test feedback I'll probably package it up more nicely and post it somewhere more conspicuous too.
 

Attachments

Dresden - well done!:trophy: I am pretty sure I have some stuffed saves somewhere. I'll give it a whirl. You should definitely post something on this in the SG forum and send a PM to Lee (user name: LKendter).
 
After I get some independent confirmation that it works for others and doesn't have any obvious side effects I'll post an announcement in the SG forum; I don't expect any problems but I try to be thorough. ;) I think Lee has "retired" from Civ4 SGs though.
 
I think Lee has "retired" from Civ4 SGs though.
Yes - but I will bet that he wants to know that he can 'fix' his corrupted games now.
 
Good call ruff. I actually thought of that after I posted but sadly not before ;)

If anyone wants to help test, here are a couple pairs of files.

From shyuhe-5:

From ruff's BUG Hunting experiment:

Please let me know if the fixed versions in either case still cause a crash.

Changing gears, is there reason to create a 3.13 version of this fix too? Probably not hard since I have the unmodded 3.13 source from EF, but extra work. :p
 

Attachments

Just want to say nice work on this. I never suspected that the in-game log was just the replay messages and that they would be modifiable after-the-fact. As Ruff said, it's good to have an SDK tinkerer around. :)

I keep saying that once we get enough UG ideas for the SDK, I'll jump into it. So far most of the things I'd like to change are the hover texts, but wow we could do some awesome things with the ability to create new widget types!
 
The log is different from the replay, but I had remembered hearing that the replay had the problem too and that's what I found and fixed first. The in-game log is actually made of the same player-specific message queue that you see every turn but it contains only those messages that haven't expired. I was also pleasantly surprised that both were modifiable.
 
To open the console, edit your CivilizationIV.ini file and change the CheatCode setting to "chipotle" without the quotes.

Code:
; Move along
CheatCode = [B]chipotle[/B]
 
To open the console, edit your CivilizationIV.ini file and change the CheatCode setting to "chipotle" without the quotes.

Code:
; Move along
CheatCode = [B]chipotle[/B]

Yeeeee! Thanks a lot I got it. But it's useless, however, as I can't use the special dll file because I play with a mod and it has different dll file, so if I copy I wont turn on the mod. Maybe someone could edit that dll file from the mod? Perhaps.

I tried to write CyGame().fixlog() and I got this:
file"<string>",line1,in?
Attribte Error:'CyGame'object has no attribute 'fixlog'
 
Are you aware that this fix is for people who used a really old version of BUG? Given that your game uses some other mod that requires a DLL, it certainly can't have used BUG. Are you sure you need to use this fix in your game?
 
Are you aware that this fix is for people who used a really old version of BUG? Given that your game uses some other mod that requires a DLL, it certainly can't have used BUG. Are you sure you need to use this fix in your game?
You're right. I'm on the wrong boat :(
I'm having crashes at the end of the turn and I'm desparetly trying to solve it so I'm searching the whole forum and trying every possible opportunity. Really don't know what to do :(
 
I see you posted in that forum, which is good, but you didn't include your saved game! They can't possibly help you without that. This forum is for the BUG Mod which doesn't use the Giant Earth Map at all. We're an unrelated project.

I highly recommend you attach your saved game to that thread with more information (for example year, civilization you're playing, anything else you can think of).
 
I see you posted in that forum, which is good, but you didn't include your saved game! They can't possibly help you without that. This forum is for the BUG Mod which doesn't use the Giant Earth Map at all. We're an unrelated project.

I highly recommend you attach your saved game to that thread with more information (for example year, civilization you're playing, anything else you can think of).
The point was that I couldn't, or didnt know how to attach it on both places - it said "this file you have already attached" so I choose the place where I have one member willing to help :)

I've just uploaded the logs, maybe you could find out where the problem might be. I don't really know much about python and c++
 
Well I know nothing about that mod. I would think the authors of the mod would be the best people to ask for help with their mod. I'm quite swamped dealing with my mod as it is; I don't have time to take on another mod.
 
Back
Top Bottom