diff --git a/CommonLibSF/include/RE/A/Actor.h b/CommonLibSF/include/RE/A/Actor.h index 6c8fa0ee..b679884d 100644 --- a/CommonLibSF/include/RE/A/Actor.h +++ b/CommonLibSF/include/RE/A/Actor.h @@ -380,7 +380,7 @@ namespace RE std::uint64_t unk518; // 518 std::uint64_t unk520; // 520 std::uint64_t unk528; // 528 - std::uint8_t unk530[88]; // 530 + std::uint8_t unk530[88]; // 530 }; static_assert(sizeof(Actor) == 0x570); } diff --git a/CommonLibSF/include/RE/B/BSInputEnableManager.h b/CommonLibSF/include/RE/B/BSInputEnableManager.h index 783df2fa..c2f390d5 100644 --- a/CommonLibSF/include/RE/B/BSInputEnableManager.h +++ b/CommonLibSF/include/RE/B/BSInputEnableManager.h @@ -19,7 +19,7 @@ namespace RE { using func_t = decltype(&BSInputEnableManager::CreateLayer); REL::Relocation func(REL::ID(179101)); - return func(this, a_layer, a_layerName); + return func(this, a_layer, a_layerName); } }; } diff --git a/CommonLibSF/include/RE/B/BSInputEventUser.h b/CommonLibSF/include/RE/B/BSInputEventUser.h index b3c4a361..a38ac204 100644 --- a/CommonLibSF/include/RE/B/BSInputEventUser.h +++ b/CommonLibSF/include/RE/B/BSInputEventUser.h @@ -1,7 +1,7 @@ #pragma once -#include "RE/M/MemoryManager.h" #include "RE/B/BSFixedString.h" +#include "RE/M/MemoryManager.h" namespace RE { @@ -98,8 +98,8 @@ namespace RE { using func_t = decltype(&BSInputEventUser::InputEventUser_Unk_09); REL::Relocation func(REL::ID(178899)); - return func(this, a_event); - } + return func(this, a_event); + } SF_HEAP_REDEFINE_NEW(BSInputEventUser); diff --git a/CommonLibSF/include/RE/B/BSTScatterTable.h b/CommonLibSF/include/RE/B/BSTScatterTable.h index a899b22a..e877190a 100644 --- a/CommonLibSF/include/RE/B/BSTScatterTable.h +++ b/CommonLibSF/include/RE/B/BSTScatterTable.h @@ -7,10 +7,9 @@ namespace RE static uint32_t GenerateCRC(uint32_t initial, const void* buf, size_t len) { static REL::Relocation uiCRCTable{ REL::ID(292339) }; - uint32_t c = initial; - const uint8_t* u = static_cast(buf); - for (size_t i = 0; i < len; ++i) - { + uint32_t c = initial; + const uint8_t* u = static_cast(buf); + for (size_t i = 0; i < len; ++i) { c = uiCRCTable.get()[(c ^ u[i]) & 0xFF] ^ (c >> 8); } return c; @@ -28,7 +27,7 @@ namespace RE } }; - template + template class String { size_t operator()(const T& key) @@ -51,14 +50,15 @@ namespace RE }; } - template + template class BSTScatterTableDefaultHashPolicy { public: size_t operator()(const T& key) = delete; }; - template<> class BSTScatterTableDefaultHashPolicy + template <> + class BSTScatterTableDefaultHashPolicy { public: size_t operator()(const BSFixedString& key) @@ -67,7 +67,8 @@ namespace RE } }; - template<> class BSTScatterTableDefaultHashPolicy + template <> + class BSTScatterTableDefaultHashPolicy { public: size_t operator()(const BSFixedStringCS& key) @@ -76,7 +77,8 @@ namespace RE } }; - template<> class BSTScatterTableDefaultHashPolicy + template <> + class BSTScatterTableDefaultHashPolicy { public: size_t operator()(const BSFixedStringW& key) @@ -85,7 +87,8 @@ namespace RE } }; - template<> class BSTScatterTableDefaultHashPolicy + template <> + class BSTScatterTableDefaultHashPolicy { public: size_t operator()(const BSFixedStringW& key) @@ -94,7 +97,8 @@ namespace RE } }; - template<> class BSTScatterTableDefaultHashPolicy + template <> + class BSTScatterTableDefaultHashPolicy { public: size_t operator()(const uint32_t& key) @@ -135,17 +139,16 @@ namespace RE } // Convenience to convert from std::make_pair - BSTScatterTableDefaultKVStorage(const std::pair& pair) : - Key(pair.first), + BSTScatterTableDefaultKVStorage(const std::pair& pair) : + Key(pair.first), Value(pair.second) {} - - T1 Key; // 00 - T2 Value; // ?? + T1 Key; // 00 + T2 Value; // ?? }; - template class Storage = BSTScatterTableDefaultKVStorage> + template class Storage = BSTScatterTableDefaultKVStorage> struct BSTScatterTableTraits { public: @@ -153,19 +156,18 @@ namespace RE using mapped_type = T; using value_type = Storage; - const key_type& operator()(const value_type& a_value) const { return a_value.Key; } }; - template class Storage = BSTScatterTableDefaultKVStorage> + template class Storage = BSTScatterTableDefaultKVStorage> struct BSTScatterTableEntry { Storage Value; - int32_t iNextIndex; - int32_t iIndex; + int32_t iNextIndex; + int32_t iIndex; }; template @@ -182,8 +184,7 @@ namespace RE auto size = a_num * sizeof(entry_type); auto mem = (entry_type*)RE::malloc(size, 8); memset(mem, 0, size); - for (uint64_t i = 0; i < a_num; ++i) - { + for (uint64_t i = 0; i < a_num; ++i) { mem[i].iNextIndex = -1; mem[i].iIndex = -1; } @@ -209,7 +210,7 @@ namespace RE // Maybe related to the allocator type? struct BSTScatterTableParent1 { - void* unk00 = nullptr; + void* unk00 = nullptr; uint64_t unk08 = 0; uint64_t unk10 = 0; }; @@ -217,18 +218,17 @@ namespace RE // Maybe related to the allocator type? struct BSTScatterTableParent2 { - void* unk00 = nullptr; + void* unk00 = nullptr; uint64_t unk08 = 0; }; template < class Traits, - uint32_t N, - template class Allocator, - class Hash, + uint32_t N, + template class Allocator, + class Hash, class KeyEqual, - class Parent - > + class Parent> class BSTScatterTableBase : public Parent { public: @@ -243,7 +243,8 @@ namespace RE using entry_type = BSTScatterTableEntry; using allocator_type = Allocator; - BSTScatterTableBase() : Parent(), + BSTScatterTableBase() : + Parent(), pTable(nullptr), uiSize(0), uiFree(0), @@ -252,8 +253,7 @@ namespace RE } ~BSTScatterTableBase() { - if (pTable) - { + if (pTable) { deallocate(pTable); pTable = nullptr; } @@ -265,10 +265,10 @@ namespace RE struct iterator_base { public: - typedef std::ptrdiff_t difference_type; - typedef U value_type; - typedef U* pointer; - typedef U& reference; + typedef std::ptrdiff_t difference_type; + typedef U value_type; + typedef U* pointer; + typedef U& reference; typedef std::forward_iterator_tag iterator_category; iterator_base() : @@ -297,7 +297,7 @@ namespace RE } } - ~iterator_base(){} + ~iterator_base() {} iterator_base& operator=(const iterator_base& a_rhs) { @@ -355,7 +355,6 @@ namespace RE entry_type* _end; }; - using iterator = iterator_base; using const_iterator = iterator_base; @@ -379,13 +378,11 @@ namespace RE return get_entries() ? make_iterator(get_entries()) : iterator(); } - const_iterator begin() const { return get_entries() ? make_iterator(get_entries()) : const_iterator(); } - const_iterator cbegin() const { return begin(); @@ -396,25 +393,21 @@ namespace RE return get_entries() ? make_iterator(get_entries() + uiSize) : iterator(); } - const_iterator end() const { return get_entries() ? make_iterator(get_entries() + uiSize) : const_iterator(); } - const_iterator cend() const { return end(); } - bool empty() const { return !get_entries() || uiFree == 0; } - size_type size() const { return uiSize - uiFree; @@ -457,7 +450,7 @@ namespace RE } auto entry = get_pos(calc_idx(a_key)); - if (entry->iNextIndex == -1) { // key not in table + if (entry->iNextIndex == -1) { // key not in table return 0; } @@ -472,13 +465,12 @@ namespace RE entry->Value.~value_type(); - if (entry->iNextIndex == uiSize) { // if no chain + if (entry->iNextIndex == uiSize) { // if no chain if (tail) { tail->iNextIndex = static_cast(uiSize); } entry->iNextIndex = -1; - } - else { // else move next entry into current + } else { // else move next entry into current new (entry) entry_type(std::move(*get_pos(entry->iNextIndex))); } @@ -492,7 +484,6 @@ namespace RE return entry ? make_iterator(entry) : end(); } - const_iterator find(const key_type& a_key) const { auto entry = find_impl(a_key); @@ -537,212 +528,207 @@ namespace RE } private: - bool grow() - { - if (uiSize == (uint32_t)1 << 31) { - return false; - } - - uint32_t newCapacity = static_cast(uiSize ? uiSize << 1 : min_size()); - return grow(newCapacity); - } - - void clear_entries(uint64_t start, uint64_t end) - { - for (uint64_t i = start; i < end; ++i) - { - auto entry = get_pos(i); - if (entry->iNextIndex != -1) - { - entry->Value.~value_type(); - entry->iNextIndex = -1; - entry->iIndex = -1; - } - } - } - - bool grow(uint32_t a_newCapacity) - { - auto oldEntries = get_entries(); - auto begIter = begin(); - auto endIter = end(); - - auto newEntries = allocate(a_newCapacity); - if (!newEntries) { - return false; - } - else if (newEntries == oldEntries) { - uiSize = a_newCapacity; - return true; - } - else { - uiSize = a_newCapacity; - uiLastFree = a_newCapacity; - uiFree = a_newCapacity; - set_entries(newEntries); - - while (begIter != endIter) { - insert(std::move(*begIter)); - ++begIter; - } - - deallocate(oldEntries); - return true; - } - } - - size_t calc_hash(const key_type& a_key) const - { - return hash_function()(a_key); - } - - uint64_t calc_idx(const key_type& a_key) const - { - return calc_hash(a_key) & (uiSize - 1); // capacity is always a factor of 2, so this is a faster modulo - } - - entry_type* find_impl(const key_type& a_key) const - { - if (!get_entries()) { - return nullptr; - } - - auto probe = get_pos(calc_idx(a_key)); // try ideal pos - if (probe->iNextIndex == -1) { - return nullptr; // nothing there - } - - do { - if (comp_key(get_key(probe->Value), a_key)) { - return probe; - } - else { - probe = get_pos(probe->iNextIndex); - } - } while (probe != get_pos(uiSize)); // follow chain - - return nullptr; - } - - template - std::pair insert_impl(bool a_overwrite, Arg&& a_value) - { - if (!get_entries() || !uiFree) { - if (!grow()) { - return std::make_pair(end(), false); // maybe throw? - } - } - - auto idealEntry = calc_pos(get_key(a_value)); - - // Slot is empty, fill it - if (idealEntry->iNextIndex == -1) { - new (std::addressof(idealEntry->Value)) value_type(std::forward(a_value)); - idealEntry->iNextIndex = static_cast(uiSize); - idealEntry->iIndex = static_cast(std::distance(get_pos(0), idealEntry)); - --uiFree; - return std::make_pair(make_iterator(idealEntry), true); - } - - for (auto iter = idealEntry; iter != get_pos(uiSize); iter = get_pos(iter->iNextIndex)) { - if (comp_key(get_key(iter->Value), get_key(a_value))) { - if (a_overwrite) { - iter->Value.~value_type(); - new (std::addressof(iter->Value)) value_type(std::forward(a_value)); - } - return std::make_pair(make_iterator(iter), false); - } - } - - auto freeEntry = get_free_entry(); - - auto takenIdealEntry = calc_pos(get_key(idealEntry->Value)); - if (takenIdealEntry == idealEntry) { // if entry occupying our slot would've hashed here anyway - freeEntry->iIndex = idealEntry->iIndex; - freeEntry->iNextIndex = idealEntry->iNextIndex; - idealEntry->iNextIndex = static_cast(std::distance(get_pos(0), freeEntry)); - new (std::addressof(freeEntry->Value)) value_type(std::forward(a_value)); - --uiFree; - return std::make_pair(make_iterator(freeEntry), true); - } - - while (takenIdealEntry->iNextIndex != static_cast(std::distance(get_pos(0), idealEntry))) { // find entry that links here - takenIdealEntry = get_pos(takenIdealEntry->iNextIndex); - } - - // move taken slot out, so we can move in - new (std::addressof(freeEntry->Value)) value_type(std::move(idealEntry->Value)); - freeEntry->iNextIndex = idealEntry->iNextIndex; - freeEntry->iIndex = idealEntry->iIndex; - takenIdealEntry->iNextIndex = static_cast(std::distance(get_pos(0), freeEntry)); - new (std::addressof(idealEntry->Value)) value_type(std::forward(a_value)); - idealEntry->iNextIndex = static_cast(uiSize); - --uiFree; - return std::make_pair(make_iterator(idealEntry), true); - } - - entry_type* get_pos(uint64_t index) const - { - return const_cast(get_entries() + index); - } - - entry_type* calc_pos(const key_type& a_key) const - { - return get_pos(calc_idx(a_key)); - } - - entry_type* get_free_entry() - { - entry_type* entry = nullptr; - do { - uiLastFree = (uiSize - 1) & (uiLastFree - 1); - entry = get_pos(uiLastFree); - } while (entry->iNextIndex != -1); - - return entry; - } - - const key_type& get_key(const value_type& a_value) const - { - traits_type traits; - return traits(a_value); - } - - iterator make_iterator(entry_type* a_entry) - { - return iterator(a_entry, pTable + uiSize); - } - - const_iterator make_iterator(entry_type* a_entry) const - { - return const_iterator(a_entry, pTable + uiSize); - } - - entry_type* allocate(std::size_t a_num) - { - return allocator_type().allocate(a_num); - } - void deallocate(entry_type* a_ptr) - { - allocator_type().deallocate(a_ptr); - } - entry_type* get_entries() const - { - return pTable; - } - void set_entries(entry_type* a_entries) - { - pTable = a_entries; - } - size_type min_size() const - { - return allocator_type().min_size(); - } + bool grow() + { + if (uiSize == (uint32_t)1 << 31) { + return false; + } + + uint32_t newCapacity = static_cast(uiSize ? uiSize << 1 : min_size()); + return grow(newCapacity); + } + + void clear_entries(uint64_t start, uint64_t end) + { + for (uint64_t i = start; i < end; ++i) { + auto entry = get_pos(i); + if (entry->iNextIndex != -1) { + entry->Value.~value_type(); + entry->iNextIndex = -1; + entry->iIndex = -1; + } + } + } + + bool grow(uint32_t a_newCapacity) + { + auto oldEntries = get_entries(); + auto begIter = begin(); + auto endIter = end(); + + auto newEntries = allocate(a_newCapacity); + if (!newEntries) { + return false; + } else if (newEntries == oldEntries) { + uiSize = a_newCapacity; + return true; + } else { + uiSize = a_newCapacity; + uiLastFree = a_newCapacity; + uiFree = a_newCapacity; + set_entries(newEntries); + + while (begIter != endIter) { + insert(std::move(*begIter)); + ++begIter; + } + + deallocate(oldEntries); + return true; + } + } + + size_t calc_hash(const key_type& a_key) const + { + return hash_function()(a_key); + } + + uint64_t calc_idx(const key_type& a_key) const + { + return calc_hash(a_key) & (uiSize - 1); // capacity is always a factor of 2, so this is a faster modulo + } + + entry_type* find_impl(const key_type& a_key) const + { + if (!get_entries()) { + return nullptr; + } + + auto probe = get_pos(calc_idx(a_key)); // try ideal pos + if (probe->iNextIndex == -1) { + return nullptr; // nothing there + } + + do { + if (comp_key(get_key(probe->Value), a_key)) { + return probe; + } else { + probe = get_pos(probe->iNextIndex); + } + } while (probe != get_pos(uiSize)); // follow chain + + return nullptr; + } + + template + std::pair insert_impl(bool a_overwrite, Arg&& a_value) + { + if (!get_entries() || !uiFree) { + if (!grow()) { + return std::make_pair(end(), false); // maybe throw? + } + } + + auto idealEntry = calc_pos(get_key(a_value)); + + // Slot is empty, fill it + if (idealEntry->iNextIndex == -1) { + new (std::addressof(idealEntry->Value)) value_type(std::forward(a_value)); + idealEntry->iNextIndex = static_cast(uiSize); + idealEntry->iIndex = static_cast(std::distance(get_pos(0), idealEntry)); + --uiFree; + return std::make_pair(make_iterator(idealEntry), true); + } + + for (auto iter = idealEntry; iter != get_pos(uiSize); iter = get_pos(iter->iNextIndex)) { + if (comp_key(get_key(iter->Value), get_key(a_value))) { + if (a_overwrite) { + iter->Value.~value_type(); + new (std::addressof(iter->Value)) value_type(std::forward(a_value)); + } + return std::make_pair(make_iterator(iter), false); + } + } + + auto freeEntry = get_free_entry(); + + auto takenIdealEntry = calc_pos(get_key(idealEntry->Value)); + if (takenIdealEntry == idealEntry) { // if entry occupying our slot would've hashed here anyway + freeEntry->iIndex = idealEntry->iIndex; + freeEntry->iNextIndex = idealEntry->iNextIndex; + idealEntry->iNextIndex = static_cast(std::distance(get_pos(0), freeEntry)); + new (std::addressof(freeEntry->Value)) value_type(std::forward(a_value)); + --uiFree; + return std::make_pair(make_iterator(freeEntry), true); + } + + while (takenIdealEntry->iNextIndex != static_cast(std::distance(get_pos(0), idealEntry))) { // find entry that links here + takenIdealEntry = get_pos(takenIdealEntry->iNextIndex); + } + + // move taken slot out, so we can move in + new (std::addressof(freeEntry->Value)) value_type(std::move(idealEntry->Value)); + freeEntry->iNextIndex = idealEntry->iNextIndex; + freeEntry->iIndex = idealEntry->iIndex; + takenIdealEntry->iNextIndex = static_cast(std::distance(get_pos(0), freeEntry)); + new (std::addressof(idealEntry->Value)) value_type(std::forward(a_value)); + idealEntry->iNextIndex = static_cast(uiSize); + --uiFree; + return std::make_pair(make_iterator(idealEntry), true); + } + + entry_type* get_pos(uint64_t index) const + { + return const_cast(get_entries() + index); + } + + entry_type* calc_pos(const key_type& a_key) const + { + return get_pos(calc_idx(a_key)); + } + + entry_type* get_free_entry() + { + entry_type* entry = nullptr; + do { + uiLastFree = (uiSize - 1) & (uiLastFree - 1); + entry = get_pos(uiLastFree); + } while (entry->iNextIndex != -1); + + return entry; + } + + const key_type& get_key(const value_type& a_value) const + { + traits_type traits; + return traits(a_value); + } + + iterator make_iterator(entry_type* a_entry) + { + return iterator(a_entry, pTable + uiSize); + } + + const_iterator make_iterator(entry_type* a_entry) const + { + return const_iterator(a_entry, pTable + uiSize); + } + + entry_type* allocate(std::size_t a_num) + { + return allocator_type().allocate(a_num); + } + void deallocate(entry_type* a_ptr) + { + allocator_type().deallocate(a_ptr); + } + entry_type* get_entries() const + { + return pTable; + } + void set_entries(entry_type* a_entries) + { + pTable = a_entries; + } + size_type min_size() const + { + return allocator_type().min_size(); + } entry_type* pTable; - uint64_t uiSize; - uint64_t uiFree; - uint64_t uiLastFree; + uint64_t uiSize; + uint64_t uiFree; + uint64_t uiLastFree; }; template , class KeyEqual = std::equal_to> diff --git a/CommonLibSF/include/RE/G/GameMenuBase.h b/CommonLibSF/include/RE/G/GameMenuBase.h index 269c2945..ffbd4750 100644 --- a/CommonLibSF/include/RE/G/GameMenuBase.h +++ b/CommonLibSF/include/RE/G/GameMenuBase.h @@ -21,7 +21,7 @@ namespace RE func(this); } - virtual ~GameMenuBase() = default; // 00 + virtual ~GameMenuBase() = default; // 00 //override virtual uint64_t Unk10() override diff --git a/CommonLibSF/include/RE/H/Hazard.h b/CommonLibSF/include/RE/H/Hazard.h index a6742cd7..a1b99c3d 100644 --- a/CommonLibSF/include/RE/H/Hazard.h +++ b/CommonLibSF/include/RE/H/Hazard.h @@ -27,7 +27,7 @@ namespace RE float radius; // 12C float magnitude; // 130 std::uint32_t flags; // 134 - void* unk280; // 280 + void* unk280; // 280 }; static_assert(sizeof(Hazard) == 0x120); } diff --git a/CommonLibSF/include/RE/I/IMenu.h b/CommonLibSF/include/RE/I/IMenu.h index d4a33aa2..a59a89a9 100644 --- a/CommonLibSF/include/RE/I/IMenu.h +++ b/CommonLibSF/include/RE/I/IMenu.h @@ -36,9 +36,9 @@ namespace RE Flag27 = 1 << 27, }; - virtual ~IMenu() // 00 + virtual ~IMenu() // 00 { - using func_t = void(*)(IMenu*); + using func_t = void (*)(IMenu*); REL::Relocation func(REL::ID(187216)); func(this); } @@ -74,122 +74,122 @@ namespace RE } // add - virtual const char* GetName() const = 0; // 03 - virtual const char* GetRootPath() const = 0; // 04 - virtual uint64_t GetUnk05() = 0; // 05 + virtual const char* GetName() const = 0; // 03 + virtual const char* GetRootPath() const = 0; // 04 + virtual uint64_t GetUnk05() = 0; // 05 - virtual bool LoadMovie(bool a_addEventDispatcher, bool a_arg2) // 06 + virtual bool LoadMovie(bool a_addEventDispatcher, bool a_arg2) // 06 { using func_t = decltype(&IMenu::LoadMovie); REL::Relocation func(REL::ID(187240)); return func(this, a_addEventDispatcher, a_arg2); - } + } - virtual void Unk07() {} // 07 + virtual void Unk07() {} // 07 - virtual UI_MESSAGE_RESULT ProcessMessage(UIMessageData& a_message) // 08 + virtual UI_MESSAGE_RESULT ProcessMessage(UIMessageData& a_message) // 08 { using func_t = decltype(&IMenu::ProcessMessage); REL::Relocation func(REL::ID(187247)); return func(this, a_message); } - - virtual bool Unk09() // 09 + + virtual bool Unk09() // 09 { using func_t = decltype(&IMenu::Unk09); REL::Relocation func(REL::ID(80440)); - return func(this); + return func(this); } - virtual bool Unk0A() // 0A + virtual bool Unk0A() // 0A { using func_t = decltype(&IMenu::Unk0A); REL::Relocation func(REL::ID(187238)); return func(this); } - virtual void Unk_0B(void) {} // 0B - virtual void Unk_0C(void) {} // 0C - virtual void Unk_0D(void) {} // 0D + virtual void Unk_0B(void) {} // 0B + virtual void Unk_0C(void) {} // 0C + virtual void Unk_0D(void) {} // 0D - virtual bool Unk0E(void* a, bool b) // 0E + virtual bool Unk0E(void* a, bool b) // 0E { using func_t = decltype(&IMenu::Unk0E); REL::Relocation func(REL::ID(187242)); return func(this, a, b); } - virtual void Unk0F() {}; // 0F + virtual void Unk0F(){}; // 0F - virtual uint64_t Unk10() // 10 - { + virtual uint64_t Unk10() // 10 + { using func_t = decltype(&IMenu::Unk10); REL::Relocation func(REL::ID(187241)); return func(this); }; - virtual uint64_t Unk11() // 11 - { + virtual uint64_t Unk11() // 11 + { using func_t = decltype(&IMenu::Unk11); REL::Relocation func(REL::ID(187243)); return func(this); }; - virtual uint64_t Unk12() // 12 + virtual uint64_t Unk12() // 12 { using func_t = decltype(&IMenu::Unk12); REL::Relocation func(REL::ID(80451)); - return func(this); + return func(this); }; - virtual BSFixedString* Unk13() // 13 + virtual BSFixedString* Unk13() // 13 { using func_t = decltype(&IMenu::Unk13); REL::Relocation func(REL::ID(76183)); return func(this); }; - virtual bool Unk14() // 14 - { - return true; + virtual bool Unk14() // 14 + { + return true; }; - virtual bool Unk15(void* a) // 15 + virtual bool Unk15(void* a) // 15 { using func_t = decltype(&IMenu::Unk15); REL::Relocation func(REL::ID(187225)); - return func(this, a); + return func(this, a); }; - virtual bool Unk16() // 16 - { + virtual bool Unk16() // 16 + { return false; - }; - virtual bool ProcessInputUserEvent() // 17 + virtual bool ProcessInputUserEvent() // 17 { return false; }; - virtual uint64_t Unk18(void* a, uint64_t b) // 18 + virtual uint64_t Unk18(void* a, uint64_t b) // 18 { using func_t = decltype(&IMenu::Unk18); REL::Relocation func(REL::ID(1275268)); return func(this, a, b); } - virtual uint64_t Unk19(void* a, int b, int c) { // 19 + virtual uint64_t Unk19(void* a, int b, int c) + { // 19 using func_t = decltype(&IMenu::Unk19); REL::Relocation func(REL::ID(187245)); - return func(this, a, b, c); + return func(this, a, b, c); } - virtual float Unk1A() // 1A - { + virtual float Unk1A() // 1A + { using func_t = decltype(&IMenu::Unk1A); REL::Relocation func(REL::ID(187232)); - return func(this); + return func(this); }; void SetFlags(uint32_t _flags) @@ -204,35 +204,35 @@ namespace RE flagsUpdated = true; } - Scaleform::GFx::Value menuObj; // 058 - Scaleform::Ptr uiMovie; // 088 - std::uint64_t unk090; // 090 - std::uint64_t unk098; // 098 - std::uint64_t unk0A0; // 0A0 - std::uint32_t unk0A8; // 0A8 - std::uint32_t unk0AC; // 0AC - BSFixedString menuName; // 0B0 - BSFixedString unk0B8; // 0B8 - std::uint32_t flags; // 0C0 - std::uint32_t unk0C4; // 0C4 + Scaleform::GFx::Value menuObj; // 058 + Scaleform::Ptr uiMovie; // 088 + std::uint64_t unk090; // 090 + std::uint64_t unk098; // 098 + std::uint64_t unk0A0; // 0A0 + std::uint32_t unk0A8; // 0A8 + std::uint32_t unk0AC; // 0AC + BSFixedString menuName; // 0B0 + BSFixedString unk0B8; // 0B8 + std::uint32_t flags; // 0C0 + std::uint32_t unk0C4; // 0C4 std::uint32_t unk0C8; // 0C8 std::uint32_t unk0CC; // 0CC std::uint16_t unk0D0; // 0D0 bool flagsUpdated; // 0D2 std::uint8_t unk0D3; // 0D3 - std::uint32_t unk0D4; // 0D4 - std::uint64_t unk0D8; // 0D8 - std::uint64_t unk0E0; // 0E0 - std::uint64_t unk0E8; // 0E8 - std::uint64_t unk0F0; // 0F0 - std::uint64_t unk0F8; // 0F8 - std::uint64_t unk100; // 100 - std::uint32_t unk108; // 108 - std::uint32_t unk10C; // 10C - std::uint64_t unk110; // 110 - std::uint64_t unk118; // 118 - std::uint64_t unk120; // 120 - std::uint64_t unk128; // 128 + std::uint32_t unk0D4; // 0D4 + std::uint64_t unk0D8; // 0D8 + std::uint64_t unk0E0; // 0E0 + std::uint64_t unk0E8; // 0E8 + std::uint64_t unk0F0; // 0F0 + std::uint64_t unk0F8; // 0F8 + std::uint64_t unk100; // 100 + std::uint32_t unk108; // 108 + std::uint32_t unk10C; // 10C + std::uint64_t unk110; // 110 + std::uint64_t unk118; // 118 + std::uint64_t unk120; // 120 + std::uint64_t unk128; // 128 }; static_assert(offsetof(IMenu, uiMovie) == 0x088); static_assert(offsetof(IMenu, menuName) == 0x0B0); diff --git a/CommonLibSF/include/RE/M/Main.h b/CommonLibSF/include/RE/M/Main.h index dd7e940b..c84b4e6b 100644 --- a/CommonLibSF/include/RE/M/Main.h +++ b/CommonLibSF/include/RE/M/Main.h @@ -10,9 +10,9 @@ namespace RE public: struct SceneGraphRoot { - std::byte unk[120]; - NiAVObject* worldCameraRoot; //NiNode - NiCamera* worldCamera; + std::byte unk[120]; + NiAVObject* worldCameraRoot; //NiNode + NiCamera* worldCamera; }; static_assert(offsetof(SceneGraphRoot, SceneGraphRoot::worldCamera) == 0x80); diff --git a/CommonLibSF/include/RE/N/NiAVObject.h b/CommonLibSF/include/RE/N/NiAVObject.h index 034482d8..aa95cbb8 100644 --- a/CommonLibSF/include/RE/N/NiAVObject.h +++ b/CommonLibSF/include/RE/N/NiAVObject.h @@ -1,7 +1,7 @@ #pragma once #include "RE/B/BSFixedString.h" -#include "RE/N/NiTransform.h" #include "RE/N/NiBound.h" +#include "RE/N/NiTransform.h" namespace RE { diff --git a/CommonLibSF/include/RE/N/NiCamera.h b/CommonLibSF/include/RE/N/NiCamera.h index 83989dc0..d4481e8f 100644 --- a/CommonLibSF/include/RE/N/NiCamera.h +++ b/CommonLibSF/include/RE/N/NiCamera.h @@ -49,11 +49,10 @@ namespace RE NiPoint3 WorldToScreen(const NiPoint3& 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]) - ) - viewFrustum._near; + 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])) - + viewFrustum._near; result.z = worldDiffRotated * (1.0f / (viewFrustum._far - viewFrustum._near)); diff --git a/CommonLibSF/include/RE/N/NiPoint4.h b/CommonLibSF/include/RE/N/NiPoint4.h index 8fd348ea..f5b511ce 100644 --- a/CommonLibSF/include/RE/N/NiPoint4.h +++ b/CommonLibSF/include/RE/N/NiPoint4.h @@ -23,7 +23,8 @@ namespace RE float pt[4]{ 0.0F }; }; // 00 - float& operator[](size_t i) { + float& operator[](size_t i) + { assert(i < 4); return pt[i]; } diff --git a/CommonLibSF/include/RE/S/ScaleformGFxValue.h b/CommonLibSF/include/RE/S/ScaleformGFxValue.h index 1c6bd153..93c70efc 100644 --- a/CommonLibSF/include/RE/S/ScaleformGFxValue.h +++ b/CommonLibSF/include/RE/S/ScaleformGFxValue.h @@ -322,7 +322,7 @@ namespace RE::Scaleform::GFx // members MovieImpl* movieRoot; // 08 - Value* lastValue; + Value* lastValue; }; static_assert(sizeof(ObjectInterface) == 0x18); diff --git a/CommonLibSF/include/RE/Starfield.h b/CommonLibSF/include/RE/Starfield.h index 49dc4137..b8640772 100644 --- a/CommonLibSF/include/RE/Starfield.h +++ b/CommonLibSF/include/RE/Starfield.h @@ -140,6 +140,7 @@ #include "RE/B/BGSResource.h" #include "RE/B/BGSResourceGenerationData.h" #include "RE/B/BGSReverbParameters.h" +#include "RE/B/BGSSaveLoadManager.h" #include "RE/B/BGSScene.h" #include "RE/B/BGSSecondaryDamageList.h" #include "RE/B/BGSShaderParticleGeometryData.h" @@ -205,7 +206,6 @@ #include "RE/B/BarrierProjectile.h" #include "RE/B/BaseFormComponent.h" #include "RE/B/BeamProjectile.h" -#include "RE/B/BGSSaveLoadManager.h" #include "RE/C/CodeTasklet.h" #include "RE/C/CollisionLayers.h" #include "RE/C/Color.h" @@ -271,12 +271,12 @@ #include "RE/M/MagicItem.h" #include "RE/M/MagicSystem.h" #include "RE/M/MagicTarget.h" +#include "RE/M/Main.h" #include "RE/M/MemoryManager.h" #include "RE/M/MenuOpenCloseEvent.h" #include "RE/M/Misc.h" #include "RE/M/MissileProjectile.h" #include "RE/M/msvc.h" -#include "RE/M/Main.h" #include "RE/N/NativeFunction.h" #include "RE/N/NativeFunctionBase.h" #include "RE/N/NiAVObject.h" diff --git a/CommonLibSF/include/RE/U/UI.h b/CommonLibSF/include/RE/U/UI.h index 1cc823dd..ed830efb 100644 --- a/CommonLibSF/include/RE/U/UI.h +++ b/CommonLibSF/include/RE/U/UI.h @@ -1,7 +1,7 @@ #pragma once +#include "RE/B/BSInputEventReceiver.h" #include "RE/B/BSTArray.h" #include "RE/B/BSTEvent.h" -#include "RE/B/BSInputEventReceiver.h" #include "RE/B/BSTScatterTable.h" #include "RE/I/IMenu.h" @@ -48,8 +48,8 @@ namespace RE Scaleform::Ptr menu; Create_t* initFunc; void* unk18 = nullptr; - uint64_t unk20 = 1; - uint64_t unk28 = 0; + uint64_t unk20 = 1; + uint64_t unk28 = 0; }; template @@ -85,7 +85,7 @@ namespace RE auto& entry = menuMap[a_name]; entry.initFunc = [](Scaleform::Ptr* menu) { - auto createdMenu = new T(); + auto createdMenu = new T(); REL::Relocation*(Scaleform::Ptr*, T*)> CopyRef(REL::ID(80375)); CopyRef(menu, createdMenu); return menu; diff --git a/CommonLibSF/include/RE/U/UIMessageQueue.h b/CommonLibSF/include/RE/U/UIMessageQueue.h index d9fa5de3..cdaba978 100644 --- a/CommonLibSF/include/RE/U/UIMessageQueue.h +++ b/CommonLibSF/include/RE/U/UIMessageQueue.h @@ -20,8 +20,8 @@ namespace RE public: virtual ~UIMessageData() = default; - UIMessage type; //08 - //...more? + UIMessage type; //08 + //...more? }; enum UI_MESSAGE_RESULT : int64_t diff --git a/CommonLibSF/vcpkg.json b/CommonLibSF/vcpkg.json index d7c9f5ce..025ac001 100644 --- a/CommonLibSF/vcpkg.json +++ b/CommonLibSF/vcpkg.json @@ -1,7 +1,7 @@ { "$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg.schema.json", "name": "commonlibsf", - "version-date": "2024-06-29", + "version-date": "2024-07-13", "port-version": 0, "description": "A collaborative reverse-engineered library for Starfield.", "homepage": "https://github.com/Starfield-Reverse-Engineering/CommonLibSF", diff --git a/README.md b/README.md index 071630c5..0f2b9fc5 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ [![C++23](https://img.shields.io/static/v1?label=standard&message=c%2B%2B23&color=blue&logo=c%2B%2B&&logoColor=red&style=flat)](https://en.cppreference.com/w/cpp/compiler_support) ![Platform](https://img.shields.io/static/v1?label=platform&message=windows&color=dimgray&style=flat&logo=windows) [![Game version](https://img.shields.io/badge/game%20version-1.8.86-orange)](#Developing-with-CommonLibSF) -[![VCPKG_VER](https://img.shields.io/static/v1?label=vcpkg%20registry&message=2024-06-29&color=green&style=flat)](https://github.com/Starfield-Reverse-Engineering/Starfield-RE-vcpkg) +[![VCPKG_VER](https://img.shields.io/static/v1?label=vcpkg%20registry&message=2024-07-13&color=green&style=flat)](https://github.com/Starfield-Reverse-Engineering/Starfield-RE-vcpkg) [![Main CI](https://img.shields.io/github/actions/workflow/status/Starfield-Reverse-Engineering/CommonLibSF/main_ci.yml)](https://github.com/Starfield-Reverse-Engineering/CommonLibSF/actions/workflows/main_ci.yml) ## Build Dependencies