Jump to content

Reskinning Step 1 : Duplicating game objects


Amineri

Recommended Posts

Was messing around a bit and figured out to duplicate existing game object package files, but changing the UE-referenced object name. By itself this doesn't affect anything, but creates a new object which can then be further altered (by hex editing the mesh or textures) in order to create actually new skins. I think that the new object references the same textures in the tfc file, so the two different objects couldn't have their textures altered via TexMod without further direct hex changes.

 

For my initial example I wanted to create a variant of the MEC Railgun. Here were the steps :

 

1) Duplicate Weapon_MEC_Railgun_SF.upk, with new name Weapon_MEC_Lasegun_SF.upk
2) Use HxD to edit name-table, changing :
2a) Weapon_MEC_Railgun to Weapon_MEC_Lasegun
2b) GD_MEC_Railgun to GD_MEC_Lasegun
3) Change DefaultContent.ini line to : WeaponPackageInfo=(ItemType=eItem_XPACK_BEGIN_CORPSES,ArchetypeName="Weapon_MEC_Lasegun.GD_MEC_Lasegun")
The last line is LongWar-specific, setting the XComWeapon model for the laser tier MEC weapon to the newly created model.
-------------
The reason for duplicating existing model packages instead of creating new packages with UDK is that weapons are quite complex. Weapons for example contain :
-- soldier ANIMSETS (e.g. CHH_MEC_MarkI_ANIMSET)
-- the weapon meshes, materials and textures (e.g. MECRailgun/Textures/MEC_Railgun_DIF)
-- sound files (e.g. SoundAmbience/BilletImpactDirt00)
-- shot particle effects (e.g. Weapon_MEC_Railgun/GD_MEC_Railgun_Shot/ShotFX)
We discovered the ANIMSET issue when we allowed equipping of solder LMGs (scaled in-game using Scale3 built-in method) to MECs. These weapons tried to force the solder ANIMSET (e.g. CHH_SoldierMale_ANIMSET) to be applied to MECs, with terrible-looking results.
IIRC, Wghost and Drakous made prior progress on modding the flag texture for armor models, which included hex modding the armor package to:
1) Directly replace low-res versions of textures
2) Change referenced tfc file for hi-res versions of textures
3) Creating a new tfc file containing the hi-res versions of textures
If something similar could be done here, it should be possible to create a new weapon model based on old, but with new textures.
There may also need to be some further namelist edits, but I can't verify that until the copied model is tested with some new textures.
Link to comment
Share on other sites

  • Replies 90
  • Created
  • Last Reply

Top Posters In This Topic

Only the name (file and NameTable) of the package have to be changed in order to create a "new" package from it. We did it with Liquid911 while experimenting with map streams and everything worked perfectly. There are two names for seek free packages, though: PackageName and PackageName_SF. Both need to be changed, afaik. Edited by wghost81
Link to comment
Share on other sites

IIRC, Wghost and Drakous made prior progress on modding the flag texture for armor models, which included hex modding the armor package to:
1) Directly replace low-res versions of textures
2) Change referenced tfc file for hi-res versions of textures
3) Creating a new tfc file containing the hi-res versions of textures
If something similar could be done here, it should be possible to create a new weapon model based on old, but with new textures.

 

I can confirm it is possible. Will start working on it asap.

Link to comment
Share on other sites

I've been trying to experiment with UDK to try and cook a package that creates a small tfc with just certain textures, but so far I haven't had much success. If it can be made to work, though, it might be an easier route to create LOD-enabled tfc files to support texture swapping in duplicated model packages.

Link to comment
Share on other sites

I'll be sure to regularily check on your progress for this very specific issue as i think it may solve something you surely know about by now; LaserLance & RailGun doubling (as hinted about in another thread). That's why you started looking into this i gather -- not to insult your intelligence even further, Amineri. :wink:

 

Beyond *THAT*, there's also a vast abyss of similar features that could be reached with a magic submarine filled to the Pacific-Rim by coding arsenal(s) and nuclear graphical brushes. Won't extrapolate on the exact perpectives... as you (again) can certainly deduct the water pressure at these oceanic depths.

 

Let's just yell - Armor Decos & customized colors for weapons and helmets, for now. :D

 

And -- 128 flags instead of 32, only.

 

http://s9.postimg.org/kybk47svz/Quadruple_The_Flags_count.png

 

Effectively quadrupling the potential available Hi-Low res Countries on Backs & B_arr_acks.

UV coordinates mapping included.

:smile:

Edited by Zyxpsilon
Link to comment
Share on other sites

Atm I have tfc done and smaller images data ready and creating a mod file to patch it.

 

For flags I have been pounding around changing Texture parameter in MaterialExpressionTextureSampleParameter2D of CHH_Soldiers master material with scripts, but no joy. The idea is to swap textures somehow, because what part of texture is displayed (like 0,25 x 0,125 in vanilla) is defined by UV coordinates in 3D model mesh.

Edited by Drakous79
Link to comment
Share on other sites

Here's a walkthrough. At the end you can find link to tfc file and complete mod file.

 

http://i.imgur.com/7QAMUn4.jpg

Added alien face with bullets and some blue glow.

 

1. Texture extraction.

 

Place umodel.exe and SDL.dll into XEW\XComGame\CookedPCConsole\, open command line to that location and run command:

umodel -lzo -export -noanim Weapon_MEC_Railgun_SF.upk

An option -out=PATH can be used in the command above to store extracted content in a folder of your chose.

 

New folder Weapon_MEC_Railgun_SF is created inside CookedPCConsole folder or at your chosen PATH. It contains Texture2D folder with all textures.

 

2. Changing the texture and importing it into UDK.

 

Find MECRailgun_DIF.tga and copy (duplicate with new name) it to MECLasegun_DIF.tga. Edit and save.

 

Start UDK. Click on Import button in Content Browser and select MECLasegun_DIF.tga. When import dialogue appears, enter your package name (I used MyPackage), tick Compression No Alpha and select LODGroup TEXTUREGROUP_Weapon. Compression Settings can stay on TC_Default. Click OK button. Next right click on your package and save it.

 

