Jump to content

UI Editing


johnnylump

Recommended Posts

UPDATE: I hadn't found anything grouped together with a MEC header, but I did find the following inventory images:

  • Inv_ProximityMine
  • Inv_Flamethrower

I'm thinking that these were left over images from EU, and could be used for 2 of the 6 MEC secondary weapons. Neither of these two is in UIUtilities.GetInventoryImagePath.

 

That leaves:

  • Kinetic Strike Module (no idea what to use here....)
  • Restorative Mist (using Medikit inventory image should be clear)
  • Grenade Launcher (perhaps use Frag Grenade inventory image?)
  • EMP (perhaps use Mind Shield inventory image temporarily?)

 

In the long run being able to add new images would be really handy, but at least for the short term I now know where the original set of images are :)

Link to comment
Share on other sites

  • Replies 54
  • Created
  • Last Reply

Top Posters In This Topic

What I ended up doing for the short term (until it's figured out how to add new images) is add the following four images to the GetInventoryImagePath function:

        case 81:
            return inventoryLibraryPath $ "Inv_FlameThrower";
        // End:0xBBD
        case 82:
            return inventoryLibraryPath $ "Inv_TargetPainter";
        // End:0xBF6
        case 83:
            return inventoryLibraryPath $ "Inv_ProximityMine";
        // End:0xC3C
        case 84:
            return "img:///UILibrary_StrategyImages.ScienceIcons.IC_MECCloseCombat";
Link to comment
Share on other sites

  • 1 month later...

Finally back revisiting this issue.

 

I've discovered that there are copies of the icon images in both UICollection_Strategy_SF.upk and Command1.upk, and I've even deciphered a bit of the header information. This icon data is not particularly compressed, as two of the icons I examined (fieldmedic and willtosurvive) are both 64 x 64 pixels, and the raw image data in both cases is 0x1000 = 4096 = 64 * 64 bytes long, so these are using 1 byte per pixel, with sRGB flag = false.

 

UE Explorer decompiles the objectlist entry / header info as:

begin object name=willtosurvive class=Texture2D
    SizeX=64
    SizeY=64
    OriginalSizeX=64
    OriginalSizeY=64
    Format=EPixelFormat.PF_DXT5
    MipTailBaseIdx=6
    SRGB=false
    NeverStream=true
    LODGroup=TextureGroup.TEXTUREGROUP_UI
object end
// Reference: Texture2D'gfxXComIcons.willtosurvive'

which I've been able to map to the hex entries within the header (as well as where the image data size is specified).

 

Since most of these icons have identically sized images, I've conducted tests by swapping the willtosurvive image data into the fieldmedic icon definition. I did this in both UICollection_Strategy_SF.upk and in Command1.upk. In both cases the game ran without problem, and the icon data in-game was unaffected, so clearly these definitions are superfluous and the image data is being drawn from another location.

 

So either of these two locations is adequate to retrieve a copy of what the image data looks like, but modifying the data here doesn't alter anything in the game.

 

My suspicion is that the unreal engine is actually drawing the image data from one of the tfc (texture cache files) located in the CookedPCConsole directory.

 

------------

 

UPDATE - It looks like I was wrong about icon image data being located in the tfc, as when I opened Command1.upk using Gildor's uemodel app, the icon data indicates that TCFName: none

 

My next step is to explore some of the other UICollection upks in case the in-game data is being drawn from one of them.

Edited by Amineri
Link to comment
Share on other sites

Success at last.

 

The game is drawing perk icon data from UICollection_Common_SF.upk.

 

When I replaced the fieldmedic icon image data with the willtosurvive icon image data, upon loading the game the perk image was indeed changed. As a further test I spliced together the first 0x800 bytes of fieldmedic with the last 0x800 bytes of willtosurvive, and the displayed perk icon was indeed a "half-and-half" image.

 

Here are the steps I took to replace perk image data :

1) Decompress UICollection_Common_SF.upk using Gildor's decompress tool

2) Open the upk using UE Explorer and navigate to gfxXComIcons -- find the icon you wish to modify (e.g. fieldmedic, bringemon, willtosurvive)

3) Right-click on the icon name and open the Buffer, then copy the Buffer data to whichever program suits you (Notepad++, HxD, UPKmodder) -- I used UPKmodder since I'm familiar with it

4) The first 0x13D bytes of hex are header information. Only the final 12 = 0xC bytes of this need be kept unless the image is being resized, which I haven't tried yet.

5) The final 0x24 bytes of hex are footer information.

6) Isolate the image data byte and replace as desired

 

-----------------

 

A couple of notes about this.

 

There are two different methods by which image data is specified to be loaded within the various Flash UI components. All of these are defined in XComGame.upk >> UIUtilities, which contains a bunch of different functions to retrieve strings associated with image data.

 

Firaxis designates the difference by ending the UIUtilities function with either "path" or "label".

 

Path strings are strings such as :

"img:///UILibrary_StrategyImages.InterceptorImages.Inv_InterceptorPlasmaCannon",

"img:///UILibrary_StrategyImages.InventoryIcons.Inv_AssaultRifleModern", and even

"img:///UILibrary_StrategyImages.CaptiveIcons.Captive_Sectoid"

 

These conform to how raster image data is labeled within the UDK : https://udn.epicgames.com/Three/ScaleformTechnicalGuide.html

 

To load the texture Texture2D'MyPackage.MyGroup.MyTexture', for example, you would set the "source" variable of the UILoader to "img://MyPackage.MyGroup.MyTexture" for bilinear sample scaling, or "imgps://MyPackage.MyGroup.MyTexture" for point sampling.

 

I'm no expert on UE3, but I think that these stored/loaded progressively using the usual Unreal Engine mechanics (i.e. stored in a tfc).

 

Label strings are very much shorter, such as

"urbancombat", "rank0", "AlienContainment", and "fieldmedic"

 

These appear to used exclusively for single color bitmap icon image data, which could suffer from the lossy compression typically applied to UE texture data (my guess, anyhow).

 

The above only works for images defined via label, which includes :

  • GetAbilityIconLabel
  • GetButtonName (breaking the naming convention)
  • GetClassLabel
  • GetCountryLabel
  • GetEItemType_InfoIcon (breaking the naming convention)
  • GetFacilityLabel
  • GetMECItemToAbilityIconLabel
  • GetMedalLabel
  • GetMedalLabels
  • GetMissionListItemIcon
  • GetOTSImageLabel
  • GetPerkIconLabel
  • GetRankLabel
  • GetShipIconLabel

 

The gamepad icons (GetButtonName ) aren't stored in gfxXComIcons but are instead stored in gfxGamePadIcons.

 

The above list includes a fair bit of stuff, but there's also a lot that uses the full pathname specification, and which I don't know how to modify:

  • GetCharacterCardImage
  • GetFoundryImagePath
  • GetInventoryImagePath
  • GetItemImagePath
  • GetLargeMedalImagePath
  • GetMapImagePath
  • GetMedalImagePath
  • GetPowerImagePath
  • GetResearchCreditImagePath
  • GetStrategyImagePath
  • GetTechImagePath

These include images show on Item Cards, in the Lockers when loading out soldiers, and various other places. As of yet, I don't know how to swap out these types of images.

 

------------------------

 

However, the next step I think will be adding in additional icon data directly into UICollection_Common_SF.upk.

 

This will require adding quite a bit of extra stuff to the upk:

  • Adding namelist entry(ies) for the new icon labels
  • Adding objectlist entry(ies) for the new icons
  • Linking the new objects into gfxXComIcons

Through all of this the header information providing file location for all objects has to be maintained, so it's not going to be a trivial task.

Link to comment
Share on other sites

It turns out that (unsurprisingly) the picture is a little more complex than I initially thought.

 

The icon image data is defined as a Texture2D object contained within gfxXComIcons. However there is also a upk object XComIcons which contains a GFX (Flash) file XComIcons. This XComIcons contains a little bit of actionscript but also a MovieClip used to display the Texture2D objects. The objects are imported using a GFX extension (not standard Flash) DefineExternalImage2 command. JPEXS supports this command, but other SWF tools may not. Adobe CS5 requires a plug-in for GFX in order to recognize it (I'm pretty sure, since Epic has instructions for installing the plug-in).

 

The Texture2D icons are imported into the XComIcons GFX object and are then primarily put into 1 of 2 MovieClips for display -- there is one used for "perk" icons and one used for "ability" icons. A "perk" icon can be displayed when selecting a new perk for a unit, while an "ability" icon can be displayed as a clickable button the tactical HUD. To make matters more confusing, some icons are available in both (e.g. "battlescanner"), while some are available in perks only or ability only.

 

There are a few other icons used in other ways, such as the class icons, rank icons, promote icons, etc that are part of the above 2 movie clips but are made available in other ways.

 

So far I've identified 21 icons that look to have been originally defined as perk/ability icons, but are not currently in either MovieClip (I'm not sure if they are being imported into XComIcons), so XMTS is working on updating these to include these icons. Either the original icon imagery created by Firaxis can be used or the image data could be replaced.

 

Adding new icons would then also require updating of the XComIcons embedded GFX object as well as all of the upk-side stuff necessary to add new objects.

Link to comment
Share on other sites

  • 3 months later...

So, I tried another spin on getting new objects into XCOM, but have hit a bit of a wall.

 

My goal was to cook new package-files with UDK and then alter the config files to load the new package, allowing at least new inventory images to be created. For a test I created a simple LongWar.upk with a single image in InventoryImages.Inv_LaserShotgun_2. This was a simple palette rotation of the existing Laser Shotgun inventory image, used only for testing purposes. The LongWar.upk was created with not problem, and the image path within the file was : Texture2D'LongWar.InventoryImages.Inv_LaserShotgun_2'.

 

I downloaded the oldest version of UDK I could find (March 2012) available from the Epic website. Unfortunately when opening the newly-built LongWar.upk and Command1.upk (from Enemy Within) using UE Explorer, the following high level details were different :

XCOM EW : Version 845, Licensee Version 64, Engine Version 8916

UPK cooked with March 2012 UDK : Version 859, Licensee Version 0, Engine Version 9656

 

Upon adding the line Package=LongWar to DefaultContent to load the new UPK data as part of the Command1 strategy "map", Launch.log reports the following :

[0007.97] XCom_Content: Loading package ..\..\XComGame\CookedPCConsole\StrategyResources_SF.upk(StrategyResources)
[0008.11] XCom_Content: Loading package ..\..\XComGame\CookedPCConsole\UICollection_Strategy_SF.upk(UICollection_Strategy)
[0008.16] XCom_Content: Loading package ..\..\XComGame\CookedPCConsole\LongWar.upk(LongWar)
[0008.16] Warning: Package '..\..\XComGame\CookedPCConsole\LongWar.upk' has been saved with engine version newer than current and therefore won't be possible to save. CurrEngineVersion: 8917  VersionSavedWith: 9656
[0008.16] Log: Unable to load package (..\..\XComGame\CookedPCConsole\LongWar.upk) PackageVersion  859, MaxExpected  845 : LicenseePackageVersion    0, MaxExpected   64.
[0008.16] Warning: Warning, Failed to load '..\..\XComGame\CookedPCConsole\LongWar.upk': Unable to load package (..\..\XComGame\CookedPCConsole\LongWar.upk) PackageVersion  859, MaxExpected  845 : LicenseePackageVersion    0, MaxExpected   64.

If I go in with HxD and manually change the Version and Licensee version in the new upk to match to try and force the engine to load the new upk, the game CTDs with the following message from Launch.log :

