Monday, August 19, 2013

Guide: Creating Texmod Package Files (TPF) for ME Series Games

What is Texmod?


Texmod is a utility to browse, extract, save and modify textures in Direct3D 9 applications.
In order to share and distribute texture modifications, packages can be created which are compressed to prevent further modification.
This modding method allows you to temporarily replace any texture in your application without the need to use an application specific modding tool or replacing any files in your application's installation. Download Texmod here. For Mass Effect it is the natural counterpart to ME3Explorer, which allows for permanent texture replacement.

The application interface offers three modes:
  1. Package mode: If you're looking to run Texmods created by others, this is the correct mode. Add package files to a list and load them into the selected application. Packages on top of the list are loaded first.
  2. Logging mode: If you are looking to extract textures, this is the correct mode. Choose between several options and start in logging mode. You can browse through all loaded textures of the application and save the selected one in the output folder.
    You can also use this mode to test textures as you are creating them, without having to build a .tpf to test between edits or restarting your application.
  3. Package Build mode: If you are looking to create a Texmod package file, this is the correct mode. Create a package by selecting a definition file (.log) and entering your name and a comment.

Supported Formats

While Texmod supports most all file formats used in the ME Series, it can't extract nor load the ATI2N / 3DC / BC5 format that is used for normal maps in both ME1 and ME2.
Loading in or creating a tpf that contains them will not return an error, it will simply not display these textures when loaded in-game.

How to launch Mass Effect (1/2/3) with Texmod

Before you can use Texmod, you'll have to load the target application .exe properly ("Target Application" box in the top left corner). Depending on which game you want to launch and which Client you own them on, the technique for loading an exe correctly and launching with Texmod differs.

For the Origin / boxed copy of ME1 and ME2 you can launch "texmod.exe" and manually browse to the target application exe file ( "..\Mass Effect\Binaries\MassEffect.exe" and "..\Mass Effect 2\Binaries\ME2Game.exe") and select them. Simple.

Alternately, you can use a batch-file to automate the renaming process when launching through Origin.
1. Download this .rar containing both "texmod.bat" and "Texmod.exe" for ME2.
2. Place "Texmod.exe" and "texmod.bat" in the "..\\Origin Games\Mass Effect 2\Binaries" folder.
3. Launch "texmod.bat" and follow the instructions in the prompt in the correct order to go through the entire renaming process. Be sure to select "ME2Game.exe", NOT "MassEffect2.exe" in Texmod.
Unlike the renaming process for the Steam version of ME1/ME2, you will need to do this every time you launch.

For the Steam version of ME1 (and ME2) it's a little more complex the first time around:
1. Place "Texmod.exe" in the Binaries folder.
2. Rename "MassEffect.exe" (or  "MassEffect2.exe") to anything you want (example: "MassEffectOriginal.exe").
3. Rename "Texmod.exe" to "MassEffect.exe".
4. Launch "Masseffect.exe" (=renamed Texmod) through Steam.
5. Point Texmod to your original "Masseffect.exe" (now renamed)
This renaming process is only necessary the first time you set up, you can leave it like this and every time you launch ME1 or 2 through Steam (whichever you set up) it will launch Texmod instead and you can start the 'real' .exe through Texmod (example: "MassEffectOriginal.exe").

For ME3 you'll need to use a batch-file to automate the renaming process required when launching through Origin.
1. Download this .rar containing both texmod.bat and "Texmod.exe" for ME3.
2. Place "Texmod.exe" and "texmod.bat" in the "..\Origin Games\Mass Effect 3\Binaries\Win32" folder.
3. Launch "texmod.bat" and follow the instructions in the prompt in the correct order to go through the entire renaming process. Unlike the renaming process for the Steam version of ME1/ME2, you will need to do this every time you launch.

Tip:
It is advised you manually browse to and select your .exe under "Target Application". Not doing this can cause Texmod to stop functioning on occasion.

Logging mode explained

Once you've successfully added the .exe to "Target Application" you'll notice the checked options in Logging Mode are no longer grayed out. How you ultimately set this up is up to you. I'll give you some information on each option below.





