Steam and mods

From Nexus Mods Wiki
Jump to: navigation, search

Overview

Some mod changes have to be made by altering the hex code of the game executable file (<SomeGame>.exe) directly, or by replacing original game files. As a consequence, every time a patch to the game is released, or Steam 'verifies' the game files, any such mods will be removed when the original (or 'vanilla') version of the files are restored, and eventually you will find it necessary to reapply many, if not all of your desired mods. Steam's 'phone-home' capability has been known to override only some elements of a mod, producing mixed results for no apparent reason. This 'phoning home' occurs every time the game is launched, and is independent of patches. To prevent this from happening unexpectedly, you must assert control over when Steam performs such steps.

Steam has demonstrated that they will ignore the disabled 'auto update' settings for a game without warning (at least sometimes) when the game vendor releases a patch. The only reliable method to avoid unwanted or unexpected patches is to always run the game in Off-Line mode. If you have mods that are not easily re-installed, it is advisable to have a complete backup of the game folder tree, so you can revert when a patch does get forced upon you.

Retaining Control

First, see Installing Games on Windows Vista+ for WHY and HOW TO move your Steam folder out of the Program Files folder tree if you haven't done so already. Simply disabling Windows User Account Control (UAC) or folder permissions is not sufficient.

Here is how to take control of Steam updates:

Ensure your Steam application is unable to 'phone home' via a network connection to automatically perform verification updates behind your back (intended to prevent cheating in multi-player games) that will overwrite part of the mod(s). There are two ways to do this, and both may prove necessary (i.e. if you have an active WiFi connection, your computer is always networking in the background even if the Steam App is in 'Offline Mode', so you MUST apply the hosts file fix as well):

Offline Mode

Easier to accomplish. This prevents the Steam App from connecting to it's servers, but you won't be able to chat, play multi-player, register achievements, or update other games until you switch back to 'Online' mode. See the official Offline Mode Steam Support instructions for the type of computer running Windows OS. Here are the very basics, but read the Steam Support instructions first. There is more to a first time setup:

  • Start the Steam App.
  • Select the Library (second menu line), which will display your library of installed Steam games.
  • Select a game title (i.e. XCOM: Enemy Unknown) and right-click on it to display the context menu.
  • Select Properties from the context menu.
  • Select the Updates tab.
  • In the Automatic updates field, click on the upside-down triangle at the right edge, and select Do not automatically update this game.
(This will prevent updates except as you determine the timing. If you wish to engage in multi-player mode, this may be all you can do besides modifying the hosts file. Disabling automatic updates by itself: people have still had issues.)
  • Close the Properties window.
  • Select the Steam Menu (top left, first line) > Go Offline > Restart the Steam App in offline mode.

Modifying hosts file

Prevents Steam from connecting to it's update servers behind your back. Slightly more complicated, but lets you use the Steam Apps's online functions such as multi-player, and is only required once. It is not affected by patches or re-installing Steam and does not affect your ability to get updated when you go back to 'Online' mode.

To determine where your game attempts to communicate, you want to examine your \My Games\<Steam Game folder>\Logs\Launch.log file. You are looking for lines similar to these:

The entries marked like so are:

  1. The Server IP address: 65.118.245.165
  2. The Server DNS Name: prod.xcom.firaxis.com

These are what you will place into the hosts file to block attempts to connect.

  • Start Menu > Right click on 'Notepad' (or any text editor), select "Run as Administrator"
    • File > Open > %systemroot%\system32\drivers\etc\hosts. The hosts file has no '.' suffix, so make sure you don't add .txt or anything else. Also, %systemroot% on most systems is C:\Windows, but the exact folder name may vary by OS version. The value of the global environmental variable %systemroot% on your system can be determined by entering 'set' on the Windows command line, or as it's shortcut is called, the Command Prompt. But the variable %systemroot% (including the percent "%" signs) can safely be used without knowing it's actual value.
    • Add these three lines to the hosts file:
      (The first line is a comment. The next two lines do the actual work, but are specific to XCOM:Enemy Unknown 2012. Other games may have their own DNS names [i.e. prod.xcom.firaxis.com] and IP addresses [i.e. 65.118.245.165]. The '127.0.0.1' IP address is a local loopback address the prevents attempts to connect to either of the other addresses from ever leaving your computer.)
  • # Prevent Steam from Phoning Home
  • 127.0.0.1 prod.xcom.firaxis.com
  • 127.0.0.1 65.118.245.165
  • Save the file.