3. Cooking.

 

To get proper TextureFileCache (tfc) data, the package has to be cooked. Edit UDKGame\Config\DefaultEngine.ini and add your package:

[Engine.PackagesToAlwaysCook]
+SeekFreePackage=MyPackage

Run UnrealFrontend and click Cook / Cook Packages. Now go to UDKGame\CookedPC\ and grab MyPackage_SF.upk and Textures.tfc.

 

4. Custom TFC and mod creation.

 

I will be using a term mip or mips (Wikipedia). A mip is an image in a sequence of textures called Mipmap. Mipmap is optimized collection of images that accompany main texture, intended to increase rendering speed, reduce stress on GPU and reduce aliasing artifacts. Each mip is progressively lower resolution representation of the same image (power of two smaller than the previous one).

 

Also we used LODGroup TEXTUREGROUP_Weapon. In DefaultEngine.ini is specified that the biggest texture in this group is 1024 px.

TEXTUREGROUP_Weapon=(MinLODSize=256,MaxLODSize=1024,LODBias=0,MinMagFilter=aniso,MipFilter=point)

So, decompress your UDK created package and open it with HxD or UE Explorer. I used HxD with enabled option "Allow multiple program instances in HxD." in Extras / Options. I had MyPackage_SF.upk on left half of screen and Textures.tfc on right half of the screen.

Search your upk for hex 0B 00 00 00 11 00 00 00 (11 mips stored, compressed mip follows) and you should land at the start where mips are defined:

0B 00 00 00
11 00 00 00 00 00 08 00 C1 69 04 00 84 05 C3 01 00 04 00 00 00 04 00 00
11 00 00 00 00 00 02 00 EC 3C 01 00 98 C8 C1 01 00 02 00 00 00 02 00 00
11 00 00 00 00 80 00 00 4E 5A 00 00 4A 6E C1 01 00 01 00 00 00 01 00 00
11 00 00 00 00 20 00 00 40 19 00 00 0A 55 C1 01 80 00 00 00 80 00 00 00

Mips follow a structure described in UPK_Texture2D.pdf (Dropbox).

Compressed mip example:
11 00 00 00 - Compressed mip follows
00 00 08 00 - Uncompressed size
C1 69 04 00 - Compressed size
84 05 C3 01 - TFC offset
00 04 00 00 - Width 1024
00 04 00 00 - Height 1024

In upk, mips are defined and stored from the biggest to the smallest. Also 1x1 and 2x2 mips are substituted with 4x4 mip.

 

In tfc, mips are stored from the smallest to the biggest. Tfc file contains dds files stripped of their header and compressed with LZO-1x. Each mip starts with C1 83 2A 9E.

