Engine Core - Kaedrin/warhammer-mod-manager GitHub Wiki

1. Steamworks initialized.

  • Set up a singleton for Steamworks
  • Set up the core data structs
  • Separate Steam Core from UI app (Future Task, not important for first pass)
  • Separate Profiles from Manager data in AppData path (KMM -> Profiles, Manager) so that the subfolder for Manager can be deleted instead of telling people delete text files but not the profiles subfolder. Alternatively create two KMM AppData paths (new one for Profiles, existing one for Manager)
  • Update Steamworks version

2. Steam checked to see if it is running.

  • Add a latency check/timer for when Steam is lost/sleeping/braindead since it's an async call
  • Exit if Steam is not running with a warning after the timer

3a. First Time Initialization Logic:

  • Use Spacewar to initialize Steamworks ID
  • Load SteamIDs from CoreIDs.XML so the list of all Total War games is current (along with AppDataGameName and ExeName). Footnote: This list is based on actual install experience or from knowledgeable information provided by others to update the list/information. The exe name could be picked up dynamically but the appdata folder name is typically a mashup of words so is much harder to find correctly when multiple titles are installed
  • Scan for all Total War titles owned (read SteamIDs from CoreIDs.XML) and record their ExePath, IsOwned, and SteamID in GameDataV2.xml Footnote: I believe the API will give you a blank value if you own the game and you don't have it installed, I'll verify this when I test Empire and the like. This won't be an issue due to the dynamic filepath pickup later
  • Assign AppDataGameName and ExeName based on SteamIDs from the CoreIDs.XML data
  • "Ownership" has now been established
  • Set Warhammer 2 or the last owned+installed game in the list (if Warhammer 2 is not owned/not installed) as the "Current" game for KMM so it uses that game when it starts next. Installed is defined as the ExePath is valid and the ExeName + ExePath results in a valid exe located there
  • Close down Steamworks and Exit after firing a message about needing to restart

3b. After Initial Setup Logic:

  • Check to see if the path for the "Current" game is still valid
  • If it is not: use the steam api to get the current ExePath
  • If it returns NULL/Blank, the game is not installed and you need to switch to another owned+installed game
  • Start at the first game in the owned list and check the install path for a valid game (then check steam for the current path) till you find an installed game
  • Error out if you don't find any games at all (which you should never see this error, why did they launch KMM?!)
  • Assign the SteamID for the Current game (and it's path) now that you have finally chosen one
  • Continue to preference loading once you have a valid location (or game):

3c. Scan for New Games Logic:

  • Scan for unowned games
  • Update CoreData
  • Serialize CoreData
  • Enable New UI Options

4 Preference Loading Logic:

  • Load the ModManagerSettingsV3 file (up from v2)
  • Add option to bypass Steam for mod info (but not for the ownership check, IsSteamRunning check)
  • Add Backup Path Support (two folders) that stores each game separately within it (by AppData folder name such as x/ThreeKingdoms/a.hak)
  • Backup path can be set separately for each game
  • Add ability to set which games are backed up (not just all games or only the current game)
  • Add ability to set the path to the UserMods folder for each game that supports Content loading
  • Add ability to set the path to the Upload folder for each game that supports Uploading
  • Backup CA Data Files option added along with a Path

5 Game Specific Logic:

  • Out of date moved to xml file, one entry per game (when possible) Footnote: Allows for "no code updates" when a patch hits
  • Ability to disable out of date when not applicable to a title added
  • Steam Info cached, considered stale, updated if author not unknown (Future task, only benefit is to allow Mod Manager to generate HTML based on the steam info for a mod for notes, tags, etc)
  • New version available text added to title bar when an update is available

6 Workshop/Content Folder Logic:

  • Data Folder is no longer used. Content Folder is the default behavior in the following manner:
  • Content folder is scanned for thumbnail only folders, empty folders, and invalid files and deleted as needed (known bugs)
  • Data Folder is scanned user mods and thumbnails and any found are removed
  • If the Backup CA Files is enabled, Timestamp between Data and CAPath is compared for each CA mod and if a difference is detected the mod is copied
  • Timestamp between Content Folder and UserMods is compared for each mod and if a difference is detected the following copy logic begins:

7 File Copy Logic:

  • If the number of Backup Copies is 1:
  • Timestamp between UserMods and Backup1 is compared for each mod and if a difference is detected the mod is copied
  • Timestamp between Content and UserMods is compared for each mod and if a difference is detected the mod is copied
  • If the number of Backup Copies is 2:
  • Timestamp between Backup1 and Backup2 is compared for each mod and if a difference is detected the mod is copied
  • Timestamp between UserMods and Backup1 is compared for each mod and if a difference is detected the mod is copied
  • Timestamp between Content and UserMods is compared for each mod and if a difference is detected the mod is copied

8 File Handling Logic:

  • Rename mods: If the mod exists in Content the context is Copy and Rename which renames the mod in UserMods
  • Rename mods: If the mod does not exist in Content the context is Rename which just renames the mod in UserMods
  • Merge Mods: Merges selected mods into the new mod and puts the output into the UserMods folder
  • Unsubscribe: This context only shows up if the does exist in Content (using this will unsubscribe via Steam AND delete from UserMods as well as Backups)
  • Delete: This context only shows up if the mod does not exist in Content (using this will delete the mod from UserMods)
  • Cleanup will simply nuke the contents of the UserMod folder

9 UserMod Folder Logic:

  • Option added to set to the Path for this
  • This folder is intended for to be the clean slate folder where it has no impact on the Data folder, can be easily wiped, and synchronized with the backup folders

10 File Loading Logic:

  • No files are loaded at the start unless Conflict detection is enabled. Using options that require a loaded mod (such as View Contents, Merge, ect) will load the mod on demand and add it to the loaded mod list
  • Potentially implement a quick header load for validating pack files (due to invalid pack file issues that have happened)
  • If Conflict Detection is enabled, Mods are loaded per usual

11 Upload Folder Logic:

  • Upload folder is untouched by the manager at this time until the Uploader functionality is available