Draw control and Texture info: This shows text information and controls in red in the top left corner of your screen.
Show texture in upper left corner: Speaks for itself, texture cycle overlay position is the top left corner expanding to the bottom-right.
Replace Texture: This applies a green overlay to objects a diffuse applies to when cycling over them using + and -. The overlay colour will be different for spec-maps (with and without alpha) and normal maps.
Alternative Method: Unknown.
Translucent: Lowers the opacity of the texture overlay.
Output format: Variety of formats available, I strongly advise using "DDS" to preserve alphas.
Log with: Key used to extract textures. Defaults to "Enter".
Output folder: Every successfully extracted texture will be saved to this folder.
DefFile: Location for the definition file you want to use. If you leave this open, Texmod will create a new definition file in the Output folder you selected whenever you extract a texture.

Basic controls for Logging mode in-game:
Numpad +   Select next texture
Numpad -    Select previous texture
Enter          Default logging key
*                 Turns filter mode on. With filter mode on, only textures current visible on screen will
                   be cycled through.
/                 Turns filter mode off. With filter mode off, all loaded textures can be cycled through.

Extracting textures

When extracting a texture the naming will always be similar to this:
MASSEFFECT3.EXE_0x487289A3.dds

The first part will reflect the application the texture was extracted from, the second part is the hash that is used to identify that particular texture with (0x487289A3). Texmod will also generate a file called "Texmod.def" in the same folder, but you don't really need it. I'll explain how to create these from scratch later in this guide.

While it's tempting to change the name of textures completely, I'd advise keeping the hash in there so you have an easy time creating manual definition files for Texmod Packaging and the textures can also be picked up in ME3Explorer TPFTools for matching.

Testing new textures in-game

You don't actually have to build a new .tpf every time you're looking to test a texture. You can also use Texmod logging mode to do this without having to restart your application.

When you launch in logging mode and have Draw control and Texture info turned on, you will see the following message at the top of your screen:
As you can see, it tells you the key to reload replacement textures is the comma ( , ), but this has never worked for me. Instead I need to use the period ( . ) key on my NumPad.

When you select a definition file under Logging Mode that includes textures you want to test, Texmod will automatically load these in whenever you launch with Texmod in logging mode.


If you then make changes to the loaded definition file or the textures linked in the definition file, you can reload these changes without leaving the game by hitting the period ( . ) key on your NumPad. The game will lock up momentarily as it reloads and changes become visible.

Creating a Definition File (.log)

To build a Texmod TPF using Package Build Mode or to test textures in Logging Mode, you'll need to create a definition file. Definition files list the hash for the texture you are going to replace and point to the location of the texture that is supposed to replace it. An example: 

Hash - Separator - Texture location
0x487289A3|D:\Projects\Texmod\Out ME3\skin\MASSEFFECT3.EXE_0x487289A3.dds

Now the texture location can be inserted relative to the location of the definition file as well, but I prefer using absolute paths to avoid any issues while building. To create one from scratch you can simply create a new text document (.txt) using notepad or wordpad.
Every texture should be defined on a new line in this file, so counting the number of lines counts the number of added Texures Texmod should return when you build your TPF with this definition file selected.

When you save the file, change the extension from .txt to .log. Feel free to give it whatever name is convenient for you.

Package build mode explained




Definition File: Definition file location for the mod you are planning to build.
Creator Name: Your name goes here, it will be visible when loading the tpf under Package Mode.
Comment: Specify what your Texmod does, also visible when loading the tpf under Package Mode.

When you have selected your definition file, filled in your name and added your comments, hit 'Build'. While processing, Texmod will display 'Started...' under Build Status and when completed it will pop up a save dialogue box for the TPF and it will show you under Build Status how many textures it packed into this newly created TPF.

This is a good way to double-check if Texmod packaged all your textures. If it hasn't, be sure to recheck the paths in the definition file.

Tip:
If you are unable to view file extensions in Windows, this can be changed in your folder options. While you have your folder selected, press "Alt+T" followed by "o" (aka in the menu go through Tools, Folder Options). Open the "View" tab and under "Files and Folders" un-check the box next to "Hide extensions for known file types".

