Announcement

Collapse
No announcement yet.

c4lib and c4edit

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • c4lib and c4edit

    I'm pleased to announce that c4lib is available for download on GitHub. c4edit is a command line program that was built using c4lib which allows users to view and change Civilization 4, Beyond the Sword, binary save game files (.CivBeyondSwordSave) using a text editor. c4edit is part of the c4lib distribution.

    c4lib understands the compressed data format used in BTS saves and is able to decompress saves. c4lib also understands the checksum format used in BTS saves, enabling programs to change saves.

    One of the nice features of c4edit, is that it can output human-readable text file representations of a save called "translations." Translations are similar in appearance to the view shown in a debugger. The beginning of a tranlsation is shown below:

    Savegame: Tiny-Map-BC-4000.CivBeyondSwordSave
    Schema: BTS.schema
    Date: 01-13-2025 02:12:27.160872 UTC
    c4lib version: 01.00.00

    Code:
    Offset Hex ASCII Translation
    0x00000000 | -- -- -- -- | -- -- -- -- | -- -- -- -- | -- -- -- -- | ---------------- | Begin Savegame
    0x00000000 | -- -- -- -- | -- -- -- -- | -- -- -- -- | -- -- -- -- | ---------------- | Begin GameHeader
    0x00000000 | 2e 01 00 00 | -- -- -- -- | -- -- -- -- | -- -- -- -- | ....------------ | GameVersion=302
    0x00000004 | 00 00 00 00 | -- -- -- -- | -- -- -- -- | -- -- -- -- | ....------------ | RequiredMod=""
    0x00000008 | 00 00 00 00 | -- -- -- -- | -- -- -- -- | -- -- -- -- | ....------------ | ModMd5=""
    0x0000000c | 00 00 00 00 | -- -- -- -- | -- -- -- -- | -- -- -- -- | ....------------ | ChecksumDWord=0
    0x00000010 | 00 00 00 00 | -- -- -- -- | -- -- -- -- | -- -- -- -- | ....------------ | LockModifiedAssetsText=""
    0x00000014 | 00 00 00 00 | -- -- -- -- | -- -- -- -- | -- -- -- -- | ....------------ | LmaMd5_1=""
    0x00000018 | 00 00 00 00 | -- -- -- -- | -- -- -- -- | -- -- -- -- | ....------------ | LmaMd5_2=""
    0x0000001c | 00 00 00 00 | -- -- -- -- | -- -- -- -- | -- -- -- -- | ....------------ | LmaMd5_3=""
    0x00000020 | 00 00 00 00 | -- -- -- -- | -- -- -- -- | -- -- -- -- | ....------------ | LmaMd5_4=""
    0x00000024 | bf 05 00 00 | -- -- -- -- | -- -- -- -- | -- -- -- -- | ....------------ | CvInitCoreMd5Size=1471
    0x00000028 | -- -- -- -- | -- -- -- -- | -- -- -- -- | -- -- -- -- | ---------------- | End GameHeader
    0x00000028 | -- -- -- -- | -- -- -- -- | -- -- -- -- | -- -- -- -- | ---------------- | Begin CvInitCore
    0x00000028 | 01 00 00 00 | -- -- -- -- | -- -- -- -- | -- -- -- -- | ....------------ | SaveFlag=1
    0x0000002c | 00 00 00 00 | -- -- -- -- | -- -- -- -- | -- -- -- -- | ....------------ | Type=GAME_SP_NEW
    0x00000030 | 10 00 00 00 | 50 00 61 00 | 73 00 73 00 | 65 00 6e 00 | ....P.a.s.s.e.n. | GameName="Passenger's Game"
    0x00000040 | 67 00 65 00 | 72 00 27 00 | 73 00 20 00 | 47 00 61 00 | g.e.r.'.s. .G.a. | ...
    0x00000050 | 6d 00 65 00 | -- -- -- -- | -- -- -- -- | -- -- -- -- | m.e.------------ | ...​

    You can download c4lib and c4edit on GitHub by clicking here https://github.com/hankinsohl/c4lib (on the GitHub page the actual download link is the button to the right called "Latest").

  • #2
    I just downloaded c4lib and c4edit from the GitHub link. How easy is it to modify specific game elements in the translated text file, and are there any common pitfalls to avoid when editing to ensure the save file still works properly?
    Last edited by Ming; March 27, 2025, 22:17.
    Chill Guy Game

    Comment


    • #3
      Does c4edit support batch processing of multiple .CivBeyondSwordSave files at once, or is it limited to editing one save file at a time?
      Chill Guy Game

      Comment

      Working...
      X