Civ5 Mod Manager

osmuni

Chieftain
Joined
Apr 26, 2016
Messages
38
I have been playing CIV5 for some years and finally got fed up with the Steam Workshop download and install quirks, and other shortcomings of the mods screen, so I decided to create a Civ5 Mod Manager.



To get started, you click on "Import", and all your installed steam workshop subscribed mods are imported.

You then go to Steam Workshop and unsubscribe to every mod, since now the Mod Manager will handle the download, update and install of your current mods.

For new mods, you just copy the mod workshop url to the clipboard, click "Add Mod" and the mod is added to the Mod Manager database.

No more Steam Workshop troubles.

Clicking "Update All" will download all mods not already downloaded, and check for mod updates.

The Mod Manager keeps a copy of each civ5mod file in a folder.

By checking/unchecking the 3 "DIE" columns, you control Download, Install, and Enable of each mod.

Clicking "Install" will install the mods to Civ5, uncompressed, in the MODS folder.

For now, you have to run Civ5 so the mods are loaded into Civ5ModsDatabase.db, then exit Civ5, and then click "Export Enabled" to activate the selected mods in Civ5. In the future, hopefully the Mod Manager will do that step too.

Sets are also implemented, so you can have different sets of mods grouped in a set.

I have also implemented download and updates for WHoward's mods, but will have to get his permission before including that feature in a public release.

Of course I hate the fact taht I have to install the mods, open Civ5, close it, and only then export the enabled state to Civ5, so I am currently reverse-engineering the process of installing a mod. Basically the modinfo file is parsed and added to Civ5ModsDatabase.db in multiple tables.

I already have the Civ5ModsDatabase.db tables and table structures, what is left is to reverse-engineer the "install" process. If anyone has already done that, or knows if that information is available, it will save me a lot of hours.

Not yet available for download, but posting this to get feedback, comments or feature requests.

The Mod Manager is ready for my own use, but there are a ton of use cases and other details on how to handle some things that it would be great to hear suggestions before making a public release.
 
what is left is to reverse-engineer the "install" process. If anyone has already done that, or knows if that information is available, it will save me a lot of hours.

There's probably very little to do beyond updating the tables from the .modinfo file. Your installer will look like a .civ5mod file has been copied to the MODS sub-directory and the game has unzipped it.

I don't use Steam, and the ModRatings, SteamWorkshopMods and SteamWorkshopSubscribedFiles tables on my system are empty. You can also ignore the two tables starting "sqlite_"

All the other tables, except for ScannedFiles, are pretty self explanatory (and are populated from the .modinfo file)

In ScannedFiles, the HighDateTime appears to be the epoch value when the modinfo file was read, on my system LowDateTime is pretty much random - at a guess it's not used any more (I'd try setting it to HighDateTime-1 and see what happens)

HTH

W
 
There's probably very little to do beyond updating the tables from the .modinfo file. Your installer will look like a .civ5mod file has been copied to the MODS sub-directory and the game has unzipped it.

I don't use Steam, and the ModRatings, SteamWorkshopMods and SteamWorkshopSubscribedFiles tables on my system are empty. You can also ignore the two tables starting "sqlite_"

All the other tables, except for ScannedFiles, are pretty self explanatory (and are populated from the .modinfo file)

In ScannedFiles, the HighDateTime appears to be the epoch value when the modinfo file was read, on my system LowDateTime is pretty much random - at a guess it's not used any more (I'd try setting it to HighDateTime-1 and see what happens)

I am doing this right now, and started with the scannedfiles table, so I am working right now on that.

The routine to find civ5mod files in the game folder and the mods folder I coded seems to replicate exactly the routine used by the game, I get the civ5mod files list in exactly the same order. :)

Regarding highdatetime and lowdatetime, I already figured those out. they are the lastwritetime FILETIME structure members you get from a call to the GetFileTime winapi.

As you said, it does not seem to be so hard to replicate the mod "install" process. the only table that I can´t figure out yet is dlcrelationships.

Thank you for your comments.
 
dlcrelationships should be the same as modrelationships but for the DLC and Expansion packs - the PackageIds are all "well-known" and can be obtained from the .civ5pkg files in the root of the DLC/Expansion sub-folders - so 293C1EE3-1176-44f6-AC1F-59663826DE74 is DLC1(Mongols) and 6DA07636-4123-4018-B643-6575B4EC336B is Expansion 2 (BNW)

All of these entries should also come from the .modinfo files, eg for the Mongols scenario

Code:
  <Dependencies>
	  <Dlc id="8871E748-29A4-4910-8C57-8C99E32D0167" minversion="0" maxversion="9999" />
	  <Dlc id="293C1EE3-1176-44f6-AC1F-59663826DE74" minversion="0" maxversion="9999" />		
  </Dependencies>
  <Blocks>
    <Dlc id="*" minversion="0" maxversion="9999" />
  </Blocks>

HTH

W
 
dlcrelationships should be the same as modrelationships but for the DLC and Expansion packs - the PackageIds are all "well-known" and can be obtained from the .civ5pkg files in the root of the DLC/Expansion sub-folders - so 293C1EE3-1176-44f6-AC1F-59663826DE74 is DLC1(Mongols) and 6DA07636-4123-4018-B643-6575B4EC336B is Expansion 2 (BNW)

All of these entries should also come from the .modinfo files, eg for the Mongols scenario

I have it all figured out now. Everything is working great, except for some minor hurdles I encountered.

Two of the modinfo files for the DLCs are mising the UTF8 Byte Order Marks, for example:

Assets\DLC\DLC_05\Scenarios\KoreaScenario\Samurai Invasion of Korea.modinfo
Assets\DLC\DLC_06\Scenarios\WonderScenario\Wonders of the Ancient World.modinfo

It took me a while to figure out why loading the xml was failing...

Also the structure of the modinfo xml seems overly complicated in the <Dependencies> section, that was the hardest one to figure out. They could have made it much simpler, just like the other sections. It seems a bad programmer was in charge of that part of the modinfo, the rest was fairly simple.

I guess reverse engineering the processing of the dlc mods in the install folder was a bit too much, since maybe the game would do it if I left that part out, but where is the fun in not over doing something, right?

I have done some test runs and my tables match exactly the tables generated by the game... so far.
 
wow, cool, nice work.
Looking forward to using this to keep my 20+ whoward69 mods up-to-date!

EDIT: Ah, found the mod release post: http://forums.civfanatics.com/showthread.php?t=566793

Yes, I posted a release, but it is very early beta. Working right now on a lot of new features, like importing current mods besides the workshop mods, and mod versioning, meaning that you can have multiple versions of the same mod in the database if you wanted to, and not just the latest version as it works now.
 
This. THIS is what we have needed for years. Thank you, this is a miracle.

You are welcomed! That is exactly the reason I decided to finally code it, we should have had something like this 5 years ago. Just keep in mind the posted release is a very early beta, backup everything first, and don´t unsubscribe from any workshop mods yet.

What I need is feature requests and use cases, since I just had in mind the way I play, but quicly realized there are a lot of other ways people use mods.

Anything you think should be in there, ask for it.
 
Top Bottom