CommonLibSSE (powerof3)
IVirtualMachine.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "RE/B/BSFixedString.h"
5 #include "RE/B/BSTEvent.h"
6 #include "RE/B/BSTSmartPointer.h"
7 #include "RE/E/ErrorLogger.h"
8 #include "RE/T/TypeInfo.h"
9 
10 namespace RE
11 {
12  namespace BSJobs
13  {
14  class JobList;
15  }
16 
17  class TESForm;
18 
19  namespace BSScript
20  {
21  class Array;
22  class ErrorLogger;
23  class IForEachScriptObjectFunctor;
24  class IFunction;
25  class IFunctionArguments;
26  class ISavePatcherInterface;
27  class IStackCallbackFunctor;
28  class ITypeLinkedCallback;
29  class Object;
30  class ObjectBindPolicy;
31  class ObjectTypeInfo;
32  class Variable;
33  struct IObjectHandlePolicy;
34  struct LogEvent;
35  struct StatsEvent;
36 
38  {
39  public:
40  inline static constexpr auto RTTI = RTTI_BSScript__IVirtualMachine;
41 
43 
44  virtual ~IVirtualMachine(); // 00
45 
46  // add
47  virtual void SetLinkedCallback(ITypeLinkedCallback* a_callback) = 0; // 01
48  virtual void TraceStack(const char* a_str, VMStackID a_stackID, Severity a_severity = Severity::kInfo) = 0; // 02
49  virtual void Unk_03(void) = 0; // 03
50  virtual void Update(float a_budget) = 0; // 04
51  virtual void UpdateTasklets(float a_budget) = 0; // 05
52  virtual void SetOverstressed(bool a_set) = 0; // 06
53  virtual bool IsCompletelyFrozen() const = 0; // 07
54  virtual bool RegisterObjectType(VMTypeID a_typeID, const char* a_className) = 0; // 08
55  virtual bool GetScriptObjectType1(const BSFixedString& a_className, BSTSmartPointer<ObjectTypeInfo>& a_outTypeInfoPtr) = 0; // 09
56  virtual bool GetScriptObjectType2(VMTypeID a_typeID, BSTSmartPointer<ObjectTypeInfo>& a_outTypeInfoPtr) = 0; // 0A
57  virtual bool GetScriptObjectTypeNoLoad1(const BSFixedString& a_className, BSTSmartPointer<ObjectTypeInfo>& a_typeInfoPtr) const = 0; // 0B
58  virtual bool GetScriptObjectTypeNoLoad2(VMTypeID a_typeID, BSTSmartPointer<ObjectTypeInfo>& a_outTypeInfoPtr) const = 0; // 0C
59  virtual bool GetTypeIDForScriptObject(const BSFixedString& a_className, VMTypeID& a_typeID) const = 0; // 0D
60  virtual void GetScriptObjectsWithATypeID(BSScrapArray<BSFixedString>& a_classes) const = 0; // 0E
61  virtual bool GetParentNativeType(const BSFixedString& a_className, BSTSmartPointer<ObjectTypeInfo>& a_typeInfoPtr) = 0; // 0F
62  virtual bool TypeIsValid(const BSFixedString& a_className) = 0; // 10
63  virtual bool ReloadType(const char* a_className) = 0; // 11
64  virtual void TasksToJobs(BSJobs::JobList& a_jobList) = 0; // 12
65  virtual void CalculateFullReloadList(void) const = 0; // 13
66  virtual bool CreateObject1(const BSFixedString& a_className, void* a_property, BSTSmartPointer<Object>& a_objPtr) = 0; // 14
67  virtual bool CreateObject2(const BSFixedString& a_className, BSTSmartPointer<Object>& a_result) = 0; // 15
68  virtual bool CreateArray1(const TypeInfo& a_typeInfo, std::uint32_t a_size, BSTSmartPointer<Array>& a_arrayPtr) = 0; // 16
69  virtual bool CreateArray2(TypeInfo::RawType a_typeID, const BSFixedString& a_className, std::uint32_t a_size, BSTSmartPointer<Array>& a_arrayPtr) = 0; // 17
70  virtual bool BindNativeMethod(IFunction* a_fn) = 0; // 18
71  virtual void SetCallableFromTasklets1(const char* a_className, const char* a_stateName, const char* a_fnName, bool a_callable) = 0; // 19
72  virtual void SetCallableFromTasklets2(const char* a_className, const char* a_fnName, bool a_callable) = 0; // 1A
73  virtual void ForEachBoundObject(VMHandle a_handle, IForEachScriptObjectFunctor* a_functor) = 0; // 1B
74  virtual bool FindBoundObject(VMHandle a_handle, const char* a_className, BSTSmartPointer<Object>& a_result) const = 0; // 1C
75  virtual void MoveBoundObjects(VMHandle a_from, VMHandle a_to) = 0; // 1D
76  virtual void ResetAllBoundObjects(VMHandle a_handle) = 0; // 1E
77  virtual bool CastObject(const BSTSmartPointer<Object>& a_fromObjPtr, const BSTSmartPointer<ObjectTypeInfo>& a_toTypeInfoPtr, BSTSmartPointer<Object>& a_toObjPtr) = 0; // 1F
78  virtual bool SetPropertyValue(BSTSmartPointer<Object>& a_obj, const char* a_propertyName, Variable& a_setVal) = 0; // 20
79  virtual bool GetPropertyValue(BSTSmartPointer<Object>& a_obj, const char* a_propertyName, Variable& a_getVal) = 0; // 21
80  virtual bool GetVariableValue1(const BSTSmartPointer<Object>& a_objPtr, std::uint32_t a_index, Variable& a_out) const = 0; // 22
81  virtual bool GetVariableValue2(VMHandle a_handle, const BSFixedString& a_className, std::int32_t a_variableIndex, Variable& a_out) const = 0; // 23
82  virtual void SendEvent(VMHandle a_handle, const BSFixedString& a_eventName, IFunctionArguments* a_args) = 0; // 24
83  virtual void SendEventAll(const BSFixedString& a_eventName, IFunctionArguments* a_args) = 0; // 25
84  virtual bool DispatchStaticCall(const BSFixedString& a_className, const BSFixedString& a_fnName, IFunctionArguments* a_args, BSTSmartPointer<IStackCallbackFunctor>& a_result) = 0; // 26
85  virtual bool DispatchMethodCall1(BSTSmartPointer<Object>& a_obj, const BSFixedString& a_fnName, IFunctionArguments* a_args, BSTSmartPointer<IStackCallbackFunctor>& a_result) = 0; // 27
86  virtual bool DispatchMethodCall2(VMHandle a_handle, const BSFixedString& a_className, const BSFixedString& a_fnName, IFunctionArguments* a_args, BSTSmartPointer<IStackCallbackFunctor>& a_result) = 0; // 28
87  virtual bool DispatchUnboundMethodCall(void) = 0; // 29
88  virtual bool IsWaitingOnLatent(VMStackID a_stackID) const = 0; // 2A
89  virtual void ReturnFromLatent(VMStackID a_stackID, const Variable& a_val) = 0; // 2B
90  virtual ErrorLogger* GetErrorLogger() = 0; // 2C
92  virtual const IObjectHandlePolicy* GetObjectHandlePolicy2() const = 0; // 2E
93  virtual ObjectBindPolicy* GetObjectBindPolicy1() = 0; // 2F
94  virtual const ObjectBindPolicy* GetObjectBindPolicy2() const = 0; // 30
96  virtual void RegisterForLogEvent(BSTEventSink<LogEvent>* a_sink) = 0; // 32
97  virtual void UnregisterForLogEvent(BSTEventSink<LogEvent>* a_sink) = 0; // 33
98  virtual void RegisterForStatsEvent(BSTEventSink<StatsEvent>* a_sink) = 0; // 34
99  virtual void UnregisterForStatsEvent(BSTEventSink<StatsEvent>* a_sink) = 0; // 35
100 
101  bool CreateArray(const TypeInfo& a_typeInfo, std::uint32_t a_size, BSTSmartPointer<Array>& a_arrayPtr);
102  bool CreateArray(TypeInfo::RawType a_typeID, const BSFixedString& a_className, std::uint32_t a_size, BSTSmartPointer<Array>& a_arrayPtr);
103  bool CreateObject(const BSFixedString& a_className, void* a_property, BSTSmartPointer<Object>& a_objPtr);
104  bool CreateObject(const BSFixedString& a_className, BSTSmartPointer<Object>& a_result);
106  bool DispatchMethodCall(VMHandle a_handle, const BSFixedString& a_className, const BSFixedString& a_fnName, IFunctionArguments* a_args, BSTSmartPointer<IStackCallbackFunctor>& a_result);
111  bool GetScriptObjectType(const BSFixedString& a_className, BSTSmartPointer<ObjectTypeInfo>& a_outTypeInfoPtr);
113  bool GetScriptObjectTypeNoLoad(const BSFixedString& a_className, BSTSmartPointer<ObjectTypeInfo>& a_typeInfoPtr) const;
114  bool GetScriptObjectTypeNoLoad(VMTypeID a_typeID, BSTSmartPointer<ObjectTypeInfo>& a_outTypeInfoPtr) const;
115  bool GetVariableValue(const BSTSmartPointer<Object>& a_objPtr, std::uint32_t a_index, Variable& a_out) const;
116  bool GetVariableValue(VMHandle a_handle, const BSFixedString& a_className, std::int32_t a_variableIndex, Variable& a_out) const;
117 
118  template <class F>
119  void RegisterFunction(std::string_view a_fnName, std::string_view a_className, F a_callback, bool a_callableFromTasklets = false);
120 
121  void SetCallableFromTasklets(const char* a_className, const char* a_stateName, const char* a_fnName, bool a_callable);
122  void SetCallableFromTasklets(const char* a_className, const char* a_fnName, bool a_callable);
123  void TraceForm(TESForm* a_form, const char* a_str, VMStackID a_stackID, Severity a_severity);
124  void VTraceStack(const char* a_fmt, VMStackID a_stackID, Severity a_severity = Severity::kInfo, ...);
125 
126  // members
127  std::uint32_t pad0C; // 0C
128  };
129  static_assert(sizeof(IVirtualMachine) == 0x10);
130  }
131 }
Definition: ErrorLogger.h:13
Severity
Definition: ErrorLogger.h:18
Definition: IFunctionArguments.h:12
Definition: IFunction.h:23
Definition: ISavePatcherInterface.h:11
Definition: IVirtualMachine.h:38
bool DispatchMethodCall(VMHandle a_handle, const BSFixedString &a_className, const BSFixedString &a_fnName, IFunctionArguments *a_args, BSTSmartPointer< IStackCallbackFunctor > &a_result)
virtual void UpdateTasklets(float a_budget)=0
virtual ISavePatcherInterface * GetSavePatcherInterface()=0
virtual bool FindBoundObject(VMHandle a_handle, const char *a_className, BSTSmartPointer< Object > &a_result) const =0
void SetCallableFromTasklets(const char *a_className, const char *a_stateName, const char *a_fnName, bool a_callable)
virtual void SetOverstressed(bool a_set)=0
virtual bool CreateObject1(const BSFixedString &a_className, void *a_property, BSTSmartPointer< Object > &a_objPtr)=0
virtual void RegisterForLogEvent(BSTEventSink< LogEvent > *a_sink)=0
virtual bool IsCompletelyFrozen() const =0
virtual bool CreateArray1(const TypeInfo &a_typeInfo, std::uint32_t a_size, BSTSmartPointer< Array > &a_arrayPtr)=0
virtual bool CreateArray2(TypeInfo::RawType a_typeID, const BSFixedString &a_className, std::uint32_t a_size, BSTSmartPointer< Array > &a_arrayPtr)=0
virtual void ReturnFromLatent(VMStackID a_stackID, const Variable &a_val)=0
virtual bool GetScriptObjectType2(VMTypeID a_typeID, BSTSmartPointer< ObjectTypeInfo > &a_outTypeInfoPtr)=0
std::uint32_t pad0C
Definition: IVirtualMachine.h:127
virtual void SetLinkedCallback(ITypeLinkedCallback *a_callback)=0
virtual void Unk_03(void)=0
virtual bool DispatchMethodCall2(VMHandle a_handle, const BSFixedString &a_className, const BSFixedString &a_fnName, IFunctionArguments *a_args, BSTSmartPointer< IStackCallbackFunctor > &a_result)=0
virtual bool DispatchStaticCall(const BSFixedString &a_className, const BSFixedString &a_fnName, IFunctionArguments *a_args, BSTSmartPointer< IStackCallbackFunctor > &a_result)=0
bool DispatchMethodCall(BSTSmartPointer< Object > &a_obj, const BSFixedString &a_fnName, IFunctionArguments *a_args, BSTSmartPointer< IStackCallbackFunctor > &a_result)
virtual const IObjectHandlePolicy * GetObjectHandlePolicy2() const =0
virtual void TraceStack(const char *a_str, VMStackID a_stackID, Severity a_severity=Severity::kInfo)=0
virtual void GetScriptObjectsWithATypeID(BSScrapArray< BSFixedString > &a_classes) const =0
virtual bool GetTypeIDForScriptObject(const BSFixedString &a_className, VMTypeID &a_typeID) const =0
virtual void CalculateFullReloadList(void) const =0
virtual bool GetScriptObjectType1(const BSFixedString &a_className, BSTSmartPointer< ObjectTypeInfo > &a_outTypeInfoPtr)=0
virtual bool GetScriptObjectTypeNoLoad1(const BSFixedString &a_className, BSTSmartPointer< ObjectTypeInfo > &a_typeInfoPtr) const =0
virtual const ObjectBindPolicy * GetObjectBindPolicy2() const =0
virtual bool DispatchUnboundMethodCall(void)=0
virtual void ResetAllBoundObjects(VMHandle a_handle)=0
virtual void UnregisterForLogEvent(BSTEventSink< LogEvent > *a_sink)=0
void RegisterFunction(std::string_view a_fnName, std::string_view a_className, F a_callback, bool a_callableFromTasklets=false)
Definition: NativeFunction.h:174
virtual bool SetPropertyValue(BSTSmartPointer< Object > &a_obj, const char *a_propertyName, Variable &a_setVal)=0
void TraceForm(TESForm *a_form, const char *a_str, VMStackID a_stackID, Severity a_severity)
virtual void RegisterForStatsEvent(BSTEventSink< StatsEvent > *a_sink)=0
virtual bool CreateObject2(const BSFixedString &a_className, BSTSmartPointer< Object > &a_result)=0
virtual void Update(float a_budget)=0
bool GetVariableValue(const BSTSmartPointer< Object > &a_objPtr, std::uint32_t a_index, Variable &a_out) const
bool GetScriptObjectType(VMTypeID a_typeID, BSTSmartPointer< ObjectTypeInfo > &a_outTypeInfoPtr)
bool CreateObject(const BSFixedString &a_className, BSTSmartPointer< Object > &a_result)
virtual void MoveBoundObjects(VMHandle a_from, VMHandle a_to)=0
virtual bool RegisterObjectType(VMTypeID a_typeID, const char *a_className)=0
virtual void SetCallableFromTasklets1(const char *a_className, const char *a_stateName, const char *a_fnName, bool a_callable)=0
IObjectHandlePolicy * GetObjectHandlePolicy()
virtual bool IsWaitingOnLatent(VMStackID a_stackID) const =0
virtual void ForEachBoundObject(VMHandle a_handle, IForEachScriptObjectFunctor *a_functor)=0
virtual void UnregisterForStatsEvent(BSTEventSink< StatsEvent > *a_sink)=0
bool GetScriptObjectTypeNoLoad(const BSFixedString &a_className, BSTSmartPointer< ObjectTypeInfo > &a_typeInfoPtr) const
virtual bool TypeIsValid(const BSFixedString &a_className)=0
virtual bool GetScriptObjectTypeNoLoad2(VMTypeID a_typeID, BSTSmartPointer< ObjectTypeInfo > &a_outTypeInfoPtr) const =0
virtual bool ReloadType(const char *a_className)=0
virtual bool GetVariableValue1(const BSTSmartPointer< Object > &a_objPtr, std::uint32_t a_index, Variable &a_out) const =0
virtual bool CastObject(const BSTSmartPointer< Object > &a_fromObjPtr, const BSTSmartPointer< ObjectTypeInfo > &a_toTypeInfoPtr, BSTSmartPointer< Object > &a_toObjPtr)=0
virtual bool BindNativeMethod(IFunction *a_fn)=0
virtual bool GetParentNativeType(const BSFixedString &a_className, BSTSmartPointer< ObjectTypeInfo > &a_typeInfoPtr)=0
bool GetScriptObjectTypeNoLoad(VMTypeID a_typeID, BSTSmartPointer< ObjectTypeInfo > &a_outTypeInfoPtr) const
virtual void SendEvent(VMHandle a_handle, const BSFixedString &a_eventName, IFunctionArguments *a_args)=0
bool CreateArray(TypeInfo::RawType a_typeID, const BSFixedString &a_className, std::uint32_t a_size, BSTSmartPointer< Array > &a_arrayPtr)
virtual void SetCallableFromTasklets2(const char *a_className, const char *a_fnName, bool a_callable)=0
virtual ObjectBindPolicy * GetObjectBindPolicy1()=0
static constexpr auto RTTI
Definition: IVirtualMachine.h:40
void SetCallableFromTasklets(const char *a_className, const char *a_fnName, bool a_callable)
virtual bool DispatchMethodCall1(BSTSmartPointer< Object > &a_obj, const BSFixedString &a_fnName, IFunctionArguments *a_args, BSTSmartPointer< IStackCallbackFunctor > &a_result)=0
bool GetScriptObjectType(const BSFixedString &a_className, BSTSmartPointer< ObjectTypeInfo > &a_outTypeInfoPtr)
const ObjectBindPolicy * GetObjectBindPolicy() const
bool CreateObject(const BSFixedString &a_className, void *a_property, BSTSmartPointer< Object > &a_objPtr)
bool GetVariableValue(VMHandle a_handle, const BSFixedString &a_className, std::int32_t a_variableIndex, Variable &a_out) const
void VTraceStack(const char *a_fmt, VMStackID a_stackID, Severity a_severity=Severity::kInfo,...)
virtual bool GetPropertyValue(BSTSmartPointer< Object > &a_obj, const char *a_propertyName, Variable &a_getVal)=0
virtual void TasksToJobs(BSJobs::JobList &a_jobList)=0
const IObjectHandlePolicy * GetObjectHandlePolicy() const
virtual IObjectHandlePolicy * GetObjectHandlePolicy1()=0
virtual bool GetVariableValue2(VMHandle a_handle, const BSFixedString &a_className, std::int32_t a_variableIndex, Variable &a_out) const =0
bool CreateArray(const TypeInfo &a_typeInfo, std::uint32_t a_size, BSTSmartPointer< Array > &a_arrayPtr)
virtual void SendEventAll(const BSFixedString &a_eventName, IFunctionArguments *a_args)=0
ObjectBindPolicy * GetObjectBindPolicy()
virtual ErrorLogger * GetErrorLogger()=0
Definition: BSScriptObjectBindPolicy.h:16
Definition: TypeInfo.h:10
RawType
Definition: TypeInfo.h:13
Definition: Variable.h:15
Definition: BSTArray.h:377
Definition: BSTEvent.h:146
Definition: BSTSmartPointer.h:37
Definition: TESForm.h:34
Definition: AbsorbEffect.h:6
constexpr REL::ID RTTI_BSScript__IVirtualMachine
Definition: Offsets_RTTI.h:2192
std::uint32_t VMTypeID
Definition: BSCoreTypes.h:9
std::uint32_t VMStackID
Definition: BSCoreTypes.h:8
std::uint64_t VMHandle
Definition: BSCoreTypes.h:7
Definition: BSIntrusiveRefCounted.h:8
Definition: IObjectHandlePolicy.h:13