Tip: If you have trouble opening DDS files, make sure that you have installed the appropriate plugin. While it might seem more convenient to work with other file-types, I personally advise against it as Mass Effect uses DXT1 and DXT5 compression for all textures apart from normal maps. To save as DXT you will need the DDS plugin. For Photoshop, it is located here.

Troubleshooting

  • Q: I get an error message with the text "D'OH". What should I do? 
This is a general error message used for nearly all exceptions. You can check several things here:
- Make sure you manually browse to the .exe for the game you are looking to launch.
- A TPF you are trying to load is corrupt
- A TPF you are trying to load is no longer in the location where Texmod expects it to be. Reload it.
- Your virus scanner has blocked TexMod's access to the target application executable file. Turn your virus scanner off, then launch TexMod. Once you are ingame you can turn your Virusscanner back on. You can also add texmod to your exception list. Some Virus scanners allow you to temporarily turn them off, after which time they turn back on automatically.
- Try running TexMod as an administrator, especially for Windows Vista or Windows 7.

  • Q: My anti-virus/anti-malware software claims that Texmod has a trojan in it. Is it safe to use it? 
If your anti-virus/anti-malware program uses heuristic detection, a program's ability to modify the way another program works, it might detect TexMod as a trojan. This is a false positive. You are safe to use Texmod as long as you make sure to download it from trusted sources only.

  • Q: I can't get Texmod to work (anymore). It won't load tpf's changes and logging mode doesn't show draw information or allow for texture extraction. 
- You changed or recently updated Antivirus software and it requires you whitelist Texmod again.
- You have software installed that provides an overlay effect in game. Texmod will not function with another overlay effect active. This includes (but is not limted to) Origin Ingame, steam overlay, voicechat overlays and AMD Gaming Evolved.
- You loaded in the wrong exe. For instance MassEffect2.exe instead of ME2Game.exe



Happy Modding!


5 comments:

  1. Hey, for anyone having trouble, I had to use the ME3 method for ME1 (for the Origin version).

    ReplyDelete
  2. This is not enough for other games, though. Every def I've looked at had a black NUL at the end, like you see in a .exe if you open it in NP++. This indicates there is more to it than text. Also the file path is not necessary, at least for some other games. Maybe it is for ME, I don't know for sure. Like Divinity 2, for example:

    0x359E5A68|3DIVINITY2.EXE_0x359E5A68.tga
    0x03DB9F5A|3DIVINITY2.EXE_0x03DB9F5A.png
    0xA1BBDEB9|2DIVINITY2.EXE_0xA1BBDEB9.dds
    0x6BEA90BF|2DIVINITY2.EXE_0xA1BBDEB9.dds
    [NUL]

    This is a .tpf that will work, but I don't know how to add the "black NUL" at the end. This is just a mod I extracted. I also know nothing of hex, so I'll never be able to make a def properly. Not if I don't even know where to look. HxD has always confused the daylights out of me.

    ReplyDelete
    Replies
    1. Adding the path is good practice for the ME series games, not adding the path has netted me tpf's that didn't work in the past. As to the .def, that's what a tpf spits out when extracted, not what you feed Texmod. Texmod takes .log files in package mode, which you can build as described in the guide.

      Delete
  3. Isn't there like a simple mod manager that can install mods like fall out and skyrim... this sounds to complicated.

    ReplyDelete
    Replies
    1. This Texmod guide is more geared towards modders, not mod users. For a mod user, you only need to read the section on how to launch.
      Once you have the exe selected, you can go straight into Package Mode and select which tpf's you want to load. If you have issues loading, check out the FAQ here.

      Modding ME1-3 is by definition not simple, because it did not have an official toolset. You have several options, either you use Texmod to temporarily apply texture mod TPF files, or you use ME3Explorer to permanently apply them. The .MOD format is specifically for ME3Explorer.

      You could also use MEM but it requires you convert mods into a format it can use (if I'm not mistaken) so that's not necessarily any easier.

      My advice would be, test texture mods with Texmod first, then permanently apply them with ME3Explorer. It has an extensive wiki and you can always ask for help onforum.

      Delete