Template:XGCharacter Soldier.SetXP - XCOM:EU 2012
Overview
From file XComGame.upk, Class= XGCharacter_Soldier, Function= XGCharacter_Soldier.SetXP.
- Main purpose is to provide the required information for modifying this "Function" (a.k.a. "Object"), using the utility PatcherGUI (a separate download from UPK Utils Nexus "Files" page).
Programs and Tools
- UE Explorer
- UE Explorer (version 1.2.7.1) was used to obtain the desired function's "view=Object" (below), "view=Disassembled Tokens" (below) & "[BEFORE_HEX]" (below) from the XComGame.upk file.
- UPK Utils
- PatcherGUI (version 7.3, 04/10/15) utility was used to verify the "[BEFORE_CODE]" (below) from the XComGame.upk file.
- HexToPseudoCode utility provides an alternative method for obtaining the "[BEFORE_CODE]" (below) from an UnrealPackage file, in this case from the XComGame.upk file.
- ... this 'command-line' utility's output may be used as a "seed" (to start a PatcherGUI mod file with).
Details
1. Find the desired function (in Unreal Engine Explorer - view=Object) :
XGCharacter_Soldier.SetXP 1 function SetXP(int iXP) 2 { 3 // End:0x33 4 if(CanGainXP()) 5 { 6 m_kSoldier.iXP = iXP; 7 } 8 //return; 9 }
2. Discover (reveal) the hexidecimal values (in Unreal Engine Explorer - view=Disassembled Tokens) :
XGCharacter_Soldier.SetXP 1 (0-2;000/000) [07 33 00 1B 77 0F 00 00 00 00 00 00 16] 2 JumpIfNotToken(13/13) 3 if(CanGainXP()) 4 5 (1-2;003/003) [1B 77 0F 00 00 00 00 00 00 16] 6 VirtualFunctionToken(10/10) 7 CanGainXP() 8 9 (2-2;00C/00C) [16] 10 EndFunctionParmsToken(1/1) 11 ) 12 13 (3-6;00D/00D) [0F 35 35 0E 00 00 3D 0E 00 00 00 01 01 8A A3 00 00 00 BF A3 00 00] 14 LetToken(38/22) 15 m_kSoldier.iXP = iXP 16 17 (4-5;00E/00E) [35 35 0E 00 00 3D 0E 00 00 00 01 01 8A A3 00 00] 18 StructMemberToken(28/16) 19 m_kSoldier.iXP 20 21 (5-5;021/019) [01 8A A3 00 00] 22 InstanceVariableToken(9/5) 23 m_kSoldier 24 25 (6-6;02A/01E) [00 BF A3 00 00] 26 LocalVariableToken(9/5) 27 iXP 28 29 (7-8;033/023) [04 0B] 30 ReturnToken(2/2) 31 return 32 33 (8-8;034/024) [0B] 34 NothingToken(1/1) 35
3. Capture the function's hexidecimal code (as shown here - PatcherGUI ready) :
UPK_FILE=XComGame.upk OBJECT=XGCharacter_Soldier.SetXP:KEEP [BEFORE_HEX] 07 33 00 1B 77 0F 00 00 00 00 00 00 16 0F 35 35 0E 00 00 3D 0E 00 00 00 01 01 8A A3 00 00 00 BF A3 00 00 04 0B [/BEFORE_HEX] // The Mod Developer / Programmer has to do all the Offset and Size arithmetic!
4. By whatever means obtain the required UPKUtils pseodo-code (that will produce the -above- 'captured' hexidecimal code) :
UPK_FILE=XComGame.upk OBJECT=XGCharacter_Soldier.SetXP:AUTO [BEFORE_CODE] 07 [@XGCSsxp] 1B <CanGainXP> 16 0F 35 <XGTacticalGameCoreNativeBase.TSoldier.iXP> <XGTacticalGameCoreNativeBase.TSoldier> 00 01 01 <XGCharacter_Soldier.m_kSoldier> 00 <.iXP> [#XGCSsxp] 04 0B [/BEFORE_CODE] { When properly coded - PatcherGUI will do the Offset and Size arithmetic; while also doing any required expanding or shrinking. } [AFTER_CODE] // modified PatcherGUI script (more properly stated: a mixture of hexidecimal code and UPKUtils pseudo-code) goes here ... // or the BEFORE_CODE values may be copied here to confirm that the BEFORE_CODE values are correct, without making any actual modifications. [/AFTER_CODE]
References
Referred to by this article:
That refer to this article: