Yzaxtol Posted March 11, 2013 Share Posted March 11, 2013 (edited) This Opening post is very under construction. Because some people are asking how do I mod XCOM, I felt that because so many other people have helped me start to Mod I might aswell return the favour.If anyone else have their own resources and links they want to share please post them here and I will endeavour to include them in the opening post. BlackAlpha's .UPK Modding TutorialExplanation of the different tools:Notepad++ Text Editor to more easily manipulate/see text data.UPK Decompressor to uncompress UPK files.UPK Extractor to unpack UPK Files.UE Explorer to look through the uncompressed UPK files.HxD HEX Editor to search for HEX values and edit the UPK files.XSHAPE to hack the EXE and make it run uncompressed UPK files.WinMerge to compare text files. See the "comparing UPK files" tutorial at the bottom on how to apply WinMerge in modding UPK files.Note, as of 12-14-2012, it's not possible to recompress XCOM UPK files. And it's only possible to HEX edit the UPK files.Each folder contains an instruction text file that explains how the tool is used.General instructions on how to modify XCOM UPK files:=== Preparing files ===1. Extract XSHAPE to your game root folder.2. Go to: "(game folder)\XComGame\CookedPCConsole\". Rename the .upk file you want to edit to create a backup.For example, rename it to: "(Backup) XComGame.upk".Do not move the file to a subfolder, or the game will try to load it when you start the game. You must rename the file for the game to consider the file to be "gone".3. Rename the associated ".uncompressed_size" file to create a backup.For example, rename it to: "(Backup) XComGame.upk.uncompressed_size".This file must be "removed", or renamed in this case, for the game to load a modified UPK file.4. Grab the original UPK file you want to edit and run it through the UPK Decompressor (See the UPK Decompressor folder for instructions).5. Grab the uncompressed UPK file and run it through the UPK Extractor (See the UPK Extractor folder for instructions).=== Looking for data to edit ===6. Open the uncompressed UPK file in UE Explorer to look around the code.7. Use the built-in HEX viewer of UE Explorer to find the correct bytes you want to edit (right click on a Class/Function/Property and choose View Buffer).The advantage of this is that you get more info than with a regular HEX editor. Click on the different HEX values to see the additional info on the left.Also, see the file "Bytecode Table.txt" for some info on common HEX values and what they 'might' mean.And open the unpacked files in the HEX Editor to help in identifying the right HEX value. Don't actually make changes to the unpacked files!8. Do your best to identify the right HEX value you want to edit.9. Write down all changes you want to make. For example, write it down inside "Changes to UPK Files.txt".If you don't, you will lose all changes when a game patch arrives. Or you'll simply forget where you made the changes.=== Apply the changes ===10. Make the changes to the uncompressed UPK file using the HEX editor.11. Now open the modified UPK file with UE Explorer and navigate to the page where you've made the changes.If the changes show up in UE Explorer and everything is looking good, then you've successfully applied the changes.12. Copy the modified UPK file to (game folder)\XComGame\CookedPCConsole\13. Run XSHAPE.bat inside the game root folder (you copied XSHAPE there earlier, at step 1 of these instructions). XSHAPE will modify the EXE file so that the game will run uncompressed UPK files.14. Done. Start game.Helpful Links: UPK Modding Tools - BlackAlphaDefaultGameCore.ini Wiki Page.UPK Research: Tech Tree UPK Changes for Merciless Edited March 11, 2013 by Yzaxtol Link to comment Share on other sites More sharing options...
anUser Posted March 11, 2013 Share Posted March 11, 2013 Nice, it'd be great to have those second first steps together in a post. I've realized I had overlooked the readme file... it's really worth a reading. I couldn't do the Ctrl-A Ctrl-C trick mentioned there, but I've found that on UE Explorer 1.2.2.1, if selecting view buffer, and then Edit > Dump bytes, you can later paste that into notepad++, and perform a search and replace, replacing all dashes with a whitespace, so you end up with the clean hex function. 'till now I was hand-typing function headers into HxD and then I calculated the function end position so I knew whether I was in or out of the function's boundaries (offsets) while searching inside HxD... :( that tutorial it's definitively worth a reading or two! Link to comment Share on other sites More sharing options...
Recommended Posts