From 89ac36e2e646f11b4fbeaadcdbf7d810389caf45 Mon Sep 17 00:00:00 2001 From: nikitalita <69168929+nikitalita@users.noreply.github.com> Date: Fri, 27 Oct 2023 14:49:55 -0700 Subject: [PATCH] feat: add VirtualMachine interfaces (#210) Co-authored-by: Angad <66992519+ThirdEyeSqueegee@users.noreply.github.com> --- CommonLibSF/include/RE/D/DebuggerMessages.h | 15 +- CommonLibSF/include/RE/E/ErrorLogger.h | 54 +++++++ .../include/RE/I/ICachedErrorMessage.h | 22 +++ .../include/RE/I/ISavePatcherInterface.h | 23 +++ CommonLibSF/include/RE/I/IVMDebugInterface.h | 25 ++++ .../include/RE/I/IVMFunctionMessageDispatch.h | 15 ++ .../include/RE/I/IVMRemoteDebuggerInterface.h | 22 +++ .../include/RE/I/IVMSaveLoadInterface.h | 70 +++++++++ CommonLibSF/include/RE/I/IVirtualMachine.h | 137 ++++++++++++++++++ CommonLibSF/include/RE/L/Logger.h | 26 ++++ CommonLibSF/include/RE/S/SavePatcher.h | 18 +++ CommonLibSF/include/RE/Starfield.h | 10 ++ 12 files changed, 434 insertions(+), 3 deletions(-) create mode 100644 CommonLibSF/include/RE/E/ErrorLogger.h create mode 100644 CommonLibSF/include/RE/I/ICachedErrorMessage.h create mode 100644 CommonLibSF/include/RE/I/ISavePatcherInterface.h create mode 100644 CommonLibSF/include/RE/I/IVMDebugInterface.h create mode 100644 CommonLibSF/include/RE/I/IVMFunctionMessageDispatch.h create mode 100644 CommonLibSF/include/RE/I/IVMRemoteDebuggerInterface.h create mode 100644 CommonLibSF/include/RE/I/IVMSaveLoadInterface.h create mode 100644 CommonLibSF/include/RE/I/IVirtualMachine.h create mode 100644 CommonLibSF/include/RE/L/Logger.h create mode 100644 CommonLibSF/include/RE/S/SavePatcher.h diff --git a/CommonLibSF/include/RE/D/DebuggerMessages.h b/CommonLibSF/include/RE/D/DebuggerMessages.h index cd552acd..f5c4643c 100644 --- a/CommonLibSF/include/RE/D/DebuggerMessages.h +++ b/CommonLibSF/include/RE/D/DebuggerMessages.h @@ -119,8 +119,11 @@ namespace RE::GameScript // override Request virtual void HandleMessage(const RemoteDebugger& a_debugger) override; // 02 + + // members + std::uint32_t threadId; // 50 }; - static_assert(sizeof(StepInRequest) == 0x50); + static_assert(sizeof(StepInRequest) == 0x58); struct StepOutRequest : public Request { @@ -128,8 +131,11 @@ namespace RE::GameScript // override Request virtual void HandleMessage(const RemoteDebugger& a_debugger) override; // 02 + + // members + std::uint32_t threadId; // 50 }; - static_assert(sizeof(StepOutRequest) == 0x50); + static_assert(sizeof(StepOutRequest) == 0x58); struct NextRequest : public Request { @@ -137,8 +143,11 @@ namespace RE::GameScript // override Request virtual void HandleMessage(const RemoteDebugger& a_debugger) override; // 02 + + // members + std::uint32_t threadId; // 50 }; - static_assert(sizeof(NextRequest) == 0x50); + static_assert(sizeof(NextRequest) == 0x58); struct ContinueRequest : public Request { diff --git a/CommonLibSF/include/RE/E/ErrorLogger.h b/CommonLibSF/include/RE/E/ErrorLogger.h new file mode 100644 index 00000000..c6d166e2 --- /dev/null +++ b/CommonLibSF/include/RE/E/ErrorLogger.h @@ -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 // 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::byte threadErrors[0x38]; // 38 + }; + static_assert(sizeof(ErrorLogger) == 0x70); + } +} diff --git a/CommonLibSF/include/RE/I/ICachedErrorMessage.h b/CommonLibSF/include/RE/I/ICachedErrorMessage.h new file mode 100644 index 00000000..c8cb45bb --- /dev/null +++ b/CommonLibSF/include/RE/I/ICachedErrorMessage.h @@ -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); + } +} diff --git a/CommonLibSF/include/RE/I/ISavePatcherInterface.h b/CommonLibSF/include/RE/I/ISavePatcherInterface.h new file mode 100644 index 00000000..72ec5e9d --- /dev/null +++ b/CommonLibSF/include/RE/I/ISavePatcherInterface.h @@ -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); + } +} diff --git a/CommonLibSF/include/RE/I/IVMDebugInterface.h b/CommonLibSF/include/RE/I/IVMDebugInterface.h new file mode 100644 index 00000000..361809db --- /dev/null +++ b/CommonLibSF/include/RE/I/IVMDebugInterface.h @@ -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); + } +} diff --git a/CommonLibSF/include/RE/I/IVMFunctionMessageDispatch.h b/CommonLibSF/include/RE/I/IVMFunctionMessageDispatch.h new file mode 100644 index 00000000..8cb9dab1 --- /dev/null +++ b/CommonLibSF/include/RE/I/IVMFunctionMessageDispatch.h @@ -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); +} diff --git a/CommonLibSF/include/RE/I/IVMRemoteDebuggerInterface.h b/CommonLibSF/include/RE/I/IVMRemoteDebuggerInterface.h new file mode 100644 index 00000000..78c0d9b6 --- /dev/null +++ b/CommonLibSF/include/RE/I/IVMRemoteDebuggerInterface.h @@ -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); + } +} diff --git a/CommonLibSF/include/RE/I/IVMSaveLoadInterface.h b/CommonLibSF/include/RE/I/IVMSaveLoadInterface.h new file mode 100644 index 00000000..5bd9cfdc --- /dev/null +++ b/CommonLibSF/include/RE/I/IVMSaveLoadInterface.h @@ -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& a_object_pointer) const = 0; // 0A + virtual bool GetObjectBySaveHandle(std::uint64_t, BSTSmartPointer& 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& 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& a_array_pointer) const = 0; // 15 + virtual bool GetStackByID(unsigned int, BSTSmartPointer& 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& a_tasklet_pointer) = 0; // 1F + }; + static_assert(sizeof(IVMSaveLoadInterface) == 0x8); + } +} diff --git a/CommonLibSF/include/RE/I/IVirtualMachine.h b/CommonLibSF/include/RE/I/IVirtualMachine.h new file mode 100644 index 00000000..d90a3616 --- /dev/null +++ b/CommonLibSF/include/RE/I/IVirtualMachine.h @@ -0,0 +1,137 @@ +#pragma once +#include "RE/B/BSIntrusiveRefCounted.h" +#include "RE/B/BSTSmartPointer.h" +namespace RE +{ + template + using BSTThreadScrapFunction = msvc::function; + + namespace BSScript + { + class Array; + class BoundScript; + class ErrorLogger; + class ICachedErrorMessage; + class IFunction; + class ISavePatcherInterface; + class IStackCallbackFunctor; + class ITypeLinkedCallback; + class JobList; + class Object; + class ObjectBindPolicy; + class ObjectTypeInfo; + class Struct; + class StructTypeInfo; + class TypeInfo; + class Variable; + + struct ILoader; + struct IObjectHandlePolicy; + struct LogEvent; + struct StatsEvent; + + namespace UnlinkedTypes + { + struct Object; // stub + } + + class __declspec(novtable) IVirtualMachine : + public BSIntrusiveRefCounted // 08 + { + public: + static constexpr auto RTTI{ RTTI::BSScript__IVirtualMachine }; + static constexpr auto VTABLE{ VTABLE::BSScript__IVirtualMachine }; + + virtual ~IVirtualMachine() = default; // 00 + + // add + virtual void SetLoader(ILoader* a_newLoader) = 0; // 01 + virtual void SetLinkedCallback(ITypeLinkedCallback* a_typeLinkedCallback) = 0; // 02 + virtual void Update(float a_updateBudget) = 0; // 03 + virtual void UpdateTasklets(float a_updateBudget) = 0; // 04 + virtual void Unk_05(void) = 0; // 05 + virtual void SetOverstressed(bool a_overstressed) = 0; // 06 + virtual void Unk_07(void) = 0; // 07 + virtual bool IsCompletelyFrozen() const = 0; // 08 + virtual void Unk_09(void) = 0; // 09 + virtual bool RegisterObjectType(std::uint32_t a_typeID, const char* a_objectTypeName) = 0; // 0A + virtual bool GetScriptObjectType(std::uint32_t a_typeID, BSTSmartPointer& a_objType) = 0; // 0B + virtual bool GetScriptObjectType(const BSFixedString& a_name, BSTSmartPointer& a_objType) = 0; // 0C + virtual bool GetScriptObjectTypeNoLoad(std::uint32_t a_typeID, BSTSmartPointer& a_objType) const = 0; // 0D + virtual bool GetScriptObjectTypeNoLoad(const BSFixedString& a_objectTypeName, BSTSmartPointer& a_objType) const = 0; // 0E + virtual bool GetTypeIDForScriptObject(const BSFixedString& a_objectTypeName, std::uint32_t& a_typeID) const = 0; // 0F + virtual void GetScriptObjectsWithATypeID(BSScrapArray& a_objectTypeList) const = 0; // 10 + virtual bool GetParentNativeType(const BSFixedString& a_childTypeName, BSTSmartPointer& a_parentType) = 0; // 11 + virtual bool TypeIsValid(const BSFixedString& a_objectTypeName) = 0; // 12 + virtual bool ReloadType(const char* a_objectTypeName) = 0; // 13 + virtual void TasksToJobs(JobList& a_jobList) = 0; // 14 + virtual void CalculateFullReloadList(const /*BSTSet&*/ void* a_scriptSet, /*BSTObjectArena&*/ void* a_scriptList) const = 0; // 15 + virtual bool GetScriptStructType(const BSFixedString& a_structTypeName, BSTSmartPointer& a_structType) = 0; // 16 + virtual bool GetScriptStructTypeNoLoad(const BSFixedString& a_structTypeName, BSTSmartPointer& a_structType) const = 0; // 17 + virtual bool GetChildStructTypes(const BSFixedString& a_parentObjectName, /*BSTObjectArena&*/ void* a_structTypes) const = 0; // 18 + virtual bool CreateObject(const BSFixedString& a_objectTypeName, const /*BSTScrapHashMap&*/ void* a_properties, BSTSmartPointer& a_newObj) = 0; // 19 + virtual bool CreateObject(const BSFixedString& a_objectTypeName, BSTSmartPointer& a_newObj) = 0; // 1A + virtual bool CreateStruct(const BSFixedString& a_structTypeName, BSTSmartPointer& a_newStruct) = 0; // 1B + virtual bool CreateArray(TypeInfo::RawType a_elementType, const BSFixedString& a_elementObjectTypeName, std::uint32_t a_elementCount, BSTSmartPointer& a_newArray) = 0; // 1C + virtual bool CreateArray(const TypeInfo& a_type, std::uint32_t a_elementCount, BSTSmartPointer& a_newArray) = 0; // 1D + virtual bool BindNativeMethod(IFunction* a_function) = 0; // 1E + virtual void SetCallableFromTasklets(const char* a_objectName, const char* a_functionName, bool a_taskletCallable) = 0; // 1F + virtual void SetCallableFromTasklets(const char* a_objectName, const char* a_stateName, const char* a_functionName, bool a_taskletCallable) = 0; // 20 + virtual void ForEachBoundObject(std::uint64_t a_objHandle, const BSTThreadScrapFunction& a_functor) = 0; // 21 + virtual bool FindBoundObject(std::uint64_t a_objHandle, const char* a_objectTypeName, bool a_allowConst, BSTSmartPointer& a_attachedObj, bool a_exactMatch) const = 0; // 22 + virtual void MoveBoundObjects(std::uint64_t a_sourceHandle, std::uint64_t a_destHandle) = 0; // 23 + virtual void ResetAllBoundObjects(std::uint64_t a_objHandle) = 0; // 24 + virtual bool CastObject(const BSTSmartPointer& a_sourceObj, const BSTSmartPointer& a_targetType, BSTSmartPointer& a_castedObj) = 0; // 25 + virtual bool SetPropertyValue(const BSTSmartPointer& a_self, ...) = 0; // 26 -- unknown VA args + virtual bool GetPropertyValue(const BSTSmartPointer& a_self, const char* a_propName, const BSTSmartPointer& a_callback, int a_unk0) = 0; // 27 + virtual bool GetVariableValue(std::uint64_t a_objHandle, const BSFixedString& a_scriptName, std::uint32_t a_varIndex, Variable& a_var) const = 0; // 28 + virtual bool GetVariableValue(const BSTSmartPointer& a_obj, std::uint32_t a_varIndex, Variable& a_var) const = 0; // 29 + virtual bool HandleImplementsEvent(std::uint64_t a_object, const BSFixedString& a_eventName) const = 0; // 2A + virtual bool AddEventRelay(std::uint64_t a_sourceObject, const BSFixedString& a_eventName, const BSTSmartPointer& a_destObj) = 0; // 2B + virtual void RemoveEventRelay(std::uint64_t a_sourceObject, const BSFixedString& a_eventName, const BSTSmartPointer& a_destObj) = 0; // 2C + virtual void RemoveAllEventRelays(const BSTSmartPointer& a_destObj) = 0; // 2D + virtual void SendEvent(std::uint64_t a_objHandle, const BSFixedString& a_eventName, const BSTThreadScrapFunction&)>& a_arguments, const BSTThreadScrapFunction&)>& a_filter, const BSTSmartPointer& a_callback, int a_unk0) = 0; // 2E + virtual bool DispatchStaticCall(const BSFixedString& a_objName, const BSFixedString& a_funcName, const BSTThreadScrapFunction&)>& a_arguments, const BSTSmartPointer& a_callback, int a_unk0) = 0; // 2F + virtual bool DispatchMethodCall(std::uint64_t a_objHandle, const BSFixedString& a_objName, const BSFixedString& a_funcName, const BSTThreadScrapFunction&)>& a_arguments, const BSTSmartPointer& a_callback, int a_unk0) = 0; // 30 + virtual bool DispatchMethodCall(const BSTSmartPointer& a_self, const BSFixedString& a_funcName, const BSTThreadScrapFunction&)>& a_arguments, const BSTSmartPointer& a_callback, int a_unk0) = 0; // 31 + virtual bool DispatchUnboundMethodCall(std::uint64_t a_objHandle, const BSTSmartPointer& a_script, const BSFixedString& a_funcName, const BSTThreadScrapFunction&)>& a_arguments, const BSTSmartPointer& a_callback, int a_unk0) = 0; // 32 + virtual void ReturnFromLatent(std::uint32_t a_stackID, const Variable& a_retValue) = 0; // 33 -- IsWaitingOnLatent was removed + virtual void UnkGuardFunction(void) = 0; // 34 + [[nodiscard]] virtual ErrorLogger& GetErrorLogger() const = 0; // 35 + [[nodiscard]] virtual const IObjectHandlePolicy& GetObjectHandlePolicy() const = 0; // 36 + [[nodiscard]] virtual IObjectHandlePolicy& GetObjectHandlePolicy() = 0; // 37 + [[nodiscard]] virtual const ObjectBindPolicy& GetObjectBindPolicy() const = 0; // 38 + [[nodiscard]] virtual ObjectBindPolicy& GetObjectBindPolicy() = 0; // 39 + [[nodiscard]] virtual ISavePatcherInterface& GetSavePatcherInterface() = 0; // 3A + [[nodiscard]] virtual const IVirtualMachine& GetVMInterface() const = 0; // 3B + [[nodiscard]] virtual IVirtualMachine& GetVMInterface() = 0; // 3C + virtual void RegisterForLogEvent(BSTEventSink* a_sink) = 0; // 3D + virtual void UnregisterForLogEvent(BSTEventSink* a_sink) = 0; // 3E + virtual void RegisterForStatsEvent(BSTEventSink* a_sink) = 0; // 3F + virtual void UnregisterForStatsEvent(BSTEventSink* a_sink) = 0; // 40 + virtual void PostCachedErrorToLogger(const ICachedErrorMessage& a_errorFunctor, ErrorLogger::Severity a_severity) const = 0; // 41 + virtual void PostCachedErrorToLogger(const ICachedErrorMessage& a_errorFunctor, std::uint32_t a_stackID, ErrorLogger::Severity a_severity) const = 0; // 42 + + void PostError(std::string_view a_msg, std::uint32_t a_stackID, ErrorLogger::Severity a_severity) + { + class ErrorImpl : + public ICachedErrorMessage + { + public: + ErrorImpl(std::string_view a_message) noexcept : + _message(a_message) + {} + + void GetErrorMsg(BSFixedString& a_message) const override { a_message = _message; } + + private: + std::string_view _message; + }; + + const ErrorImpl e{ a_msg }; + PostCachedErrorToLogger(e, a_stackID, a_severity); + } + }; + static_assert(sizeof(IVirtualMachine) == 0x10); + } +} diff --git a/CommonLibSF/include/RE/L/Logger.h b/CommonLibSF/include/RE/L/Logger.h new file mode 100644 index 00000000..1beaf201 --- /dev/null +++ b/CommonLibSF/include/RE/L/Logger.h @@ -0,0 +1,26 @@ +#pragma once + +#include "RE/E/ErrorLogger.h" + +namespace RE::GameScript +{ + + class BSLog; + + class __declspec(novtable) Logger : + public BSScript::ErrorLogger // 00 + { + public: + static constexpr auto RTTI{ RTTI::GameScript__Logger }; + static constexpr auto VTABLE{ VTABLE::GameScript__Logger }; + + // override (BSScript::ErrorLogger) + void PostErrorImpl(const BSScript::ICachedErrorMessage* a_errMsg, Severity a_severity) override; // 01 + + // members + BSFixedString logFolder; // 70 + BSLog* log; // 78 + std::uint64_t unk80; // 80 + }; + static_assert(sizeof(Logger) == 0x88); +} \ No newline at end of file diff --git a/CommonLibSF/include/RE/S/SavePatcher.h b/CommonLibSF/include/RE/S/SavePatcher.h new file mode 100644 index 00000000..02b0186c --- /dev/null +++ b/CommonLibSF/include/RE/S/SavePatcher.h @@ -0,0 +1,18 @@ +#pragma once + +#include "RE/I/ISavePatcherInterface.h" + +namespace RE::GameScript +{ + class __declspec(novtable) SavePatcher : + public BSScript::ISavePatcherInterface // 0 + { + public: + static constexpr auto RTTI{ RTTI::GameScript__SavePatcher }; + static constexpr auto VTABLE{ VTABLE::GameScript__SavePatcher }; + + // override (BSScript::ISavePatcherInterface) + void PatchStackFrame(BSScript::StackFrame&, BSScript::IVirtualMachine&) override { return; } // 01 + }; + static_assert(sizeof(SavePatcher) == 0x8); +} \ No newline at end of file diff --git a/CommonLibSF/include/RE/Starfield.h b/CommonLibSF/include/RE/Starfield.h index 2e9a70d4..5744355d 100644 --- a/CommonLibSF/include/RE/Starfield.h +++ b/CommonLibSF/include/RE/Starfield.h @@ -85,6 +85,7 @@ #include "RE/C/ConsoleLog.h" #include "RE/D/DebuggerMessages.h" #include "RE/E/EffectItem.h" +#include "RE/E/ErrorLogger.h" #include "RE/E/ExtraDataList.h" #include "RE/E/ExtraDataTypes.h" #include "RE/E/ExtraLock.h" @@ -94,6 +95,7 @@ #include "RE/G/GameMenuBase.h" #include "RE/H/HandlePolicy.h" #include "RE/I/IAnimationGraphManagerHolder.h" +#include "RE/I/ICachedErrorMessage.h" #include "RE/I/IComplexType.h" #include "RE/I/IFuncCallQuery.h" #include "RE/I/IFunction.h" @@ -107,8 +109,14 @@ #include "RE/I/INISettingCollection.h" #include "RE/I/IObjectHandlePolicy.h" #include "RE/I/IPostAnimationChannelUpdateFunctor.h" +#include "RE/I/ISavePatcherInterface.h" #include "RE/I/IStoreAnimationActions.h" +#include "RE/I/IVMDebugInterface.h" +#include "RE/I/IVMFunctionMessageDispatch.h" #include "RE/I/IVMObjectBindInterface.h" +#include "RE/I/IVMRemoteDebuggerInterface.h" +#include "RE/I/IVMSaveLoadInterface.h" +#include "RE/I/IVirtualMachine.h" #include "RE/I/idLogging.h" #include "RE/I/idTCP.h" #include "RE/IDs.h" @@ -116,6 +124,7 @@ #include "RE/IDs_RTTI.h" #include "RE/IDs_VTABLE.h" #include "RE/L/LockPickedEvent.h" +#include "RE/L/Logger.h" #include "RE/M/MagicItem.h" #include "RE/M/MagicSystem.h" #include "RE/M/MagicTarget.h" @@ -139,6 +148,7 @@ #include "RE/R/RegSettingCollection.h" #include "RE/RTTI.h" #include "RE/S/SWFToCodeFunctionHandler.h" +#include "RE/S/SavePatcher.h" #include "RE/S/ScaleformGFxASMovieRootBase.h" #include "RE/S/ScaleformGFxFileTypeConstants.h" #include "RE/S/ScaleformGFxFunctionHandler.h"