Template:XGCharacter Soldier.GetPsiXP - XCOM:EU 2012

From Nexus Mods Wiki
Revision as of 04:33, 17 November 2018 by Dubiousintent (talk | contribs) (Added 'Category:Mod_Creation' & 'Category:Mods')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Overview

From file XComGame.upk, Class= XGCharacter_Soldier, Function= XGCharacter_Soldier.GetPsiXP.

  • 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.GetPsiXP
1	function int GetPsiXP()
2	{
3		return m_kSoldier.iPsiXP;
4		//return ReturnValue;    
5	}

2. Discover (reveal) the hexidecimal values (in Unreal Engine Explorer - view=Disassembled Tokens) :

XGCharacter_Soldier.GetPsiXP
 1	(0-2;000/000) [04 35 34 0E 00 00 3D 0E 00 00 00 00 01 8A A3 00 00]
 2		ReturnToken(29/17)
 3		return m_kSoldier.iPsiXP
 4
 5		(1-2;001/001) [35 34 0E 00 00 3D 0E 00 00 00 00 01 8A A3 00 00]
 6			StructMemberToken(28/16)
 7			m_kSoldier.iPsiXP
 8
 9			(2-2;014/00C) [01 8A A3 00 00]
10				InstanceVariableToken(9/5)
11				m_kSoldier
12
13	(3-4;01D/011) [04 3A BB A3 00 00]
14		ReturnToken(10/6)
15		return ReturnValue
16
17		(4-4;01E/012) [3A BB A3 00 00]
18			ReturnNothingToken(9/5)
19			ReturnValue

3. Capture the function's hexidecimal code (as shown here - PatcherGUI ready) :

UPK_FILE=XComGame.upk
OBJECT=XGCharacter_Soldier.GetPsiXP:KEEP
[BEFORE_HEX]
04 35 34 0E 00 00 3D 0E 00 00 00 00 01 8A A3 00 00
04 3A BB A3 00 00
[/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.GetPsiXP:AUTO
[BEFORE_CODE]
04 35 <XGTacticalGameCoreNativeBase.TSoldier.iPsiXP> <XGTacticalGameCoreNativeBase.TSoldier> 00 00 01 <XGCharacter_Soldier.m_kSoldier>
04 3A <.ReturnValue>
[/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: