1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

Logfix DLL: A Utility to repair saves with the in-game log crash

Discussion in 'Civ4 - Succession Games' started by Dresden, Oct 18, 2008.

  1. Dresden

    Dresden Emperor

    Joined:
    Jul 10, 2008
    Messages:
    1,081
    For those SG Players whose saves have become victims to the dreaded in-game log crash, a fix is now available. It is a custom DLL that will allow you to load the problem save into BTS, run an in-game fix through the Python console, and then resave the game after it is repaired. Below is a forum-friendly version of the Readme file and a link to the download.

    Download: Zip Archive hosted at CFC; 1.5MB

    Spoiler Readme Text :
    Logfix DLL

    by Dresden; version 1.0

    Introduction

    Logfix is a custom DLL based on Beyond the Sword 3.17 (official) which will allow you to repair color problems that cause the game to crash when trying to view the in-game log or replay. It will reset all out-of-range colors to white and makes no other changes to the game. The crash itself was caused by SimCutie's Extended Colors mod which was included in early versions (prior to 2.3) of the BUG Mod.

    Requirements
    • BTS Version 3.17 Installed.
    • A BTS 3.17 savegame that has the log-crash problem; you can open and repair 3.13 saves as well but when you resave them they will become version 3.17. Note that the save must NOT have the "Locked Modified Assets" option set; if this option is present, the game will not load under this DLL.
    • The chipotle "cheat code" present in your Civilization4.INI file as outlined in Soren Johnson's CFC Post (http://forums.civfanatics.com/showthread.php?t=134287)

    Instructions
    1. First, verify that you do not have SimCutie's version of CIV4ColorVals.xml installed in your CustomAssets folder (it should be under .../XML/Interface/ if you have it.) If you do have this file, remove it from your CustomAssets because that's the file that has caused all this trouble and if it is still present, the save won't be fixed.
    2. Backup your current <BTS Folder>/Assets/CvGameCoreDLL.dll to someplace safe.
    3. Install (i.e. copy) the included CvGameCoreDLL.dll to your BTS Assets folder.
    4. Launch BTS and load your problem savegame. Do NOT try and look at the log yet.
    5. Hit the tilde key ("~") to enter the Python Console. You should see a small grey window appear over the interface which contains the following text (or something quite similar):



      And underneath that should be a green ">>" prompt. If you have the window but see no text and only have a ">" prompt, then you are in the "regular" console instead of the Python console; close the window using the same key and try it again because you need the Python console for this to work. On some keyboards, you must hold Shift in order to type the "~".
    6. Enter the following command into the Python Console and hit enter:
      Code:
      CyGame().fixLog()
    7. If all goes well, you should see a green event message saying how many log and replay messages were repaired. If you get an error message, make sure you typed the command exactly and that all the previous steps were followed.
    8. Now you can close the console by again using the "~" key. You should now be able to view the in-game log and replay without crashing. Save the game and you're done. You can now continue playing from this save and the crash problem will be gone. You can repeat this process for any other problem saves you have as well.
    9. After you quit the game, remember to restore your original DLL. While the included DLL will function the same as the official 3.17 DLL, it can cause a problem when trying to play "Locked Modified Assets" saves later such as those from the HoF mod or CFC GoTM. If you later need to fix another save, just switch back to the included DLL to do the fix and then restore the original afterwards.

    Technical Notes

    The Source folder contains those files changed from Official 3.17 needed to compile this DLL. Two new functions were added, CvGame::fixLog() and CvPlayer::fixMessages() and the former was exposed to Python. This fixLog() function iterates over all replay messages making sure they have valid colors and changing any which are invalid to "COLOR_WHITE". It then calls fixMessages() for all the players in the game (except barbarians) which does the same thing for each player's message log entries. When done, it outputs an interface message to the screen which will persist in the active player's log for at least 10 turns. (Might be much longer; I don't know.)

    Download

    Zip Archive hosted at CFC; 1.5MB


    Special thanks to GreyFox and the other players of shyuhe-5 for testing a fixed save, even though they continued the game from the original. ;)
     
  2. GreyFox

    GreyFox Make it so ...

    Joined:
    Dec 28, 2005
    Messages:
    5,553
    Location:
    Where No One Has Gone Before
    Ah ... thanks to Dresden for the utility. I would actually have no problem with using the fixed game (had it been my game) :)
     
  3. GreyFox

    GreyFox Make it so ...

    Joined:
    Dec 28, 2005
    Messages:
    5,553
    Location:
    Where No One Has Gone Before
    I would like to thank Dresden again for this utility, which I finally manged to use it to fix a save in PH14.

    Great job! :goodjob:
     

Share This Page