-
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: add VirtualMachine interfaces (#210)
Co-authored-by: Angad <[email protected]>
- Loading branch information
1 parent
c28732e
commit 89ac36e
Showing
12 changed files
with
434 additions
and
3 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
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,54 @@ | ||
#pragma once | ||
|
||
#include "RE/B/BSFixedString.h" | ||
#include "RE/B/BSLock.h" | ||
#include "RE/B/BSTEvent.h" | ||
#include "RE/I/ICachedErrorMessage.h" | ||
|
||
namespace RE | ||
{ | ||
namespace BSScript | ||
{ | ||
class ICachedErrorMessage; | ||
|
||
struct LogEvent; | ||
|
||
class __declspec(novtable) ErrorLogger : | ||
public BSTEventSource<LogEvent> // 08 | ||
{ | ||
public: | ||
static constexpr auto RTTI{ RTTI::BSScript__ErrorLogger }; | ||
static constexpr auto VTABLE{ VTABLE::BSScript__ErrorLogger }; | ||
|
||
enum class Severity | ||
{ | ||
kInfo, | ||
kWarning, | ||
kError, | ||
kFatal | ||
}; | ||
|
||
struct PerThreadErrorCounts | ||
{ | ||
public: | ||
// members | ||
std::uint32_t fatalCount; // 0 | ||
std::uint32_t errorCount; // 4 | ||
std::uint32_t warningCount; // 8 | ||
}; | ||
static_assert(sizeof(PerThreadErrorCounts) == 0xC); | ||
|
||
virtual ~ErrorLogger(); // 00 | ||
|
||
// add | ||
virtual void PostErrorImpl(const ICachedErrorMessage* a_errMsg, Severity a_severity) = 0; // 01 | ||
virtual void ResetImpl() { return; } // 02 | ||
|
||
// members | ||
const BSFixedString logName; // 28 | ||
BSSpinLock dataLock; // 30 | ||
/*BSTHashMap<std::uint32_t, ErrorLogger::PerThreadErrorCounts>*/ std::byte threadErrors[0x38]; // 38 | ||
}; | ||
static_assert(sizeof(ErrorLogger) == 0x70); | ||
} | ||
} |
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,22 @@ | ||
#pragma once | ||
|
||
#include "RE/B/BSFixedString.h" | ||
|
||
namespace RE | ||
{ | ||
namespace BSScript | ||
{ | ||
class __declspec(novtable) ICachedErrorMessage | ||
{ | ||
public: | ||
static constexpr auto RTTI{ RTTI::BSScript__ICachedErrorMessage }; | ||
static constexpr auto VTABLE{ VTABLE::BSScript__ICachedErrorMessage }; | ||
|
||
virtual ~ICachedErrorMessage() = default; // 00 | ||
|
||
// add | ||
virtual void GetErrorMsg(BSFixedString& a_message) const = 0; // 01 | ||
}; | ||
static_assert(sizeof(ICachedErrorMessage) == 0x8); | ||
} | ||
} |
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,23 @@ | ||
#pragma once | ||
|
||
namespace RE | ||
{ | ||
namespace BSScript | ||
{ | ||
class IVirtualMachine; | ||
class StackFrame; | ||
|
||
class ISavePatcherInterface | ||
{ | ||
public: | ||
static constexpr auto RTTI{ RTTI::BSScript__ISavePatcherInterface }; | ||
static constexpr auto VTABLE{ VTABLE::BSScript__ISavePatcherInterface }; | ||
|
||
virtual ~ISavePatcherInterface() = default; // 00 | ||
|
||
// add | ||
virtual void PatchStackFrame(StackFrame&, IVirtualMachine&) = 0; // 01 | ||
}; | ||
static_assert(sizeof(ISavePatcherInterface) == 0x8); | ||
} | ||
} |
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,25 @@ | ||
#pragma once | ||
|
||
#include "RE/B/BSFixedString.h" | ||
|
||
namespace RE | ||
{ | ||
namespace BSScript | ||
{ | ||
class __declspec(novtable) IVMDebugInterface | ||
{ | ||
public: | ||
static constexpr auto RTTI{ RTTI::BSScript__IVMDebugInterface }; | ||
static constexpr auto VTABLE{ VTABLE::BSScript__IVMDebugInterface }; | ||
|
||
virtual ~IVMDebugInterface(); // 00 | ||
|
||
virtual void DumpRunningStacksToLog() = 0; // 01 | ||
virtual void DumpStackFrameToLog(unsigned int a_v, unsigned int b_v, bool a_flag) = 0; // 02 | ||
virtual void GetStackFrame(unsigned int a_v, unsigned int b_v, bool a_flag, BSFixedString& a_identifier) = 0; // 03 | ||
virtual void DumpPersistenceInformationToLog(char const* logfile, uint64_t a_v) const = 0; // 04 | ||
virtual void DumpEventRelayInformationToLog(char const* logfile, uint64_t a_v, BSFixedString const& a_string) const = 0; // 05 | ||
}; | ||
static_assert(sizeof(IVMDebugInterface) == 0x8); | ||
} | ||
} |
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,15 @@ | ||
#pragma once | ||
|
||
namespace RE::BSScript::Internal | ||
{ | ||
class __declspec(novtable) IVMFunctionMessageDispatch | ||
{ | ||
public: | ||
static constexpr auto RTTI{ RTTI::BSScript__Internal__IVMFunctionMessageDispatch }; | ||
// VTable got optimized out? | ||
|
||
virtual void Unk00(); // 00 | ||
virtual ~IVMFunctionMessageDispatch(); // 01 -- destructor is BELOW the first function. | ||
}; | ||
static_assert(sizeof(IVMFunctionMessageDispatch) == 0x8); | ||
} |
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,22 @@ | ||
#pragma once | ||
|
||
#include "RE/B/BSFixedString.h" | ||
|
||
namespace RE | ||
{ | ||
namespace BSScript | ||
{ | ||
class __declspec(novtable) IVMRemoteDebuggerInterface | ||
{ | ||
public: | ||
SF_RTTI_VTABLE(BSScript__IVMRemoteDebuggerInterface); | ||
|
||
~IVMRemoteDebuggerInterface() = delete; | ||
|
||
virtual void Unk00(); // 00 -- calls Unk05 in IVirtualMachine | ||
virtual void Unk01(); // 01 | ||
virtual void Unk02(); // 02 | ||
}; | ||
static_assert(sizeof(IVMRemoteDebuggerInterface) == 0x8); | ||
} | ||
} |
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,70 @@ | ||
#pragma once | ||
|
||
#include "RE/B/BSTSmartPointer.h" | ||
|
||
namespace RE | ||
{ | ||
class BSStorage; | ||
|
||
namespace BSScript | ||
{ | ||
class Object; | ||
class Array; | ||
class TypeInfo; | ||
class Stack; | ||
class Struct; | ||
|
||
struct IHandleReaderWriter; | ||
|
||
namespace Internal | ||
{ | ||
class ReadableStringTable; | ||
class ReadableTypeTable; | ||
class WritableStringTable; | ||
class WritableTypeTable; | ||
class CodeTasklet; | ||
} | ||
|
||
class __declspec(novtable) IVMSaveLoadInterface | ||
{ | ||
public: | ||
static constexpr auto RTTI{ RTTI::BSScript__IVMSaveLoadInterface }; | ||
static constexpr auto VTABLE{ VTABLE::BSScript__IVMSaveLoadInterface }; | ||
|
||
virtual ~IVMSaveLoadInterface(); // 00 | ||
|
||
virtual bool SaveGame(BSStorage& a_storage, IHandleReaderWriter const& a_HandleReaderWriter, bool a_flag) = 0; // 01 | ||
virtual bool LoadGame(BSStorage const& a_storage, IHandleReaderWriter const& a_HandleReaderWriter, bool& a_flag, bool& b_flag) = 0; // 02 | ||
virtual void MarkSaveInvalid(BSStorage& a_storage) = 0; // 03 | ||
virtual unsigned short GetSaveGameVersion() const = 0; // 04 | ||
virtual void CleanupSave() = 0; // 05 | ||
virtual void CleanupLoad() = 0; // 06 | ||
virtual void DropAllRunningData() = 0; // 07 | ||
virtual std::uint64_t GetSaveHandleForObject(const Object* a_Object) const = 0; // 08 | ||
virtual void SetSaveHandleForObject(const Object* a_Object, std::uint64_t) = 0; // 09 | ||
virtual bool GetObjectBySaveHandle(std::uint64_t, const TypeInfo& a_TypeInfo, BSTSmartPointer<Object, BSTSmartPointerIntrusiveRefCount>& a_object_pointer) const = 0; // 0A | ||
virtual bool GetObjectBySaveHandle(std::uint64_t, BSTSmartPointer<Object, BSTSmartPointerIntrusiveRefCount>& a_object_pointer) const = 0; // 0B | ||
virtual void unk_0C(void) = 0; // 0C | ||
virtual void unk_0D(void) = 0; // 0D | ||
virtual std::uint64_t GetSaveHandleForStruct(const Struct* a_Struct) const = 0; // 0E | ||
virtual void SetSaveHandleForStruct(const Struct* a_Struct, std::uint64_t) = 0; // 0F | ||
virtual bool GetStructBySaveHandle(std::uint64_t, BSTSmartPointer<Struct, BSTSmartPointerIntrusiveRefCount>& a_object_pointer) const = 0; // 10 | ||
virtual void unk_11(void) = 0; // 11 | ||
virtual void unk_12(void) = 0; // 12 | ||
virtual std::uint64_t GetSaveHandleForArray(const Array* a_Array) const = 0; // 13 | ||
virtual void SetSaveHandleForArray(const Array* a_Array, std::uint64_t) = 0; // 14 | ||
virtual bool GetArrayBySaveHandle(std::uint64_t handle, BSTSmartPointer<Array, BSTSmartPointerIntrusiveRefCount>& a_array_pointer) const = 0; // 15 | ||
virtual bool GetStackByID(unsigned int, BSTSmartPointer<Stack, BSTSmartPointerIntrusiveRefCount>& a_stack_pointer) const = 0; // 16 | ||
virtual void unk_17(void) = 0; // 17 | ||
virtual const Internal::WritableStringTable& GetWritableStringTable() const = 0; // 18 | ||
virtual const Internal::WritableStringTable& GetWritableStringTable() = 0; // 19 | ||
virtual Internal::ReadableStringTable& GetReadableStringTable() const = 0; // 1A | ||
virtual const Internal::WritableTypeTable& GetWritableTypeTable() const = 0; // 1B | ||
virtual Internal::WritableTypeTable& GetWritableTypeTable() = 0; // 1C | ||
virtual const Internal::ReadableTypeTable& GetReadableTypeTable() const = 0; // 1D | ||
virtual void unk_1E(void) = 0; // 1E | ||
virtual bool CreateEmptyTasklet(Stack* a_Stack, BSTSmartPointer<Internal::CodeTasklet, BSTSmartPointerIntrusiveRefCount>& a_tasklet_pointer) = 0; // 1F | ||
}; | ||
static_assert(sizeof(IVMSaveLoadInterface) == 0x8); | ||
} | ||
} |
Oops, something went wrong.