HomeWildfire Games

Add mod selection mod.


Add mod selection mod.

Includes some contributions by rada and sanderd17.


leperAug 25 2014, 6:02 PM
rP15676: Add engine support to load mods from config and restart into mods.

Event Timeline

elexis raised a concern with this commit.Nov 30 2017, 12:44 PM
elexis added a subscriber: elexis.

See discussion in rP20552.
Mostly raising a concern for the missing documentation which should be fixed in a separate patch.


Misses defining documentation.


example inside an example


A minority of developers will comprehend this.


Contains all mods that are available and not enabled, especially not the ones returned by GetAvailableMods.
Last time I checked disabled is the same as not enabled.




Does not return all existing mods


So write a ticket


Only one copy of the ternary and sort call needed.
The entire switch and compare function could have been collapsed into a single line.


Dark gray on dark gray background


These properties are mandatory

This commit now has outstanding concerns.Nov 30 2017, 12:45 PM
elexis added inline comments.Dec 1 2017, 5:39 PM

Someone should have informed mod developers that they may not used version comparison operators in the name field.
Most of them think that the name property is a label and use all kinds of characters and it's just coincidence that the mod page didn't break yet.

But this field may only be used with dependency checks if different mods may use the same identifier to denote the same set of implemented features. (That hypothetical use case might make more sense with a special field however, so that a mod can state that it implements different features that can be tested against).

elexis accepted this commit.Dec 15 2017, 5:05 PM

Besides the confusing GUI page name the defects should be fixed following rP20552, rP20637 and some others. Thanks for giving the user an easy way to enable and disable mods!

All concerns with this commit have now been addressed.Dec 15 2017, 5:05 PM

Thanks for giving the user an easy way to enable and disable mods!

Thanks for cleaning this up, breaking parts of it, not caring about invalidating possibly not obvious parts of the design instead of figuring out or even just asking to clarify that, then being smug about having done so. Have fun mainta^W breaking this more.


So we should open a ticket for every TODO in the whole codebase? Really?

elexis raised a concern with this commit.Dec 28 2017, 10:14 PM
elexis added inline comments.

This doesn't work as expected.

Because neither this nor enableMod update the user config, the mod page after the restart only displays the list of mods enabled in the user.cfg, not the list of mods that are currently actually enabled. It should display the same list before and after the restart, just that the mods have been actually enabled after the restart.


  1. Open the mod page.
  2. Disable the public mod.
  3. Notice the list of enabled mods is empty.
  4. Click on "Start mods"
  5. Press F9 and type warn(uneval(Engine.GetEngineInfo()));`
  6. Notice the public mod is not enabled but listed as enabled.

Described in #4881.

<Insert guilt flamewar here>

(The restarting is done without restarting the process but just restarting the main loop in main.cpp which calls CONFIG_Init in source/ps/GameSetup/Config.cpp which reloads the user.cfg, so might not be a cakewalk to fix)

This commit now has outstanding concerns.Dec 28 2017, 10:14 PM
elexis resigned from this commit.Dec 28 2017, 10:14 PM
This commit no longer requires audit.Dec 28 2017, 10:14 PM
elexis raised a concern with this commit.Oct 23 2018, 5:37 PM

Enabling a mod when a filter is active does not remove the mod from the list of unenabled mods, thus misleads the user into believing the mod is not activated. Then after some multiple clicks on enabling it will trigger a debug breakpoint in the engine complaining about OOB access.

This commit now has outstanding concerns.Oct 23 2018, 5:37 PM
Silier added a subscriber: Silier.Jan 9 2020, 2:28 PM

@elexis your last concern was fixed in rP23269, can you confirm and remove it or do you have something else here?

wraitii added a subscriber: wraitii.

Sadly won't be able to "request verification" on this one. For the time being I'm removed elexis from the auditor list to take this out of the queue, feel free to raise again if there are outstanding issues.

This commit no longer requires audit.Jul 27 2020, 10:46 AM
wraitii raised a concern with this commit.

GetAvailableMods is too slow (see rP21823), but in a way that's rather subtle, and only on release copies.

We create a new Vfs, and populate it with mods. There are two major features of the Vfs that contribute to making this bad:

  • It populates mods when a new folder is loaded to the same path
  • if it finds an archive, it reads the whole thing immediately.

In this case, we'll load the mod mod, then the public mod to the same path, loading a bunch of mod stuff, but it's light enough to mostly not matter, then the user mod (from rP13472), which will populate the root of public, which finds the .zip (in Releases, which is why we missed A23's lag before the release), loads it up entirely, and takes too long.

I don't think we actually needed a VFS for this. We're trying to read a single json file. However, that .json file doesn't always exist physically, since it's sometimes in the .zip. _but_, because of an unrelated bug that I can't find a trace of (see #4027), we install a mod.json on windows. So we could just generalise that.

IMO the simplest solution would be to work VFS-less and open the mod.json that's on the side, since we need it on windows for an unknown bug. Then this should go back to always taking a relatively trivial amount of time.
There's no breakage since, as noted on #4027, modders would not use archives, so they'd create their own mod.json file. We control releases, so we can include the .json. The installer ifdef can just be removed to always run that code.

This commit now has outstanding concerns.Dec 12 2020, 5:36 PM
wraitii resigned from this commit.May 16 2021, 5:17 PM

Optimisation concern above fixed in rP25446.

This commit no longer requires audit.May 16 2021, 5:17 PM