diff --git a/CommonLibSF/include/RE/C/CodeTasklet.h b/CommonLibSF/include/RE/C/CodeTasklet.h new file mode 100644 index 00000000..106fc5ff --- /dev/null +++ b/CommonLibSF/include/RE/C/CodeTasklet.h @@ -0,0 +1,113 @@ +#include "RE/I/IFuncCallQuery.h" + +namespace RE +{ + namespace BSScript + { + class ErrorLogger; + class Stack; // stub + class StackFrame; // stub + + namespace Internal + { + class VirtualMachine; + + class CodeTasklet : + public IFuncCallQuery // 00 + { + public: + SF_RTTI_VTABLE(BSScript__Internal__CodeTasklet); + + enum class OpCode : std::uint32_t + { + kNOP, + kIADD, + kFADD, + kISUB, + kFSUB, + kIMUL, + kFMUL, + kIDIV, + kFDIV, + kIMOD, + kNOT, + kINEG, + kFNEG, + kASSIGN, + kCAST, + kCMP_EQ, + kCMP_LT, + kCMP_LTE, + kCMP_GT, + kCMP_GTE, + kJMP, + kJMPT, + kJMPF, + kCALLMETHOD, + kCALLPARENT, + kCALLSTATIC, + kRETURN, + kSTRCAT, + kPROPGET, + kPROPSET, + kARRAY_CREATE, + kARRAY_LENGTH, + kARRAY_GETELEMENT, + kARRAY_SETELEMENT, + kARRAY_FINDELEMENT, + kARRAY_RFINDELEMENT, + kIS, + kSTRUCT_CREATE, + kSTRUCT_GET, + kSTRUCT_SET, + kARRAY_FINDSTRUCT, + kARRAY_RFINDSTRUCT, + kARRAY_ADD, + kARRAY_INSERT, + kARRAY_REMOVELAST, + kARRAY_REMOVE, + kARRAY_CLEAR + }; + + enum class ResumeReason + { + kNotResuming = 0, + kNotResumingNoIncrement = 1, + kInitialStart = 2, + kFunctionReturn = 3, + kRetryInstruction = 4, + kFunctionCall = 5 + }; + + virtual ~CodeTasklet(); // 00 + + // override (IFuncCallQuery) + virtual bool GetFunctionCallInfo( + CallType& a_callType, + BSTSmartPointer& a_objectTypeInfo, + BSFixedString& a_name, + Variable& a_self, + void* /* BSScrapArray& */ a_args) const override; // 01 + + virtual BSTSmartPointer GetSelfAsObject() const override; // 02 + + // members + Stack* stack; // 10 + VirtualMachine* vm; // 18 + ErrorLogger* errorLogger; // 20 + stl::enumeration resumeReason; // 28 + std::uint32_t pad2C; // 2C + const void* instructionDataStart; // 30 + StackFrame* topFrame; // 38 + std::uint32_t frameMemoryPage; // 40 + std::uint32_t instructionDataBitCount; // 44 + std::int8_t jumpBitCount; // 48 + std::int8_t localVarBitCount; // 49 + std::int8_t memberVarBitCount; // 4A + std::int8_t unk4B; // 4B + std::uint32_t pad4C; // 4C + }; + static_assert(sizeof(CodeTasklet) == 0x50); + } + } +} \ No newline at end of file diff --git a/CommonLibSF/include/RE/I/IFuncCallQuery.h b/CommonLibSF/include/RE/I/IFuncCallQuery.h new file mode 100644 index 00000000..6cd53199 --- /dev/null +++ b/CommonLibSF/include/RE/I/IFuncCallQuery.h @@ -0,0 +1,43 @@ +#pragma once + +#include "RE/B/BSFixedString.h" +#include "RE/B/BSIntrusiveRefCounted.h" +#include "RE/B/BSTSmartPointer.h" + +namespace RE +{ + namespace BSScript + { + + class StackFrame; + class Variable; + class ObjectTypeInfo; + class Object; + + class IFuncCallQuery : public BSIntrusiveRefCounted + { + public: + SF_RTTI_VTABLE(BSScript__Internal__IFuncCallQuery); + + enum class CallType + { + kMember, + kStatic, + kGetter, + kSetter + }; + virtual ~IFuncCallQuery(); // 00 + + // add + virtual bool GetFunctionCallInfo( + CallType& a_callType, + BSTSmartPointer& a_objectTypeInfo, + BSFixedString& a_name, + Variable& a_self, + void* /* BSScrapArray& */ a_args) const = 0; // 01 + virtual BSTSmartPointer GetSelfAsObject() const = 0; // 02 + }; + static_assert(sizeof(IFuncCallQuery) == 0x10); + + }; +} diff --git a/CommonLibSF/include/RE/R/RawFuncCallQuery.h b/CommonLibSF/include/RE/R/RawFuncCallQuery.h new file mode 100644 index 00000000..1b60cb5c --- /dev/null +++ b/CommonLibSF/include/RE/R/RawFuncCallQuery.h @@ -0,0 +1,50 @@ +#pragma once + +#include "RE/B/BSFixedString.h" +#include "RE/B/BSTSmartPointer.h" + +#include "RE/B/BSTArray.h" +#include "RE/I/IFuncCallQuery.h" +#include "RE/V/Variable.h" +namespace RE +{ + namespace BSScript + { + + class StackFrame; + class Variable; + class ObjectTypeInfo; + + namespace Internal + { + class RawFuncCallQuery : + public IFuncCallQuery // 00 + { + public: + SF_RTTI_VTABLE(BSScript__Internal__RawFuncCallQuery); + + virtual ~RawFuncCallQuery(); // 00 + + // override (IFuncCallQuery) + virtual bool GetFunctionCallInfo( + CallType& a_callType, + BSTSmartPointer& a_objectTypeInfo, + BSFixedString& a_name, + Variable& a_self, + void* /* BSScrapArray& */ a_args) const override; // 01 + + virtual BSTSmartPointer GetSelfAsObject() const override; // 02 -- just calls get>() + + // members + CallType callType; // 10 + std::uint32_t pad14; // 14 + BSTSmartPointer objType; // 18 + BSFixedString name; // 20 + Variable self; // 28 + BSTArray args; // 38 + }; + static_assert(sizeof(RawFuncCallQuery) == 0x48); + } + + }; +} diff --git a/CommonLibSF/include/RE/Starfield.h b/CommonLibSF/include/RE/Starfield.h index 68d3436e..dbed8903 100644 --- a/CommonLibSF/include/RE/Starfield.h +++ b/CommonLibSF/include/RE/Starfield.h @@ -74,6 +74,7 @@ #include "RE/B/BSTTuple.h" #include "RE/B/BSTTuple3.h" #include "RE/B/BaseFormComponent.h" +#include "RE/C/CodeTasklet.h" #include "RE/C/Color.h" #include "RE/C/CombatGroup.h" #include "RE/C/Console.h" @@ -88,6 +89,7 @@ #include "RE/H/HandlePolicy.h" #include "RE/I/IAnimationGraphManagerHolder.h" #include "RE/I/IComplexType.h" +#include "RE/I/IFuncCallQuery.h" #include "RE/I/IFunction.h" #include "RE/I/IKeywordFormBase.h" #include "RE/I/IMenu.h" @@ -122,6 +124,7 @@ #include "RE/P/PlayerCharacter.h" #include "RE/P/PropertyGroupInfo.h" #include "RE/P/PropertyTypeInfo.h" +#include "RE/R/RawFuncCallQuery.h" #include "RE/R/RegSettingCollection.h" #include "RE/RTTI.h" #include "RE/S/SWFToCodeFunctionHandler.h"