-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Implement IFuncCallQuery, RawFuncCallQuery, CodeTasklet (#194)
- Loading branch information
1 parent
0cd9f3d
commit 32dfc33
Showing
4 changed files
with
209 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<ObjectTypeInfo>& a_objectTypeInfo, | ||
BSFixedString& a_name, | ||
Variable& a_self, | ||
void* /* BSScrapArray<Variable>& */ a_args) const override; // 01 | ||
|
||
virtual BSTSmartPointer<Object> GetSelfAsObject() const override; // 02 | ||
|
||
// members | ||
Stack* stack; // 10 | ||
VirtualMachine* vm; // 18 | ||
ErrorLogger* errorLogger; // 20 | ||
stl::enumeration<ResumeReason, std::uint32_t> 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); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<ObjectTypeInfo>& a_objectTypeInfo, | ||
BSFixedString& a_name, | ||
Variable& a_self, | ||
void* /* BSScrapArray<Variable>& */ a_args) const = 0; // 01 | ||
virtual BSTSmartPointer<Object> GetSelfAsObject() const = 0; // 02 | ||
}; | ||
static_assert(sizeof(IFuncCallQuery) == 0x10); | ||
|
||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<ObjectTypeInfo>& a_objectTypeInfo, | ||
BSFixedString& a_name, | ||
Variable& a_self, | ||
void* /* BSScrapArray<Variable>& */ a_args) const override; // 01 | ||
|
||
virtual BSTSmartPointer<Object> GetSelfAsObject() const override; // 02 -- just calls get<BSTSmartPointer<Object>>() | ||
|
||
// members | ||
CallType callType; // 10 | ||
std::uint32_t pad14; // 14 | ||
BSTSmartPointer<ObjectTypeInfo> objType; // 18 | ||
BSFixedString name; // 20 | ||
Variable self; // 28 | ||
BSTArray<Variable> args; // 38 | ||
}; | ||
static_assert(sizeof(RawFuncCallQuery) == 0x48); | ||
} | ||
|
||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters