Template:XGCharacter Soldier.SetPsiRank - XCOM:EU 2012

From Nexus Mods Wiki
Revision as of 04:34, 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.SetPsiRank.

  • 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.SetPsiRank
1	function SetPsiRank(XGTacticalGameCoreNativeBase.EPsiRanks newRank)
2	{
3		 m_kSoldier.iPsiRank = newRank;
4		//return;    
5	}

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

XGCharacter_Soldier.SetPsiRank
 1	(0-4;000/000) [0F 35 37 0E 00 00 3D 0E 00 00 00 01 01 8A A3 00 00 38 3A 00 B5 A3 00 00]
 2		LetToken(40/24)
 3		m_kSoldier.iPsiRank = newRank
 4
 5		(1-2;001/001) [35 37 0E 00 00 3D 0E 00 00 00 01 01 8A A3 00 00]
 6			StructMemberToken(28/16)
 7			m_kSoldier.iPsiRank
 8
 9			(2-2;014/00C) [01 8A A3 00 00]
10				InstanceVariableToken(9/5)
11				m_kSoldier
12
13		(3-4;01D/012) [3A 00 B5 A3 00 00]
14			ByteToIntToken(11/6)
15			newRank
16
17			(4-4;01F/013) [00 B5 A3 00 00]
18				LocalVariableToken(9/5)
19				newRank
20
21	(5-6;028/018) [04 0B]
22		ReturnToken(2/2)
23		return
24
25		(6-6;029/019) [0B]
26			NothingToken(1/1)
27

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

UPK_FILE=XComGame.upk
OBJECT=XGCharacter_Soldier.SetPsiRank:KEEP
[BEFORE_HEX]
0F 35 37 0E 00 00 3D 0E 00 00 00 01 01 8A A3 00 00 38 3A 00 B5 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.SetPsiRank:AUTO
[BEFORE_CODE]
0F 35 <XGTacticalGameCoreNativeBase.TSoldier.iPsiRank> <XGTacticalGameCoreNativeBase.TSoldier> 00 01 01 <XGCharacter_Soldier.m_kSoldier> 38 3A 00 <.newRank>
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: