diff --git a/include/RE/A/Actor.h b/include/RE/A/Actor.h index 2b1ef597..3acf3eb4 100644 --- a/include/RE/A/Actor.h +++ b/include/RE/A/Actor.h @@ -13,7 +13,6 @@ namespace RE { class AIProcess; - class BGSKeyword; class BGSPerk; class CombatController; class CombatGroup; @@ -360,13 +359,6 @@ namespace RE func(this); } - [[nodiscard]] bool WornHasKeyword(BGSKeyword* a_keyword) - { - using func_t = decltype(&Actor::WornHasKeyword); - static REL::Relocation func{ ID::Actor::WornHasKeyword }; - return func(this, a_keyword); - } - // members REX::EnumSet boolBits; // 200 float unk204; // 204 diff --git a/include/RE/B/BGSDefaultObjectManager.h b/include/RE/B/BGSDefaultObjectManager.h index 1cc9a22f..a9d04dd4 100644 --- a/include/RE/B/BGSDefaultObjectManager.h +++ b/include/RE/B/BGSDefaultObjectManager.h @@ -419,7 +419,7 @@ namespace RE [[nodiscard]] static BGSDefaultObjectManager* GetSingleton() { using func_t = decltype(&BGSDefaultObjectManager::GetSingleton); - static REL::Relocation func{ REL::ID(82283) }; + static REL::Relocation func{ ID::BGSDefaultObjectManager::GetSingleton }; return func(); } diff --git a/include/RE/B/BGSEntryPoint.h b/include/RE/B/BGSEntryPoint.h index 487e54d8..ecf29929 100644 --- a/include/RE/B/BGSEntryPoint.h +++ b/include/RE/B/BGSEntryPoint.h @@ -267,7 +267,7 @@ namespace RE inline void HandleEntryPoint(ENTRY_POINT a_entryPoint, Actor* a_perkOwner, Args... a_args) { using func_t = decltype(&BGSEntryPoint::HandleEntryPoint); - static REL::Relocation func{ REL::ID(110912) }; + static REL::Relocation func{ ID::BGSEntryPoint::HandleEntryPoint }; return func(a_entryPoint, a_perkOwner, a_args...); } } diff --git a/include/RE/B/BGSInventoryInterface.h b/include/RE/B/BGSInventoryInterface.h index 2f772b65..bee48191 100644 --- a/include/RE/B/BGSInventoryInterface.h +++ b/include/RE/B/BGSInventoryInterface.h @@ -50,7 +50,7 @@ namespace RE [[nodiscard]] static BGSInventoryInterface* GetSingleton() { - static REL::Relocation singleton{ ID::BGSInventoryInterface::singleton }; + static REL::Relocation singleton{ ID::BGSInventoryInterface::Singleton }; return *singleton; } diff --git a/include/RE/B/BGSMod.h b/include/RE/B/BGSMod.h index 5e8ed866..ee0722ce 100644 --- a/include/RE/B/BGSMod.h +++ b/include/RE/B/BGSMod.h @@ -15,9 +15,15 @@ namespace RE namespace RE::BGSMod { + class Container + { + public: + SF_RTTI(BGSMod__Container); + }; + namespace Attachment { - class Mod : + class __declspec(novtable) Mod : public TESForm, // 00 public TESFullName, // 30 public TESDescription, // 40 @@ -39,7 +45,7 @@ namespace RE::BGSMod struct Include { - RE::BGSMod::Attachment::Mod* mod; + BGSMod::Attachment::Mod* mod; std::uint8_t level; REX::EnumSet flags; }; @@ -74,7 +80,18 @@ namespace RE::BGSMod namespace Template { - class Items : public BaseFormComponent + class __declspec(novtable) Item : + public TESFullName, // 00 + public BGSMod::Container // 10 + { + public: + SF_RTTI_VTABLE(BGSMod__Template__Item); + + ~Item() override; // 00 + }; + + class __declspec(novtable) Items : + public BaseFormComponent // 00 { public: SF_RTTI_VTABLE(BGSMod__Template__Items); @@ -91,7 +108,7 @@ namespace RE::BGSMod virtual void Unk_0D(); // 0D // members - BSTArray unk08; // 08 + BSTArray items; // 08 BSFixedString unk18; // 18 }; static_assert(sizeof(Items) == 0x20); diff --git a/include/RE/B/BGSSaveLoadGame.h b/include/RE/B/BGSSaveLoadGame.h index 61fcafac..3b67934e 100644 --- a/include/RE/B/BGSSaveLoadGame.h +++ b/include/RE/B/BGSSaveLoadGame.h @@ -8,14 +8,14 @@ namespace RE void SaveGame(void* a_unk1, void* a_unk2, const char* a_name) { using func_t = decltype(&BGSSaveLoadGame::SaveGame); - static REL::Relocation func{ REL::ID(147515) }; + static REL::Relocation func{ ID::BGSSaveLoadGame::SaveGame }; return func(this, a_unk1, a_unk2, a_name); } bool LoadGame(const char* a_name, void* a_unk1, void* a_unk2) { using func_t = decltype(&BGSSaveLoadGame::LoadGame); - static REL::Relocation func{ REL::ID(147564) }; + static REL::Relocation func{ ID::BGSSaveLoadGame::LoadGame }; return func(this, a_name, a_unk1, a_unk2); } }; diff --git a/include/RE/B/BGSSaveLoadManager.h b/include/RE/B/BGSSaveLoadManager.h index 7bb6aa10..c802097b 100644 --- a/include/RE/B/BGSSaveLoadManager.h +++ b/include/RE/B/BGSSaveLoadManager.h @@ -7,14 +7,14 @@ namespace RE public: static BGSSaveLoadManager* GetSingleton() { - static REL::Relocation singleton{ REL::ID(880997) }; + static REL::Relocation singleton{ ID::BGSSaveLoadManager::Singleton }; return *singleton; } bool DeleteSaveFile(const char* a_filename, void* a_unk1, bool a_unk2) { using func_t = decltype(&BGSSaveLoadManager::DeleteSaveFile); - static REL::Relocation func{ REL::ID(147844) }; + static REL::Relocation func{ ID::BGSSaveLoadManager::DeleteSaveFile }; return func(this, a_filename, a_unk1, a_unk2); } }; diff --git a/include/RE/B/BSStringPool.h b/include/RE/B/BSStringPool.h index 8327973b..623427ea 100644 --- a/include/RE/B/BSStringPool.h +++ b/include/RE/B/BSStringPool.h @@ -111,7 +111,7 @@ namespace RE inline void GetEntry(BSStringPool::Entry*& a_result, const wchar_t* a_string, bool a_caseSensitive) { using func_t = decltype(&GetEntry); - static REL::Relocation func{ ID::BSStringPool::GetEntry_wchar_t_ }; + static REL::Relocation func{ ID::BSStringPool::GetEntry_wchar_t_ }; // TODO: ID changed return func(a_result, a_string, a_caseSensitive); } } diff --git a/include/RE/G/GameVM.h b/include/RE/G/GameVM.h index a85a0f4e..05b0c4bc 100644 --- a/include/RE/G/GameVM.h +++ b/include/RE/G/GameVM.h @@ -162,7 +162,7 @@ namespace RE [[nodiscard]] static GameVM* GetSingleton() { - static REL::Relocation singleton{ ID::GameVM::singleton }; + static REL::Relocation singleton{ ID::GameVM::Singleton }; return *singleton; } @@ -174,7 +174,7 @@ namespace RE static void BindEverythingToScript(BSScript::IVirtualMachine** a_vm) { using func_t = decltype(&BindEverythingToScript); - static REL::Relocation func{ REL::ID(171438) }; + static REL::Relocation func{ ID::GameVM::BindEverythingToScript }; return func(a_vm); } diff --git a/include/RE/IDs.h b/include/RE/IDs.h index 19b90a5b..80d7053f 100644 --- a/include/RE/IDs.h +++ b/include/RE/IDs.h @@ -12,7 +12,6 @@ namespace RE::ID inline constexpr REL::ID SetSkinTone{ 146270 }; inline constexpr REL::ID UpdateAppearance{ 151216 }; inline constexpr REL::ID UpdateChargenAppearance{ 146273 }; - inline constexpr REL::ID WornHasKeyword{ 106992 }; } namespace ActorUtils @@ -31,16 +30,26 @@ namespace RE::ID inline constexpr REL::ID EquipObject{ 151991 }; inline constexpr REL::ID UnequipObject{ 152007 }; } - //Extradatalist.h + namespace BaseExtraList { inline constexpr REL::ID AddExtra{ 83084 }; inline constexpr REL::ID GetByType{ 83208 }; } + namespace BGSDefaultObjectManager + { + inline constexpr REL::ID GetSingleton{ 82283 }; + } + + namespace BGSEntryPoint + { + inline constexpr REL::ID HandleEntryPoint{ 110912 }; + } + namespace BGSInventoryInterface { - inline constexpr REL::ID singleton{ 825787 }; + inline constexpr REL::ID Singleton{ 825787 }; inline constexpr REL::ID GetInventoryObject{ 87520 }; } @@ -49,6 +58,18 @@ namespace RE::ID inline constexpr REL::ID ctor{ 101725 }; } + namespace BGSSaveLoadGame + { + inline constexpr REL::ID SaveGame{ 147515 }; + inline constexpr REL::ID LoadGame{ 147564 }; + } + + namespace BGSSaveLoadManager + { + inline constexpr REL::ID Singleton{ 880997 }; + inline constexpr REL::ID DeleteSaveFile{ 147844 }; + } + namespace BSLog { inline constexpr REL::ID ctor{ 184813 }; @@ -75,7 +96,6 @@ namespace RE::ID inline constexpr REL::ID lock_write{ 34125 }; inline constexpr REL::ID unlock_read{ 178609 }; inline constexpr REL::ID unlock_write{ 34257 }; - } namespace BSScript @@ -96,6 +116,11 @@ namespace RE::ID inline constexpr REL::ID DecRef{ 196057 }; } + namespace ObjectBindPolicy + { + inline constexpr REL::ID BindObject{ 195981 }; + } + namespace ObjectTypeInfo { inline constexpr REL::ID ctor{ 197047 }; @@ -142,6 +167,7 @@ namespace RE::ID { inline constexpr REL::ID release{ 36754 }; } + namespace BucketTable { inline constexpr REL::ID GetSingleton{ 198241 }; @@ -149,7 +175,6 @@ namespace RE::ID inline constexpr REL::ID GetEntry_char_{ 198219 }; inline constexpr REL::ID GetEntry_wchar_t_{ 198220 }; - } namespace BSStorage @@ -158,6 +183,7 @@ namespace RE::ID inline constexpr REL::ID PrepareStreamBuffer{ 72461 }; inline constexpr REL::ID WriteString{ 87863 }; } + namespace BSSystemFile { inline constexpr REL::ID ctor{ 198445 }; @@ -225,7 +251,8 @@ namespace RE::ID namespace GameVM { - inline constexpr REL::ID singleton{ 878371 }; + inline constexpr REL::ID Singleton{ 878371 }; + inline constexpr REL::ID BindEverythingToScript{ 171438 }; } namespace idLogging @@ -260,12 +287,12 @@ namespace RE::ID namespace MemoryManager { - namespace AutoScrapBuffer { inline constexpr REL::ID ctor{ 178513 }; inline constexpr REL::ID dtor{ 178516 }; } + inline constexpr REL::ID GetSingleton{ 33961 }; inline constexpr REL::ID Allocate{ 33962 }; inline constexpr REL::ID Free{ 34032 }; @@ -279,14 +306,14 @@ namespace RE::ID inline constexpr REL::ID PlayMenuSound{ 167344 }; } - namespace NiMatrix3 + namespace NiCamera { - inline constexpr REL::ID ToEulerAnglesXYZ{ 210095 }; + inline constexpr REL::ID WorldToScreenInternal{ 210415 }; } - namespace ObjectBindPolicy + namespace NiMatrix3 { - inline constexpr REL::ID BindObject{ 195981 }; + inline constexpr REL::ID ToEulerAnglesXYZ{ 210095 }; } namespace PlayerCamera @@ -316,35 +343,41 @@ namespace RE::ID namespace RegSettingCollection { - inline constexpr REL::ID singleton{ 885510 }; + inline constexpr REL::ID Singleton{ 885510 }; } namespace Scaleform { - namespace ObjectInterface + namespace GFx { - inline constexpr REL::ID ObjectAddRef{ 57288 }; - inline constexpr REL::ID ObjectRelease{ 57289 }; - inline constexpr REL::ID HasMember{ 57290 }; - inline constexpr REL::ID GetMember{ 57291 }; - inline constexpr REL::ID SetMember{ 1867815 }; - inline constexpr REL::ID Invoke{ 1867816 }; - inline constexpr REL::ID VisitMembers{ 57296 }; - inline constexpr REL::ID GetArraySize{ 57297 }; - inline constexpr REL::ID SetArraySize{ 57298 }; - inline constexpr REL::ID GetElement{ 57299 }; - inline constexpr REL::ID SetElement{ 57300 }; - inline constexpr REL::ID VisitElements{ 57301 }; - inline constexpr REL::ID PushBack{ 57303 }; - inline constexpr REL::ID PopBack{ 57304 }; - inline constexpr REL::ID RemoveElements{ 57305 }; - inline constexpr REL::ID GetParent{ 57314 }; - inline constexpr REL::ID GetText{ 57324 }; - inline constexpr REL::ID SetText{ 57325 }; - inline constexpr REL::ID SetTextW{ 57326 }; - inline constexpr REL::ID CreateEmptyMovieClip{ 57327 }; - inline constexpr REL::ID GotoAndPlayL{ 57329 }; - inline constexpr REL::ID GotoAndPlay{ 57330 }; + namespace Value + { + namespace ObjectInterface + { + inline constexpr REL::ID ObjectAddRef{ 57288 }; + inline constexpr REL::ID ObjectRelease{ 57289 }; + inline constexpr REL::ID HasMember{ 57290 }; + inline constexpr REL::ID GetMember{ 57291 }; + inline constexpr REL::ID SetMember{ 1867815 }; + inline constexpr REL::ID Invoke{ 1867816 }; + inline constexpr REL::ID VisitMembers{ 57296 }; + inline constexpr REL::ID GetArraySize{ 57297 }; + inline constexpr REL::ID SetArraySize{ 57298 }; + inline constexpr REL::ID GetElement{ 57299 }; + inline constexpr REL::ID SetElement{ 57300 }; + inline constexpr REL::ID VisitElements{ 57301 }; + inline constexpr REL::ID PushBack{ 57303 }; + inline constexpr REL::ID PopBack{ 57304 }; + inline constexpr REL::ID RemoveElements{ 57305 }; + inline constexpr REL::ID GetParent{ 57314 }; + inline constexpr REL::ID GetText{ 57324 }; + inline constexpr REL::ID SetText{ 57325 }; + inline constexpr REL::ID SetTextW{ 57326 }; + inline constexpr REL::ID CreateEmptyMovieClip{ 57327 }; + inline constexpr REL::ID GotoAndPlayL{ 57329 }; + inline constexpr REL::ID GotoAndPlay{ 57330 }; + } + } } } @@ -371,6 +404,16 @@ namespace RE::ID inline constexpr REL::ID GetEventSource{ 107143 }; } + namespace TESCondition + { + inline constexpr REL::ID CheckValue{ 116112 }; + } + + namespace TESConditionItem + { + inline constexpr REL::ID IsTrue{ 116127 }; + } + namespace TESContainerChangedEvent { inline constexpr REL::ID GetEventSource{ 107155 }; @@ -378,7 +421,7 @@ namespace RE::ID namespace TESDataHandler { - inline constexpr REL::ID singleton{ 825890 }; + inline constexpr REL::ID Singleton{ 825890 }; } namespace TESDeathEvent @@ -440,6 +483,7 @@ namespace RE::ID inline constexpr REL::ID IsObjectEquipped{ 106991 }; inline constexpr REL::ID IsSpaceshipDocked{ 174146 }; inline constexpr REL::ID IsSpaceshipLanded{ 173880 }; + inline constexpr REL::ID WornHasKeyword{ 106992 }; } namespace TESQuest @@ -454,10 +498,16 @@ namespace RE::ID namespace UI { - inline constexpr REL::ID singleton{ 878339 }; + inline constexpr REL::ID Singleton{ 878339 }; inline constexpr REL::ID IsMenuOpen{ 1870208 }; } + namespace UIMessageQueue + { + inline constexpr REL::ID Singleton{ 878637 }; + inline constexpr REL::ID AddMessage{ 187268 }; + } + // global functions/ ids inline constexpr REL::ID RTDynamicCast{ 211916 }; diff --git a/include/RE/N/NiCamera.h b/include/RE/N/NiCamera.h index 0e180926..ce05f538 100644 --- a/include/RE/N/NiCamera.h +++ b/include/RE/N/NiCamera.h @@ -1,4 +1,5 @@ #pragma once + #include "RE/N/NiPoint3.h" namespace RE @@ -30,15 +31,16 @@ namespace RE { public: virtual ~NiCamera() = default; + //leftBoundary and rightBoundary are outputted based on the W (radius) component of worldPt. //If the W component is small enough, they are essentially equal, and point to the exact //XYZ location provided. //The returned NiPoint2 does not contain any world-to-screen information and can be ignored. - NiPoint2 WorldToScreenInternal(const NiPoint4* worldPt, NiPoint3* leftBoundary, NiPoint3* rightBoundary) + NiPoint2 WorldToScreenInternal(const NiPoint4* a_worldPt, NiPoint3* a_leftBoundary, NiPoint3* a_rightBoundary) { using func_t = decltype(&NiCamera::WorldToScreenInternal); - static REL::Relocation func{ REL::ID(210415) }; - return func(this, worldPt, leftBoundary, rightBoundary); + static REL::Relocation func{ ID::NiCamera::WorldToScreenInternal }; + return func(this, a_worldPt, a_leftBoundary, a_rightBoundary); } //The returned X and Y are in the range -1 to 1, with 1 being top right and -1 being bottom left. @@ -46,38 +48,39 @@ namespace RE //camera is facing away from the worldPt. //Note: The Z component is very small due to Starfield's unit scale. //i.e. distance from player to camera when the camera is close is ~0.0004 - NiPoint3 WorldToScreen(const NiPoint3& worldPt) + NiPoint3 WorldToScreen(const NiPoint3& a_worldPt) { NiPoint3 result{ 0.0f, 0.0f, -1.0f }; - float worldDiffRotated = (((worldPt.y - world.translate.y) * world.rotate[0][1]) + - ((worldPt.x - world.translate.x) * world.rotate[0][0]) + - ((worldPt.z - world.translate.z) * world.rotate[0][2])) - + float worldDiffRotated = (((a_worldPt.y - world.translate.y) * world.rotate[0][1]) + + ((a_worldPt.x - world.translate.x) * world.rotate[0][0]) + + ((a_worldPt.z - world.translate.z) * world.rotate[0][2])) - viewFrustum._near; result.z = worldDiffRotated * (1.0f / (viewFrustum._far - viewFrustum._near)); - float trace = (worldPt.x * worldToCam[3][0]) + (worldPt.y * worldToCam[3][1]) + ((worldPt.z * worldToCam[3][2]) + worldToCam[3][3]); + float trace = (a_worldPt.x * worldToCam[3][0]) + (a_worldPt.y * worldToCam[3][1]) + ((a_worldPt.z * worldToCam[3][2]) + worldToCam[3][3]); if (trace <= 0.00001f) { return result; } float traceInv = 1.0f / trace; - result.x = (((worldPt.y * worldToCam[0][1]) + (worldPt.x * worldToCam[0][0])) + ((worldPt.z * worldToCam[0][2]) + worldToCam[0][3])) * traceInv; - result.y = (((worldPt.y * worldToCam[1][1]) + (worldPt.x * worldToCam[1][0])) + ((worldPt.z * worldToCam[1][2]) + worldToCam[1][3])) * traceInv; + result.x = (((a_worldPt.y * worldToCam[0][1]) + (a_worldPt.x * worldToCam[0][0])) + ((a_worldPt.z * worldToCam[0][2]) + worldToCam[0][3])) * traceInv; + result.y = (((a_worldPt.y * worldToCam[1][1]) + (a_worldPt.x * worldToCam[1][0])) + ((a_worldPt.z * worldToCam[1][2]) + worldToCam[1][3])) * traceInv; return result; } //Same as WorldToScreen, but normalizes X and Y to the 0 to 1 range, //and flips the Y component so that 0 is top left and 1 is bottom right. - NiPoint3 WorldToScreenNormalized(const NiPoint3& worldPt) + NiPoint3 WorldToScreenNormalized(const NiPoint3& a_worldPt) { - auto result = WorldToScreen(worldPt); + auto result = WorldToScreen(a_worldPt); result.x = (result.x + 1.0f) * 0.5f; result.y = -result.y; result.y = (result.y + 1.0f) * 0.5f; return result; } + // memebers float unk[20]; float worldToCam[4][4]; NiFrustum viewFrustum; diff --git a/include/RE/O/ObjectBindPolicy.h b/include/RE/O/ObjectBindPolicy.h index 86372524..a0744a95 100644 --- a/include/RE/O/ObjectBindPolicy.h +++ b/include/RE/O/ObjectBindPolicy.h @@ -62,7 +62,7 @@ namespace RE void BindObject(const BSTSmartPointer& a_obj, std::size_t a_objHandle) { using func_t = decltype(&ObjectBindPolicy::BindObject); - static REL::Relocation func{ ID::ObjectBindPolicy::BindObject }; + static REL::Relocation func{ ID::BSScript::ObjectBindPolicy::BindObject }; return func(this, a_obj, a_objHandle); } diff --git a/include/RE/P/PlayerCamera.h b/include/RE/P/PlayerCamera.h index 070426b7..dd94c3c9 100644 --- a/include/RE/P/PlayerCamera.h +++ b/include/RE/P/PlayerCamera.h @@ -103,7 +103,7 @@ namespace RE void SetCameraState(CameraState a_cameraState) { using func_t = decltype(&PlayerCamera::SetCameraState); - static REL::Relocation func{ ID::PlayerCamera::SetCameraState }; + static REL::Relocation func{ ID::PlayerCamera::SetCameraState }; // TODO: ID changed return func(this, a_cameraState); } diff --git a/include/RE/R/RegSettingCollection.h b/include/RE/R/RegSettingCollection.h index a6b718f7..39bf0dc5 100644 --- a/include/RE/R/RegSettingCollection.h +++ b/include/RE/R/RegSettingCollection.h @@ -15,7 +15,7 @@ namespace RE [[nodiscard]] static RegSettingCollection* GetSingleton() { - static REL::Relocation singleton{ ID::RegSettingCollection::singleton }; + static REL::Relocation singleton{ ID::RegSettingCollection::Singleton }; return *singleton; } diff --git a/include/RE/S/ScaleformGFxValue.h b/include/RE/S/ScaleformGFxValue.h index 09944447..36bd432b 100644 --- a/include/RE/S/ScaleformGFxValue.h +++ b/include/RE/S/ScaleformGFxValue.h @@ -169,154 +169,154 @@ namespace RE::Scaleform::GFx void ObjectAddRef(Value* a_val, void* a_obj) { using func_t = decltype(&ObjectInterface::ObjectAddRef); - static REL::Relocation func{ ID::Scaleform::ObjectInterface::ObjectAddRef }; + static REL::Relocation func{ ID::Scaleform::GFx::Value::ObjectInterface::ObjectAddRef }; return func(this, a_val, a_obj); } void ObjectRelease(Value* a_val, void* a_obj) { using func_t = decltype(&ObjectInterface::ObjectRelease); - static REL::Relocation func{ ID::Scaleform::ObjectInterface::ObjectRelease }; + static REL::Relocation func{ ID::Scaleform::GFx::Value::ObjectInterface::ObjectRelease }; return func(this, a_val, a_obj); } bool HasMember(void* a_data, const char* a_name, bool a_isdobj) const { using func_t = decltype(&ObjectInterface::HasMember); - static REL::Relocation func{ ID::Scaleform::ObjectInterface::HasMember }; + static REL::Relocation func{ ID::Scaleform::GFx::Value::ObjectInterface::HasMember }; return func(this, a_data, a_name, a_isdobj); } bool GetMember(void* a_data, const char* a_name, Value* a_val, bool a_isdobj) const { using func_t = decltype(&ObjectInterface::GetMember); - static REL::Relocation func{ ID::Scaleform::ObjectInterface::GetMember }; + static REL::Relocation func{ ID::Scaleform::GFx::Value::ObjectInterface::GetMember }; return func(this, a_data, a_name, a_val, a_isdobj); } bool SetMember(void* a_data, const char* a_name, const Value& a_value, bool a_isdobj) { using func_t = decltype(&ObjectInterface::SetMember); - static REL::Relocation func{ ID::Scaleform::ObjectInterface::SetMember }; + static REL::Relocation func{ ID::Scaleform::GFx::Value::ObjectInterface::SetMember }; return func(this, a_data, a_name, a_value, a_isdobj); } bool Invoke(void* a_data, Value* a_result, const char* a_name, const Value* a_args, std::size_t a_numArgs, bool a_isdobj) { using func_t = decltype(&ObjectInterface::Invoke); - static REL::Relocation func{ ID::Scaleform::ObjectInterface::Invoke }; + static REL::Relocation func{ ID::Scaleform::GFx::Value::ObjectInterface::Invoke }; return func(this, a_data, a_result, a_name, a_args, a_numArgs, a_isdobj); } void VisitMembers(void* a_data, ObjVisitor* a_visitor, bool a_isdobj) { using func_t = decltype(&ObjectInterface::VisitMembers); - static REL::Relocation func{ ID::Scaleform::ObjectInterface::VisitMembers }; + static REL::Relocation func{ ID::Scaleform::GFx::Value::ObjectInterface::VisitMembers }; return func(this, a_data, a_visitor, a_isdobj); } std::uint32_t GetArraySize(void* a_data) { using func_t = decltype(&ObjectInterface::GetArraySize); - static REL::Relocation func{ ID::Scaleform::ObjectInterface::GetArraySize }; + static REL::Relocation func{ ID::Scaleform::GFx::Value::ObjectInterface::GetArraySize }; return func(this, a_data); } bool SetArraySize(void* a_data, std::uint32_t a_size) { using func_t = decltype(&ObjectInterface::SetArraySize); - static REL::Relocation func{ ID::Scaleform::ObjectInterface::SetArraySize }; + static REL::Relocation func{ ID::Scaleform::GFx::Value::ObjectInterface::SetArraySize }; return func(this, a_data, a_size); } bool GetElement(void* a_data, std::uint32_t a_index, Value* a_value) { using func_t = decltype(&ObjectInterface::GetElement); - static REL::Relocation func{ ID::Scaleform::ObjectInterface::GetElement }; + static REL::Relocation func{ ID::Scaleform::GFx::Value::ObjectInterface::GetElement }; return func(this, a_data, a_index, a_value); } bool SetElement(void* a_data, std::uint32_t a_index, const Value& a_value) { using func_t = decltype(&ObjectInterface::SetElement); - static REL::Relocation func{ ID::Scaleform::ObjectInterface::SetElement }; + static REL::Relocation func{ ID::Scaleform::GFx::Value::ObjectInterface::SetElement }; return func(this, a_data, a_index, a_value); } void VisitElements(void* a_data, ArrVisitor* a_visitor, std::uint32_t a_index, std::int32_t a_count) { using func_t = decltype(&ObjectInterface::VisitElements); - static REL::Relocation func{ ID::Scaleform::ObjectInterface::VisitElements }; + static REL::Relocation func{ ID::Scaleform::GFx::Value::ObjectInterface::VisitElements }; return func(this, a_data, a_visitor, a_index, a_count); } bool PushBack(void* a_data, const Value& a_value) { using func_t = decltype(&ObjectInterface::PushBack); - static REL::Relocation func{ ID::Scaleform::ObjectInterface::PushBack }; + static REL::Relocation func{ ID::Scaleform::GFx::Value::ObjectInterface::PushBack }; return func(this, a_data, a_value); } bool PopBack(void* a_data, Value* a_value) { using func_t = decltype(&ObjectInterface::PopBack); - static REL::Relocation func{ ID::Scaleform::ObjectInterface::PopBack }; + static REL::Relocation func{ ID::Scaleform::GFx::Value::ObjectInterface::PopBack }; return func(this, a_data, a_value); } bool RemoveElements(void* a_data, std::uint32_t a_index, std::int32_t a_count) { using func_t = decltype(&ObjectInterface::RemoveElements); - static REL::Relocation func{ ID::Scaleform::ObjectInterface::RemoveElements }; + static REL::Relocation func{ ID::Scaleform::GFx::Value::ObjectInterface::RemoveElements }; return func(this, a_data, a_index, a_count); } bool GetParent(void* a_data, Value* a_value) { using func_t = decltype(&ObjectInterface::GetParent); - static REL::Relocation func{ ID::Scaleform::ObjectInterface::GetParent }; + static REL::Relocation func{ ID::Scaleform::GFx::Value::ObjectInterface::GetParent }; return func(this, a_data, a_value); } bool GetText(void* a_data, Value* a_value, bool a_html) { using func_t = decltype(&ObjectInterface::GetText); - static REL::Relocation func{ ID::Scaleform::ObjectInterface::GetText }; + static REL::Relocation func{ ID::Scaleform::GFx::Value::ObjectInterface::GetText }; return func(this, a_data, a_value, a_html); } bool SetText(void* a_data, const char* a_text, bool a_html) { using func_t = decltype(&ObjectInterface::SetText); - static REL::Relocation func{ ID::Scaleform::ObjectInterface::SetText }; + static REL::Relocation func{ ID::Scaleform::GFx::Value::ObjectInterface::SetText }; return func(this, a_data, a_text, a_html); } bool SetTextW(void* a_data, const wchar_t* a_text, bool a_html) { using func_t = decltype(&ObjectInterface::SetTextW); - static REL::Relocation func{ ID::Scaleform::ObjectInterface::SetTextW }; + static REL::Relocation func{ ID::Scaleform::GFx::Value::ObjectInterface::SetTextW }; return func(this, a_data, a_text, a_html); } bool CreateEmptyMovieClip(void* a_data, Value* a_value, const char* a_name, std::int32_t a_depth) { using func_t = decltype(&ObjectInterface::CreateEmptyMovieClip); - static REL::Relocation func{ ID::Scaleform::ObjectInterface::CreateEmptyMovieClip }; + static REL::Relocation func{ ID::Scaleform::GFx::Value::ObjectInterface::CreateEmptyMovieClip }; return func(this, a_data, a_value, a_name, a_depth); } bool GotoAndPlayL(void* a_data, const char* a_frame, bool a_stop) { using func_t = decltype(&ObjectInterface::GotoAndPlayL); - static REL::Relocation func{ ID::Scaleform::ObjectInterface::GotoAndPlayL }; + static REL::Relocation func{ ID::Scaleform::GFx::Value::ObjectInterface::GotoAndPlayL }; return func(this, a_data, a_frame, a_stop); } bool GotoAndPlay(void* a_data, std::uint32_t a_frame, bool a_stop) { using func_t = decltype(&ObjectInterface::GotoAndPlay); - static REL::Relocation func{ ID::Scaleform::ObjectInterface::GotoAndPlay }; + static REL::Relocation func{ ID::Scaleform::GFx::Value::ObjectInterface::GotoAndPlay }; return func(this, a_data, a_frame, a_stop); } diff --git a/include/RE/S/Script.h b/include/RE/S/Script.h index 21e91879..c5ff706a 100644 --- a/include/RE/S/Script.h +++ b/include/RE/S/Script.h @@ -2,14 +2,27 @@ #include "RE/B/BSStringT.h" #include "RE/B/BSTList.h" -#include "RE/T/TESForm.h" -#include "RE/T/TESQuest.h" +#include "RE/N/NiSmartPointer.h" namespace RE { + class Actor; + class BGSPackageDataList; + class BGSStoryEvent; class Script; + class TESForm; + class TESObjectREFR; + class TESQuest; - enum class SCRIPT_OUTPUT; + namespace BGSMod::Template + { + class Item; + } + + struct ScriptLocals; + struct SCRIPT_PARAMETER; + + enum class SCRIPT_OUTPUT : std::int32_t; struct ACTION_OBJECT { @@ -19,6 +32,22 @@ namespace RE }; static_assert(sizeof(ACTION_OBJECT) == 0x10); + struct ConditionCheckParams + { + // members + NiPointer actionRef; // 00 + NiPointer targetRef; // 08 + TESQuest* scopeQuest; // 10 + BGSStoryEvent* scopeEvent; // 18 + NiPointer scopeActor; // 20 + BGSPackageDataList* runningPackageData; // 28 + BGSMod::Template::Item* objectTemplateItem; // 30 + TESForm* extraForms[5]; // 38 + std::uint32_t extraFormCount; // 60 + bool outDispFailure; // 64 + }; + static_assert(sizeof(ConditionCheckParams) == 0x68); + struct SCRIPT_EFFECT_DATA { // members @@ -28,6 +57,37 @@ namespace RE }; static_assert(sizeof(SCRIPT_EFFECT_DATA) == 0x8); + struct SCRIPT_FUNCTION + { + using ConditionFunction_t = bool (*)(ConditionCheckParams& a_data, void* a_param2, void* a_param1, float& a_returnValue); + using ExecuteFunction_t = bool (*)(const SCRIPT_PARAMETER* a_paramInfo, const char*, TESObjectREFR* a_object, TESObjectREFR* a_objectContainer, Script* a_script, ScriptLocals* a_scriptLocals, float* a_result, std::uint32_t* a_opcodeOffsetPtr); + + // members + const char* functionName; // 00 + const char* shortName; // 08 + std::uint32_t output; // 10 + std::uint32_t pad14; // 14 + const char* helpString; // 18 + std::uint8_t referenceFunction; // 20 + std::uint8_t pad21; // 21 + std::uint16_t numParams; // 22 + std::uint32_t pad24; // 24 + SCRIPT_PARAMETER* params; // 28 + ExecuteFunction_t executeFunction; // 30 + void* compileFunction; // 38 + ConditionFunction_t conditionFunction; // 40 + std::uint8_t editorFilter; // 48 + std::uint8_t invalidatesCellList; // 49 + std::uint8_t unk4A; // 4A + std::uint8_t unk4B; // 4B + std::uint8_t unk4C; // 4C + std::uint8_t unk4E; // 4D + std::uint8_t unk4F; // 4F + std::uint8_t unk50; // 50 + std::uint8_t unk51; // 51 + }; + static_assert(sizeof(SCRIPT_FUNCTION) == 0x58); + struct alignas(4) SCRIPT_HEADER { // members @@ -59,15 +119,6 @@ namespace RE }; static_assert(sizeof(SCRIPT_OPERATOR) == 0x8); - struct SCRIPT_PARAMETER_DEF - { - // members - std::uint32_t paramType; // 00 - std::uint8_t canBeVariable; // 04 - std::uint8_t referencedObject; // 05 - }; - static_assert(sizeof(SCRIPT_PARAMETER_DEF) == 0x8); - struct SCRIPT_PARAMETER { // members @@ -77,6 +128,15 @@ namespace RE }; static_assert(sizeof(SCRIPT_PARAMETER) == 0x10); + struct SCRIPT_PARAMETER_DEF + { + // members + std::uint32_t paramType; // 00 + std::uint8_t canBeVariable; // 04 + std::uint8_t referencedObject; // 05 + }; + static_assert(sizeof(SCRIPT_PARAMETER_DEF) == 0x8); + struct SCRIPT_REFERENCED_OBJECT { // members @@ -118,41 +178,11 @@ namespace RE }; static_assert(sizeof(ScriptVariable) == 0x20); - using ExecuteFunction = bool (*)(const SCRIPT_PARAMETER* a_paramInfo, const char*, TESObjectREFR* a_object, TESObjectREFR* a_objectContainer, Script* a_script, ScriptLocals* a_scriptLocals, float* a_result, std::uint32_t* a_opcodeOffsetPtr); - class Script { public: SF_RTTI_VTABLE(Script); - struct SCRIPT_FUNCTION - { - // members - const char* functionName; // 00 - const char* shortName; // 08 - std::uint32_t output; // 10 - std::uint32_t pad14; // 14 - const char* helpString; // 18 - std::uint8_t referenceFunction; // 20 - std::uint8_t pad21; // 21 - std::uint16_t numParams; // 22 - std::uint32_t pad24; // 24 - SCRIPT_PARAMETER* params; // 28 - ExecuteFunction executeFunction; // 30 - void* compileFunction; // 38 - void* conditionFunction; // 40 - std::uint8_t editorFilter; // 48 - std::uint8_t invalidatesCellList; // 49 - std::uint8_t unk4A; // 4A - std::uint8_t unk4B; // 4B - std::uint8_t unk4C; // 4C - std::uint8_t unk4E; // 4D - std::uint8_t unk4F; // 4F - std::uint8_t unk50; // 50 - std::uint8_t unk51; // 51 - }; - static_assert(sizeof(SCRIPT_FUNCTION) == 0x58); - enum { kNumConsoleCommands = 0x0244, diff --git a/include/RE/Starfield.h b/include/RE/Starfield.h index 18b4a794..1cc99c74 100644 --- a/include/RE/Starfield.h +++ b/include/RE/Starfield.h @@ -438,6 +438,7 @@ #include "RE/T/TESWeather.h" #include "RE/T/TESWeightForm.h" #include "RE/T/TESWorldSpace.h" +#include "RE/T/TLS.h" #include "RE/T/TypeInfo.h" #include "RE/U/UI.h" #include "RE/U/UICellRenderer.h" diff --git a/include/RE/T/TESCondition.h b/include/RE/T/TESCondition.h index cd741cb4..2d504fea 100644 --- a/include/RE/T/TESCondition.h +++ b/include/RE/T/TESCondition.h @@ -2,11 +2,48 @@ namespace RE { - class TESConditionItem; + struct ConditionCheckParams; + + enum class ENUM_COMPARISION_CONDITION : std::int32_t + { + kEqual = 0, // == + kNotEqual = 1, // != + kGreaterThan = 2, // > + kGreaterThanOrEqualTo = 3, // >= + kLessThan = 4, // < + kLessThanOrEqualTo = 5, // <= + }; + + class TESConditionItem + { + public: + bool IsTrue(ConditionCheckParams& a_params) const + { + using func_t = decltype(&TESConditionItem::IsTrue); + static REL::Relocation func{ ID::TESConditionItem::IsTrue }; + return func(this, a_params); + } + + bool operator()(ConditionCheckParams& a_params) const + { + return IsTrue(a_params); + } + + // members + TESConditionItem* next{ nullptr }; + //... + }; class TESCondition { public: + static bool CheckValue(ENUM_COMPARISION_CONDITION a_comparison, float a_valueA, float a_valueB) + { + using func_t = decltype(&TESCondition::CheckValue); + static REL::Relocation func{ ID::TESCondition::CheckValue }; + return func(a_comparison, a_valueA, a_valueB); + } + // members std::uint8_t unk0; // 0 TESConditionItem* head; // 8 diff --git a/include/RE/T/TESDataHandler.h b/include/RE/T/TESDataHandler.h index 3e346fda..ed668092 100644 --- a/include/RE/T/TESDataHandler.h +++ b/include/RE/T/TESDataHandler.h @@ -40,7 +40,7 @@ namespace RE [[nodiscard]] static TESDataHandler* GetSingleton() { - static REL::Relocation singleton{ ID::TESDataHandler::singleton }; + static REL::Relocation singleton{ ID::TESDataHandler::Singleton }; return *singleton; } diff --git a/include/RE/T/TESForm.h b/include/RE/T/TESForm.h index 8ebe415d..bf53b665 100644 --- a/include/RE/T/TESForm.h +++ b/include/RE/T/TESForm.h @@ -148,7 +148,7 @@ namespace RE std::uint64_t DecExternalRefCount() const { using func_t = decltype(&TESForm::DecRefCount); - static REL::Relocation func{ ID::TESForm::DecExternalRefCount }; + static REL::Relocation func{ ID::TESForm::DecExternalRefCount }; // TODO: ID changed return func(this); } diff --git a/include/RE/T/TESObjectREFR.h b/include/RE/T/TESObjectREFR.h index 97aba13a..84bc3685 100644 --- a/include/RE/T/TESObjectREFR.h +++ b/include/RE/T/TESObjectREFR.h @@ -26,6 +26,7 @@ namespace RE class Actor; class ActorCause; class BGSEquipSlot; + class BGSKeyword; class BGSLocation; class BGSObjectInstance; class BGSScene; @@ -392,6 +393,7 @@ namespace RE [[nodiscard]] bool IsSpaceshipLanded(); void Lock(); void Unlock(); + [[nodiscard]] bool WornHasKeyword(BGSKeyword* a_keyword); // members OBJ_REFR data; // 78 diff --git a/include/RE/T/TLS.h b/include/RE/T/TLS.h new file mode 100644 index 00000000..cab71e73 --- /dev/null +++ b/include/RE/T/TLS.h @@ -0,0 +1,18 @@ +#pragma once + +#include "REX/W32/NT.h" + +namespace RE +{ + struct TLS + { + [[nodiscard]] static TLS* GetSingleton() + { + return *static_cast(REX::W32::NtCurrentTeb()->threadLocalStoragePointer); + } + + // members + std::byte pad000[0x1D0]; // 000 + bool logConditionFunctions; // 1D0 + }; +} diff --git a/include/RE/U/UI.h b/include/RE/U/UI.h index 113016a4..cc4a5db4 100644 --- a/include/RE/U/UI.h +++ b/include/RE/U/UI.h @@ -60,7 +60,7 @@ namespace RE inline static UI* GetSingleton() { - static REL::Relocation singleton{ ID::UI::singleton }; + static REL::Relocation singleton{ ID::UI::Singleton }; return *singleton; } diff --git a/include/RE/U/UIMessageQueue.h b/include/RE/U/UIMessageQueue.h index 04e167d1..bf43c28f 100644 --- a/include/RE/U/UIMessageQueue.h +++ b/include/RE/U/UIMessageQueue.h @@ -1,8 +1,10 @@ #pragma once +#include "RE/B/BSFixedString.h" + namespace RE { - enum UIMessage : uint32_t + enum UIMessage : std::uint32_t { kShow = 0, kHide = 2 @@ -24,7 +26,7 @@ namespace RE //...more? }; - enum UI_MESSAGE_RESULT : int64_t + enum UI_MESSAGE_RESULT : std::int64_t { kHandled = 0, kIgnore, @@ -36,14 +38,14 @@ namespace RE public: static UIMessageQueue* GetSingleton() { - static REL::Relocation singleton{ REL::ID(878637) }; + static REL::Relocation singleton{ ID::UIMessageQueue::Singleton }; return *singleton; } - int64_t AddMessage(const BSFixedString& a_menuName, UIMessage a_message) + std::int64_t AddMessage(const BSFixedString& a_menuName, UIMessage a_message) { using func_t = decltype(&UIMessageQueue::AddMessage); - static REL::Relocation func{ REL::ID(187268) }; + static REL::Relocation func{ ID::UIMessageQueue::AddMessage }; return func(this, a_menuName, a_message); } }; diff --git a/src/RE/B/BSSystemFile.cpp b/src/RE/B/BSSystemFile.cpp index d5d0dacd..5277f53e 100644 --- a/src/RE/B/BSSystemFile.cpp +++ b/src/RE/B/BSSystemFile.cpp @@ -131,7 +131,7 @@ namespace RE std::uint32_t BSSystemFile::DeleteFileA(const char* a_path) { using func_t = decltype(&BSSystemFile::DeleteFileA); - static REL::Relocation func{ ID::BSSystemFile::DeleteFileA }; + static REL::Relocation func{ ID::BSSystemFile::DeleteFileA }; // TODO: ID changed return func(a_path); } diff --git a/src/RE/T/TESObjectREFR.cpp b/src/RE/T/TESObjectREFR.cpp index b0b2a403..fc767951 100644 --- a/src/RE/T/TESObjectREFR.cpp +++ b/src/RE/T/TESObjectREFR.cpp @@ -159,6 +159,13 @@ namespace RE return func(this); } + bool TESObjectREFR::WornHasKeyword(BGSKeyword* a_keyword) + { + using func_t = decltype(&TESObjectREFR::WornHasKeyword); + static REL::Relocation func{ ID::TESObjectREFR::WornHasKeyword }; + return func(this, a_keyword); + } + void TESObjectREFR::Lock() { if (const auto lock = GetLock()) {