In this case, there are 128x128, 256x256, 512x512 and 1024x1024 mips stored in Textures.tfc and it is time to copy them into new file. You need to locate tfc offset for 128x128 mip (don't forget it is written in little endian) and mark everything from the offset to the end of the file (CTRL+Shift+End). It can be done this way as long as only one texture was added to the tfc. Otherwise it is needed to mark data by offset and compressed size.

 

Copy and paste the data into new file and save it as TestTextures.tfc or as you wish to XEW\XComGame\CookedPCConsole\.

Now to create mod file to update new tfc compressed sizes and offsets and new tfc name. I am using PatcherGUI.

 

For new tfc offsets, you can just search for C1 83 2A 9E and write them in little endian.

 

For new compressed sizes, you can use data from UDK created package.

 

Mod file - compressed images:

 

 

DESCRIPTION=New DIF texture for MEC's Railgun.

UPK_FILE=Weapon_MEC_Lasegun_SF.upk

[ADD_NAME_ENTRY]
<%u 13>
<%t "TestTextures">
<x00000000>
<x00070010>

OBJECT=MECRailgun.Textures.MECRailgun_DIF

// Link to new name TestTextures
REL_OFFSET=0xb4
MODDED_CODE=<TestTextures>

// Update TFC compressed sizes and offsets
REL_OFFSET=0x159 // 1024x1024
[MODDED_HEX]
C1 69 04 00 // comp. size
7A B0 01 00 // offset

REL_OFFSET=0x171 // 512x512
[MODDED_HEX]
EC 3C 01 00 // comp. size
8E 73 00 00 // offset

REL_OFFSET=0x189 // 256x256
[MODDED_HEX]
4E 5A 00 00 // comp. size
40 19 00 00 // offset

REL_OFFSET=0x1a1 // 128x128
[MODDED_HEX]
40 19 00 00 // comp. size
00 00 00 00 // offset

 

 

 

Next update mod file with uncompressed data of mips smaller than 128x128 taken from UDK created package.

Uncompressed mip example:
00 00 00 00 - Uncompressed image
08 00 00 00 - Uncompressed size
08 00 00 00 - Compressed size same as uncompressed size
EF 13 00 00 - Absolute offset in upk pointing to byte after this
26 32 87 31 FF FF FF FF - Image data
04 00 00 00 - Width
04 00 00 00 - Height

If I need to copy out the data, I place a cursor just before image data and mark a block equal to uncompressed size.

 

Mod file - uncompressed images:

 

 

// Update uncompressed image data for mips smaller than 128x128

REL_OFFSET=0x1c1 // 64x64
[MODDED_HEX]
48 4A 82 10 35 0D 03 82 CA 52 E7 41 EE AA FF 55 AE 73 E7 41 FF FF C2 75 CA 5A A6 31 AA AA FF 55 86 31 69 4A 55 55 AA 00 EF 7B C7 39 3F 3F 95 55 EF 7B 65 29 00 00 A9 FF EF 7B A7 39 00 00 AA 55 EC 62 82 10 54 58 54 57 A6 31 62 10 55 D5 B5 2D A6 31 A3 18 D5 AB 02 00 A6 31 62 10 5F EA 80 00 45 29 00 00 FF FF FC F0 E3 18 31 14 C0 40 40 40 52 04 82 10 58 58 58 58 28 42 82 10 55 82 80 82 69 4A 07 42 A9 A9 A9 A9 69 4A E7 41 AA AA E7 67 48 4A A6 31 F8 26 03 00 38 C6 08 42 55 75 29 83 F3 9C 28 42 55 55 5E 54 28 42 04 21 6A 40 70 5C C3 18 04 21 AA 55 55 55 04 21 82 10 AA 00 00 00 04 21 82 10 56 54 D4 14 EB 5A C3 18 FD FD BF AF 5C 7F 65 29 55 55 F5 09 BA 76 65 29 55 55 57 58 A6 31 62 10 60 E0 80 80 5E 0F E3 18 95 95 95 95 B3 04 82 10 58 58 58 58 28 42 24 29 C2 C2 C2 C2 69 4A E7 41 AB AB AB AD 69 4A A6 39 EF EE EA AA CA 5A 45 29 AA AA AA FF 38 C6 08 42 89 09 E5 55 50 8C E3 18 FC FE 7F 5F 86 31 C3 18 FC FF FF 55 C3 18 04 21 55 55 55 00 04 21 41 00 00 00 00 AA 04 21 82 10 94 94 14 15 86 31 04 21 EF F5 CA AA 3C 8F 86 19 03 03 03 0D 1C 87 A6 29 50 70 50 5C 86 31 82 10 E8 FA 80 80 DB 06 E4 20 95 95 95 95 51 04 62 10 58 58 58 58 28 42 85 31 42 42 42 42 E7 39 62 10 00 AA F5 AD 08 42 82 10 00 A2 5F 57 C7 39 61 08 00 80 D5 D5 04 21 28 42 AA 00 00 00 69 52 04 21 FF 55 55 55 A6 39 04 21 EA 55 55 55 28 4A 04 21 FF 55 55 55 28 42 04 21 3F D5 55 55 04 21 62 10 D7 56 54 54 E7 39 82 10 AA AB A9 A5 2C 3B 65 29 25 55 55 55 29 32 24 29 F4 FD FF FF 86 31 82 10 E0 70 58 56 AF 1B 62 10 3D 95 55 55 62 10 71 04 09 0B 00 00 28 42 62 10 80 82 55 55 45 29 A2 10 01 03 03 29 45 29 00 00 FC F8 F0 F8 C3 18 41 08 3F 3F FF EF 45 29 61 08 AA 02 57 55 66 31 00 00 AA 00 FF FF 65 29 62 10 AA 00 55 55 62 08 86 31 AA A9 A0 80 04 21 04 19 80 20 02 00 04 21 82 10 54 E0 00 00 04 21 82 10 15 55 78 E0 65 29 62 10 00 AD D5 55 82 10 65 29 95 0A 00 A0 04 21 82 10 55 3D FA 7A 04 21 20 00 FF 00 00 02 E3 18 21 08 FF FF F8 80 62 10 61 10 AA AA AA BA 49 4A 62 10 55 75 09 0A 4D 6B A2 10 55 09 00 00 82 10 61 08 F0 50 54 E4 61 08 82 10 90 A4 AA AA 62 10 81 08 AA AA AA AA E3 18 41 08 3F 7F FF FF 45 29 00 00 FF FC FB CF C7 39 82 10 FF FD F5 35 04 21 8A 52 00 00 00 02 04 21 C3 18 78 7A 68 A0 65 29 00 00 FF BF 3F 3F C7 39 82 10 FD FF FF FF 25 21 C3 18 5F 5F 5F 5F 04 21 82 10 01 0D 0D 85 A6 31 04 21 B5 A5 A5 E5 82 10 04 21 09 21 10 10 2C 63 62 10 FD 95 15 15 8E 73 C3 18 C0 40 40 40 E7 39 62 10 55 58 58 58 65 29 00 00 FF FF FF 00 A6 31 62 10 55 AB AB 00 86 31 62 10 55 57 57 00 A6 31 62 10 B5 95 35 00 A6 39 62 08 35 8B 5B 55 28 42 82 10 A8 FF 55 55 86 31 62 10 00 AA 55 55 65 29 00 00 3E 3E 3F 3F 04 21 E4 18 82 82 80 80 04 21 82 10 EA EA FA 7A 04 21 82 10 AD 09 09 AB 65 29 82 10 0E 0E 8E 5F 04 21 20 00 CB EC E0 FF 8E 73 62 10 35 B5 55 55 6D 6B 82 10 C0 8A FF 55 28 42 62 10 58 5A FB 25 0F 84 65 29 FD FD FD FF 69 4A 28 4A AA EA FF FF 69 4A 28 4A AA FA FF FF 89 52 28 42 FF FF FF 7F EB 5A 82 10 55 55 7F 6A 62 10 81 08 AA AA AA AA C3 18 41 08 FF FF FF 2F 45 29 00 00 3F FF FF FF 49 4A 62 10 FF BD 55 55 86 31 82 10 5F DC 60 55 C3 18 41 08 00 A8 55 FF C3 18 41 08 DC E5 F5 FF 28 42 61 08 42 42 42 42 45 29 62 10 55 FE A8 A8 62 10 E4 20 00 AA 55 55 65 29 62 10 15 FF FE AE 48 4A 41 08 00 AA FF FF 48 4A 41 08 00 AA FF FF 48 4A 41 08 00 AA FF FF 48 4A 41 08 00 AA FF FF 07 42 C3 18 40 6A 55 FF 04 21 20 00 FF AA AA 00 04 21 82 10 2D 0B 2A 00 45 29 C3 18 7A 82 AB AE E7 39 82 10 AD AD 0F AE 28 42 A6 31 BF FD 02 FD 69 4A E7 39 7F 5D A0 55 28 42 04 21 6A 6A 40 6A 61 10 89 52 16 16 16 16 86 31 04 21 54 56 56 56 04 21 82 10 00 80 58 56 04 21 82 10 00 AA F5 55 04 21 82 10 00 00 02 AF 04 21 82 10 00 00 00 AA E7 39 82 10 FF FF FF F3 04 21 CB 5A 00 00 00 80 04 21 A3 10 00 00 00 AA 04 21 CB 5A 00 00 00 08 04 21 62 08 00 80 80 58 45 29 62 08 0A AA 57 15 6D 3B C3 20 FD F5 57 0F D2 9C 82 10 FF FF 55 55 28 42 A2 10 00 20 55 F5 28 42 82 10 C0 E8 55 57 61 08 89 52 16 16 16 16 65 29 62 10 A8 68 57 55 82 10 41 08 AA AA AA 2A 82 10 41 08 AA AA AA 00 E7 39 C3 18 A9 09 AD F5 49 4A 24 21 55 70 FA 55 86 31 24 21 55 FF 00 FF A6 31 E4 20 FF FF 00 AA C7 39 24 21 55 FF 02 FF 28 42 04 21 55 FF AA FF A6 31 82 10 55 54 B4 56 E7 39 62 10 A5 5A 55 02 79 66 A2 18 09 09 F5 FF 6D 5B 82 10 56 56 55 4A 24 11 79 66 A0 58 58 A0 14 45 A2 10 57 5C 5C 57 28 42 61 08 42 42 42 42 62 10 81 08 AA AA AA AA 28 42 62 10 FD 09 09 0B CB 5A 65 31 55 62 40 EA A6 39 65 29 0A AB AF 4F 07 42 04 21 AA AA AA FF E7 39 65 29 02 AA AA 56 AA 5A 65 29 FF FF FF 75 E7 39 04 21 78 58 5C 56 65 29 82 10 55 78 2A AA E7 39 82 10 D5 DD AF 0E CF 7B 28 42 A9 A9 AB AB 8E 73 EB 5A EA EA EA EA 6D 6B C7 39 40 C0 80 00 A6 19 62 10 0D 55 55 55 24 19 00 08 FC FF FF FF 07 42 61 10 42 42 42 42 04 21 00 00 FF AF 03 03 69 4A 62 10 D5 FF 00 0A 69 4A A2 10 56 FF 00 00 69 52 A2 10 55 FF 00 00 69 52 A2 10 55 FF 00 00 69 52 A3 18 55 FF 00 00 89 52 C3 18 55 7F 80 20 04 21 C3 18 BF 89 25 B5 45 29 C3 18 2A 3F BA D7 EB 5A 24 21 E5 F5 35 35 6D 6B CB 5A 0D 0D 0B 2B 6D 6B 2C 63 C0 80 20 AA 6D 6B CB 5A 00 02 83 E3 28 42 62 10 55 56 54 54 62 10 81 08 AA AA AA AA C3 18 41 08 C0 DF 93 93 04 21 41 08 01 01 D7 DE 28 4A 65 29 0D 09 A9 A9 48 4A C7 39 61 C3 EB FF 69 4A C6 39 18 38 BA FF 69 4A C6 39 86 8E EF EF 69 4A A6 39 61 E3 FB FB 69 52 E7 39 1C 1C 9E DF 04 21 41 08 BA 7B C9 2D 04 21 62 08 5F 55 A5 63 8A 52 82 10 3D 37 D5 F5 EB 5A 65 29 00 8B 55 55 EB 5A 65 29 00 AA 55 55 0C 63 65 29 80 0A 55 55 0C 63 A2 10 56 50 7F FF 28 42 62 10 55 55 FF 80 28 42 82 10 7D FD 7D 5C 86 31 61 08 58 5B BB 55 08 42 65 29 8D 0B AD A9 28 42 86 31 E3 A2 79 BA 28 42 86 31 38 20 9E AE 28 42 86 31 8E 08 E7 AE 28 42 65 31 E3 83 E9 AA 28 42 86 31 38 20 DB EB E7 39 A2 18 D7 5E 56 00 C7 39 61 08 55 55 FF 00 E7 39 61 08 55 55 FF 00 C7 39 C3 18 AA AA 55 00 8A 52 C3 18 FF FF 55 EA 65 29 00 00 00 00 FF FF E7 39 62 08 1A 1E 35 25 49 4A 07 42 AF AF AF AB CA 5A 82 10 7E 7E 7E 7E 62 10 61 10 EA AA AA AA 48 4A 04 21 85 A5 8D AB 69 4A 65 29 47 45 47 BA 28 42 65 31 49 69 CB AA 49 4A 65 29 F1 51 F1 AE 28 4A 65 29 53 53 52 AA 28 42 65 31 F8 5C F8 AA 69 4A 65 31 94 D6 94 EB 69 4A 04 21 3E 1E 3E AA 28 4A 65 29 2D B5 2F AA 48 4A 65 29 C5 C5 C7 BA 69 4A 45 29 4F 6D 4F 6A 62 10 61 10 AB AB AB AB 28 42 82 10 25 05 85 75 08 42 82 10 00 0A BD 55 A6 31 62 10 68 7A 5E 5F

REL_OFFSET=0x9d9 // 32x32
[MODDED_HEX]
28 42 C3 18 01 02 00 00 75 AD 28 42 55 5F 55 25 8D 73 86 31 3F D5 7F 7C 75 AD 04 21 AA FF 55 55 2C 63 82 10 56 D7 F5 B5 F7 65 45 29 55 55 55 63 EC 22 A2 18 15 17 1F 1F A2 28 CF 1B A1 A1 A1 A1 28 42 82 10 00 00 8A 7D 34 A5 C3 18 2F BF 5F 55 24 21 0C 63 09 02 00 00 66 31 E3 18 FF 55 2A FF 65 29 82 10 2F 0D 05 37 9D 8F A7 29 42 63 55 55 AA 22 41 18 3F 3E 3E 57 62 18 6D 23 A1 A1 A1 00 4D 6B 41 08 7F 7F B5 0B 24 21 00 00 0B FF FF FF 45 29 00 00 00 FF FF FF 04 21 20 00 00 0B 0E 3A 45 29 41 08 FE EA AA A8 45 29 82 10 E2 D5 B5 A9 04 21 82 10 FD 0E 3E 9E 65 29 00 00 FF FE E2 B2 AE 73 82 10 8D 89 A9 D5 28 42 62 10 57 F6 06 0B 48 4A 82 10 5D FA 00 00 28 4A 61 08 BD 7B 50 A0 65 29 00 00 00 FF FF FF 45 29 62 10 AB A9 2D 55 24 21 62 10 BE BE FC 58 E7 39 82 10 5B 7F 85 85 45 29 82 10 57 AA A8 78 E7 39 82 10 0D FF FF F5 E7 39 82 10 00 FF FF EF E7 39 82 10 80 FF FF FB 45 29 41 08 BF AA AA E8 69 3A 82 18 9F BF BF 35 07 42 A2 10 02 00 00 D5 07 42 A2 10 88 08 08 05 49 4A 62 10 5F 55 B5 35 28 4A 82 10 B5 F5 A8 A0 E7 39 45 29 54 D7 2A EF C7 39 E3 18 FF AA C0 E2 86 31 82 10 7A E0 77 2A BA 8E 45 31 35 D5 FF FF F3 6C 82 10 37 3F 5A 5A CB 3A 82 18 A4 E4 E5 E5 28 42 82 10 D5 0D 2D 25 89 52 04 21 55 00 AA AA 89 52 04 21 55 00 A2 AA 28 42 82 10 FF D0 50 D0 49 4A 82 10 BF 3F 35 D5 4D 6B 65 29 02 00 AA 55 2C 63 82 10 50 70 60 FF 86 31 82 10 55 55 F5 C0 07 42 82 10 27 2D 35 25 08 42 85 31 8A AA F9 AB 28 42 65 31 A2 BB 66 EA E7 39 C3 18 70 A0 08 00 E7 39 62 10 55 AA 20 00 E7 39 45 29 FF 7F 21 02 E7 39 62 10 AA 15 15 95 08 42 82 10 E0 E0 60 7D

REL_OFFSET=0xbf1 // 16x16
[MODDED_HEX]
EF 7B 45 29 EF 3F 3F 55 4D 6B 04 21 0B 5E 56 55 9A 7E 25 21 55 F5 85 55 24 29 AB 12 9C 9C 9C 28 EB 5A A2 10 57 53 73 BB 48 4A 62 10 FF D5 FF C0 04 21 82 10 AE B8 20 95 86 31 82 10 5D 6F 6F 17 08 42 61 08 BF FF 97 89 C7 39 04 21 EA 55 FE CA 6E 5B 04 21 55 D5 15 05 AE 5B C3 18 FF FF F3 D4 E7 39 41 08 03 03 03 01 89 52 C3 18 6A 6A EA AA 2C 63 E3 18 0D AD F5 FF 2C 63 61 08 5C FE EF FD

REL_OFFSET=0xc89 // 8x8
[MODDED_HEX]
AA 52 C3 18 22 72 56 EE 51 4C E3 18 FD F1 55 55 E7 39 04 21 F5 E9 83 83 EB 52 04 21 F5 C1 61 DF

REL_OFFSET=0xcc1 // 4x4
[MODDED_HEX]
69 42 C3 18 88 5E AF AA

REL_OFFSET=0xce1 // 4x4
[MODDED_HEX]
08 42 65 21 EE BB EE BB

REL_OFFSET=0xd01 // 4x4
[MODDED_HEX]
26 32 87 31 FF FF FF FF

 

 

 

5. Game integration.

 

Find Weapon_MEC_Railgun_SF.upk in XEW\XComGame\CookedPCConsole\ and copy (duplicate with new name) it to Weapon_MEC_Lasegun_SF.upk.

 

Edit DefaultContent.ini and change:

WeaponPackageInfo=(ItemType=eItem_Railgun,ArchetypeName="Weapon_MEC_Railgun.GD_MEC_Railgun")
to
WeaponPackageInfo=(ItemType=eItem_Railgun,ArchetypeName="Weapon_MEC_Lasegun.GD_MEC_Lasegun")

Also find this section and add our new package:

[Content.MapContent]
Map=$ALL
Package=UICollection_Common
Package=Weapon_MEC_Lasegun

Save changes.

Edit mod file and add few rename rules:

RENAME=Weapon_MEC_Railgun:Weapon_MEC_Lasegun // Package name?
RENAME=Weapon_MEC_Railgun_SF:Weapon_MEC_Lasegun_SF // File name?
RENAME=GD_MEC_Railgun:GD_MEC_Lasegun // Archetype?
RENAME=MECRailgun_DIF:MECLasegun_DIF // DIF texture, in case name matters for cash.

Once finished, run the mod and check the gun in the game.

 

6. Final notes.

 

In barracks there is Railgun texture, but in mission is Lasegun texture. In order to have correct texture in barracks, I think Lasegun texture should be inserted into StrategyResources_SF.upk too.

 

The issue above is solved by adding the package to [Content.MapContent] section of DefaultContent.ini under Map=$ALL.

---

Complete mod file:

 

 

DESCRIPTION=New DIF texture for MEC's Railgun.

UPK_FILE=Weapon_MEC_Lasegun_SF.upk

[ADD_NAME_ENTRY]
<%u 13>
<%t "TestTextures">
<x00000000>
<x00070010>

OBJECT=MECRailgun.Textures.MECRailgun_DIF

// Link to new name TestTextures
REL_OFFSET=0xb4
MODDED_CODE=<TestTextures>

// Update TFC compressed sizes and offsets
REL_OFFSET=0x159 // 1024x1024
[MODDED_HEX]
C1 69 04 00 // comp. size
7A B0 01 00 // offset

REL_OFFSET=0x171 // 512x512
[MODDED_HEX]
EC 3C 01 00 // comp. size
8E 73 00 00 // offset

REL_OFFSET=0x189 // 256x256
[MODDED_HEX]
4E 5A 00 00 // comp. size
40 19 00 00 // offset

REL_OFFSET=0x1a1 // 128x128
[MODDED_HEX]
40 19 00 00 // comp. size
00 00 00 00 // offset

// Update uncompressed image data for mips smaller than 128x128

REL_OFFSET=0x1c1 // 64x64
[MODDED_HEX]
48 4A 82 10 35 0D 03 82 CA 52 E7 41 EE AA FF 55 AE 73 E7 41 FF FF C2 75 CA 5A A6 31 AA AA FF 55 86 31 69 4A 55 55 AA 00 EF 7B C7 39 3F 3F 95 55 EF 7B 65 29 00 00 A9 FF EF 7B A7 39 00 00 AA 55 EC 62 82 10 54 58 54 57 A6 31 62 10 55 D5 B5 2D A6 31 A3 18 D5 AB 02 00 A6 31 62 10 5F EA 80 00 45 29 00 00 FF FF FC F0 E3 18 31 14 C0 40 40 40 52 04 82 10 58 58 58 58 28 42 82 10 55 82 80 82 69 4A 07 42 A9 A9 A9 A9 69 4A E7 41 AA AA E7 67 48 4A A6 31 F8 26 03 00 38 C6 08 42 55 75 29 83 F3 9C 28 42 55 55 5E 54 28 42 04 21 6A 40 70 5C C3 18 04 21 AA 55 55 55 04 21 82 10 AA 00 00 00 04 21 82 10 56 54 D4 14 EB 5A C3 18 FD FD BF AF 5C 7F 65 29 55 55 F5 09 BA 76 65 29 55 55 57 58 A6 31 62 10 60 E0 80 80 5E 0F E3 18 95 95 95 95 B3 04 82 10 58 58 58 58 28 42 24 29 C2 C2 C2 C2 69 4A E7 41 AB AB AB AD 69 4A A6 39 EF EE EA AA CA 5A 45 29 AA AA AA FF 38 C6 08 42 89 09 E5 55 50 8C E3 18 FC FE 7F 5F 86 31 C3 18 FC FF FF 55 C3 18 04 21 55 55 55 00 04 21 41 00 00 00 00 AA 04 21 82 10 94 94 14 15 86 31 04 21 EF F5 CA AA 3C 8F 86 19 03 03 03 0D 1C 87 A6 29 50 70 50 5C 86 31 82 10 E8 FA 80 80 DB 06 E4 20 95 95 95 95 51 04 62 10 58 58 58 58 28 42 85 31 42 42 42 42 E7 39 62 10 00 AA F5 AD 08 42 82 10 00 A2 5F 57 C7 39 61 08 00 80 D5 D5 04 21 28 42 AA 00 00 00 69 52 04 21 FF 55 55 55 A6 39 04 21 EA 55 55 55 28 4A 04 21 FF 55 55 55 28 42 04 21 3F D5 55 55 04 21 62 10 D7 56 54 54 E7 39 82 10 AA AB A9 A5 2C 3B 65 29 25 55 55 55 29 32 24 29 F4 FD FF FF 86 31 82 10 E0 70 58 56 AF 1B 62 10 3D 95 55 55 62 10 71 04 09 0B 00 00 28 42 62 10 80 82 55 55 45 29 A2 10 01 03 03 29 45 29 00 00 FC F8 F0 F8 C3 18 41 08 3F 3F FF EF 45 29 61 08 AA 02 57 55 66 31 00 00 AA 00 FF FF 65 29 62 10 AA 00 55 55 62 08 86 31 AA A9 A0 80 04 21 04 19 80 20 02 00 04 21 82 10 54 E0 00 00 04 21 82 10 15 55 78 E0 65 29 62 10 00 AD D5 55 82 10 65 29 95 0A 00 A0 04 21 82 10 55 3D FA 7A 04 21 20 00 FF 00 00 02 E3 18 21 08 FF FF F8 80 62 10 61 10 AA AA AA BA 49 4A 62 10 55 75 09 0A 4D 6B A2 10 55 09 00 00 82 10 61 08 F0 50 54 E4 61 08 82 10 90 A4 AA AA 62 10 81 08 AA AA AA AA E3 18 41 08 3F 7F FF FF 45 29 00 00 FF FC FB CF C7 39 82 10 FF FD F5 35 04 21 8A 52 00 00 00 02 04 21 C3 18 78 7A 68 A0 65 29 00 00 FF BF 3F 3F C7 39 82 10 FD FF FF FF 25 21 C3 18 5F 5F 5F 5F 04 21 82 10 01 0D 0D 85 A6 31 04 21 B5 A5 A5 E5 82 10 04 21 09 21 10 10 2C 63 62 10 FD 95 15 15 8E 73 C3 18 C0 40 40 40 E7 39 62 10 55 58 58 58 65 29 00 00 FF FF FF 00 A6 31 62 10 55 AB AB 00 86 31 62 10 55 57 57 00 A6 31 62 10 B5 95 35 00 A6 39 62 08 35 8B 5B 55 28 42 82 10 A8 FF 55 55 86 31 62 10 00 AA 55 55 65 29 00 00 3E 3E 3F 3F 04 21 E4 18 82 82 80 80 04 21 82 10 EA EA FA 7A 04 21 82 10 AD 09 09 AB 65 29 82 10 0E 0E 8E 5F 04 21 20 00 CB EC E0 FF 8E 73 62 10 35 B5 55 55 6D 6B 82 10 C0 8A FF 55 28 42 62 10 58 5A FB 25 0F 84 65 29 FD FD FD FF 69 4A 28 4A AA EA FF FF 69 4A 28 4A AA FA FF FF 89 52 28 42 FF FF FF 7F EB 5A 82 10 55 55 7F 6A 62 10 81 08 AA AA AA AA C3 18 41 08 FF FF FF 2F 45 29 00 00 3F FF FF FF 49 4A 62 10 FF BD 55 55 86 31 82 10 5F DC 60 55 C3 18 41 08 00 A8 55 FF C3 18 41 08 DC E5 F5 FF 28 42 61 08 42 42 42 42 45 29 62 10 55 FE A8 A8 62 10 E4 20 00 AA 55 55 65 29 62 10 15 FF FE AE 48 4A 41 08 00 AA FF FF 48 4A 41 08 00 AA FF FF 48 4A 41 08 00 AA FF FF 48 4A 41 08 00 AA FF FF 07 42 C3 18 40 6A 55 FF 04 21 20 00 FF AA AA 00 04 21 82 10 2D 0B 2A 00 45 29 C3 18 7A 82 AB AE E7 39 82 10 AD AD 0F AE 28 42 A6 31 BF FD 02 FD 69 4A E7 39 7F 5D A0 55 28 42 04 21 6A 6A 40 6A 61 10 89 52 16 16 16 16 86 31 04 21 54 56 56 56 04 21 82 10 00 80 58 56 04 21 82 10 00 AA F5 55 04 21 82 10 00 00 02 AF 04 21 82 10 00 00 00 AA E7 39 82 10 FF FF FF F3 04 21 CB 5A 00 00 00 80 04 21 A3 10 00 00 00 AA 04 21 CB 5A 00 00 00 08 04 21 62 08 00 80 80 58 45 29 62 08 0A AA 57 15 6D 3B C3 20 FD F5 57 0F D2 9C 82 10 FF FF 55 55 28 42 A2 10 00 20 55 F5 28 42 82 10 C0 E8 55 57 61 08 89 52 16 16 16 16 65 29 62 10 A8 68 57 55 82 10 41 08 AA AA AA 2A 82 10 41 08 AA AA AA 00 E7 39 C3 18 A9 09 AD F5 49 4A 24 21 55 70 FA 55 86 31 24 21 55 FF 00 FF A6 31 E4 20 FF FF 00 AA C7 39 24 21 55 FF 02 FF 28 42 04 21 55 FF AA FF A6 31 82 10 55 54 B4 56 E7 39 62 10 A5 5A 55 02 79 66 A2 18 09 09 F5 FF 6D 5B 82 10 56 56 55 4A 24 11 79 66 A0 58 58 A0 14 45 A2 10 57 5C 5C 57 28 42 61 08 42 42 42 42 62 10 81 08 AA AA AA AA 28 42 62 10 FD 09 09 0B CB 5A 65 31 55 62 40 EA A6 39 65 29 0A AB AF 4F 07 42 04 21 AA AA AA FF E7 39 65 29 02 AA AA 56 AA 5A 65 29 FF FF FF 75 E7 39 04 21 78 58 5C 56 65 29 82 10 55 78 2A AA E7 39 82 10 D5 DD AF 0E CF 7B 28 42 A9 A9 AB AB 8E 73 EB 5A EA EA EA EA 6D 6B C7 39 40 C0 80 00 A6 19 62 10 0D 55 55 55 24 19 00 08 FC FF FF FF 07 42 61 10 42 42 42 42 04 21 00 00 FF AF 03 03 69 4A 62 10 D5 FF 00 0A 69 4A A2 10 56 FF 00 00 69 52 A2 10 55 FF 00 00 69 52 A2 10 55 FF 00 00 69 52 A3 18 55 FF 00 00 89 52 C3 18 55 7F 80 20 04 21 C3 18 BF 89 25 B5 45 29 C3 18 2A 3F BA D7 EB 5A 24 21 E5 F5 35 35 6D 6B CB 5A 0D 0D 0B 2B 6D 6B 2C 63 C0 80 20 AA 6D 6B CB 5A 00 02 83 E3 28 42 62 10 55 56 54 54 62 10 81 08 AA AA AA AA C3 18 41 08 C0 DF 93 93 04 21 41 08 01 01 D7 DE 28 4A 65 29 0D 09 A9 A9 48 4A C7 39 61 C3 EB FF 69 4A C6 39 18 38 BA FF 69 4A C6 39 86 8E EF EF 69 4A A6 39 61 E3 FB FB 69 52 E7 39 1C 1C 9E DF 04 21 41 08 BA 7B C9 2D 04 21 62 08 5F 55 A5 63 8A 52 82 10 3D 37 D5 F5 EB 5A 65 29 00 8B 55 55 EB 5A 65 29 00 AA 55 55 0C 63 65 29 80 0A 55 55 0C 63 A2 10 56 50 7F FF 28 42 62 10 55 55 FF 80 28 42 82 10 7D FD 7D 5C 86 31 61 08 58 5B BB 55 08 42 65 29 8D 0B AD A9 28 42 86 31 E3 A2 79 BA 28 42 86 31 38 20 9E AE 28 42 86 31 8E 08 E7 AE 28 42 65 31 E3 83 E9 AA 28 42 86 31 38 20 DB EB E7 39 A2 18 D7 5E 56 00 C7 39 61 08 55 55 FF 00 E7 39 61 08 55 55 FF 00 C7 39 C3 18 AA AA 55 00 8A 52 C3 18 FF FF 55 EA 65 29 00 00 00 00 FF FF E7 39 62 08 1A 1E 35 25 49 4A 07 42 AF AF AF AB CA 5A 82 10 7E 7E 7E 7E 62 10 61 10 EA AA AA AA 48 4A 04 21 85 A5 8D AB 69 4A 65 29 47 45 47 BA 28 42 65 31 49 69 CB AA 49 4A 65 29 F1 51 F1 AE 28 4A 65 29 53 53 52 AA 28 42 65 31 F8 5C F8 AA 69 4A 65 31 94 D6 94 EB 69 4A 04 21 3E 1E 3E AA 28 4A 65 29 2D B5 2F AA 48 4A 65 29 C5 C5 C7 BA 69 4A 45 29 4F 6D 4F 6A 62 10 61 10 AB AB AB AB 28 42 82 10 25 05 85 75 08 42 82 10 00 0A BD 55 A6 31 62 10 68 7A 5E 5F

REL_OFFSET=0x9d9 // 32x32
[MODDED_HEX]
28 42 C3 18 01 02 00 00 75 AD 28 42 55 5F 55 25 8D 73 86 31 3F D5 7F 7C 75 AD 04 21 AA FF 55 55 2C 63 82 10 56 D7 F5 B5 F7 65 45 29 55 55 55 63 EC 22 A2 18 15 17 1F 1F A2 28 CF 1B A1 A1 A1 A1 28 42 82 10 00 00 8A 7D 34 A5 C3 18 2F BF 5F 55 24 21 0C 63 09 02 00 00 66 31 E3 18 FF 55 2A FF 65 29 82 10 2F 0D 05 37 9D 8F A7 29 42 63 55 55 AA 22 41 18 3F 3E 3E 57 62 18 6D 23 A1 A1 A1 00 4D 6B 41 08 7F 7F B5 0B 24 21 00 00 0B FF FF FF 45 29 00 00 00 FF FF FF 04 21 20 00 00 0B 0E 3A 45 29 41 08 FE EA AA A8 45 29 82 10 E2 D5 B5 A9 04 21 82 10 FD 0E 3E 9E 65 29 00 00 FF FE E2 B2 AE 73 82 10 8D 89 A9 D5 28 42 62 10 57 F6 06 0B 48 4A 82 10 5D FA 00 00 28 4A 61 08 BD 7B 50 A0 65 29 00 00 00 FF FF FF 45 29 62 10 AB A9 2D 55 24 21 62 10 BE BE FC 58 E7 39 82 10 5B 7F 85 85 45 29 82 10 57 AA A8 78 E7 39 82 10 0D FF FF F5 E7 39 82 10 00 FF FF EF E7 39 82 10 80 FF FF FB 45 29 41 08 BF AA AA E8 69 3A 82 18 9F BF BF 35 07 42 A2 10 02 00 00 D5 07 42 A2 10 88 08 08 05 49 4A 62 10 5F 55 B5 35 28 4A 82 10 B5 F5 A8 A0 E7 39 45 29 54 D7 2A EF C7 39 E3 18 FF AA C0 E2 86 31 82 10 7A E0 77 2A BA 8E 45 31 35 D5 FF FF F3 6C 82 10 37 3F 5A 5A CB 3A 82 18 A4 E4 E5 E5 28 42 82 10 D5 0D 2D 25 89 52 04 21 55 00 AA AA 89 52 04 21 55 00 A2 AA 28 42 82 10 FF D0 50 D0 49 4A 82 10 BF 3F 35 D5 4D 6B 65 29 02 00 AA 55 2C 63 82 10 50 70 60 FF 86 31 82 10 55 55 F5 C0 07 42 82 10 27 2D 35 25 08 42 85 31 8A AA F9 AB 28 42 65 31 A2 BB 66 EA E7 39 C3 18 70 A0 08 00 E7 39 62 10 55 AA 20 00 E7 39 45 29 FF 7F 21 02 E7 39 62 10 AA 15 15 95 08 42 82 10 E0 E0 60 7D

REL_OFFSET=0xbf1 // 16x16
[MODDED_HEX]
EF 7B 45 29 EF 3F 3F 55 4D 6B 04 21 0B 5E 56 55 9A 7E 25 21 55 F5 85 55 24 29 AB 12 9C 9C 9C 28 EB 5A A2 10 57 53 73 BB 48 4A 62 10 FF D5 FF C0 04 21 82 10 AE B8 20 95 86 31 82 10 5D 6F 6F 17 08 42 61 08 BF FF 97 89 C7 39 04 21 EA 55 FE CA 6E 5B 04 21 55 D5 15 05 AE 5B C3 18 FF FF F3 D4 E7 39 41 08 03 03 03 01 89 52 C3 18 6A 6A EA AA 2C 63 E3 18 0D AD F5 FF 2C 63 61 08 5C FE EF FD

REL_OFFSET=0xc89 // 8x8
[MODDED_HEX]
AA 52 C3 18 22 72 56 EE 51 4C E3 18 FD F1 55 55 E7 39 04 21 F5 E9 83 83 EB 52 04 21 F5 C1 61 DF

REL_OFFSET=0xcc1 // 4x4
[MODDED_HEX]
69 42 C3 18 88 5E AF AA

REL_OFFSET=0xce1 // 4x4
[MODDED_HEX]
08 42 65 21 EE BB EE BB

REL_OFFSET=0xd01 // 4x4
[MODDED_HEX]
26 32 87 31 FF FF FF FF

// Rename

RENAME=Weapon_MEC_Railgun:Weapon_MEC_Lasegun
RENAME=Weapon_MEC_Railgun_SF:Weapon_MEC_Lasegun_SF
RENAME=GD_MEC_Railgun:GD_MEC_Lasegun
RENAME=MECRailgun_DIF:MECLasegun_DIF

 

 

 

Edit: Added a note into 5. Game integration about adding the package to DC.ini [Content.MapContent] section under Map=$ALL. Stroked text in 6. Final notes.

Edited by Drakous79
Link to comment
Share on other sites

I'd like to add, that image data can be created manually. All you need are images of all sizes needed for the texture in dds format (DXT1 in Railgun case). It can be done with Photoshop and NVIDIA Texture Tools for Adobe Photoshop or MS DirectX SDK (June 2010).

 

To use dds files with Unreal Engine, you have to strip dds header (first 128 bytes if I remember right). Just this step is enough for uncompressed mips. Compressed mips require usage of wghost's XComLZO, which is part of great UPKUtils.

Link to comment
Share on other sites

Really nice work.

 

 

For flags I have been pounding around changing Texture parameter in MaterialExpressionTextureSampleParameter2D of CHH_Soldiers master material with scripts, but no joy. The idea is to swap textures somehow, because what part of texture is displayed (like 0,25 x 0,125 in vanilla) is defined by UV coordinates in 3D model mesh.

 

I thought the issue with the back flag textures was that they appeared in a bunch of files instead of just one, making it prohibitively complicated to swap out via non-texmod methods? (Or maybe that's what you are trying to address) ... if an enlarged set of flags isn't possible personally I'd be happy with a generic XCOM or UN logo in place of the blank texture, which I could assign as the default to the other countries that have strat game flags but not tactical game ones.

 

EDIT (Rather than fill up thread by veering away from main topic): Yep, I understand changing those flag textures would require adding something like 30+ files to the Long War download, and it's just not worth that degree of trouble.

Edited by johnnylump
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...