CommonLibSSE (Parapets fork)
ScriptFunction.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "RE/B/BSFixedString.h"
4 #include "RE/I/IFunction.h"
6 #include "RE/T/TypeInfo.h"
7 #include "RE/V/VDescTable.h"
8 
9 namespace RE
10 {
11  namespace BSScript
12  {
13  namespace Internal
14  {
15  class ScriptFunction : public IFunction
16  {
17  public:
18  inline static constexpr auto RTTI = RTTI_BSScript__Internal__ScriptFunction;
19 
20  ~ScriptFunction() override; // 00
21 
22  // override (IFunction)
23  const BSFixedString& GetName() const override; // 01 - { return functionName; }
24  const BSFixedString& GetObjectTypeName() const override; // 02 - { return scriptName; }
25  const BSFixedString& GetStateName() const override; // 03 - { return stateName; }
26  TypeInfo GetReturnType() const override; // 04 - { return returnType; }
27  std::uint32_t GetParamCount() const override; // 05 - { return varInfo.numParams; }
28  void GetParam(std::uint32_t a_idx, BSFixedString& a_nameOut, TypeInfo& a_typeOut) const override; // 06
29  std::uint32_t GetStackFrameSize() const override; // 07 - { return (descTable.totalEntries - descTable.paramCount) + GetNumParams(); }
30  bool GetIsNative() const override; // 08 - { return false; }
31  bool GetIsStatic() const override; // 09 - { return isStatic; }
32  bool GetIsEmpty() const override; // 0A - { return instructions.numInstructionBits == 0; }
33  FunctionType GetFunctionType() const override; // 0B - { return functionType; }
34  std::uint32_t GetUserFlags() const override; // 0C - { return userFlags; }
35  const BSFixedString& GetDocString() const override; // 0D - { return docString; }
36  void InsertLocals(StackFrame* a_frame) override; // 0E
37  CallResult Call(const BSTSmartPointer<Stack>& a_stack, ErrorLogger* a_logger, Internal::VirtualMachine* a_vm, bool a_arg4) override; // 0F
38  const BSFixedString& GetSourceFilename() const override; // 10 - { return sourceFileName; }
39  bool TranslateIPToLineNumber(std::uint32_t a_indexPtr, std::uint32_t& a_lineNumberOut) const override; // 11
40  bool GetVarNameForStackIndex(std::uint32_t a_idx, BSFixedString& a_nameOut) const override; // 12
41  bool CanBeCalledFromTasklets() const override; // 13 - { return true; }
42  void SetCallableFromTasklets(bool a_callable) override; // 14 - { return; }
43 
44  // members
50  std::uint32_t userFlags; // 40
51  std::uint32_t pad44; // 44
54  bool isStatic; // 5A
55  std::uint8_t pad5B; // 5B
56  std::uint32_t pad5C; // 5C
59  std::uint32_t lineNumberCount; // 70
60  std::uint32_t pad74; // 74
61  std::uint16_t* lineNumbers; // 78
62  };
63  static_assert(sizeof(ScriptFunction) == 0x80);
64  }
65  }
66 }
Definition: ErrorLogger.h:13
Definition: IFunction.h:23
CallResult
Definition: IFunction.h:35
FunctionType
Definition: IFunction.h:28
Definition: ScriptFunction.h:16
const BSFixedString & GetObjectTypeName() const override
std::uint8_t pad5B
Definition: ScriptFunction.h:55
std::uint32_t pad5C
Definition: ScriptFunction.h:56
BSFixedString stateName
Definition: ScriptFunction.h:47
bool CanBeCalledFromTasklets() const override
TypeInfo retType
Definition: ScriptFunction.h:48
TypeInfo GetReturnType() const override
const BSFixedString & GetName() const override
void InsertLocals(StackFrame *a_frame) override
bool TranslateIPToLineNumber(std::uint32_t a_indexPtr, std::uint32_t &a_lineNumberOut) const override
std::uint16_t * lineNumbers
Definition: ScriptFunction.h:61
bool isStatic
Definition: ScriptFunction.h:54
const BSFixedString & GetDocString() const override
BSFixedString sourceFileName
Definition: ScriptFunction.h:58
CallResult Call(const BSTSmartPointer< Stack > &a_stack, ErrorLogger *a_logger, Internal::VirtualMachine *a_vm, bool a_arg4) override
std::uint32_t lineNumberCount
Definition: ScriptFunction.h:59
ByteCode::PackedInstructionStream instructions
Definition: ScriptFunction.h:52
std::uint32_t GetStackFrameSize() const override
void GetParam(std::uint32_t a_idx, BSFixedString &a_nameOut, TypeInfo &a_typeOut) const override
const BSFixedString & GetSourceFilename() const override
std::uint32_t GetParamCount() const override
std::uint32_t userFlags
Definition: ScriptFunction.h:50
bool GetVarNameForStackIndex(std::uint32_t a_idx, BSFixedString &a_nameOut) const override
void SetCallableFromTasklets(bool a_callable) override
VDescTable descTable
Definition: ScriptFunction.h:49
BSFixedString objName
Definition: ScriptFunction.h:46
stl::enumeration< FunctionType, std::uint16_t > functionType
Definition: ScriptFunction.h:53
std::uint32_t pad74
Definition: ScriptFunction.h:60
BSFixedString name
Definition: ScriptFunction.h:45
std::uint32_t pad44
Definition: ScriptFunction.h:51
const BSFixedString & GetStateName() const override
static constexpr auto RTTI
Definition: ScriptFunction.h:18
FunctionType GetFunctionType() const override
BSFixedString docString
Definition: ScriptFunction.h:57
std::uint32_t GetUserFlags() const override
Definition: VirtualMachine.h:46
Definition: StackFrame.h:15
Definition: TypeInfo.h:10
Definition: BSTSmartPointer.h:37
Definition: AbsorbEffect.h:6
constexpr REL::ID RTTI_BSScript__Internal__ScriptFunction
Definition: Offsets_RTTI.h:2199
Definition: PackedInstructionStream.h:10
Definition: VDescTable.h:15