Jump to content

Photo

IniLocPatcher


  • Please log in to reply
9 replies to this topic

#1
Drakous79

Drakous79

    Drak

  • Supporter
  • PipPipPip
  • 845 posts

IniLocPatcher is well known for phoning home (Nexus Wiki article) - silently downloading some config and localization patches. Especially painful for XCOM EU is XComGameCore.ini overriding armors, weapons and characters sections of DefaultGameCore.ini. Patches are stored in ...\Documents\My Games\XCOM - Enemy Unknown\XComGame\Logs\EMS\ folder.

 

An example of Launch.log:

// [0009.44] DevHTTP: FHttpDownload request (/Dict.ashx?key=XCOMGAMECORE_PC_INT_00000.INI) started
// [0010.33] DevHTTP: FHttpDownload request (/Dict.ashx?key=XCOMGAMECORE_PC_INT_00000.INI) completed
// [0010.45] Log: Updating config/loc from XComGameCore.ini took 0.014856 seconds

Also DefaultEngine.ini contains IniLocPatcher entries.

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

[Engine.IniLocPatcher]
!Files=ClearArray
+Files=(Filename="XComGameCore.ini") // Commenting this doesn't help
;+Files=(Filename="XComGame.ini")

Entering custom file like

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

produces empty file MyFile.ini (16 bytes).

 

 

We got used to prevent phone home by editing hosts file, but there is another way - to modify a function in IniLocPatcher class.

 

Engine.upk, class IniLocPatcher, function DownloadFiles

 

There are more ways how to achieve the goal. Either prevent all files to be downloaded by skipping a conditional:

if(NotEqual_InterfaceInterface(TitleFileInterface, (none)))

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

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

Tested it on XCOM EU Patch 6 and XComGameCore.ini was not created in EMS folder and Launch.log was clear.

 

Below is mod file for PatcherGUI and XCOM EU Patch 4-6. Don't forget to disable or update SHA hash in XComGame.exe.

 

Spoiler

Edited by Drakous79, 01 March 2016 - 11:15 AM.


#2
Amineri

Amineri

    Resident poster

  • Premium Member
  • 3,927 posts

This is a very nice find!

 

Should make it a lot easier to generate installers that won't require users to block via hosts file or similar mechanism. That's probably the most common issue with getting mods working correctly, so this could easily reduce troubleshooting by over half  :thumbsup:



#3
dubiousintent

dubiousintent

    Resident poster

  • Premium Member
  • 8,878 posts

Nice indeed. Let me be sure I have this clear before I try to update the wiki.

 

IniLocPatcher is an internal XCOM function that performs the 'phone home' operation that can cause reversion of some modifications to INI and localization files by updating the local copies with vanilla versions from the Firaxis server.  DefaultEngine.ini contains IniLocPatcher entries that define the files it 'updates', though some appear to be hard coded as well.  By modifying the Engine.upk, class IniLocPatcher, function DownloadFiles hex we can prevent it from either downloading all or only some of the files identified in the DefaultEngine.ini entries.

 