Restoring to Vanilla

Eventually you will need to patch your game and re-apply your mods, sometimes because you will desire to apply different mods or apply them in a different order. Here is how to restore your game to the latest version of the vanilla game:

Remove any and all installed Mods

This step is needed to ensure there are no conflicts that the following restoration of vanilla steps won't catch.

  • Follow the uninstall instructions provided with each Mod.
  • Check the My Games\XCOM - Enemy Unknown subfolders and backup any save game files from the XComGame\SaveData folder. In particular, DLCs install files under this folder and verify cache does not touch it.
  • Remove any mod files or simply delete all the subfolders under My Games\XCOM - Enemy Unknown. They will be recreated when you run the game again.

Take Steam back Online

  • Start Steam, and when prompted remain OFFLINE.
  • Select the Library (second menu line), which will display your library of installed Steam games.
  • Select a game title (i.e. XCOM: Enemy Unknown) and right-click on it to display the context menu.
  • Select Properties from the context menu.
  • Select the Updates tab.
  • In the Automatic updates field, click on the upside-down triangle at the right edge, and select Always keep this game up to date.
(This will restore automatic updates.)
  • Select the Steam Menu (top left, first line) > GO ONLINE > Restart the Steam App.

Update the Game

  • Select the Library (second menu line), which will display your library of installed Steam games.
  • Select a game title (i.e. XCOM: Enemy Unknown) and right-click on it to display the context menu.
  • Select Properties from the context menu.
  • Navigate to the LOCAL FILES tab and Select Verify integrity of game cache.
(Progress is indicated on the filename in the Steam Library).
  • When the verification is completed the number of files needing to be reacquired will be indicated. Close the window.
  • Double-click on the game title in the Library tab to launch the game.
  • Wait while the game is re-patched (progress is indicated on the filename in the Steam Library).
  • Once patched, right-click, select game Properties, and Verify cache again.
  • Once verified, while still 'online', play the game to the Main Menu at least TWICE.
  • The first time played, the game will install any files the verification process determined needed updating.
  • Take the opportunity to check/reset the game configuration options, particularly 'video'.
  • The second 'play' enables the save game files to 'sync' with the Steam servers.
To confirm a patch has been applied, you have to look in the Version.txt file located in the game base install path (i.e. Steam\steamapps\common\XCom-Enemy-Unknown\) and examine the Date and Changelist: entries. Patch version data may be found here.
  • Follow all the steps above to take Steam 'offline', and mod again.
  • Only after Steam is taken back 'offline', should you restore your backed up save games to the My Games\XCOM - Enemy Unknown\XComGame\SaveData folder.

Save Files

Often a player can find they have saved a large number of game files they subsequently have to scroll through in order to get at a desired file, and sometimes when the number of files gets over 100 find the scrolling is 'messed up'. And then you wonder why simply deleting them from the local drive folder still fails to eliminate them. The answer is that the files are being restored from the cloud automatically, and you aren't really getting rid of them.

Save game cloud syncing is the process of having local save game data automatically copied to or from cloud storage so the latest version of a given save state is present in both locations.

It can be useful to understand how the Steam Cloud servers sync save game files. A large number of save files (100+) can have indexing problems when displayed in game. The following information is derived from the article HOW TO DELETE FILES STORED IN STEAM CLOUD SERVERS on the SteamPowered Forums. (When I followed this guide I was unable to trigger the 'Cloud Sync Conflict dialog'. However, the "simpler but not as efficient" method of disabling the Steam Cloud first and then deleting files worked for me. I attributed the difference to the age of the technique description and later revisions to the Steam application and synching process.)

The Steam Game Save Locations article on the same site may also prove of some assistance in locating save files. That thread has grown quite lengthy, but the game save locations are now maintained as a wiki. The XCOM page of the SaveLocations wiki is here.

Downgrade EU to patch 4 Mod Note

Background

Steam Cloud is used to backup config files and save games online in order to access them from every computer you register with Steam. This feature can be enabled/disabled through two different dialogs:

  • Steam | Settings | Downloads + Cloud | Enable Steam Cloud synchronization for games which support it (affects all the games).
  • Right-click on <game name> | Properties | Updates | Enable Steam Cloud synchronization for <game name> (affects only the selected game).

Advantages

Cloud syncing has a number of benefits:

  • Automatic backup protects against catastrophic data loss like hard drive crashes.
  • Continue a game on another PC such as a laptop seamlessly.
  • Ability to store save games for long term retrieval (useful for series such as Mass Effect which spanned over 4 years).

Steam applications which support Cloud synching by default use the Steam Cloud service. Not all Steam games support this capability.

Alternatives

GameSave Manager: (Freeware) Supports many cloud storage services besides Steam, as well as alternate drives and directories.

How Steam Cloud synching works

Most of the time there are three versions of your save game files:

  • the original version stored in the game folder or in AppData (hereafter GameFolder)
Note: XCOM:EU 2012 puts the save game file in the <username>\My Documents\My Games\XCOM - Enemy Unknown\XComGame\SaveData folder (hereafter My Games). (The <Steam game install path>\Saves folder itself is left empty.)
In general the most important save location for XCOM:EU 2012 mod users is the My Games save folder. Consider references to the GameFolder in that case as meaning the My Games folder instead.
  • the cloud version stored in \Steam\userdata\<SteamID>\<AppID> (hereafter UserData)
<AppID> for XCOM:EU 2012 is 7, and it puts the REMOTECACHE.VDF file and "remote" sub-folder here.
  • the cloud version stored in Steam servers (hereafter Cloud)

When you start a game for the first time, the GameFolder savegame is created. When you close it, the GameFolder savegame is copied to the UserData savegame which is then subsequently synced as the Cloud savegame on the Steam Cloud servers.

When you start a game from another computer, if Steam has a Cloud savegame file on its servers but doesn't find a matching UserData savegame file on your computer, it will copy the Cloud savegame to the UserData folder. Steam Cloud automatically downloads the missing files each time you start Steam in "Online" mode.

UserData contents

In Steam\userdata (UserData) you should have 1 (or more) folder(s) corresponding to your Steam account ID (SteamID). Inside that folder you'll find a sub-folder for each game using Steam Cloud you have installed. The sub-folder name is the AppID of the game (found in the URL when you visit its store page: it's a number like 220 for Half-Life 2). (When you look in your Steam Library, the games which are synced to the cloud have a 'cloud icon' after their name.) In the game folder you'll find:

  • a remote folder: it contains all the files that are being synced up with Steam servers
  • a REMOTECACHE.VDF file: the file describe the properties (such as file size or modification date) of the files contained in the remote folder. _
NOTE: Some games don't have or use the GameFolder and write directly to the UserData folder, while others don't use the UserData "remote" sub-folder to store the save files. In this case, the REMOTECACHE.VDF file in the UserData folder points directly to the files located in the GameFolder.
  • In either case, the profile.bin file contains everything that is not stored in your character's savegame files. When deleting savegame files, this profile.bin file should NOT be deleted.

Common Problems

  • Game won't start after modding the EXE. This often appears as a generic Windows error "0xC0000142", indicating something thinks it is a corrupted file.
  • Mod changes do not appear to be in effect.
    • Ensure that you are running Steam in offline mode and have disabled auto updates. This may be restoring the vanilla files and reverting your mods.
    • Ensure that the hosts file has been modified (see #Modifying hosts file above) to prevent Steam from 'phoning home'. This may be restoring the vanilla files and reverting your mods.
    • Some tools used to apply mods or changes may need to use the RunAs Administrator option, either when launched or by enabling the Privilege Level under the Properties | Compatibility tab of the program in order to have the necessary privileges to effect the change. Those relying upon .NET Framework or other network based languages may be among these, at least in some instances.
    • The mod effect you are looking for may require the game to have advanced to meet necessary requirements, such as having researched particular Foundry Projects. Check the mod's documentation for the presence of different, earlier available effects or other means of verification.
  • The game doesn't seem to be using all of my system RAM. It seems to top out at roughly 2GB.

Troubleshooting

Finally, if you have problems with installing a mod see the following wiki article. Note that this document is one of those it will refer you to, so you might as well start by reviewing the material here.


References

Referred to by this article:


That refer to this article: