From 0801c7ad2a29c30588c2a31cde7b347a26a6f727 Mon Sep 17 00:00:00 2001 From: Angad <66992519+ThirdEyeSqueegee@users.noreply.github.com> Date: Tue, 23 Jul 2024 22:02:02 -0700 Subject: [PATCH] chore: cleanup --- include/RE/B/BSResourceEnums.h | 2 +- include/RE/B/BSStorage.h | 2 + include/RE/B/BSTimer.h | 1 - include/RE/C/CompiledScriptLoader.h | 2 +- include/RE/G/GameVM.h | 5 +- include/RE/H/HandleReaderWriter.h | 5 +- include/RE/I/IStore.h | 2 + include/RE/I/idTCP.h | 1 - include/RE/M/MemoryManager.h | 1 - include/RE/P/PlayerCharacter.h | 2 +- include/RE/P/Profiler.h | 2 +- include/RE/R/ReadableStringTable.h | 68 ++- include/RE/R/ReadableTypeTable.h | 36 +- include/RE/R/RemoteDebugger.h | 4 +- include/RE/S/SimpleAllocMemoryPagePolicy.h | 53 +- include/RE/S/Store.h | 45 +- include/RE/S/Stream.h | 2 +- include/RE/S/SuspendedStack.h | 25 +- include/RE/V/VirtualMachine.h | 563 ++++++++++----------- include/RE/W/WritableStringTable.h | 28 +- include/RE/W/WritableTypeTable.h | 27 +- src/RE/R/RemoteDebugger.cpp | 9 +- src/RE/S/Stream.cpp | 287 ++++++----- src/RE/S/StreamBase.cpp | 109 ++-- src/RE/V/VirtualMachine.cpp | 2 +- 25 files changed, 627 insertions(+), 656 deletions(-) diff --git a/include/RE/B/BSResourceEnums.h b/include/RE/B/BSResourceEnums.h index 27eea02f..68c04086 100644 --- a/include/RE/B/BSResourceEnums.h +++ b/include/RE/B/BSResourceEnums.h @@ -53,4 +53,4 @@ namespace RE::BSResource std::uint64_t fileSize; // 10 }; static_assert(sizeof(Info) == 0x18); -} \ No newline at end of file +} diff --git a/include/RE/B/BSStorage.h b/include/RE/B/BSStorage.h index ac0259d0..48a529b1 100644 --- a/include/RE/B/BSStorage.h +++ b/include/RE/B/BSStorage.h @@ -13,7 +13,9 @@ namespace RE kError = 1, kNotImplemented = 2, }; + enum class SeekMode; + struct StreamBuffer { void Reset() diff --git a/include/RE/B/BSTimer.h b/include/RE/B/BSTimer.h index bac78082..3e0a1ec1 100644 --- a/include/RE/B/BSTimer.h +++ b/include/RE/B/BSTimer.h @@ -1,4 +1,3 @@ - #pragma once namespace RE diff --git a/include/RE/C/CompiledScriptLoader.h b/include/RE/C/CompiledScriptLoader.h index afd2a582..33b3c171 100644 --- a/include/RE/C/CompiledScriptLoader.h +++ b/include/RE/C/CompiledScriptLoader.h @@ -15,8 +15,8 @@ namespace RE namespace Internal { class ReadableStringTable; - } + namespace UnlinkedTypes { struct Object; // stub diff --git a/include/RE/G/GameVM.h b/include/RE/G/GameVM.h index b0f38d86..5d3e4d1e 100644 --- a/include/RE/G/GameVM.h +++ b/include/RE/G/GameVM.h @@ -18,7 +18,6 @@ namespace RE { - struct InputEnableLayerDestroyedEvent; struct PositionPlayerEvent; struct TESFormDeleteEvent; @@ -26,16 +25,19 @@ namespace RE struct TESInitScriptEvent; struct TESResolveNPCTemplatesEvent; struct TESUniqueIDChangeEvent; + namespace ModelReferenceEffectEvents { struct ReferenceEffectFinished; } + namespace BSScript { struct StatsEvent; class IVMSaveLoadInterface; class IVMDebugInterface; } + namespace GameScript { struct StatsEvent; @@ -215,5 +217,4 @@ namespace RE std::uint32_t overflowFlags; // 8968 }; static_assert(sizeof(GameVM) == 0x8970); - } diff --git a/include/RE/H/HandleReaderWriter.h b/include/RE/H/HandleReaderWriter.h index 25849acb..9298a17a 100644 --- a/include/RE/H/HandleReaderWriter.h +++ b/include/RE/H/HandleReaderWriter.h @@ -1,3 +1,5 @@ +#pragma once + #include "RE/I/IHandleReaderWriter.h" #include "RE/I/IObjectHandlePolicy.h" #include "RE/T/TESFile.h" @@ -62,5 +64,4 @@ namespace RE::GameScript TESFile* file; //10 }; static_assert(sizeof(DataFileHandleReaderWriter) == 0x18); - -} \ No newline at end of file +} diff --git a/include/RE/I/IStore.h b/include/RE/I/IStore.h index 90547414..7a9d31b5 100644 --- a/include/RE/I/IStore.h +++ b/include/RE/I/IStore.h @@ -1,7 +1,9 @@ #pragma once + #include "RE/B/BSFixedString.h" #include "RE/B/BSStorage.h" #include "RE/B/BSTSmartPointer.h" + namespace RE { namespace BSScript diff --git a/include/RE/I/idTCP.h b/include/RE/I/idTCP.h index b3db24b0..0b273182 100644 --- a/include/RE/I/idTCP.h +++ b/include/RE/I/idTCP.h @@ -41,5 +41,4 @@ namespace RE std::uintptr_t socket; // 18 }; static_assert(sizeof(idTCP) == 0x20); - } diff --git a/include/RE/M/MemoryManager.h b/include/RE/M/MemoryManager.h index ff1f7732..ba927113 100644 --- a/include/RE/M/MemoryManager.h +++ b/include/RE/M/MemoryManager.h @@ -2,7 +2,6 @@ namespace RE { - class ScrapHeap; struct HeapStats; struct MemoryStats; diff --git a/include/RE/P/PlayerCharacter.h b/include/RE/P/PlayerCharacter.h index aa6d88a3..7121632a 100644 --- a/include/RE/P/PlayerCharacter.h +++ b/include/RE/P/PlayerCharacter.h @@ -8,7 +8,6 @@ namespace RE class MenuModeChangeEvent; class MenuOpenCloseEvent; class OtherEventEnabledEvent; - struct TESFormDeleteEvent; class TESHitEvent; class UserEventEnabledEvent; @@ -18,6 +17,7 @@ namespace RE struct PickRefUpdateEvent; struct PositionPlayerEvent; struct TargetHitEvent; + struct TESFormDeleteEvent; struct QuestStatus { diff --git a/include/RE/P/Profiler.h b/include/RE/P/Profiler.h index 610180ef..868d11a0 100644 --- a/include/RE/P/Profiler.h +++ b/include/RE/P/Profiler.h @@ -39,4 +39,4 @@ namespace RE }; static_assert(sizeof(Profiler) == 0x130); } -} \ No newline at end of file +} diff --git a/include/RE/R/ReadableStringTable.h b/include/RE/R/ReadableStringTable.h index 18a766f5..6caf0ad9 100644 --- a/include/RE/R/ReadableStringTable.h +++ b/include/RE/R/ReadableStringTable.h @@ -4,46 +4,40 @@ #include "RE/B/BSTArray.h" #include "RE/B/BSTObjectArena.h" -namespace RE +namespace RE::BSScript::Internal { - namespace BSScript + enum class StringIndexSize { - namespace Internal - { - enum class StringIndexSize - { - kSmall, - kLarge - }; + kSmall, + kLarge + }; - class ReadableStringTable - { - public: - class StringEntry - { - public: - // members - const char* originalData; // 00 - BSFixedString convertedString; // 08 - }; - static_assert(sizeof(StringEntry) == 0x10); + class ReadableStringTable + { + public: + class StringEntry + { + public: + // members + const char* originalData; // 00 + BSFixedString convertedString; // 08 + }; + static_assert(sizeof(StringEntry) == 0x10); - class StringTableScrapPage - { - public: - // members - char buffer[0x1000]; // 0000 - char* curr; // 1000 - const char* const end; // 1008 - }; - static_assert(sizeof(StringTableScrapPage) == 0x1010); + class StringTableScrapPage + { + public: + // members + char buffer[0x1000]; // 0000 + char* curr; // 1000 + const char* const end; // 1008 + }; + static_assert(sizeof(StringTableScrapPage) == 0x1010); - // members - msvc::unique_ptr> scrapPages; // 00 - msvc::unique_ptr> entries; // 08 - stl::enumeration indexSize; // 10 - }; - static_assert(sizeof(ReadableStringTable) == 0x18); - } - } + // members + msvc::unique_ptr> scrapPages; // 00 + msvc::unique_ptr> entries; // 08 + stl::enumeration indexSize; // 10 + }; + static_assert(sizeof(ReadableStringTable) == 0x18); } diff --git a/include/RE/R/ReadableTypeTable.h b/include/RE/R/ReadableTypeTable.h index 78f2fcb8..a094fa92 100644 --- a/include/RE/R/ReadableTypeTable.h +++ b/include/RE/R/ReadableTypeTable.h @@ -3,29 +3,23 @@ #include "RE/B/BSFixedString.h" #include "RE/B/BSTSmartPointer.h" -namespace RE +namespace RE::BSScript::Internal { - namespace BSScript + class ReadableTypeTable { - namespace Internal + public: + struct SaveTypeInfo : + public BSIntrusiveRefCounted // 00 { - class ReadableTypeTable - { - public: - struct SaveTypeInfo : - public BSIntrusiveRefCounted // 00 - { - public: - // members - BSFixedString parentType; // 08 - BSScrapArray variableIndicies; // 10 - }; - static_assert(sizeof(SaveTypeInfo) == 0x28); + public: + // members + BSFixedString parentType; // 08 + BSScrapArray variableIndicies; // 10 + }; + static_assert(sizeof(SaveTypeInfo) == 0x28); - // members - /*BSTScrapHashMap>* */ void* saveTypeInfo; // 00 - }; - static_assert(sizeof(ReadableTypeTable) == 0x08); - } - } + // members + /*BSTScrapHashMap>* */ void* saveTypeInfo; // 00 + }; + static_assert(sizeof(ReadableTypeTable) == 0x08); } diff --git a/include/RE/R/RemoteDebugger.h b/include/RE/R/RemoteDebugger.h index be15e0b1..db1b152b 100644 --- a/include/RE/R/RemoteDebugger.h +++ b/include/RE/R/RemoteDebugger.h @@ -4,9 +4,9 @@ #include "RE/D/DebuggerMessages.h" #include "RE/I/IRemoteDebugger.h" #include "RE/I/idTCP.h" + namespace RE::GameScript { - class RemoteDebugger : BSScript::IRemoteDebugger { public: @@ -97,4 +97,4 @@ namespace RE::GameScript BSNonReentrantSpinLock logLock; // D0 }; static_assert(sizeof(RemoteDebugger) == 0xD8); -} \ No newline at end of file +} diff --git a/include/RE/S/SimpleAllocMemoryPagePolicy.h b/include/RE/S/SimpleAllocMemoryPagePolicy.h index 88b1539d..a6108a13 100644 --- a/include/RE/S/SimpleAllocMemoryPagePolicy.h +++ b/include/RE/S/SimpleAllocMemoryPagePolicy.h @@ -10,36 +10,33 @@ #include "RE/B/BSTTuple.h" #include "RE/I/IMemoryPagePolicy.h" -namespace RE +namespace RE::BSScript { - namespace BSScript - { - class MemoryPage; // stub + class MemoryPage; // stub - class SimpleAllocMemoryPagePolicy : - public IMemoryPagePolicy - { - public: - SF_RTTI_VTABLE(BSScript__SimpleAllocMemoryPagePolicy); + class SimpleAllocMemoryPagePolicy : + public IMemoryPagePolicy + { + public: + SF_RTTI_VTABLE(BSScript__SimpleAllocMemoryPagePolicy); - // override (IMemoryPagePolicy) - std::uint32_t MaximumPageSize() const override { return maxPageSize; } // 01 - std::uint32_t MaximumStackDepth() const override { return maxStackDepth; } // 02 - AllocationStatus AllocatePage(std::uint32_t a_sizeInBytes, NewPageStrategy a_strategy, BSTAutoPointer& a_newPage) override; // 03 - AllocationStatus GetLargestAvailablePage(BSTAutoPointer& a_newPage) override; // 04 - void DisposePage(BSTAutoPointer& a_oldPage) override; // 05 + // override (IMemoryPagePolicy) + std::uint32_t MaximumPageSize() const override { return maxPageSize; } // 01 + std::uint32_t MaximumStackDepth() const override { return maxStackDepth; } // 02 + AllocationStatus AllocatePage(std::uint32_t a_sizeInBytes, NewPageStrategy a_strategy, BSTAutoPointer& a_newPage) override; // 03 + AllocationStatus GetLargestAvailablePage(BSTAutoPointer& a_newPage) override; // 04 + void DisposePage(BSTAutoPointer& a_oldPage) override; // 05 - // members - const std::uint32_t minPageSize{ 0x40 }; // 08 - const std::uint32_t maxPageSize{ 0x2000 }; // 0C - const std::uint32_t maxAllocatedMemory{ 0x100000 }; // 10 - const std::uint32_t maxStackDepth{ 500 }; // 14 - bool ignoreMemoryLimit{ false }; // 18 - bool outOfMemory{ false }; // 19 - BSSpinLock dataLock; // 1C - std::uint32_t currentMemorySize{ 0 }; // 24 - std::uint32_t maxAdditionalAllocations{ 0 }; // 28 - }; - static_assert(sizeof(SimpleAllocMemoryPagePolicy) == 0x30); - } + // members + const std::uint32_t minPageSize{ 0x40 }; // 08 + const std::uint32_t maxPageSize{ 0x2000 }; // 0C + const std::uint32_t maxAllocatedMemory{ 0x100000 }; // 10 + const std::uint32_t maxStackDepth{ 500 }; // 14 + bool ignoreMemoryLimit{ false }; // 18 + bool outOfMemory{ false }; // 19 + BSSpinLock dataLock; // 1C + std::uint32_t currentMemorySize{ 0 }; // 24 + std::uint32_t maxAdditionalAllocations{ 0 }; // 28 + }; + static_assert(sizeof(SimpleAllocMemoryPagePolicy) == 0x30); } diff --git a/include/RE/S/Store.h b/include/RE/S/Store.h index 1a03cace..f5ce57bf 100644 --- a/include/RE/S/Store.h +++ b/include/RE/S/Store.h @@ -3,33 +3,30 @@ #include "RE/B/BSTSmartPointer.h" #include "RE/I/IStore.h" #include "RE/S/Stream.h" -namespace RE + +namespace RE::GameScript { - namespace GameScript + class Store : public BSScript::IStore { + public: + SF_RTTI_VTABLE(GameScript__Store); - class Store : public BSScript::IStore - { - public: - SF_RTTI_VTABLE(GameScript__Store); - - virtual ~Store() override; // 00 + virtual ~Store() override; // 00 - // override (BSScript::IStore) - virtual bool Open(const char* a_fileName) override; // 06 - virtual bool Close() override; // 07 - virtual const BSFixedString& StoreName() const override; // 08 - virtual bool GetIsOpen() const override; // 09 - virtual bool GetIsGood() const override; // 0A - virtual bool GetIsEOS() const override; // 0B + // override (BSScript::IStore) + virtual bool Open(const char* a_fileName) override; // 06 + virtual bool Close() override; // 07 + virtual const BSFixedString& StoreName() const override; // 08 + virtual bool GetIsOpen() const override; // 09 + virtual bool GetIsGood() const override; // 0A + virtual bool GetIsEOS() const override; // 0B - // members - size_t streamPos; // 20 - BSTSmartPointer stream; // 28 - BSFixedString relPath; // 30 - bool hasOpenFile; // 38 - bool fileIsGood; // 39 - }; - static_assert(sizeof(Store) == 0x40); - } + // members + size_t streamPos; // 20 + BSTSmartPointer stream; // 28 + BSFixedString relPath; // 30 + bool hasOpenFile; // 38 + bool fileIsGood; // 39 + }; + static_assert(sizeof(Store) == 0x40); } diff --git a/include/RE/S/Stream.h b/include/RE/S/Stream.h index 51258990..38062b0e 100644 --- a/include/RE/S/Stream.h +++ b/include/RE/S/Stream.h @@ -64,4 +64,4 @@ namespace RE }; static_assert(sizeof(Stream) == 0x10); } -} \ No newline at end of file +} diff --git a/include/RE/S/SuspendedStack.h b/include/RE/S/SuspendedStack.h index 22bc8df5..95125db6 100644 --- a/include/RE/S/SuspendedStack.h +++ b/include/RE/S/SuspendedStack.h @@ -3,22 +3,19 @@ #include "RE/I/IFuncCallQuery.h" #include "RE/S/Stack.h" -namespace RE +namespace RE::BSScript { - namespace BSScript - { - class Stack; + class Stack; - namespace Internal + namespace Internal + { + struct SuspendedStack { - struct SuspendedStack - { - public: - // members - BSTSmartPointer stack; // 00 - BSTSmartPointer funcCallQuery; // 08 - }; - static_assert(sizeof(SuspendedStack) == 0x10); - } + public: + // members + BSTSmartPointer stack; // 00 + BSTSmartPointer funcCallQuery; // 08 + }; + static_assert(sizeof(SuspendedStack) == 0x10); } } diff --git a/include/RE/V/VirtualMachine.h b/include/RE/V/VirtualMachine.h index fbb136e4..a5a9acd7 100644 --- a/include/RE/V/VirtualMachine.h +++ b/include/RE/V/VirtualMachine.h @@ -19,308 +19,305 @@ #include "RE/W/WritableStringTable.h" #include "RE/W/WritableTypeTable.h" -namespace RE +namespace RE::BSScript { - namespace BSScript - { - class Array; - class ErrorLogger; - class IFreezeQuery; - class IProfilePolicy; - class ISavePatcherInterface; - class IStackCallbackFunctor; - class IStackCallbackSaveInterface; - class ObjectBindPolicy; - class Stack; - class IRemoteDebugger; + class Array; + class ErrorLogger; + class IFreezeQuery; + class IProfilePolicy; + class ISavePatcherInterface; + class IStackCallbackFunctor; + class IStackCallbackSaveInterface; + class ObjectBindPolicy; + class Stack; + class IRemoteDebugger; + + struct IMemoryPagePolicy; + struct IObjectHandlePolicy; + struct StatsEvent; - struct IMemoryPagePolicy; - struct IObjectHandlePolicy; - struct StatsEvent; + namespace Internal + { + class CodeTasklet; - namespace Internal + class VirtualMachine : + public IVirtualMachine, // 0000 + /* IVM -> public BSIntrusiveRefCounted */ // 0008 + public IVMObjectBindInterface, // 0010 + public IVMSaveLoadInterface, // 0018 + public IVMDebugInterface, // 0020 + public IVMRemoteDebuggerInterface, // 0028 + public IVMFunctionMessageDispatch, // 0030 + public BSTEventSource // 0038 { - class CodeTasklet; + public: + static constexpr auto RTTI{ RTTI::BSScript__Internal__VirtualMachine }; + static constexpr auto VTABLE{ VTABLE::BSScript__Internal__VirtualMachine }; - class VirtualMachine : - public IVirtualMachine, // 0000 - /* IVM -> public BSIntrusiveRefCounted */ // 0008 - public IVMObjectBindInterface, // 0010 - public IVMSaveLoadInterface, // 0018 - public IVMDebugInterface, // 0020 - public IVMRemoteDebuggerInterface, // 0028 - public IVMFunctionMessageDispatch, // 0030 - public BSTEventSource // 0038 + enum class FreezeState { - public: - static constexpr auto RTTI{ RTTI::BSScript__Internal__VirtualMachine }; - static constexpr auto VTABLE{ VTABLE::BSScript__Internal__VirtualMachine }; - - enum class FreezeState - { - kNotFrozen = 0, - kFreezing, - kFrozen - }; + kNotFrozen = 0, + kFreezing, + kFrozen + }; - struct LoadedArrayEntry - { - public: - // members - BSTSmartPointer array; // 00 - std::uint32_t arraySize; // 08 - }; - static_assert(sizeof(LoadedArrayEntry) == 0x10); + struct LoadedArrayEntry + { + public: + // members + BSTSmartPointer array; // 00 + std::uint32_t arraySize; // 08 + }; + static_assert(sizeof(LoadedArrayEntry) == 0x10); - struct PendingLatentReturn - { - public: - // members - std::uint32_t stackID; // 00 - Variable returnValue; // 08 - }; - static_assert(sizeof(PendingLatentReturn) == 0x18); + struct PendingLatentReturn + { + public: + // members + std::uint32_t stackID; // 00 + Variable returnValue; // 08 + }; + static_assert(sizeof(PendingLatentReturn) == 0x18); - struct QueuedUnbindRefs - { - public: - // members - BSTSmartPointer obj; // 00 - std::uint32_t refCount; // 08 - std::uint32_t pad0C; // 0C - }; - static_assert(sizeof(QueuedUnbindRefs) == 0x10); + struct QueuedUnbindRefs + { + public: + // members + BSTSmartPointer obj; // 00 + std::uint32_t refCount; // 08 + std::uint32_t pad0C; // 0C + }; + static_assert(sizeof(QueuedUnbindRefs) == 0x10); - ~VirtualMachine() override; // 00 + ~VirtualMachine() override; // 00 - using RE::BSScript::IVirtualMachine::SendEvent; - //using RE::BSTEventSource::SendEvent; + using RE::BSScript::IVirtualMachine::SendEvent; + //using RE::BSTEventSource::SendEvent; - public: - // override (IVirtualMachine) - // add - virtual void SetLoader(ILoader* a_newLoader) override; // 01 - virtual void SetLinkedCallback(ITypeLinkedCallback* a_typeLinkedCallback) override; // 02 - virtual void Update(float a_updateBudget) override; // 03 - virtual void UpdateTasklets(float a_updateBudget) override; // 04 - virtual void Unk_05(void) override; // 05 - virtual void SetOverstressed(bool a_overstressed) override; // 06 - virtual void Unk_07(void) override; // 07 - virtual bool IsCompletelyFrozen() const override; // 08 - virtual void Unk_09(void) override; // 09 - virtual bool RegisterObjectType(std::uint32_t a_typeID, const char* a_objectTypeName) override; // 0A - virtual bool GetScriptObjectType(std::uint32_t a_typeID, BSTSmartPointer& a_objType) override; // 0B - virtual bool GetScriptObjectType(const BSFixedString& a_name, BSTSmartPointer& a_objType) override; // 0C - virtual bool GetScriptObjectTypeNoLoad(std::uint32_t a_typeID, BSTSmartPointer& a_objType) const override; // 0D - virtual bool GetScriptObjectTypeNoLoad(const BSFixedString& a_objectTypeName, BSTSmartPointer& a_objType) const override; // 0E - virtual bool GetTypeIDForScriptObject(const BSFixedString& a_objectTypeName, std::uint32_t& a_typeID) const override; // 0F - virtual void GetScriptObjectsWithATypeID(BSScrapArray& a_objectTypeList) const override; // 10 - virtual bool GetParentNativeType(const BSFixedString& a_childTypeName, BSTSmartPointer& a_parentType) override; // 11 - virtual bool TypeIsValid(const BSFixedString& a_objectTypeName) override; // 12 - virtual bool ReloadType(const char* a_objectTypeName) override; // 13 - virtual void TasksToJobs(JobList& a_jobList) override; // 14 - virtual void CalculateFullReloadList(const /*BSTSet&*/ void* a_scriptSet, /*BSTObjectArena&*/ void* a_scriptList) const override; // 15 - virtual bool GetScriptStructType(const BSFixedString& a_structTypeName, BSTSmartPointer& a_structType) override; // 16 - virtual bool GetScriptStructTypeNoLoad(const BSFixedString& a_structTypeName, BSTSmartPointer& a_structType) const override; // 17 - virtual bool GetChildStructTypes(const BSFixedString& a_parentObjectName, /*BSTObjectArena&*/ void* a_structTypes) const override; // 18 - virtual bool CreateObject(const BSFixedString& a_objectTypeName, const /*BSTScrapHashMap&*/ void* a_properties, BSTSmartPointer& a_newObj) override; // 19 - virtual bool CreateObject(const BSFixedString& a_objectTypeName, BSTSmartPointer& a_newObj) override; // 1A - virtual bool CreateStruct(const BSFixedString& a_structTypeName, BSTSmartPointer& a_newStruct) override; // 1B - virtual bool CreateArray(TypeInfo::RawType a_elementType, const BSFixedString& a_elementObjectTypeName, std::uint32_t a_elementCount, BSTSmartPointer& a_newArray) override; // 1C - virtual bool CreateArray(const TypeInfo& a_type, std::uint32_t a_elementCount, BSTSmartPointer& a_newArray) override; // 1D - virtual bool BindNativeMethod(IFunction* a_function) override; // 1E - virtual void SetCallableFromTasklets(const char* a_objectName, const char* a_functionName, bool a_taskletCallable) override; // 1F - virtual void SetCallableFromTasklets(const char* a_objectName, const char* a_stateName, const char* a_functionName, bool a_taskletCallable) override; // 20 - virtual void ForEachBoundObject(std::uint64_t a_objHandle, const BSTThreadScrapFunction& a_functor) override; // 21 - virtual bool FindBoundObject(std::uint64_t a_objHandle, const char* a_objectTypeName, bool a_allowConst, BSTSmartPointer& a_attachedObj, bool a_exactMatch) const override; // 22 - virtual void MoveBoundObjects(std::uint64_t a_sourceHandle, std::uint64_t a_destHandle) override; // 23 - virtual void ResetAllBoundObjects(std::uint64_t a_objHandle) override; // 24 - virtual bool CastObject(const BSTSmartPointer& a_sourceObj, const BSTSmartPointer& a_targetType, BSTSmartPointer& a_castedObj) override; // 25 - virtual bool SetPropertyValue(const BSTSmartPointer& a_self, ...) override; // 26 -- unknown VA args - virtual bool GetPropertyValue(const BSTSmartPointer& a_self, const char* a_propName, const BSTSmartPointer& a_callback, int a_unk0) override; // 27 - virtual bool GetVariableValue(std::uint64_t a_objHandle, const BSFixedString& a_scriptName, std::uint32_t a_varIndex, Variable& a_var) const override; // 28 - virtual bool GetVariableValue(const BSTSmartPointer& a_obj, std::uint32_t a_varIndex, Variable& a_var) const override; // 29 - virtual bool HandleImplementsEvent(std::uint64_t a_object, const BSFixedString& a_eventName) const override; // 2A - virtual bool AddEventRelay(std::uint64_t a_sourceObject, const BSFixedString& a_eventName, const BSTSmartPointer& a_destObj) override; // 2B - virtual void RemoveEventRelay(std::uint64_t a_sourceObject, const BSFixedString& a_eventName, const BSTSmartPointer& a_destObj) override; // 2C - virtual void RemoveAllEventRelays(const BSTSmartPointer& a_destObj) override; // 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) override; // 2E - virtual bool DispatchStaticCall(const BSFixedString& a_objName, const BSFixedString& a_funcName, const BSTThreadScrapFunction&)>& a_arguments, const BSTSmartPointer& a_callback, int a_unk0) override; // 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) override; // 30 - virtual bool DispatchMethodCall(const BSTSmartPointer& a_self, const BSFixedString& a_funcName, const BSTThreadScrapFunction&)>& a_arguments, const BSTSmartPointer& a_callback, int a_unk0) override; // 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) override; // 32 - virtual void ReturnFromLatent(std::uint32_t a_stackID, const Variable& a_retValue) override; // 33 -- IsWaitingOnLatent was removed - virtual void ReattemptGuardLock(std::uint32_t a_stackID) override; // 34 - [[nodiscard]] virtual ErrorLogger& GetErrorLogger() const override; // 35 - [[nodiscard]] virtual const IObjectHandlePolicy& GetObjectHandlePolicy() const override; // 36 - [[nodiscard]] virtual IObjectHandlePolicy& GetObjectHandlePolicy() override; // 37 - [[nodiscard]] virtual const ObjectBindPolicy& GetObjectBindPolicy() const override; // 38 - [[nodiscard]] virtual ObjectBindPolicy& GetObjectBindPolicy() override; // 39 - [[nodiscard]] virtual ISavePatcherInterface& GetSavePatcherInterface() override; // 3A - [[nodiscard]] virtual const GuardDataIFace GetGlobalGuardDataInterface() const override; // 3B - [[nodiscard]] virtual GuardDataIFace GetGlobalGuardDataInterface() override; // 3C - virtual void RegisterForLogEvent(BSTEventSink* a_sink) override; // 3D - virtual void UnregisterForLogEvent(BSTEventSink* a_sink) override; // 3E - virtual void RegisterForStatsEvent(BSTEventSink* a_sink) override; // 3F - virtual void UnregisterForStatsEvent(BSTEventSink* a_sink) override; // 40 - virtual void PostCachedErrorToLogger(const ICachedErrorMessage& a_errorFunctor, ErrorLogger::Severity a_severity) const override; // 41 - virtual void PostCachedErrorToLogger(const ICachedErrorMessage& a_errorFunctor, std::uint32_t a_stackID, ErrorLogger::Severity a_severity) const override; // 42 + public: + // override (IVirtualMachine) + // add + virtual void SetLoader(ILoader* a_newLoader) override; // 01 + virtual void SetLinkedCallback(ITypeLinkedCallback* a_typeLinkedCallback) override; // 02 + virtual void Update(float a_updateBudget) override; // 03 + virtual void UpdateTasklets(float a_updateBudget) override; // 04 + virtual void Unk_05(void) override; // 05 + virtual void SetOverstressed(bool a_overstressed) override; // 06 + virtual void Unk_07(void) override; // 07 + virtual bool IsCompletelyFrozen() const override; // 08 + virtual void Unk_09(void) override; // 09 + virtual bool RegisterObjectType(std::uint32_t a_typeID, const char* a_objectTypeName) override; // 0A + virtual bool GetScriptObjectType(std::uint32_t a_typeID, BSTSmartPointer& a_objType) override; // 0B + virtual bool GetScriptObjectType(const BSFixedString& a_name, BSTSmartPointer& a_objType) override; // 0C + virtual bool GetScriptObjectTypeNoLoad(std::uint32_t a_typeID, BSTSmartPointer& a_objType) const override; // 0D + virtual bool GetScriptObjectTypeNoLoad(const BSFixedString& a_objectTypeName, BSTSmartPointer& a_objType) const override; // 0E + virtual bool GetTypeIDForScriptObject(const BSFixedString& a_objectTypeName, std::uint32_t& a_typeID) const override; // 0F + virtual void GetScriptObjectsWithATypeID(BSScrapArray& a_objectTypeList) const override; // 10 + virtual bool GetParentNativeType(const BSFixedString& a_childTypeName, BSTSmartPointer& a_parentType) override; // 11 + virtual bool TypeIsValid(const BSFixedString& a_objectTypeName) override; // 12 + virtual bool ReloadType(const char* a_objectTypeName) override; // 13 + virtual void TasksToJobs(JobList& a_jobList) override; // 14 + virtual void CalculateFullReloadList(const /*BSTSet&*/ void* a_scriptSet, /*BSTObjectArena&*/ void* a_scriptList) const override; // 15 + virtual bool GetScriptStructType(const BSFixedString& a_structTypeName, BSTSmartPointer& a_structType) override; // 16 + virtual bool GetScriptStructTypeNoLoad(const BSFixedString& a_structTypeName, BSTSmartPointer& a_structType) const override; // 17 + virtual bool GetChildStructTypes(const BSFixedString& a_parentObjectName, /*BSTObjectArena&*/ void* a_structTypes) const override; // 18 + virtual bool CreateObject(const BSFixedString& a_objectTypeName, const /*BSTScrapHashMap&*/ void* a_properties, BSTSmartPointer& a_newObj) override; // 19 + virtual bool CreateObject(const BSFixedString& a_objectTypeName, BSTSmartPointer& a_newObj) override; // 1A + virtual bool CreateStruct(const BSFixedString& a_structTypeName, BSTSmartPointer& a_newStruct) override; // 1B + virtual bool CreateArray(TypeInfo::RawType a_elementType, const BSFixedString& a_elementObjectTypeName, std::uint32_t a_elementCount, BSTSmartPointer& a_newArray) override; // 1C + virtual bool CreateArray(const TypeInfo& a_type, std::uint32_t a_elementCount, BSTSmartPointer& a_newArray) override; // 1D + virtual bool BindNativeMethod(IFunction* a_function) override; // 1E + virtual void SetCallableFromTasklets(const char* a_objectName, const char* a_functionName, bool a_taskletCallable) override; // 1F + virtual void SetCallableFromTasklets(const char* a_objectName, const char* a_stateName, const char* a_functionName, bool a_taskletCallable) override; // 20 + virtual void ForEachBoundObject(std::uint64_t a_objHandle, const BSTThreadScrapFunction& a_functor) override; // 21 + virtual bool FindBoundObject(std::uint64_t a_objHandle, const char* a_objectTypeName, bool a_allowConst, BSTSmartPointer& a_attachedObj, bool a_exactMatch) const override; // 22 + virtual void MoveBoundObjects(std::uint64_t a_sourceHandle, std::uint64_t a_destHandle) override; // 23 + virtual void ResetAllBoundObjects(std::uint64_t a_objHandle) override; // 24 + virtual bool CastObject(const BSTSmartPointer& a_sourceObj, const BSTSmartPointer& a_targetType, BSTSmartPointer& a_castedObj) override; // 25 + virtual bool SetPropertyValue(const BSTSmartPointer& a_self, ...) override; // 26 -- unknown VA args + virtual bool GetPropertyValue(const BSTSmartPointer& a_self, const char* a_propName, const BSTSmartPointer& a_callback, int a_unk0) override; // 27 + virtual bool GetVariableValue(std::uint64_t a_objHandle, const BSFixedString& a_scriptName, std::uint32_t a_varIndex, Variable& a_var) const override; // 28 + virtual bool GetVariableValue(const BSTSmartPointer& a_obj, std::uint32_t a_varIndex, Variable& a_var) const override; // 29 + virtual bool HandleImplementsEvent(std::uint64_t a_object, const BSFixedString& a_eventName) const override; // 2A + virtual bool AddEventRelay(std::uint64_t a_sourceObject, const BSFixedString& a_eventName, const BSTSmartPointer& a_destObj) override; // 2B + virtual void RemoveEventRelay(std::uint64_t a_sourceObject, const BSFixedString& a_eventName, const BSTSmartPointer& a_destObj) override; // 2C + virtual void RemoveAllEventRelays(const BSTSmartPointer& a_destObj) override; // 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) override; // 2E + virtual bool DispatchStaticCall(const BSFixedString& a_objName, const BSFixedString& a_funcName, const BSTThreadScrapFunction&)>& a_arguments, const BSTSmartPointer& a_callback, int a_unk0) override; // 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) override; // 30 + virtual bool DispatchMethodCall(const BSTSmartPointer& a_self, const BSFixedString& a_funcName, const BSTThreadScrapFunction&)>& a_arguments, const BSTSmartPointer& a_callback, int a_unk0) override; // 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) override; // 32 + virtual void ReturnFromLatent(std::uint32_t a_stackID, const Variable& a_retValue) override; // 33 -- IsWaitingOnLatent was removed + virtual void ReattemptGuardLock(std::uint32_t a_stackID) override; // 34 + [[nodiscard]] virtual ErrorLogger& GetErrorLogger() const override; // 35 + [[nodiscard]] virtual const IObjectHandlePolicy& GetObjectHandlePolicy() const override; // 36 + [[nodiscard]] virtual IObjectHandlePolicy& GetObjectHandlePolicy() override; // 37 + [[nodiscard]] virtual const ObjectBindPolicy& GetObjectBindPolicy() const override; // 38 + [[nodiscard]] virtual ObjectBindPolicy& GetObjectBindPolicy() override; // 39 + [[nodiscard]] virtual ISavePatcherInterface& GetSavePatcherInterface() override; // 3A + [[nodiscard]] virtual const GuardDataIFace GetGlobalGuardDataInterface() const override; // 3B + [[nodiscard]] virtual GuardDataIFace GetGlobalGuardDataInterface() override; // 3C + virtual void RegisterForLogEvent(BSTEventSink* a_sink) override; // 3D + virtual void UnregisterForLogEvent(BSTEventSink* a_sink) override; // 3E + virtual void RegisterForStatsEvent(BSTEventSink* a_sink) override; // 3F + virtual void UnregisterForStatsEvent(BSTEventSink* a_sink) override; // 40 + virtual void PostCachedErrorToLogger(const ICachedErrorMessage& a_errorFunctor, ErrorLogger::Severity a_severity) const override; // 41 + virtual void PostCachedErrorToLogger(const ICachedErrorMessage& a_errorFunctor, std::uint32_t a_stackID, ErrorLogger::Severity a_severity) const override; // 42 - // override (IVMObjectBindInterface) - [[nodiscard]] virtual std::uint64_t GetBoundHandle(const BSTSmartPointer& a_objPtr) const override; // 01 - virtual void TypeCanBeBound(const BSFixedString& a_className, std::uint64_t a_handle) override; // 02 - virtual void BindObject(BSTSmartPointer& a_objPtr, std::uint64_t a_handle, bool a_conditional) override; // 03 - virtual void HandleLoadedBinding(BSTSmartPointer& a_objPtr, std::uint64_t a_handle, bool a_conditional) override; // 04 - virtual void RemoveAllBoundObjects(std::uint64_t a_handle) override; // 05 - virtual void RemoveAllDiskLoadedBoundObjects(std::uint64_t a_handle) override; // 06 - virtual void HandleCObjectDeletion(std::uint64_t a_handle) override; // 07 - virtual void UnbindObject(const BSTSmartPointer& a_objPtr) override; // 08 - virtual bool CreateObjectWithProperties(const BSFixedString& a_className, std::uint32_t a_numProperties, BSTSmartPointer& a_objPtr) override; // 09 - virtual bool InitObjectProperties(BSTSmartPointer& a_objPtr, void* a_property, bool a_arg3) override; // 0A + // override (IVMObjectBindInterface) + [[nodiscard]] virtual std::uint64_t GetBoundHandle(const BSTSmartPointer& a_objPtr) const override; // 01 + virtual void TypeCanBeBound(const BSFixedString& a_className, std::uint64_t a_handle) override; // 02 + virtual void BindObject(BSTSmartPointer& a_objPtr, std::uint64_t a_handle, bool a_conditional) override; // 03 + virtual void HandleLoadedBinding(BSTSmartPointer& a_objPtr, std::uint64_t a_handle, bool a_conditional) override; // 04 + virtual void RemoveAllBoundObjects(std::uint64_t a_handle) override; // 05 + virtual void RemoveAllDiskLoadedBoundObjects(std::uint64_t a_handle) override; // 06 + virtual void HandleCObjectDeletion(std::uint64_t a_handle) override; // 07 + virtual void UnbindObject(const BSTSmartPointer& a_objPtr) override; // 08 + virtual bool CreateObjectWithProperties(const BSFixedString& a_className, std::uint32_t a_numProperties, BSTSmartPointer& a_objPtr) override; // 09 + virtual bool InitObjectProperties(BSTSmartPointer& a_objPtr, void* a_property, bool a_arg3) override; // 0A - // override (IVMSaveLoadInterface) - virtual bool SaveGame(BSStorage& a_storage, IHandleReaderWriter const& a_HandleReaderWriter, bool a_flag) override; // 01 - virtual bool LoadGame(BSStorage const& a_storage, IHandleReaderWriter const& a_HandleReaderWriter, bool& a_flag, bool& b_flag) override; // 02 - virtual void MarkSaveInvalid(BSStorage& a_storage) override; // 03 - virtual unsigned short GetSaveGameVersion() const override; // 04 - virtual void CleanupSave() override; // 05 - virtual void CleanupLoad() override; // 06 - virtual void DropAllRunningData() override; // 07 - virtual std::uint64_t GetSaveHandleForObject(const Object* a_Object) const override; // 08 - virtual void SetSaveHandleForObject(const Object* a_Object, std::uint64_t) override; // 09 - virtual bool GetObjectBySaveHandle(std::uint64_t, const TypeInfo& a_TypeInfo, BSTSmartPointer& a_object_pointer) const override; // 0A - virtual bool GetObjectBySaveHandle(std::uint64_t, BSTSmartPointer& a_object_pointer) const override; // 0B - virtual void unk_0C(void) override; // 0C - virtual void unk_0D(void) override; // 0D - virtual std::uint64_t GetSaveHandleForStruct(const Struct* a_Struct) const override; // 0E - virtual void SetSaveHandleForStruct(const Struct* a_Struct, std::uint64_t) override; // 0F - virtual bool GetStructBySaveHandle(std::uint64_t, BSTSmartPointer& a_object_pointer) const override; // 10 - virtual void unk_11(void) override; // 11 - virtual void unk_12(void) override; // 12 - virtual std::uint64_t GetSaveHandleForArray(const Array* a_Array) const override; // 13 - virtual void SetSaveHandleForArray(const Array* a_Array, std::uint64_t) override; // 14 - virtual bool GetArrayBySaveHandle(std::uint64_t handle, BSTSmartPointer& a_array_pointer) const override; // 15 - virtual bool GetStackByID(unsigned int, BSTSmartPointer& a_stack_pointer) const override; // 16 - virtual bool IsStackRunning(std::uint32_t a_stackid) override; // 17 - virtual const Internal::WritableStringTable& GetWritableStringTable() const override; // 18 - virtual const Internal::WritableStringTable& GetWritableStringTable() override; // 19 - virtual Internal::ReadableStringTable& GetReadableStringTable() const override; // 1A - virtual const Internal::WritableTypeTable& GetWritableTypeTable() const override; // 1B - virtual Internal::WritableTypeTable& GetWritableTypeTable() override; // 1C - virtual const Internal::ReadableTypeTable& GetReadableTypeTable() const override; // 1D - virtual void unk_1E(void) override; // 1E - virtual bool CreateEmptyTasklet(Stack* a_Stack, BSTSmartPointer& a_tasklet_pointer) override; // 1F + // override (IVMSaveLoadInterface) + virtual bool SaveGame(BSStorage& a_storage, IHandleReaderWriter const& a_HandleReaderWriter, bool a_flag) override; // 01 + virtual bool LoadGame(BSStorage const& a_storage, IHandleReaderWriter const& a_HandleReaderWriter, bool& a_flag, bool& b_flag) override; // 02 + virtual void MarkSaveInvalid(BSStorage& a_storage) override; // 03 + virtual unsigned short GetSaveGameVersion() const override; // 04 + virtual void CleanupSave() override; // 05 + virtual void CleanupLoad() override; // 06 + virtual void DropAllRunningData() override; // 07 + virtual std::uint64_t GetSaveHandleForObject(const Object* a_Object) const override; // 08 + virtual void SetSaveHandleForObject(const Object* a_Object, std::uint64_t) override; // 09 + virtual bool GetObjectBySaveHandle(std::uint64_t, const TypeInfo& a_TypeInfo, BSTSmartPointer& a_object_pointer) const override; // 0A + virtual bool GetObjectBySaveHandle(std::uint64_t, BSTSmartPointer& a_object_pointer) const override; // 0B + virtual void unk_0C(void) override; // 0C + virtual void unk_0D(void) override; // 0D + virtual std::uint64_t GetSaveHandleForStruct(const Struct* a_Struct) const override; // 0E + virtual void SetSaveHandleForStruct(const Struct* a_Struct, std::uint64_t) override; // 0F + virtual bool GetStructBySaveHandle(std::uint64_t, BSTSmartPointer& a_object_pointer) const override; // 10 + virtual void unk_11(void) override; // 11 + virtual void unk_12(void) override; // 12 + virtual std::uint64_t GetSaveHandleForArray(const Array* a_Array) const override; // 13 + virtual void SetSaveHandleForArray(const Array* a_Array, std::uint64_t) override; // 14 + virtual bool GetArrayBySaveHandle(std::uint64_t handle, BSTSmartPointer& a_array_pointer) const override; // 15 + virtual bool GetStackByID(unsigned int, BSTSmartPointer& a_stack_pointer) const override; // 16 + virtual bool IsStackRunning(std::uint32_t a_stackid) override; // 17 + virtual const Internal::WritableStringTable& GetWritableStringTable() const override; // 18 + virtual const Internal::WritableStringTable& GetWritableStringTable() override; // 19 + virtual Internal::ReadableStringTable& GetReadableStringTable() const override; // 1A + virtual const Internal::WritableTypeTable& GetWritableTypeTable() const override; // 1B + virtual Internal::WritableTypeTable& GetWritableTypeTable() override; // 1C + virtual const Internal::ReadableTypeTable& GetReadableTypeTable() const override; // 1D + virtual void unk_1E(void) override; // 1E + virtual bool CreateEmptyTasklet(Stack* a_Stack, BSTSmartPointer& a_tasklet_pointer) override; // 1F - // override (IVMDebugInterface) - virtual void DumpRunningStacksToLog() override; // 01 - virtual void DumpStackFrameToLog(unsigned int a_v, unsigned int b_v, bool a_flag) override; // 02 - virtual void GetStackFrame(unsigned int a_v, unsigned int b_v, bool a_flag, BSFixedString& a_identifier) override; // 03 - virtual void DumpPersistenceInformationToLog(char const* logfile, uint64_t a_v) const override; // 04 - virtual void DumpEventRelayInformationToLog(char const* logfile, uint64_t a_v, BSFixedString const& a_string) const override; // 05 + // override (IVMDebugInterface) + virtual void DumpRunningStacksToLog() override; // 01 + virtual void DumpStackFrameToLog(unsigned int a_v, unsigned int b_v, bool a_flag) override; // 02 + virtual void GetStackFrame(unsigned int a_v, unsigned int b_v, bool a_flag, BSFixedString& a_identifier) override; // 03 + virtual void DumpPersistenceInformationToLog(char const* logfile, uint64_t a_v) const override; // 04 + virtual void DumpEventRelayInformationToLog(char const* logfile, uint64_t a_v, BSFixedString const& a_string) const override; // 05 - // override (IVMRemoteDebuggerInterface) - virtual bool IsCompletelyFrozen() override; // 00 - virtual void Unk01() override; // 01 - virtual void Unk02() override; // 02 + // override (IVMRemoteDebuggerInterface) + virtual bool IsCompletelyFrozen() override; // 00 + virtual void Unk01() override; // 01 + virtual void Unk02() override; // 02 - // override (IVMFunctionMessageDispatch) - virtual void Unk00() override; // 00 + // override (IVMFunctionMessageDispatch) + virtual void Unk00() override; // 00 - static VirtualMachine* GetSingleton(); + static VirtualMachine* GetSingleton(); - //bool StackExists(std::uint32_t stack_id); + //bool StackExists(std::uint32_t stack_id); - // members - ErrorLogger* errorLogger; // 0060 - IMemoryPagePolicy* memoryPagePolicy; // 0068 - IObjectHandlePolicy* handlePolicy; // 0070 - ObjectBindPolicy* objectBindPolicy; // 0078 - IClientVM* clientVM; // 0080 - IStackCallbackSaveInterface* stackCallbackSaveInterface; // 0088 - IProfilePolicy* profilePolicy; // 0090 - IRemoteDebugger* remoteDebugger; // 0098 - ISavePatcherInterface* savePatcherInterface; // 00A0 - GuardDataIFace globalGuardDataInterface; // 00A8 - std::uint64_t unk01C0; // 01C0 -- 2nd param passed into constructor + 0x10 - mutable BSSpinLock typeInfoLock; // 01C8 - LinkerProcessor linker; // 01D0 - /*BSTHashMap>*/ std::byte objectTypeMap[0x38]; // 0258 - /*BSTHashMap>*/ std::byte structTypeMap[0x38]; // 0290 - /*BSTHashMap*/ std::byte typeIDToObjectType[0x38]; // 02C8 - /*BSTHashMap*/ std::byte objectTypeToTypeID[0x38]; // 0300 - BSTArray> typesToUnload; // 0338 - std::byte gap_0348[0x380 - 0x348]; // 0348 - /*BSScript::Internal::FunctionMessageProcessor*/ std::byte funcMsgProcessor[0x3C0]; // 0380 - BSTArray vmTasks; // 0740 - BSNonReentrantSpinLock vmTasksLock; // 0750 - std::uint32_t gap_754; // 0754 - bool overstressed; // 0758 - std::byte gap0759[0x780 - 0x759]; // 0759 - /*BSTCommonStaticMessageQueue*/ std::byte suspendQueue1[0x1A80]; // 0780 - /*BSTCommonStaticMessageQueue*/ std::byte suspendQueue2[0x1A80]; // 2200 - BSTArray overflowSuspendArray1; // 3C80 - BSTArray overflowSuspendArray2; // 3C90 - mutable BSSpinLock suspendQueueLock; // 3CA0 - /*BSTCommonStaticMessageQueue* */ void* stacksToResume; // 3CA8 - ref to suspendQueue1 - BSTArray* stacksToResumeOverflow; // 3CB0 - ref to overflowSuspendArray1 - /*BSTCommonStaticMessageQueue* */ void* stacksToSuspend; // 3CB8 - ref to suspendQueue2 - BSTArray* stacksToSuspendOverflow; // 3CC0 - ref to overflowSuspendArray2 - mutable BSReadWriteLock runningStacksLock; // 3CC8 - /*BSTHashMap>*/ std::byte allRunningStacks[0x38]; // 3CD0 - BSTArray waitingLatentReturns; // 3D08 - std::uint32_t nextStackID; // 3D18 - mutable BSSpinLock frozenStacksLock; // 3D1C - std::uint32_t gap3D24; // 3D24 - BSTArray> pendingLatentReturns; // 3D28 - BSTArray stacksWaitingOnGuard; // 3D38 - BSTSmartPointer frozenStacksHead; // 3D48 - std::uint32_t frozenStacksCount; // 3D50 - stl::enumeration freezeState; // 3D54 - mutable BSSpinLock attachedScriptsLock; // 3D58 - /*BSTHashMap>*/ std::byte attachedScripts[0x38]; // 3D60 - std::uint64_t unk3D98; // 3D98 - std::uint32_t nextObjectToClean; // 3DA0 - std::uint32_t gap3DA4; // 3DA4 - std::uint64_t nextAttachedObjectToClean; // 3DA8 - BSTArray> detachedScripts; // 3DB0 - mutable BSSpinLock structsLock; // 3DC0 - std::uint32_t nextStructToClean; // 3DC8 - BSTArray> allStructs; // 3DD0 - mutable BSSpinLock arraysLock; // 3DE0 - std::uint32_t nextArrayToClean; // 3DE8 - BSTArray> arrays; // 3DF0 - mutable BSSpinLock objectResetLock; // 3E00 - BSTArray> objectsAwaitingReset; // 3E08 - mutable BSSpinLock loadTableLock; // 3E18 - /*BSTHashMap>*/ std::byte loadTable[0x38]; // 3E20 - /*BSTHashMap */ std::byte loadHandlesTable[0x38]; // 3E58 - /*BSTHashMap>*/ std::byte structLoadTable[0x38]; // 3E90 - /*BSTHashMap */ std::byte arrayLoadTable[0x38]; // 3EC8 - std::uint64_t unk3F00; // 3F00 - mutable BSSpinLock queuedUnbindLock; // 3F08 - BSTArray queuedUnbinds; // 3F10 - mutable BSSpinLock eventRelayLock; // 3F20 - /* BSTHashMap>*/ std::byte eventRelays[0x38]; // 3F28 - std::uint64_t unk3F60; // 3F60 - std::uint64_t unk3F68; // 3F68 - std::uint64_t unk3F70; // 3F70 - std::uint64_t unk3F78; // 3F78 - std::uint16_t currentSaveGameVersion; // 3F80 - std::uint16_t gap3F82; // 3F82 - std::uint32_t saveObjectCount; // 3F84 - std::uint32_t saveObjectDataCount; // 3F88 - std::uint32_t saveStructCount; // 3F8C - std::uint32_t saveArrayCount; // 3F90 - std::uint32_t gap3F94; // 3F94 - WritableStringTable writableStringTable; // 3F98 - ReadableStringTable readableStringTable; // 3FB0 - WritableTypeTable writableTypeTable; // 3FC8 - ReadableTypeTable readableTypeTable; // 3FD8 - std::byte pad3FE0[0x4040 - 0x3FE0]; // 3FE0 - }; - static_assert(sizeof(VirtualMachine) == 0x4040); - static_assert(offsetof(VirtualMachine, writableStringTable) == 0x3F98); - static_assert(offsetof(VirtualMachine, frozenStacksLock) == 0x3D1C); - } + // members + ErrorLogger* errorLogger; // 0060 + IMemoryPagePolicy* memoryPagePolicy; // 0068 + IObjectHandlePolicy* handlePolicy; // 0070 + ObjectBindPolicy* objectBindPolicy; // 0078 + IClientVM* clientVM; // 0080 + IStackCallbackSaveInterface* stackCallbackSaveInterface; // 0088 + IProfilePolicy* profilePolicy; // 0090 + IRemoteDebugger* remoteDebugger; // 0098 + ISavePatcherInterface* savePatcherInterface; // 00A0 + GuardDataIFace globalGuardDataInterface; // 00A8 + std::uint64_t unk01C0; // 01C0 -- 2nd param passed into constructor + 0x10 + mutable BSSpinLock typeInfoLock; // 01C8 + LinkerProcessor linker; // 01D0 + /*BSTHashMap>*/ std::byte objectTypeMap[0x38]; // 0258 + /*BSTHashMap>*/ std::byte structTypeMap[0x38]; // 0290 + /*BSTHashMap*/ std::byte typeIDToObjectType[0x38]; // 02C8 + /*BSTHashMap*/ std::byte objectTypeToTypeID[0x38]; // 0300 + BSTArray> typesToUnload; // 0338 + std::byte gap_0348[0x380 - 0x348]; // 0348 + /*BSScript::Internal::FunctionMessageProcessor*/ std::byte funcMsgProcessor[0x3C0]; // 0380 + BSTArray vmTasks; // 0740 + BSNonReentrantSpinLock vmTasksLock; // 0750 + std::uint32_t gap_754; // 0754 + bool overstressed; // 0758 + std::byte gap0759[0x780 - 0x759]; // 0759 + /*BSTCommonStaticMessageQueue*/ std::byte suspendQueue1[0x1A80]; // 0780 + /*BSTCommonStaticMessageQueue*/ std::byte suspendQueue2[0x1A80]; // 2200 + BSTArray overflowSuspendArray1; // 3C80 + BSTArray overflowSuspendArray2; // 3C90 + mutable BSSpinLock suspendQueueLock; // 3CA0 + /*BSTCommonStaticMessageQueue* */ void* stacksToResume; // 3CA8 - ref to suspendQueue1 + BSTArray* stacksToResumeOverflow; // 3CB0 - ref to overflowSuspendArray1 + /*BSTCommonStaticMessageQueue* */ void* stacksToSuspend; // 3CB8 - ref to suspendQueue2 + BSTArray* stacksToSuspendOverflow; // 3CC0 - ref to overflowSuspendArray2 + mutable BSReadWriteLock runningStacksLock; // 3CC8 + /*BSTHashMap>*/ std::byte allRunningStacks[0x38]; // 3CD0 + BSTArray waitingLatentReturns; // 3D08 + std::uint32_t nextStackID; // 3D18 + mutable BSSpinLock frozenStacksLock; // 3D1C + std::uint32_t gap3D24; // 3D24 + BSTArray> pendingLatentReturns; // 3D28 + BSTArray stacksWaitingOnGuard; // 3D38 + BSTSmartPointer frozenStacksHead; // 3D48 + std::uint32_t frozenStacksCount; // 3D50 + stl::enumeration freezeState; // 3D54 + mutable BSSpinLock attachedScriptsLock; // 3D58 + /*BSTHashMap>*/ std::byte attachedScripts[0x38]; // 3D60 + std::uint64_t unk3D98; // 3D98 + std::uint32_t nextObjectToClean; // 3DA0 + std::uint32_t gap3DA4; // 3DA4 + std::uint64_t nextAttachedObjectToClean; // 3DA8 + BSTArray> detachedScripts; // 3DB0 + mutable BSSpinLock structsLock; // 3DC0 + std::uint32_t nextStructToClean; // 3DC8 + BSTArray> allStructs; // 3DD0 + mutable BSSpinLock arraysLock; // 3DE0 + std::uint32_t nextArrayToClean; // 3DE8 + BSTArray> arrays; // 3DF0 + mutable BSSpinLock objectResetLock; // 3E00 + BSTArray> objectsAwaitingReset; // 3E08 + mutable BSSpinLock loadTableLock; // 3E18 + /*BSTHashMap>*/ std::byte loadTable[0x38]; // 3E20 + /*BSTHashMap */ std::byte loadHandlesTable[0x38]; // 3E58 + /*BSTHashMap>*/ std::byte structLoadTable[0x38]; // 3E90 + /*BSTHashMap */ std::byte arrayLoadTable[0x38]; // 3EC8 + std::uint64_t unk3F00; // 3F00 + mutable BSSpinLock queuedUnbindLock; // 3F08 + BSTArray queuedUnbinds; // 3F10 + mutable BSSpinLock eventRelayLock; // 3F20 + /* BSTHashMap>*/ std::byte eventRelays[0x38]; // 3F28 + std::uint64_t unk3F60; // 3F60 + std::uint64_t unk3F68; // 3F68 + std::uint64_t unk3F70; // 3F70 + std::uint64_t unk3F78; // 3F78 + std::uint16_t currentSaveGameVersion; // 3F80 + std::uint16_t gap3F82; // 3F82 + std::uint32_t saveObjectCount; // 3F84 + std::uint32_t saveObjectDataCount; // 3F88 + std::uint32_t saveStructCount; // 3F8C + std::uint32_t saveArrayCount; // 3F90 + std::uint32_t gap3F94; // 3F94 + WritableStringTable writableStringTable; // 3F98 + ReadableStringTable readableStringTable; // 3FB0 + WritableTypeTable writableTypeTable; // 3FC8 + ReadableTypeTable readableTypeTable; // 3FD8 + std::byte pad3FE0[0x4040 - 0x3FE0]; // 3FE0 + }; + static_assert(sizeof(VirtualMachine) == 0x4040); + static_assert(offsetof(VirtualMachine, writableStringTable) == 0x3F98); + static_assert(offsetof(VirtualMachine, frozenStacksLock) == 0x3D1C); } } diff --git a/include/RE/W/WritableStringTable.h b/include/RE/W/WritableStringTable.h index 38fe64b5..d175785d 100644 --- a/include/RE/W/WritableStringTable.h +++ b/include/RE/W/WritableStringTable.h @@ -3,23 +3,17 @@ #include "RE/B/BSFixedString.h" #include "RE/B/BSTObjectArena.h" -namespace RE +namespace RE::BSScript::Internal { - namespace BSScript - { - namespace Internal - { - enum class StringIndexSize; + enum class StringIndexSize; - class WritableStringTable - { - public: - // members - msvc::unique_ptr> stringTable; // 00 - /*msvc::unique_ptr>*/ void* stringReferenceMap; // 08 - stl::enumeration indexSize; // 10 - }; - static_assert(sizeof(WritableStringTable) == 0x18); - } - } + class WritableStringTable + { + public: + // members + msvc::unique_ptr> stringTable; // 00 + /*msvc::unique_ptr>*/ void* stringReferenceMap; // 08 + stl::enumeration indexSize; // 10 + }; + static_assert(sizeof(WritableStringTable) == 0x18); } diff --git a/include/RE/W/WritableTypeTable.h b/include/RE/W/WritableTypeTable.h index c00228f2..5b21121c 100644 --- a/include/RE/W/WritableTypeTable.h +++ b/include/RE/W/WritableTypeTable.h @@ -3,23 +3,20 @@ #include "RE/B/BSFixedString.h" #include "RE/B/BSTSmartPointer.h" -namespace RE +namespace RE::BSScript { - namespace BSScript - { - class ObjectTypeInfo; - class StructTypeInfo; + class ObjectTypeInfo; + class StructTypeInfo; - namespace Internal + namespace Internal + { + class WritableTypeTable { - class WritableTypeTable - { - public: - // members - /*BSTScrapHashMap>* */ void* objectTypeMap; // 00 - /*BSTScrapHashMap>* */ void* structTypeMap; // 08 - }; - static_assert(sizeof(WritableTypeTable) == 0x10); - } + public: + // members + /*BSTScrapHashMap>* */ void* objectTypeMap; // 00 + /*BSTScrapHashMap>* */ void* structTypeMap; // 08 + }; + static_assert(sizeof(WritableTypeTable) == 0x10); } } diff --git a/src/RE/R/RemoteDebugger.cpp b/src/RE/R/RemoteDebugger.cpp index 4f90eb40..bfef6f18 100644 --- a/src/RE/R/RemoteDebugger.cpp +++ b/src/RE/R/RemoteDebugger.cpp @@ -1,4 +1,5 @@ #include "RE/R/RemoteDebugger.h" + namespace RE::GameScript { void RemoteDebugger::HandleContinueRequest(const DebuggerMessages::ContinueRequest& a_request) @@ -7,47 +8,53 @@ namespace RE::GameScript REL::Relocation func{ ID::GameScript::RemoteDebugger::HandleContinueRequest }; return func(this, a_request); } + void RemoteDebugger::HandleDisconnectRequest(const DebuggerMessages::DisconnectRequest& a_request) { using func_t = decltype(&RemoteDebugger::HandleDisconnectRequest); REL::Relocation func{ ID::GameScript::RemoteDebugger::HandleDisconnectRequest }; return func(this, a_request); } + void RemoteDebugger::HandlePauseRequest(const DebuggerMessages::PauseRequest& a_request) { using func_t = decltype(&RemoteDebugger::HandlePauseRequest); REL::Relocation func{ ID::GameScript::RemoteDebugger::HandlePauseRequest }; return func(this, a_request); } + void RemoteDebugger::HandleSetBreakpointsRequest(const DebuggerMessages::SetBreakpointsRequest& a_request) { using func_t = decltype(&RemoteDebugger::HandleSetBreakpointsRequest); REL::Relocation func{ ID::GameScript::RemoteDebugger::HandleSetBreakpointsRequest }; return func(this, a_request); } + void RemoteDebugger::HandleStackTraceRequest(const DebuggerMessages::StackTraceRequest& a_request) { using func_t = decltype(&RemoteDebugger::HandleStackTraceRequest); REL::Relocation func{ ID::GameScript::RemoteDebugger::HandleStackTraceRequest }; return func(this, a_request); } + void RemoteDebugger::HandleStepRequest(const DebuggerMessages::Request& a_request, uint32_t a_threadid, StepKind a_stepKind) { using func_t = decltype(&RemoteDebugger::HandleStepRequest); REL::Relocation func{ ID::GameScript::RemoteDebugger::HandleStepRequest }; return func(this, a_request, a_threadid, a_stepKind); } + void RemoteDebugger::HandleVariablesRequest(const DebuggerMessages::VariablesRequest& a_request) { using func_t = decltype(&RemoteDebugger::HandleVariablesRequest); REL::Relocation func{ ID::GameScript::RemoteDebugger::HandleVariablesRequest }; return func(this, a_request); } + void RemoteDebugger::HandleValueRequest(const DebuggerMessages::ValueRequest& a_request) { using func_t = decltype(&RemoteDebugger::HandleValueRequest); REL::Relocation func{ ID::GameScript::RemoteDebugger::HandleValueRequest }; return func(this, a_request); } - } diff --git a/src/RE/S/Stream.cpp b/src/RE/S/Stream.cpp index b9b388b0..ed663dab 100644 --- a/src/RE/S/Stream.cpp +++ b/src/RE/S/Stream.cpp @@ -1,186 +1,183 @@ #include "RE/S/Stream.h" -namespace RE +namespace RE::BSResource { - namespace BSResource + Stream::Stream() : + Stream(0, false) + {} + + Stream::Stream(std::uint32_t a_totalSize, bool writable) : + StreamBase(a_totalSize, writable) + {} + + Stream::Stream(const Stream& a_rhs) : + StreamBase(a_rhs) + {} + + Stream::Stream(Stream&& a_rhs) : + StreamBase(std::move(a_rhs)) + {} + + ErrorCode Stream::DoSetEndOfStream() { - Stream::Stream() : - Stream(0, false) - {} + return ErrorCode::kUnsupported; + } - Stream::Stream(std::uint32_t a_totalSize, bool writable) : - StreamBase(a_totalSize, writable) - {} + ErrorCode Stream::DoPrefetchAt([[maybe_unused]] std::uint64_t a_v, [[maybe_unused]] std::uint64_t b_v, [[maybe_unused]] std::uint32_t c_v) const + { + return ErrorCode::kUnsupported; + } - Stream::Stream(const Stream& a_rhs) : - StreamBase(a_rhs) - {} + ErrorCode Stream::DoPrefetchAll([[maybe_unused]] std::uint32_t a_v) const + { + return ErrorCode::kUnsupported; + } - Stream::Stream(Stream&& a_rhs) : - StreamBase(std::move(a_rhs)) - {} + ErrorCode Stream::DoStartTaggedPrioritizedRead([[maybe_unused]] void* a_buf, + [[maybe_unused]] std::uint64_t a_v, + [[maybe_unused]] std::uint64_t b_v, + [[maybe_unused]] std::uint32_t c_v, + [[maybe_unused]] std::uint32_t volatile* d_v, + [[maybe_unused]] std::uint32_t& e_v, + [[maybe_unused]] BSEventFlag* event_flag) const + { + return ErrorCode::kUnsupported; + } - ErrorCode Stream::DoSetEndOfStream() - { - return ErrorCode::kUnsupported; - } + bool Stream::DoGetName(BSFixedString& a_dst) const + { + a_dst = ""; + return false; + } - ErrorCode Stream::DoPrefetchAt([[maybe_unused]] std::uint64_t a_v, [[maybe_unused]] std::uint64_t b_v, [[maybe_unused]] std::uint32_t c_v) const - { - return ErrorCode::kUnsupported; - } + ErrorCode Stream::DoCreateAsync(BSTSmartPointer&) const + { + return ErrorCode::kUnsupported; + } - ErrorCode Stream::DoPrefetchAll([[maybe_unused]] std::uint32_t a_v) const - { - return ErrorCode::kUnsupported; - } + ErrorCode Stream::DoWaitTags([[maybe_unused]] volatile std::uint32_t* a_completionTag, + [[maybe_unused]] BSEventFlag* a_eventFlag, + [[maybe_unused]] std::uint32_t a_completionTagWaitValue) const + { + return ErrorCode::kUnsupported; + } - ErrorCode Stream::DoStartTaggedPrioritizedRead([[maybe_unused]] void* a_buf, - [[maybe_unused]] std::uint64_t a_v, - [[maybe_unused]] std::uint64_t b_v, - [[maybe_unused]] std::uint32_t c_v, - [[maybe_unused]] std::uint32_t volatile* d_v, - [[maybe_unused]] std::uint32_t& e_v, - [[maybe_unused]] BSEventFlag* event_flag) const - { - return ErrorCode::kUnsupported; - } + bool Stream::DoQTaggedPrioritizedReadSupported() const + { + return false; + } - bool Stream::DoGetName(BSFixedString& a_dst) const - { - a_dst = ""; - return false; - } + ErrorCode Stream::DoReadAt([[maybe_unused]] void* a_buffer, + [[maybe_unused]] std::uint64_t a_offset, + [[maybe_unused]] std::uint64_t a_toRead, + [[maybe_unused]] std::uint64_t& a_read) const + { + return ErrorCode::kUnsupported; + } - ErrorCode Stream::DoCreateAsync(BSTSmartPointer&) const - { + // interface functions + ErrorCode Stream::Read(void* a_buffer, std::uint64_t a_toRead, std::uint64_t& a_read) const + { + if ((flags & kWritable) != 0) { return ErrorCode::kUnsupported; } + return DoRead(a_buffer, a_toRead, a_read); + } - ErrorCode Stream::DoWaitTags([[maybe_unused]] volatile std::uint32_t* a_completionTag, - [[maybe_unused]] BSEventFlag* a_eventFlag, - [[maybe_unused]] std::uint32_t a_completionTagWaitValue) const - { + ErrorCode Stream::ReadAt(void* a_buffer, std::uint64_t a_offset, std::uint64_t a_toRead, std::uint64_t& a_read) const + { + if ((flags & kWritable) != 0) { return ErrorCode::kUnsupported; } + return DoReadAt(a_buffer, a_offset, a_toRead, a_read); + } - bool Stream::DoQTaggedPrioritizedReadSupported() const - { - return false; - } + bool Stream::GetName(BSFixedString& a_dst) const + { + return DoGetName(a_dst); + } - ErrorCode Stream::DoReadAt([[maybe_unused]] void* a_buffer, - [[maybe_unused]] std::uint64_t a_offset, - [[maybe_unused]] std::uint64_t a_toRead, - [[maybe_unused]] std::uint64_t& a_read) const - { - return ErrorCode::kUnsupported; + ErrorCode Stream::Open(bool buffered, bool readFullHint) + { + uint32_t _flags = kUnk3; + if (buffered) { + _flags |= kBuffered; } - - // interface functions - ErrorCode Stream::Read(void* a_buffer, std::uint64_t a_toRead, std::uint64_t& a_read) const - { - if ((flags & kWritable) != 0) { - return ErrorCode::kUnsupported; - } - return DoRead(a_buffer, a_toRead, a_read); + if (readFullHint) { + _flags |= kBuffered | kFullReadHint; } - - ErrorCode Stream::ReadAt(void* a_buffer, std::uint64_t a_offset, std::uint64_t a_toRead, std::uint64_t& a_read) const - { - if ((flags & kWritable) != 0) { - return ErrorCode::kUnsupported; - } - return DoReadAt(a_buffer, a_offset, a_toRead, a_read); + static std::atomic_ref myflags{ flags }; + uint32_t old_flags = flags; + while (!myflags.compare_exchange_strong(old_flags, (old_flags | _flags))) { + old_flags = flags; } + return DoOpen(); + } - bool Stream::GetName(BSFixedString& a_dst) const - { - return DoGetName(a_dst); - } + ErrorCode Stream::Seek(std::uint64_t a_toSeek, SeekMode a_mode, std::uint64_t& a_sought) const + { + return DoSeek(a_toSeek, a_mode, a_sought); + } - ErrorCode Stream::Open(bool buffered, bool readFullHint) - { - uint32_t _flags = kUnk3; - if (buffered) { - _flags |= kBuffered; - } - if (readFullHint) { - _flags |= kBuffered | kFullReadHint; - } - static std::atomic_ref myflags{ flags }; - uint32_t old_flags = flags; - while (!myflags.compare_exchange_strong(old_flags, (old_flags | _flags))) { - old_flags = flags; - } - return DoOpen(); + ErrorCode Stream::Write(const void* a_buffer, std::uint64_t a_toWrite, std::uint64_t& a_written) const + { + if ((flags & kWritable) != 0) { + return DoWrite(a_buffer, a_toWrite, a_written); } + return ErrorCode::kUnsupported; + } - ErrorCode Stream::Seek(std::uint64_t a_toSeek, SeekMode a_mode, std::uint64_t& a_sought) const - { - return DoSeek(a_toSeek, a_mode, a_sought); - } + ErrorCode Stream::CreateAsync(BSTSmartPointer& a_streamOut) const + { + return DoCreateAsync(a_streamOut); + } - ErrorCode Stream::Write(const void* a_buffer, std::uint64_t a_toWrite, std::uint64_t& a_written) const - { - if ((flags & kWritable) != 0) { - return DoWrite(a_buffer, a_toWrite, a_written); - } + ErrorCode Stream::PrefetchAll(std::uint32_t a_v) const + { + if ((flags & kWritable) != 0) { return ErrorCode::kUnsupported; } + return DoPrefetchAll(a_v); + } - ErrorCode Stream::CreateAsync(BSTSmartPointer& a_streamOut) const - { - return DoCreateAsync(a_streamOut); - } - - ErrorCode Stream::PrefetchAll(std::uint32_t a_v) const - { - if ((flags & kWritable) != 0) { - return ErrorCode::kUnsupported; - } - return DoPrefetchAll(a_v); - } - - ErrorCode Stream::PrefetchAt(std::uint64_t a_v, std::uint64_t b_v, std::uint32_t c_v) const - { - if ((flags & kWritable) != 0) { - return ErrorCode::kUnsupported; - } - return DoPrefetchAt(a_v, b_v, c_v); + ErrorCode Stream::PrefetchAt(std::uint64_t a_v, std::uint64_t b_v, std::uint32_t c_v) const + { + if ((flags & kWritable) != 0) { + return ErrorCode::kUnsupported; } + return DoPrefetchAt(a_v, b_v, c_v); + } - std::uint32_t Stream::QFullReadHint() const - { - return flags & kFullReadHint; - } + std::uint32_t Stream::QFullReadHint() const + { + return flags & kFullReadHint; + } - bool Stream::QTaggedPrioritizedReadSupported() const - { - return DoQTaggedPrioritizedReadSupported(); - } + bool Stream::QTaggedPrioritizedReadSupported() const + { + return DoQTaggedPrioritizedReadSupported(); + } - ErrorCode Stream::StartTaggedPrioritizedRead(void* buf, std::uint64_t a_v, std::uint64_t b_v, std::uint32_t c_V, std::uint32_t volatile* d_v, std::uint32_t& e_v, BSEventFlag* event_flag) const - { - if ((flags & kWritable) != 0) { - return ErrorCode::kUnsupported; - } - return DoStartTaggedPrioritizedRead(buf, a_v, b_v, c_V, d_v, e_v, event_flag); + ErrorCode Stream::StartTaggedPrioritizedRead(void* buf, std::uint64_t a_v, std::uint64_t b_v, std::uint32_t c_V, std::uint32_t volatile* d_v, std::uint32_t& e_v, BSEventFlag* event_flag) const + { + if ((flags & kWritable) != 0) { + return ErrorCode::kUnsupported; } + return DoStartTaggedPrioritizedRead(buf, a_v, b_v, c_V, d_v, e_v, event_flag); + } - ErrorCode Stream::WaitTags(volatile std::uint32_t* a_completionTag, BSEventFlag* a_eventFlag, std::uint32_t a_completionTagWaitValue) const - { - return DoWaitTags(a_completionTag, a_eventFlag, a_completionTagWaitValue); - } + ErrorCode Stream::WaitTags(volatile std::uint32_t* a_completionTag, BSEventFlag* a_eventFlag, std::uint32_t a_completionTagWaitValue) const + { + return DoWaitTags(a_completionTag, a_eventFlag, a_completionTagWaitValue); + } - std::uint32_t Stream::QBuffered() const - { - return flags & kBuffered; - } + std::uint32_t Stream::QBuffered() const + { + return flags & kBuffered; + } - ErrorCode Stream::SetEndOfStream() - { - return DoSetEndOfStream(); - } + ErrorCode Stream::SetEndOfStream() + { + return DoSetEndOfStream(); } } diff --git a/src/RE/S/StreamBase.cpp b/src/RE/S/StreamBase.cpp index 98297c33..d2c80127 100644 --- a/src/RE/S/StreamBase.cpp +++ b/src/RE/S/StreamBase.cpp @@ -1,62 +1,59 @@ #include "RE/S/StreamBase.h" -namespace RE +namespace RE::BSResource { - namespace BSResource + StreamBase::StreamBase() : + totalSize(0), + flags(0) + {} + + StreamBase::StreamBase(const StreamBase& a_rhs) : + totalSize(a_rhs.totalSize), + flags(a_rhs.flags & ~kRefCountMask) + {} + + StreamBase::StreamBase(StreamBase&& a_rhs) : + totalSize(a_rhs.totalSize), + flags(a_rhs.flags & ~kRefCountMask) + {} + + StreamBase::StreamBase(std::uint32_t a_totalSize, bool writable) : + totalSize(a_totalSize), + flags(writable ? 1 : 0) + {} + + std::uint64_t StreamBase::DoGetKey() const { - StreamBase::StreamBase() : - totalSize(0), - flags(0) - {} - - StreamBase::StreamBase(const StreamBase& a_rhs) : - totalSize(a_rhs.totalSize), - flags(a_rhs.flags & ~kRefCountMask) - {} - - StreamBase::StreamBase(StreamBase&& a_rhs) : - totalSize(a_rhs.totalSize), - flags(a_rhs.flags & ~kRefCountMask) - {} - - StreamBase::StreamBase(std::uint32_t a_totalSize, bool writable) : - totalSize(a_totalSize), - flags(writable ? 1 : 0) - {} - - std::uint64_t StreamBase::DoGetKey() const - { - return 0xFFFFFFFF00000000; - } - - ErrorCode StreamBase::DoGetInfo(Info&) - { - return ErrorCode::kUnsupported; - } - - std::uint32_t StreamBase::DecRef() - { - stl::atomic_ref myFlags{ flags }; - std::uint32_t expected; - do { - expected = myFlags; - } while (!myFlags.compare_exchange_weak(expected, expected - kRefCountBeg)); - return (expected - kRefCountBeg) & kRefCountMask; - } - - std::uint32_t StreamBase::IncRef() - { - stl::atomic_ref myFlags{ flags }; - std::uint32_t expected; - do { - expected = myFlags; - } while (!myFlags.compare_exchange_weak(expected, expected + kRefCountBeg)); - return (expected - kRefCountBeg) & kRefCountMask; - } - - bool StreamBase::IsWritable() const - { - return static_cast(flags & kWritable); - } + return 0xFFFFFFFF00000000; + } + + ErrorCode StreamBase::DoGetInfo(Info&) + { + return ErrorCode::kUnsupported; + } + + std::uint32_t StreamBase::DecRef() + { + stl::atomic_ref myFlags{ flags }; + std::uint32_t expected; + do { + expected = myFlags; + } while (!myFlags.compare_exchange_weak(expected, expected - kRefCountBeg)); + return (expected - kRefCountBeg) & kRefCountMask; + } + + std::uint32_t StreamBase::IncRef() + { + stl::atomic_ref myFlags{ flags }; + std::uint32_t expected; + do { + expected = myFlags; + } while (!myFlags.compare_exchange_weak(expected, expected + kRefCountBeg)); + return (expected - kRefCountBeg) & kRefCountMask; + } + + bool StreamBase::IsWritable() const + { + return static_cast(flags & kWritable); } } diff --git a/src/RE/V/VirtualMachine.cpp b/src/RE/V/VirtualMachine.cpp index ee0706c9..e3e51496 100644 --- a/src/RE/V/VirtualMachine.cpp +++ b/src/RE/V/VirtualMachine.cpp @@ -8,4 +8,4 @@ namespace RE::BSScript::Internal auto vm = GameVM::GetSingleton(); return vm ? static_cast(vm->impl.get()) : nullptr; } -} \ No newline at end of file +}