Correct?  (That's just an overview summary, of course.)

 

-Dubious-


Edited by dubiousintent, 24 December 2013 - 08:28 AM.


#4
Amineri

Amineri

    Resident poster

  • Premium Member
  • 3,927 posts

My first guess would have been that this would be in native code, and my second would be that they would use a Steam API, but I suppose given that it sits on XBox360 and PS3 as well as being ported to iOS makes a built-in Unreal Engine solution less work.

 

Would definitely explain how/why it's constantly bypassing all of the Steam settings <.<



#5
Drakous79

Drakous79

    Drak

  • Supporter
  • PipPipPip
  • 845 posts

Nice indeed. Let me be sure I have this clear before I try to update the wiki.

 

IniLocPatcher is an internal XCOM function that performs the 'phone home' operation that can cause reversion of some modifications to INI and localization files by updating the local copies with vanilla versions from the Firaxis server.

 

Agreed. Only "with vanilla versions" may be wrong, because it is never entire file, only small parts.

 

Let's look at XCOM Enemy Unknown Patch 6 launch log:

[0025.92] DevHTTP: Performing DNS lookup for prod.xcom.firaxis.com
[0026.03] DevHTTP: Performing DNS lookup for prod.xcom.firaxis.com
[0026.04] DevHTTP: Performing DNS lookup for prod.xcom.firaxis.com
[0026.04] DevHTTP: Performing DNS lookup for prod.xcom.firaxis.com
[0027.08] DevNet: UDownloadableContentManager::InstallIniLocFiles: Reading NetPackageMapExclusions
[0027.10] DevHTTP: FHttpDownload resolve complete to: 65.118.245.165:80
[0027.10] DevHTTP: FHttpDownload resolve complete to: 65.118.245.165:80
[0027.10] DevHTTP: FHttpDownload resolve complete to: 65.118.245.165:80
[0027.10] DevHTTP: FHttpDownload resolve complete to: 65.118.245.165:80
[0027.26] DevHTTP: FHttpDownload request (/News.ashx?TitleID=200510&Localization=INT&PlatformID=64&bIsUnicode=0) started
[0027.26] DevHTTP: FHttpDownload request (/Dict.ashx?key=XCOMGAMECORE_PC_INT_00000.INI) started
[0027.27] DevHTTP: FHttpDownload request (/Dict.ashx?key=XCOMDLC_PC_INT_00000.INI) started
[0027.27] DevHTTP: FHttpDownload request (/Dict.ashx?key=XCOMGAME_PC_INT_00000.INT) started
[0027.45] DevHTTP: FHttpDownload request (/News.ashx?TitleID=200510&Localization=INT&PlatformID=64&bIsUnicode=0) completed
[0027.52] DevHTTP: FHttpDownload request (/Dict.ashx?key=XCOMDLC_PC_INT_00000.INI) completed
[0027.53] Log: Updating config/loc from XComDLC.ini took 0.004360 seconds
[0027.53] DevHTTP: FHttpDownload request (/Dict.ashx?key=XCOMGAME_PC_INT_00000.INT) completed
[0027.54] Log: Updating config/loc from XComGame.int took 0.005064 seconds
[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

Files downloaded to ...\Logs\EMS\ folder are:

  • XComDLC.ini - [XComGame.XComDLCManager] ... 2 MarketplaceOffers added
  • XComGame.int - [XComDLCManager] ... 2 MarketplaceTitles and 2 MarketplaceDescriptions added
  • XComGameCore.ini - [XComGame.XGTacticalGameCore] ... overwrites Armors, Characters and Weapons arrays

See spoiler for contents of files:

Spoiler

 

We can clearly see only 3 files are retrieved and only problematic is XComGameCore.ini.

 

Few interesting facts:

  • XComGameCore.ini must be downloaded in order to be apllied. Disabling phone home and editing the file in EMS with iType=eItem_ArmorKevlar,iHPBonus=10 has no effect.
  • News.ashx and Dict.ashx can be downloaded by combining IP and FHttpDownload request string into web address, but resulting files are probably encrypted. I'd expect text content sent by ASP.NET generic handler. Example link: 65.118.245.165:80/News.ashx?TitleID=200510&Localization=INT&PlatformID=64&bIsUnicode=0

Also my apology for not checking earlier, but following files from ...\Localization\INT\ folder:

  • XComGame.int
  • XComStrategyGame.int
  • XComUIShell.int

are not updated by the patcher, but are merged versions of vanilla and DLC int files. This info can be removed from Nexus Wiki article.

 

 

DefaultEngine.ini contains IniLocPatcher entries that define the files it 'updates', though some appear to be hard coded as well.
 
By modifying the Engine.upk, class IniLocPatcher, function DownloadFiles hex we can prevent it from either downloading all or only some of the files identified in the DefaultEngine.ini entries.

 

I don't know what to think about DefaultEngine.ini entries. In XCOM EU, 3 files are downloaded, but only 1 of them is listed in DE.ini. Commenting XComGameCore.ini does nothing (in EW too), the file is downloaded. But adding MyFile.ini produces empty file in EMS folder :smile:

 

Update: Both XCOM EU and EW Engine.upk, class IniLocPatcher, DefaultProperties contain entry that sets XComGameCore.ini for download.

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

In a case the entry is changed to something else like WComGameCore.ini, XComGameCore.ini is downloaded anyway.

 

So sentence: "DefaultEngine.ini contains IniLocPatcher entries that define the files it 'updates', though some appear to be hard coded as well." is true. To prevent XComGameCore.ini from downloading, the file's name must be changed, not commented in DE.ini!

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

If the file is not available on the server, allmost empty (contains 20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 in hex) file is created in EMS folder.

 

Please see this post for the rest of files.

 

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

  • XComMPGame.ini

 

------

 

XCOM Enemy Within differences:

  • EW Downloads only XComGameCore.ini containing line [XComGame.XGTacticalGameCore].
  • EW uses different IP (old news) and /ew/PlayerInfo.ashx instead of News.ashx. Using it in web address fails.
[0012.19] DevHTTP: Performing DNS lookup for prod.xcom-ew.firaxis.com
[0012.19] DevOnline: ReadTitleFile() XComGameCore.ini Download Starting
[0012.20] DevHTTP: Performing DNS lookup for prod.xcom-ew.firaxis.com
[0012.73] DevHTTP: FHttpDownload resolve complete to: 65.118.245.139:80
[0012.73] DevHTTP: FHttpDownload resolve complete to: 65.118.245.139:80
[0013.40] DevHTTP: FHttpDownload request (/ew/PlayerInfo.ashx) started
[0013.41] DevHTTP: FHttpDownload request (/ew/Dict.ashx?keyz=XComGameCore.ini) started
[0013.43] DevHTTP: HTTP POST payload sent, waiting for response
[0014.15] DevHTTP: FHttpDownload request (/ew/Dict.ashx?keyz=XComGameCore.ini) completed
[0014.17] Log: Updating config/loc from XComGameCore.ini took 0.023420 seconds
[0014.17] DevOnline: TitleFile XComGameCore.ini Download Succeeded!
[0014.78] DevHTTP: FHttpDownload request (/ew/PlayerInfo.ashx?) completed

Edited by Drakous79, 24 January 2014 - 05:46 AM.


#6
Drakous79

Drakous79

    Drak

  • Supporter
  • PipPipPip
  • 845 posts

Located that URL, it is stored as unicode string in the executable.

[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

Launch.log agrees it is wrong URL.

 

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 :smile:



#7
Amineri

Amineri

    Resident poster

  • Premium Member
  • 3,927 posts

So this is functionally equivalent (as far as the XCOM game is concerned) as redirecting the hosts, file, correct? Or at least until Firaxis realizes their sequel WCOM ;)

 

With the big advantage of course that this can be installed as part of a mod instead of requiring the user to separately configure the hosts file...



#8
Drakous79

Drakous79

    Drak

  • Supporter
  • PipPipPip
  • 845 posts

Amineri, yes :smile:

 

Btw found, where is downloading of XComDLC.ini and XComGame.int for XCOM EU defined. It is in XComGame.upk, class XComDLCManager, DefaultProperties. This class isn't present in XCOM EW.

FilesToDownload(0)="XComDLC.ini"
FilesToDownload(1)="XComGame.int"
[0008.06] DevHTTP: FHttpDownload request (/Dict.ashx?key=WCOMDLC_PC_INT_00000.INI) started
[0008.06] DevHTTP: FHttpDownload request (/Dict.ashx?key=WCOMGAME_PC_INT_00000.INT) started
[0009.50] DevHTTP: FHttpDownload request (/Dict.ashx?key=WCOMDLC_PC_INT_00000.INI) completed
[0009.53] Log: Updating config/loc from WComDLC.ini took 0.000000 seconds
[0009.54] DevHTTP: FHttpDownload request (/Dict.ashx?key=WCOMGAME_PC_INT_00000.INT) completed
[0009.54] Log: Updating config/loc from WComGame.int took 0.000000 seconds

I got 2 brand new empty Wcom files in EMS folder.

 

And XComGameCore.ini is in Engine.upk, class IniLocPatcher, DefaultProperties. It's the same for XCOM EW.

Files(0)=(Filename="XComGameCore.ini")
[0012.45] DevHTTP: FHttpDownload request (/Dict.ashx?key=WCOMGAMECORE_PC_INT_00000.INI) started
[0013.82] DevHTTP: FHttpDownload request (/Dict.ashx?key=WCOMGAMECORE_PC_INT_00000.INI) completed
[0013.83] Log: Updating config/loc from WComGameCore.ini took 0.000000 seconds

1 new Wcom file in EMS folder. BUT it works only in conjunction with commenting ;+Files=(Filename="XComGameCore.ini") in DefaultEngine.ini.

 

------

 

Update: To prevent XComGameCore.ini from downloading, the file's name must be changed, not commented in DE.ini!

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

This works with unchanged IniLocPatcher's DefaultProperties.


Edited by Drakous79, 25 December 2013 - 06:27 AM.


#9
Drakous79

Drakous79

    Drak

  • Supporter
  • PipPipPip
  • 845 posts

Another interesting fact is IniLocPatcher respects Steam being in offline mode. If Steam is in offline mode, the IniLocPatcher does nothing. Must be using Steam api for internet connection.

 

In case of modding Armors, Characters and Weapons in DefaultGameCore.ini, Steam in offline mode = edited hosts file.

 

In case of multiplayer menu, 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.



#10
dubiousintent

dubiousintent

    Resident poster

  • Premium Member
  • 8,878 posts

This has now become the first of our 'Class:' articles: 'Class: IniLocPatcher - XCOM:EU 2012'.

 

-Dubious-


Edited by dubiousintent, 24 January 2014 - 12:45 AM.





IPB skins by Skinbox
Page loaded in: 0.966 seconds