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