[0010.37] XCom_Content: Loading package ..\..\XComGame\CookedPCConsole\StrategyResources_SF.upk(StrategyResources)
[0010.51] XCom_Content: Loading package ..\..\XComGame\CookedPCConsole\UICollection_Strategy_SF.upk(UICollection_Strategy)
[0010.56] XCom_Content: Loading package ..\..\XComGame\CookedPCConsole\LongWar.upk(LongWar)
[0010.56] Warning: Package '..\..\XComGame\CookedPCConsole\LongWar.upk' has been saved with engine version newer than current and therefore won't be possible to save. CurrEngineVersion: 8917  VersionSavedWith: 9656
[0010.56] Critical: appError called: Texture2D LongWar.InventoryImages.Inv_LaserShotgun_2: Serial size mismatch: Got 67562, Expected 67578
[0010.56] Critical: Windows GetLastError: The system cannot find the file specified. (2)
[0014.59] Log: === Critical error: ===
Texture2D LongWar.InventoryImages.Inv_LaserShotgun_2: Serial size mismatch: Got 67562, Expected 67578

I think this basically means that Firaxis used an even older version of Unreal Engine, and that the version of UDK I got access to can't create packages that are compatible with the Unreal Engine version in XCOM.

 

Open to any thoughts or suggestions in this area ...

Link to comment
Share on other sites

Did some google searching and managed to find a June 2010 version of UDK, which generates package files with :

June 2010 UDK : version 727, engine version 6829

 

This is well before XCOM version version 845, engine version 8917

 

I cooked a new LongWar.upk with a single 2DTexture inside and configured DefaultContent.ini to load the LongWar.upk package as part of the Command1 map :

Map=Command1
Package=StrategyResources
Package=UICollection_Strategy
Package=LongWar

I then launched the game and loaded a strategy-game savefile and closed the game. From the Launch.log :

[0008.97] XCom_Content: Loading package ..\..\XComGame\CookedPCConsole\StrategyResources_SF.upk(StrategyResources)
[0009.12] XCom_Content: Loading package ..\..\XComGame\CookedPCConsole\UICollection_Strategy_SF.upk(UICollection_Strategy)
[0009.17] XCom_Content: Loading package ..\..\XComGame\CookedPCConsole\LongWar.upk(LongWar)

This was with no hex-editing of the LongWar.upk, and it apparently loaded correctly.

 

So, the next step will be configuring the existing XComGame.upk to try and read the new image data from the new LongWar.upk.

Link to comment
Share on other sites

So, success.. using the June 2010 UDK I was able to create a new upk which I was then able to import and read inventory image data from. Here's my screenshot as proof :

http://wiki.tesnexus.com/images/a/a8/2014-06-09_00001.jpg

 

This isn't a texture swap or replacment, but a brand-new image that exists only within a new LongWar.upk file created with the UDK.

 

Here are the steps I took :

1) Downloaded and installed June2010 UDK -- I found the older version here : http://download.cnet.com/Unreal-Development-Kit/3000-2121_4-10973418.html?tag=bc

 

2) Created a new package in UDK.

2a) Within the UDKGame/Content folder created a new subfolder LongWar/InventoryImages/

2b) Added BMP image data to the new folder and imported the images into UDK, into the LongWar package using the "BuildFromFilePath" option. TextureGroup_UI was used.

2c) Saved the resultant package file to Content/LongWar.upk

 

3) Copied the LongWar.upk file into the appropriate CookedPCConsole folder. The new upk is already uncompressed. No hex alterations to the upk are required.

 

4) Configured the game to load the upk in DefaultContent.ini by adding the line Package=LongWar after:

Map=Command1
Package=StrategyResources
Package=UICollection_Strategy
Package=LongWar

If creating a package file with a different name, use yours, of course :smile:

 

5) Hex edit XComGame.UIUtilities.GetInventoryImagePath and UIItilities.GetItemImagePath. This basically requires resizing the object using either PatchUPK or UPKmodder to fit the extra lines of code.

For my test case I redirected the call from the Pistol Inventory Image ID to the new image defined in LongWar.upk :

        case 37:
            return "img:///LongWar.InventoryImages.Long_War_Banner_2";

6) Launched game and verified that new image data was loading into the game, and took the above screenshot.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...