-
Notifications
You must be signed in to change notification settings - Fork 29
/
Copy pathPatchUPK_Mod_Example.txt
141 lines (109 loc) · 4.54 KB
/
PatchUPK_Mod_Example.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
MOD_NAME=PatchUPK Mod Example
AUTHOR=wghost81 aka Wasteland Ghost
DESCRIPTION=This is sample mod file to demonstrate program features. Do not try to install this!
For more info see PatchUPK_Readme.txt.
Mod files have to be plain ASCII text files! Do not use Unicode!
Compatible with ToolBoks Custom Mod format, can be used to install ToolBoks custom mods for EU/EW.
Version: 3.0
Compatible with XCOM Enemy Unknown / Enemy Within version:
- versions list
// Next line was placed here to generate error and prevent accidental installation of the sample.
UPK_FILE=FileDoesNotExist.upk
{ Curly brackets are used for comments.
Comments can be multi-line.
Do not forget to close opened brackets. }
{ Do not use curly brackets inside comments!!! }
// You can use C-style comments as well
/* Multi-line
C-style
comment */
/* Open XComStrategyGame.upk
Do not add path to upk file if you're using it with PatcherGUI!
You need to open upk file only once to apply multiple changes,
but you still can use ToolBoks style and specify upk file name for every single change:
the file will not be reopened. */
UPK_FILE=XComStrategyGame.upk
// ToolBoks-style patching: absolute offsets followed by binary replacement data
/* Offsets can be dec or hex values. Hex values should begin with 0x
Offset key sets patching scope to entire UPK file. You can change anything, except
first 8 bytes: package signature and version. */
OFFSET=0x1234ABC
[MODDED_HEX]
// You can use comments here...
00 01 0A 0B FF /* ... and here... */ 00 AA /* ... and here... */
01 23
45
// Using external binary files
/* If you're using PatcherGUI, path to binary file should be either absolute
or relative to mod file (Your_mod_file_name.txt) location.
File name should match Full.Object.Name.ext pattern. Allowed extensions are:
.NameEntry for NameTable entry
.ImportEntry for ImportTable entry
.ExportEntry for ExportTable entry */
MODDED_FILE=Path-to-file/Full.Object.Name.ext
// User-friendly way to set values
// You can use BYTE key to set single byte value. Byte values are unsigned!
BYTE=0x0A { hex }
BYTE=10 { or dec }
// You can use FLOAT key to set 4-byte floating point value.
FLOAT=123.4
/* You can use INTEGER key to set 4-byte integer value.
WARNING! No hex values are allowed! For hex representation use UNSIGNED key! */
INTEGER=15
// You can use UNSIGNED key to set 4-byte unsigned integer value.
UNSIGNED=0xA { hex }
UNSIGNED=10 { or dec }
// Object-oriented patching
// You can use full object name (as it is shown in UE Explorer) to find it inside UPK file
OBJECT=XGBattleDesc.InitAlienLoadoutInfos
OBJECT=XGStrategyAI.GetAltWeapon:AUTO
OBJECT=XGStrategyAI.GetAltWeapon:INPL
OBJECT=XGStrategyAI.GetAltWeapon:MOVE
OBJECT=XGStrategyAI.GetAltWeapon:KEEP
/* Empty specifier is equal to KEEP. KEEP is the safest behaviour: all changes are applied
to current scope only and if data chunk length exceeds current scope, program will
output an error.
MOVE forces moving object's data to the end of UPK file before applying any changes.
AUTO allows program to auto-move/resize object when needed.
INPL works similar to AUTO, but performs object resize in place without moving.
Note that specifiers themselves do not make any changes: they work when you start to
write actual data. */
/* You can use relative offsets to patch data inside specified object.
If current scope is set to package, relative offset will be added to global offset. */
REL_OFFSET=0x28
// Changing names and expanding functions
// Rename GetAltWeapon to #GetPodProgs
RENAME=GetAltWeapon:#GetPodProgs
/* You can expand function by specifying its new ObjectSize
(not file size from script header, but full data chunk length!)
If new size is equal to old size, function will not be expanded.
EXPAND_FUNCTION sets current offset value to new data offset,
so you don't need to specify offset after using it. */
EXPAND_FUNCTION=XGStrategyAI.GetAltWeapon:300
// You can undo function expand.
EXPAND_UNDO=XGStrategyAI.GetAltWeapon
// Before-after style patching
[BEFORE_HEX]
01 AA BC 23
[/BEFORE_HEX]
[AFTER_HEX]
BB AC 22 13
[/AFTER_HEX]
// Using pseudo-code
// You can use pseudo-code instead of hex references. For more info see PatchUPK_Readme.txt.
OBJECT=XGStrategyAI.GetNumOutsiders
[REPLACEMENT_CODE]
// if(Game().GetDifficulty() >= 2)
07 [@label1] 99 19 1B <Game> 16 0A 00 <XGStrategy.GetDifficulty.ReturnValue> 00 1B <GetDifficulty> 16 2C <%b2> 16
// return 2
04 2C 02
// goto (else)
06 [@label2]
[#label1]
// return 1
04 26
[#label2]
// return ReturnValue
04 3A <.ReturnValue>
// EOS
53