Class: IniLocPatcher - XCOM:EU 2012

From Nexus Mods Wiki
Revision as of 04:48, 17 November 2018 by Dubiousintent (talk | contribs) (References: remove category 'Game Info')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


Overview

[This is primarily derived from discoveries in the IniLocPatcher thread on the Nexus forums.]

IniLocPatcher is an internal XCOM class that performs the 'phone home' operation that can cause reversion of some modifications to INI and localization files by silently downloading some config and localization patches from the Firaxis server. Especially painful for XCOM EU is it's effect on XComGameCore.INI: overriding Armors, Weapons, and Characters arrays of DefaultGameCore.INI. Patches are stored in the <drive letter>:\Users\<user name>\Documents\My Games\XCOM - Enemy Unknown\XComGame\Logs\EMS\ folder.


Programs and Tools

Any plaintext editor (like Notepad, but not Write) is sufficient. Other tools mentioned in Modding Tools - XCOM:EU 2012 may be required for specific tasks.

Details - What and Where

Logs and affected files

The indicators of the IniLocPatcher activity is found in the Launch.log file found in the ...\Documents\My Games\XCOM - Enemy Unknown\XComGame\Logs\ folder.

An example of Launch.log:

[0025.92] DevHTTP: Performing DNS lookup for prod.xcom.firaxis.com
[0027.10] DevHTTP: FHttpDownload resolve complete to: 65.118.245.165:80
[0027.26] DevHTTP: FHttpDownload request (/Dict.ashx?key=XCOMGAMECORE_PC_INT_00000.INI) started
[0028.15] DevHTTP: FHttpDownload request (/Dict.ashx?key=XCOMGAMECORE_PC_INT_00000.INI) completed
[0028.17] Log: Updating config/loc from XComGameCore.ini took 0.016790 seconds

Encrypted file of the correct size (55 040 bytes) is downloaded upon entering prod.xcom.firaxis.com/Dict.ashx?key=XCOMGAMECORE_PC_INT_00000.INI into web browser's address bar.

For the XCOM Enemy Unknown Patch 6, the files downloaded to the EMS folder are:

  • XComDLC.ini - 2 MarketplaceOffers added into [XComGame.XComDLCManager] section.
  • XComGame.int - 2 MarketplaceTitles and 2 MarketplaceDescriptions added into [XComDLCManager] section.
  • XComGameCore.ini - Armors, Characters and Weapons arrays in [XComGame.XGTacticalGameCore] section are overwritten.

One more file is downloaded into the EMS folder after clicking the Multiplayer button in the game:

  • XComMPGame.ini

We can clearly see only 3 (or 4) files are retrieved and the only problematic one is XComGameCore.INI.

Entries in DefaultEngine.INI

DefaultEngine.INI contains IniLocPatcher entries that define the files it 'updates'. Files not listed in DefaultEngine.INI are hard coded in DefaultProperties of IniLocPatcher, XComDLCManager and XComMPData classes.

[Engine.OnlineSubsystem]
IniLocPatcherClassName="Engine.IniLocPatcher"

[Engine.IniLocPatcher]
!Files=ClearArray                    // Clears an array defined in DefaultProperties of IniLocPatcher
+Files=(Filename="XComGameCore.ini") // Commenting this line doesn't help
;+Files=(Filename="XComGame.ini")

Entering a custom file name like:

+Files=(Filename="MyFile.INI")

produces allmost empty MyFile.INI (16 bytes, contains 20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 in hex) file in EMS folder, meaning the file is not available on download server.

Entries in DefaultProperties

Some files are defined in DefaultProperties of forementioned classes as arrays or variables.

Engine.UPK, class IniLocPatcher contains an entry that sets XComGameCore.INI for download.

Files(0)=(Filename="XComGameCore.ini")

EW XComGame.UPK, class XComMPData contains an entry that sets XComMPGame.INI for download.

m_strINIFilename="XComMPGame.ini"

Downloading of XComDLC.INI and XComGame.INT for XCOM EU is defined in XComGame.UPK, class XComDLCManager. This class isn't present in XCOM EW.

FilesToDownload(0)="XComDLC.ini"
FilesToDownload(1)="XComGame.int"

Connection with Steam

IniLocPatcher respects Steam being in 'offline' mode. If Steam is in 'offline' mode, the IniLocPatcher does nothing (It must be using a Steam API for the internet connection.).

In the case of modding Armors, Characters, and Weapons in DefaultGameCore.INI: Steam in 'offline' mode equals to having edited hosts file.

In the case of the MultiPlayer menu being selected, Steam in 'offline' mode disables Ranked and Quick Match, Leaderboards and View Invites buttons. Only Custom Match and Edit Squad buttons are available. This applies to EU and EW.

Countermeasures / Hosts File Alternatives

We have gotten used to preventing phone home by editing the hosts file, but there are another ways.

Changing Download Server URL

One of ways to prevent all files from downloading is to invalidate download server's URL stored in the executable as a unicode string. The idea is to provide URL that does not exist. Changing domain name extension label works as well.


XComGame.exe: prod.xcom.firaxis.com

70 00 72 00 6F 00 64 00 2E 00 78 00 63 00 6F 00
6D 00 2E 00 66 00 69 00 72 00 61 00 78 00 69 00
73 00 2E 00 63 00 6F 00 6D 00

XComEW.exe: prod.xcom-ew.firaxis.com

70 00 72 00 6F 00 64 00 2E 00 78 00 63 00 6F 00
6D 00 2D 00 65 00 77 00 2E 00 66 00 69 00 72 00
61 00 78 00 69 00 73 00 2E 00 63 00 6F 00 6D 00

Change 78 to "77", so prod.xcom.<rest of the URL> becomes prod.wcom.<rest of the URL>.

Results were verified in Launch.log:

[0026.15] DevHTTP: Performing DNS lookup for prod.wcom.firaxis.com
[0026.16] DevHTTP: Failed to resolve hostname for HTTP download

[0019.31] DevHTTP: Performing DNS lookup for prod.wcom-ew.firaxis.com
[0019.37] DevHTTP: Failed to resolve hostname for HTTP download

Modifying IniLocPatcher Class

Another way is to modify a DownloadFiles function in the IniLocPatcher class:

Engine.upk, class IniLocPatcher, function DownloadFiles

There are two options to achieve the goal:

  • prevent all files to be downloaded by skipping a conditional,

if(NotEqual_InterfaceInterface(TitleFileInterface, (none)))

  • or prevent only XComGameCore.ini from being patched by expanding the function and enclosing if(TitleFileInterface.ReadTitleFile(Files[Index].Filename)) in a new conditional.

if(Files[Index].Filename != "XComGameCore.ini")
{
   if(TitleFileInterface.ReadTitleFile(Files[Index].Filename))
   {
       Files[Index].ReadState = 1;
   }
   else
   {
       Files[Index].ReadState = 3;
   }
}

Tested on XCOM EU Patch 6, and XComGameCore.INI was not created in the EMS folder and Launch.log was clear.

Below is a mod file for the 2nd option for PatcherGUI and XCOM EU Patch 4-6. Don't forget to disable or update SHA hash in XComGame.EXE.

MOD_NAME= IniLocPatcher DGC Tweak EU
DESCRIPTION=Tells IniLocPatcher to skip downloading DefaultGameCore.ini for XCOM EU Patch 4-6

UPK_FILE=Engine.upk

{ Expand function DownloadFiles }
EXPAND_FUNCTION=IniLocPatcher.DownloadFiles:354

FUNCTION=IniLocPatcher.DownloadFiles

{ New virtual size }
REL_OFFSET=0x28
[MODDED_HEX]
B7 01

{ New conditional If (Files[Index].Filename != "XComGameCore.ini") + rest of the function with corrected jump offsets }
REL_OFFSET=0x30
[MODDED_HEX]
07 B4 01 1C 96 FF FF FF 01 13 3C 00 00 52 B1 54
00 00 2A 16 0F 00 1B 3C 00 00 25 07 B4 01 96 00
1B 3C 00 00 36 01 14 3C 00 00 16 07 A6 01 9A 38
3A 35 0E 3C 00 00 11 3C 00 00 00 00 10 00 1B 3C
00 00 01 14 3C 00 00 38 3A 24 00 16 0F 35 10 3C
00 00 11 3C 00 00 00 01 10 00 1B 3C 00 00 01 14
3C 00 00 1B 26 4A 00 00 00 00 00 00 35 10 3C 00
00 11 3C 00 00 00 00 10 00 1B 3C 00 00 01 14 3C
00 00 16 07 A6 01 7B 35 10 3C 00 00 11 3C 00 00
00 01 10 00 1B 3C 00 00 01 14 3C 00 00 1F 58 43
6F 6D 47 61 6D 65 43 6F 72 65 2E 69 6E 69 00 16
07 7D 01 19 51 01 13 3C 00 00 30 00 9D 54 00 00
00 1B 4B 3C 00 00 00 00 00 00 35 10 3C 00 00 11
3C 00 00 00 00 10 00 1B 3C 00 00 01 14 3C 00 00
16 0F 35 0E 3C 00 00 11 3C 00 00 00 01 10 00 1B
3C 00 00 01 14 3C 00 00 24 01 06 A6 01 0F 35 0E
3C 00 00 11 3C 00 00 00 01 10 00 1B 3C 00 00 01
14 3C 00 00 24 03 A5 00 1B 3C 00 00 16 06 2B 00
04 0B 53 00 00 00 02 00 02 00 64 1C 00 00 00 00
00 00

Modifying DefaultEngine.INI

Also XComGameCore.INI can be prevented from downloading by invalidating its DefaultEngine.INI entry. It works with unchanged IniLocPatcher's DefaultProperties.

[Engine.IniLocPatcher]
!Files=ClearArray
+Files=(Filename="WComGameCore.ini")

Modifying DefaultProperties

Some files, except XComGameCore.INI can be prevented from downloading by invalidating their names in corresponding DefaultProperties.

m_strINIFilename="WComMPGame.ini"

This change produces new file named WComMPGame.ini of 16 bytes in the EMS folder.

In case of XComGameCore.INI, we suspect the change in DefaultProperties has to be accompanied with commenting its entry in DefaultEngine.INI.

XCOM Enemy Within differences

  • EW Downloads only XComGameCore.INI containing the line: [XComGame.XGTacticalGameCore].
  • EW uses a different IP address (old news) and downloads /ew/PlayerInfo.ashx instead of News.ashx.

[0013.40] DevHTTP: FHttpDownload request (/ew/PlayerInfo.ashx) started


References

Referred to by this article:



That refer to this article: