Jump to content

Question on When Core-Mod Configs are Saved to User Directory


abeclancy

Recommended Posts

So I've been trying to figure out the answer to what sounds like a relatively simple question: When does the mod package's Config/INI files get copied over from the Mod's Config/ directory to the User's Config/ directory, when a mod is first installed or loaded?

 

I ask because, while testing out adding configuration to a core mod that I've been working on, I can't get the XComMyMod.ini file loading or copying over to the User's Config/ directory at all. While debugging the mod, it does seem to load values from this file, but when trying a release build the values don't get loaded and the config file doesn't get copied or saved to the user's Config directory.

 

Now maybe this is just an issue with core modding, or maybe (once again) something on my system isn't being cleared out and I either need to search the filesystem and registry for anything XCOM or Firaxis related and nuke it. But it *looks* like I'm doing everything just like other mods are, it just doesn't seem to want to work. (I already restore steamapps/common/XCOM 2 and XCOM 2 SDK and delete User/Documents/My Games/XCOM 2/XComGame/Config as I test.)

 

So I have a request from anyone on the community: Install the following mod file, wait for the EULA popup to appear in-game (I've rigged my code to execute on that event), then exit the game and report a) whether your User directory contains XComTestModConfig.ini and its contents, and b) the contents of Launch.log (namely the trace statements near the end).

 

Ideally, a) the INI file would be present in your User/Config directory (for me it's not), and/or ideally b) the Launch.log would be full of "ReportVarTrue" functions, which means that it read the value "true" from the INI file. If either (a) or (b) are true, then either I'm doing something incorrectly or I need a new clean environment or something because it's just me. If both (a) and (b) are false, then either I'm doing something incorrectly or INI config file loading in core mods works differently than non-core mods.

 

edit: removed link, SDK updated, new link later

 

(Note: Source code is included. Other than the one call added to the XComOnlineManager or whichever class it was, it's a very simple test.)

 

My current theory is just that core mods, since they are just replacing one of the core packages, don't have their configuration files executed on the first run of the mod. If this is the case, then any core mods that would add a class that has configuration wouldn't be able to count on the configuration file to be loaded or present. This doesn't *seem* accurate though, because mods do have their INI files parsed, so maybe the question is what is the trigger for executing this process, and how can a core mod emulate that?

 

Anyways, the forum's all about discussion and discovery, and I've been wrestling with this for awhile and am getting nowhere, so I don't feel particularly bad about asking about it. If I'm being an idiot about something, let me know what I'm being an idiot about and I'll read it in the morning. For now though I'm going to sleep with the hope of making some more sense of this in the morning.

Edited by abeclancy
Link to comment
Share on other sites

Neither. It gets loaded in at game launch. The files are never copied to the user's directory. It's modified within memory when the mod loads, and then dumped when XCOM 2 exits. It never actually modifies the INI files themselves.

 

Otherwise, how would you uninstall a mod? Line by line?

Edited by Maclimes
Link to comment
Share on other sites

Well here's what Amineri has to say about it when asked in another thread:

Amineri, on 09 Feb 2016 - 12:40 PM, said:http://forums.nexusmods.com/public/style_images/underground/snapback.png

oasis789, on 09 Feb 2016 - 02:10 AM, said:http://forums.nexusmods.com/public/style_images/underground/snapback.png

 


What is the difference between the XCom*.ini files in My Documents\My Games\XCOM2\XComGame\Config\ and Default*.ini files in Steam\steamapps\commonXCOM 2\XComGame\Config ?

 

The "Default" versions are more like the "base" version that everything else is built from.

 

The "XCom" versions in the My Games folder are the versions that are built/updated when the game launches. These are built by merging the "Default" version with any "XCom" versions of mod files in DLC or mods (functionally, DLC and mods integrate into the game in the same way).

 

One very important thing to realize is that the versions in the My Games folder are rebuilt using file timestamp information. So, if a mod applies a delta file that removes/changes a line that was in the Default, if the mod is made inactive or even deleted, the versions in the My Games won't be updated (because timestamps haven't been changed). This will result in inactive/delete mods "leaking" into cases where they shouldn't.

 

Firaxis is aware of this issue. The current workaround is to delete the config files in the My Games folder to force the game to rebuild them. This will be necessary when removing or not using a mod that makes adjustements to the Default configurations. This is actually a common problem in Unreal Engine 3, and was something that often had to be done with Long War for EU and EW.

 

 

So obviously there is some mechanism that triggers the INI files from the mod directories to be loaded and even saved to the User's Config directory. I guess my question is more of a request for specific information regarding this so I can try and debug why my mod's Config files don't seem to ever be loading, slash a request for people to use that test mod package link so I can confirm that it's not just some environment issue (which has screwed me over in the past).

Link to comment
Share on other sites

Alright, I've kinda narrowed down the question and testing now that I'm not tired.

 

https://www.dropbox.com/s/ydxokazclc7gx55/TestModConfig.zip?dl=0

 

This is a core mod that, when the EULA popup appears, prints debug information in the form of a sequence of trace statements to the Launch.log file. It reads the value "TestVar" from the "XComTestModConfig.ini" file, and prints either "ReportVarTrue" or "ReportVarFalse" to the log file, depending on this value.

 

When there is no INI file present, the default value is false based on UnrealScript's rules regarding default values of variables: Boolean defaults to false. The log file has ReportVarFalse.

 

When there is the INI file present in the Mods/TestModConfig/Config directory, and the value is set to "TestVar=true", then the code loads this log file and the string ReportVarTrue is printed.

 

When there is the INI file present in the User's Config directory, but there is no INI file present in the Mod's Config directory, then the code loads the config file from the User's directory and the string ReportVarTrue is printed to the log.

 

When there are both INI files present in the User's Config directory *and* the Mod's Config directory, then the file located in the Mod's Config directory takes precedence over the User's Config directory.

 

Now, I can handle it if the config file doesn't get automatically copied to the User's Config directory, you can just SaveConfig() and it will write the file. But even if I was to do that, it doesn't matter because any customizations in that file just get overwritten by the Mod's Config file. So how am I supposed to include default configuration options in Mods/TestModConfig/Config that get loaded when no User's Config file is present, but not let the Mod's Config file overwrite the User's every time the game loads?

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...