CommonLibSSE (Parapets fork)
Loading...
Searching...
No Matches
CommandTable.h
Go to the documentation of this file.
1#pragma once
2
3#include "RE/B/BSString.h"
4#include "RE/B/BSTList.h"
5#include "RE/F/FormTypes.h"
6
7namespace RE
8{
9 class ScriptLocals;
10 struct ACTION_OBJECT;
11 struct ConditionCheckParams;
12 struct ScriptCompileData;
13 struct ScriptLineBuffer;
14 struct ScriptVariable;
15 struct SCRIPT_EFFECT_DATA;
16 struct SCRIPT_HEADER;
17 struct SCRIPT_LINE;
18 struct SCRIPT_LOCAL;
19 struct SCRIPT_PARAMETER;
20 struct SCRIPT_REFERENCED_OBJECT;
21
23 {
24 kChar = 0x0,
25 kInt = 0x1,
26 kFloat = 0x2,
27 kInventoryObject = 0x3,
28 kObjectRef = 0x4,
29 kActorValue = 0x5,
30 kActor = 0x6,
31 kSpellItem = 0x7,
32 kAxis = 0x8,
33 kCell = 0x9,
34 kAnimGroup = 0x0A,
35 kMagicItem = 0x0B,
36 kSound = 0x0C,
37 kTopic = 0x0D,
38 kQuest = 0x0E,
39 kRace = 0x0F,
40 kClass = 0x10,
41 kFaction = 0x11,
42 kSex = 0x12,
43 kGlobal = 0x13,
45 kObject = 0x15,
46 kScriptVar = 0x16,
47 kStage = 0x17,
48 kMapMarker = 0x18,
49 kActorBase = 0x19,
50 kContainerRef = 0x1A,
51 kWorldOrList = 0x1B,
52 kCrimeType = 0x1C,
53 kPackage = 0x1D,
54 kCombatStyle = 0x1E,
55 kMagicEffect = 0x1F,
56 kFormType = 0x20,
57 kWeather = 0x21,
58 kNPC = 0x22,
59 kOwner = 0x23,
60 kShaderEffect = 0x24,
61 kFormList = 0x25,
62 kMenuIcon = 0x26,
63 kPerk = 0x27,
64 kNote = 0x28,
65 kMiscStat = 0x29,
66 kImagespaceMod = 0x2A,
67 kImagespace = 0x2B,
68 kVATSValue = 0x2C,
69 kVATSValueData = 0x2D,
70 kEventFunction = 0x2E,
72 kEventFunctionData = 0x30,
73 kVoiceType = 0x31,
74 kEncounterZone = 0x32,
75 kIdleForm = 0x33,
76 kMessage = 0x34,
78 kAlignment = 0x36,
79 kEquipType = 0x37,
80 kObjectOrFormList = 0x38,
81 kMusic = 0x39,
82 kCritStage = 0x3A,
83 kKeyword = 0x3B,
84 kRefType = 0x3C,
85 kLocation = 0x3D,
86 kForm = 0x3E,
87 kAlias = 0x3F,
88 kShout = 0x40,
89 kWordOfPower = 0x41,
90 kRelationshipRank = 0x42,
91 kBGSScene = 0x43,
92 kCastingSource = 0x44,
93 kAssociationType = 0x45,
94 kWardState = 0x46,
97 kFurnitureAnimType = 0x49,
99 kVMScriptVar = 0x4C,
100 kReferenceEffect = 0x4D,
101 kPackageData = 0x4E,
102 kSoundCategory = 0x50,
103 kKnowableForm = 0x51,
104 kRegion = 0x52
105 };
106
107 // basically the unique id for the function, there's ~5000 of these
108 enum class SCRIPT_OUTPUT
109 {
110 };
111
112 enum class SCRIPT_ERROR
113 {
114 };
115
117 {
118 public:
119 // members
120 std::uint32_t variableCount; // 00
121 std::uint32_t refObjectCount; // 04
122 std::uint32_t dataSize; // 08
123 std::uint32_t lastID; // 0C
124 bool isQuestScript; // 10
126 bool isCompiled; // 12
127 std::uint8_t pad13; // 13
128 };
129 static_assert(sizeof(SCRIPT_HEADER) == 0x14);
130
132 {
133 public:
134 // members
135 const char* paramName; // 00
137 bool optional; // 0C
138 std::uint8_t pad0D; // 0D
139 std::uint16_t pad0E; // 0E
140 };
141 static_assert(sizeof(SCRIPT_PARAMETER) == 0x10);
142
144 {
145 public:
146 // members
148 TESForm* form; // 10
149 std::uint32_t variableID; // 18
150 std::uint32_t pad1C; // 1C
151 };
152 static_assert(sizeof(SCRIPT_REFERENCED_OBJECT) == 0x20);
153
155 {
156 public:
157 // members
158 TESForm* form; // 00
159 std::uint32_t flags; // 08
160 std::uint32_t pad0C; // 0C
161 };
162 static_assert(sizeof(ACTION_OBJECT) == 0x10);
163
165 {
166 public:
167 // members
168 std::uint32_t id; // 0
169 float value; // 4
170 bool isInteger; // 8
171 std::uint8_t pad9; // 9
172 std::uint16_t padA; // A
173 };
174 static_assert(sizeof(SCRIPT_LOCAL) == 0xC);
175
177 {
178 public:
179 // members
182 std::uint16_t pad02; // 02
183 float secondsElapsed; // 04
184 };
185 static_assert(sizeof(SCRIPT_EFFECT_DATA) == 0x8);
186
188 {
189 public:
190 // members
192 char flags; // 08
193 std::uint8_t pad09; // 09
194 std::uint16_t pad0A; // 0A
195 std::uint32_t pad0C; // 0C
199 };
200 static_assert(sizeof(ScriptLocals) == 0x28);
201
203 {
204 public:
205 // members
207 std::uint32_t pad0C; // 0C
209 };
210 static_assert(sizeof(ScriptVariable) == 0x20);
211
213 {
214 public:
215 // members
216 std::uint32_t lineNumber; // 000
217 char line[512]; // 004
218 std::uint32_t size; // 204
219 std::uint32_t offset; // 208
220 char output[512]; // 20C
221 std::uint32_t outputSize; // 40C
223 std::uint32_t refObjectIndex; // 414
225 };
226 static_assert(sizeof(SCRIPT_LINE) == 0x41C);
227
229 {
230 struct Commands
231 {
232 enum : std::uint32_t
233 {
236
238 kScriptOpBase = 0x1000
239 };
240 };
241
242 struct StringChunk;
243 struct IntegerChunk;
244
245 struct Chunk
246 {
247 public:
250 };
251
252 struct StringChunk : public Chunk
253 {
254 public:
255 [[nodiscard]] std::string GetString() const;
257
258 // members
259 std::uint16_t length; // 00
260 char str[0]; // 02
261 };
262 static_assert(sizeof(StringChunk) == 0x2);
263
264#pragma pack(push, 1)
265 struct IntegerChunk : public Chunk
266 {
267 public:
268 [[nodiscard]] int GetInteger() const;
270
271 // members
272 char magic; // 00
273 std::int32_t value; // 01
274 };
275 static_assert(offsetof(IntegerChunk, value) == 0x1);
276 static_assert(sizeof(IntegerChunk) == 0x5);
277#pragma pack(pop)
278
280 {
281 public:
285
286 // members
287 std::uint16_t opcode; // 00
288 std::uint16_t chunkSize; // 02
289 std::uint16_t numParams; // 04
290 };
291 static_assert(sizeof(ScriptData) == 0x6);
292
293 using Execute_t = bool(const SCRIPT_PARAMETER* a_paramInfo, ScriptData* a_scriptData, TESObjectREFR* a_thisObj, TESObjectREFR* a_containingObj, Script* a_scriptObj, ScriptLocals* a_locals, double& a_result, std::uint32_t& a_opcodeOffsetPtr);
294 using Compile_t = bool(std::uint16_t a_numParams, const SCRIPT_PARAMETER* a_paramInfo, SCRIPT_LINE* a_lineBuf, ScriptCompileData* a_scriptBuf);
295 using Condition_t = bool(TESObjectREFR* a_thisObj, void* a_param1, void* a_param2, double& a_result);
296
298 static SCRIPT_FUNCTION* LocateScriptCommand(const char* a_longName);
299
301 static SCRIPT_FUNCTION* LocateConsoleCommand(const char* a_longName);
302
303 template <std::uint16_t SIZE>
304 inline void SetParameters(SCRIPT_PARAMETER (&a_params)[SIZE])
305 {
306 numParams = SIZE;
307 params = a_params;
308 }
309
311
312 // members
313 const char* functionName; // 00
314 const char* shortName; // 08
316 std::uint32_t pad14; // 14
317 const char* helpString; // 18
319 std::uint8_t pad21; // 21
320 std::uint16_t numParams; // 22
321 std::uint32_t pad24; // 24
326 bool editorFilter; // 48
328 std::uint16_t pad4A; // 4A
329 std::uint32_t pad4C; // 4C
330 };
331 static_assert(sizeof(SCRIPT_FUNCTION) == 0x50);
332}
Definition: BSTList.h:10
Definition: Script.h:23
Definition: CommandTable.h:188
std::uint32_t pad0C
Definition: CommandTable.h:195
BSSimpleList< SCRIPT_LOCAL * > * localList
Definition: CommandTable.h:197
Script * masterScript
Definition: CommandTable.h:191
char flags
Definition: CommandTable.h:192
SCRIPT_EFFECT_DATA * scriptEffectData
Definition: CommandTable.h:198
BSSimpleList< ACTION_OBJECT * > * actionList
Definition: CommandTable.h:196
std::uint16_t pad0A
Definition: CommandTable.h:194
std::uint8_t pad09
Definition: CommandTable.h:193
Definition: TESForm.h:34
Definition: TESObjectREFR.h:105
Definition: PCH.h:216
Definition: AbsorbEffect.h:6
SCRIPT_OUTPUT
Definition: CommandTable.h:109
SCRIPT_ERROR
Definition: CommandTable.h:113
SCRIPT_PARAM_TYPE
Definition: CommandTable.h:23
Definition: CommandTable.h:155
std::uint32_t pad0C
Definition: CommandTable.h:160
std::uint32_t flags
Definition: CommandTable.h:159
TESForm * form
Definition: CommandTable.h:158
Definition: CommandTable.h:177
bool scriptEffectFinish
Definition: CommandTable.h:181
bool scriptEffectStart
Definition: CommandTable.h:180
float secondsElapsed
Definition: CommandTable.h:183
std::uint16_t pad02
Definition: CommandTable.h:182
Definition: CommandTable.h:246
IntegerChunk * AsInteger()
StringChunk * AsString()
Definition: CommandTable.h:231
@ kConsoleOpBase
Definition: CommandTable.h:235
@ kScriptOpBase
Definition: CommandTable.h:238
@ kScriptCommandsEnd
Definition: CommandTable.h:237
@ kConsoleCommandsEnd
Definition: CommandTable.h:234
Definition: CommandTable.h:266
char magic
Definition: CommandTable.h:272
std::int32_t value
Definition: CommandTable.h:273
Definition: CommandTable.h:280
std::uint16_t opcode
Definition: CommandTable.h:287
IntegerChunk * GetIntegerChunk()
std::uint16_t chunkSize
Definition: CommandTable.h:288
std::uint16_t numParams
Definition: CommandTable.h:289
Definition: CommandTable.h:253
std::uint16_t length
Definition: CommandTable.h:259
std::string GetString() const
char str[0]
Definition: CommandTable.h:260
Definition: CommandTable.h:229
Compile_t * compileFunction
Definition: CommandTable.h:324
bool editorFilter
Definition: CommandTable.h:326
std::uint32_t pad24
Definition: CommandTable.h:321
std::uint32_t pad14
Definition: CommandTable.h:316
std::uint32_t pad4C
Definition: CommandTable.h:329
const char * shortName
Definition: CommandTable.h:314
std::uint16_t pad4A
Definition: CommandTable.h:328
SCRIPT_PARAMETER * params
Definition: CommandTable.h:322
Condition_t * conditionFunction
Definition: CommandTable.h:325
static SCRIPT_FUNCTION * LocateConsoleCommand(const char *a_longName)
const char * helpString
Definition: CommandTable.h:317
bool referenceFunction
Definition: CommandTable.h:318
void SetParameters(SCRIPT_PARAMETER(&a_params)[SIZE])
Definition: CommandTable.h:304
bool(std::uint16_t a_numParams, const SCRIPT_PARAMETER *a_paramInfo, SCRIPT_LINE *a_lineBuf, ScriptCompileData *a_scriptBuf) Compile_t
Definition: CommandTable.h:294
static SCRIPT_FUNCTION * GetFirstScriptCommand()
bool(TESObjectREFR *a_thisObj, void *a_param1, void *a_param2, double &a_result) Condition_t
Definition: CommandTable.h:295
static SCRIPT_FUNCTION * LocateScriptCommand(const char *a_longName)
std::uint8_t pad21
Definition: CommandTable.h:319
bool invalidatesCellList
Definition: CommandTable.h:327
const char * functionName
Definition: CommandTable.h:313
std::uint16_t numParams
Definition: CommandTable.h:320
static SCRIPT_FUNCTION * GetFirstConsoleCommand()
Execute_t * executeFunction
Definition: CommandTable.h:323
bool(const SCRIPT_PARAMETER *a_paramInfo, ScriptData *a_scriptData, TESObjectREFR *a_thisObj, TESObjectREFR *a_containingObj, Script *a_scriptObj, ScriptLocals *a_locals, double &a_result, std::uint32_t &a_opcodeOffsetPtr) Execute_t
Definition: CommandTable.h:293
SCRIPT_OUTPUT output
Definition: CommandTable.h:315
Definition: CommandTable.h:117
bool isCompiled
Definition: CommandTable.h:126
std::uint8_t pad13
Definition: CommandTable.h:127
std::uint32_t lastID
Definition: CommandTable.h:123
bool isQuestScript
Definition: CommandTable.h:124
std::uint32_t refObjectCount
Definition: CommandTable.h:121
std::uint32_t dataSize
Definition: CommandTable.h:122
bool isMagicEffectScript
Definition: CommandTable.h:125
std::uint32_t variableCount
Definition: CommandTable.h:120
Definition: CommandTable.h:213
std::uint32_t offset
Definition: CommandTable.h:219
char output[512]
Definition: CommandTable.h:220
stl::enumeration< SCRIPT_ERROR, std::uint32_t > scriptError
Definition: CommandTable.h:224
std::uint32_t refObjectIndex
Definition: CommandTable.h:223
std::uint32_t outputSize
Definition: CommandTable.h:221
stl::enumeration< SCRIPT_OUTPUT, std::uint32_t > expression
Definition: CommandTable.h:222
char line[512]
Definition: CommandTable.h:217
std::uint32_t size
Definition: CommandTable.h:218
std::uint32_t lineNumber
Definition: CommandTable.h:216
Definition: CommandTable.h:165
std::uint8_t pad9
Definition: CommandTable.h:171
std::uint32_t id
Definition: CommandTable.h:168
std::uint16_t padA
Definition: CommandTable.h:172
bool isInteger
Definition: CommandTable.h:170
float value
Definition: CommandTable.h:169
Definition: CommandTable.h:132
stl::enumeration< SCRIPT_PARAM_TYPE, std::uint32_t > paramType
Definition: CommandTable.h:136
std::uint16_t pad0E
Definition: CommandTable.h:139
std::uint8_t pad0D
Definition: CommandTable.h:138
bool optional
Definition: CommandTable.h:137
const char * paramName
Definition: CommandTable.h:135
Definition: CommandTable.h:144
TESForm * form
Definition: CommandTable.h:148
std::uint32_t pad1C
Definition: CommandTable.h:150
std::uint32_t variableID
Definition: CommandTable.h:149
BSString editorID
Definition: CommandTable.h:147
Definition: CommandTable.h:203
SCRIPT_LOCAL data
Definition: CommandTable.h:206
std::uint32_t pad0C
Definition: CommandTable.h:207
BSString name
Definition: CommandTable.h:208