Template:XGCharacter Soldier.AddPsiXP - XCOM:EU 2012
Overview
From file XComGame.upk, Class= XGCharacter_Soldier, Function= XGCharacter_Soldier.AddPsiXP.
- 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.AddPsiXP 1 function AddPsiXP(int iXP) 2 { 3 // End:0x34 4 if(CanGainXP()) 5 { 6 m_kSoldier.iPsiXP += iXP; 7 } 8 //return; 9 }
2. Discover (reveal) the hexidecimal values (in Unreal Engine Explorer - view=Disassembled Tokens) :
XGCharacter_Soldier.AddPsiXP 1 (0-2;000/000) [07 34 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-7;00D/00D) [A1 35 34 0E 00 00 3D 0E 00 00 00 01 01 8A A3 00 00 00 B7 A3 00 00 16] 14 NativeFunctionToken(39/23) 15 m_kSoldier.iPsiXP += iXP 16 17 (4-5;00E/00E) [35 34 0E 00 00 3D 0E 00 00 00 01 01 8A A3 00 00] 18 StructMemberToken(28/16) 19 m_kSoldier.iPsiXP 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 B7 A3 00 00] 26 LocalVariableToken(9/5) 27 iXP 28 29 (7-7;033/023) [16] 30 EndFunctionParmsToken(1/1) 31 ) 32 33 (8-9;034/024) [04 0B] 34 ReturnToken(2/2) 35 return 36 37 (9-9;035/025) [0B] 38 NothingToken(1/1) 39
3. Capture the function's hexidecimal code (as shown here - PatcherGUI ready) :
UPK_FILE=XComGame.upk OBJECT=XGCharacter_Soldier.AddPsiXP:KEEP [BEFORE_HEX] 07 34 00 1B 77 0F 00 00 00 00 00 00 16 A1 35 34 0E 00 00 3D 0E 00 00 00 01 01 8A A3 00 00 00 B7 A3 00 00 16 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.AddPsiXP:AUTO [BEFORE_CODE] 07 [@XGCSapxp] 1B <CanGainXP> 16 A1 35 <XGTacticalGameCoreNativeBase.TSoldier.iPsiXP> <XGTacticalGameCoreNativeBase.TSoldier> 00 01 01 <XGCharacter_Soldier.m_kSoldier> 00 <.iXP> 16 [#XGCSapxp] 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: