diff --git a/UnleashedRecomp/api/Hedgehog/Base/Container/hhMap.h b/UnleashedRecomp/api/Hedgehog/Base/Container/hhMap.h new file mode 100644 index 00000000..6d878ec3 --- /dev/null +++ b/UnleashedRecomp/api/Hedgehog/Base/Container/hhMap.h @@ -0,0 +1,378 @@ +#pragma once + +#include + +namespace hh +{ + template< + class Key, + class T, + class Compare = std::less, + class Allocator = Hedgehog::Base::TAllocator>> + class map + { + protected: + enum EColor + { + eColor_Red, + eColor_Black + }; + + struct SNode + { + using allocator_type = typename std::allocator_traits::template rebind_alloc; + + xpointer pLeft; + xpointer pParent; + xpointer pRight; + std::pair Value; + uint8_t Color; + bool IsNil; + }; + + Compare m_Comp; + typename SNode::allocator_type m_Alloc; + xpointer m_pHead; + be m_Count; + + struct SFindResult + { + SNode* pParent; + bool IsRight; + SNode* pBound; + }; + + bool LowerBoundDuplicate(const SNode* pBound, const Key& in_rKey) const + { + return !pBound->IsNil && !m_Comp(in_rKey, pBound->Value.first); + } + + SFindResult FindLowerBound(const Key& in_rKey) const + { + SFindResult result{ m_pHead->pParent, true, m_pHead }; + SNode* pNode = result.pParent; + + while (!pNode->IsNil) + { + result.pParent = pNode; + if (m_Comp(pNode->Value.first, in_rKey)) + { + result.IsRight = true; + pNode = pNode->pRight; + } + else + { + result.IsRight = false; + result.pBound = pNode; + pNode = pNode->pLeft; + } + } + + return result; + } + + SNode* Find(const Key& in_rKey) const + { + const SFindResult result = FindLowerBound(in_rKey); + return LowerBoundDuplicate(result.pBound, in_rKey) ? result.pBound : m_pHead; + } + + static SNode* Max(SNode* pNode) + { + while (!pNode->pRight->IsNil) + pNode = pNode->pRight; + + return pNode; + } + + static SNode* Min(SNode* pNode) + { + while (!pNode->pLeft->IsNil) + pNode = pNode->pLeft; + + return pNode; + } + + public: + using key_type = Key; + using mapped_type = T; + using value_type = std::pair; + using size_type = std::size_t; + using difference_type = std::ptrdiff_t; + using key_compare = Compare; + using allocator_type = Allocator; + using reference = value_type&; + using const_reference = const value_type&; + using pointer = typename std::allocator_traits::pointer; + using const_pointer = typename std::allocator_traits::const_pointer; + + class iterator + { + public: + using iterator_category = std::bidirectional_iterator_tag; + using value_type = std::pair; + using difference_type = std::ptrdiff_t; + using pointer = value_type*; + using reference = value_type&; + + iterator(const std::nullptr_t&) = delete; + iterator(SNode* pNode) : m_pNode(pNode) {} + + reference operator*() const { return m_pNode->Value; } + pointer operator->() const { return &m_pNode->Value; } + + iterator& operator++() + { + if (m_pNode->pRight->IsNil) + { + SNode* pNode; + while (!(pNode = m_pNode->pParent)->IsNil && m_pNode == pNode->pRight) + m_pNode = pNode; + + m_pNode = pNode; + } + else + { + m_pNode = map::Min(m_pNode->pRight); + } + + return *this; + } + + iterator operator++(int) + { + iterator temp(*this); + ++(*this); + return temp; + } + + iterator& operator--() + { + if (m_pNode->IsNil) + { + m_pNode = m_pNode->pRight; + } + else if (m_pNode->pLeft->IsNil) + { + SNode* pNode; + while (!(pNode = m_pNode->pParent)->IsNil && m_pNode == pNode->pLeft) + m_pNode = pNode; + + if (!m_pNode->IsNil) + m_pNode = pNode; + } + else + { + m_pNode = map::Max(m_pNode->pLeft); + } + + return *this; + } + + iterator operator--(int) + { + iterator temp(*this); + --(*this); + return temp; + } + + bool operator==(const iterator& rhs) const { return m_pNode == rhs.m_pNode; } + bool operator!=(const iterator& rhs) const { return !(*this == rhs); } + + private: + SNode* m_pNode; + friend class iterator; + friend class map; + }; + + class const_iterator + { + public: + using iterator_category = std::bidirectional_iterator_tag; + using value_type = std::pair; + using difference_type = std::ptrdiff_t; + using pointer = const value_type*; + using reference = const value_type&; + + const_iterator(const std::nullptr_t&) = delete; + const_iterator(SNode* pNode) : m_pNode(pNode) {} + const_iterator(const iterator& iterator) : m_pNode(iterator.m_pNode) {} + + reference operator*() const { return m_pNode->Value; } + pointer operator->() const { return &m_pNode->Value; } + + const_iterator& operator++() + { + if (m_pNode->pRight->IsNil) + { + SNode* pNode; + while (!(pNode = m_pNode->pParent)->IsNil && m_pNode == pNode->pRight) + m_pNode = pNode; + + m_pNode = pNode; + } + else + { + m_pNode = map::Min(m_pNode->pRight); + } + + return *this; + } + + const_iterator operator++(int) + { + const_iterator temp(*this); + ++(*this); + return temp; + } + + const_iterator& operator--() + { + if (m_pNode->IsNil) + { + m_pNode = m_pNode->pRight; + } + else if (m_pNode->pLeft->IsNil) + { + SNode* pNode; + while (!(pNode = m_pNode->pParent)->IsNil && m_pNode == pNode->pLeft) + m_pNode = pNode; + + if (!m_pNode->IsNil) + m_pNode = pNode; + } + else + { + m_pNode = map::Max(m_pNode->pLeft); + } + + return *this; + } + + const_iterator operator--(int) + { + const_iterator temp(*this); + --(*this); + return temp; + } + + bool operator==(const const_iterator& rhs) const { return m_pNode == rhs.m_pNode; } + bool operator!=(const const_iterator& rhs) const { return !(*this == rhs); } + + private: + SNode* m_pNode; + friend class map; + }; + + using reverse_iterator = std::reverse_iterator; + using const_reverse_iterator = std::reverse_iterator; + + public: + allocator_type get_allocator() const + { + return m_Alloc; + } + + T& at(const Key& key) + { + return Find(key)->Value.second; + } + + const T& at(const Key& key) const + { + return Find(key)->Value.second; + } + + iterator begin() + { + return iterator(m_pHead->pLeft); + } + + const_iterator begin() const + { + return const_iterator(m_pHead->pLeft); + } + + const_iterator cbegin() const + { + return const_iterator(m_pHead->pLeft); + } + + iterator end() + { + return iterator(m_pHead); + } + + const_iterator end() const + { + return const_iterator(m_pHead); + } + + const_iterator cend() const + { + return const_iterator(m_pHead); + } + + reverse_iterator rbegin() + { + return reverse_iterator(end()); + } + + const_reverse_iterator rbegin() const + { + return const_reverse_iterator(end()); + } + + const_reverse_iterator crbegin() const + { + return const_reverse_iterator(cend()); + } + + reverse_iterator rend() + { + return reverse_iterator(begin()); + } + + const_reverse_iterator rend() const + { + return const_reverse_iterator(begin()); + } + + const_reverse_iterator crend() const + { + return const_reverse_iterator(cbegin()); + } + + bool empty() const + { + return m_Count == 0; + } + + size_type size() const + { + return m_Count; + } + + size_type max_size() const + { + return ~0u; + } + + size_type count(const Key& key) const + { + return LowerBoundDuplicate(FindLowerBound(key).pBound, key) ? 1u : 0u; + } + + iterator find(const Key& key) + { + return iterator(Find(key)); + } + + const_iterator find(const Key& key) const + { + return const_iterator(Find(key)); + } + }; + + static_assert(sizeof(map) == 0xC); +} diff --git a/UnleashedRecomp/api/Hedgehog/Base/Container/hhVector.h b/UnleashedRecomp/api/Hedgehog/Base/Container/hhVector.h new file mode 100644 index 00000000..42f3b959 --- /dev/null +++ b/UnleashedRecomp/api/Hedgehog/Base/Container/hhVector.h @@ -0,0 +1,255 @@ +#pragma once + +#include + +namespace hh +{ + template> + class vector + { + protected: + Allocator m_Alloc; + xpointer m_pFirst; + xpointer m_pLast; + xpointer m_pEnd; + + public: + using value_type = T; + using allocator_type = Allocator; + using size_type = std::size_t; + using difference_type = std::ptrdiff_t; + using reference = value_type&; + using const_reference = const value_type&; + using pointer = typename std::allocator_traits::pointer; + using const_pointer = typename std::allocator_traits::const_pointer; + + class iterator + { + public: + using iterator_category = std::random_access_iterator_tag; + using value_type = T; + using difference_type = std::ptrdiff_t; + using pointer = T*; + using reference = T&; + + iterator() : m_pPtr(nullptr) {} + iterator(T* p) : m_pPtr(p) {} + + reference operator*() const { return *m_pPtr; } + pointer operator->() const { return m_pPtr; } + + iterator& operator++() { ++m_pPtr; return *this; } + iterator operator++(int) { iterator tmp = *this; ++(*this); return tmp; } + + iterator& operator--() { --m_pPtr; return *this; } + iterator operator--(int) { iterator tmp = *this; --(*this); return tmp; } + + iterator& operator+=(difference_type n) { m_pPtr += n; return *this; } + iterator operator+(difference_type n) const { iterator tmp = *this; return tmp += n; } + friend iterator operator+(difference_type n, iterator it) { return it + n; } + + iterator& operator-=(difference_type n) { return *this += -n; } + iterator operator-(difference_type n) const { iterator tmp = *this; return tmp -= n; } + difference_type operator-(const iterator& other) const { return m_pPtr - other.m_pPtr; } + + reference operator[](difference_type n) const { return *(*this + n); } + + bool operator==(const iterator& other) const { return m_pPtr == other.m_pPtr; } + bool operator!=(const iterator& other) const { return !(*this == other); } + bool operator<(const iterator& other) const { return m_pPtr < other.m_pPtr; } + bool operator<=(const iterator& other) const { return !(other < *this); } + bool operator>(const iterator& other) const { return other < *this; } + bool operator>=(const iterator& other) const { return !(*this < other); } + + private: + T* m_pPtr; + + friend class vector; + friend class const_iterator; + }; + + class const_iterator + { + public: + using iterator_category = std::random_access_iterator_tag; + using value_type = T; + using difference_type = std::ptrdiff_t; + using pointer = const T*; + using reference = const T&; + + const_iterator() : m_pPtr(nullptr) {} + const_iterator(T* p) : m_pPtr(p) {} + const_iterator(const iterator& other) : m_pPtr(other.m_pPtr) {} + + reference operator*() const { return *m_pPtr; } + pointer operator->() const { return m_pPtr; } + + const_iterator& operator++() { ++m_pPtr; return *this; } + const_iterator operator++(int) { const_iterator tmp = *this; ++(*this); return tmp; } + + const_iterator& operator--() { --m_pPtr; return *this; } + const_iterator operator--(int) { const_iterator tmp = *this; --(*this); return tmp; } + + const_iterator& operator+=(difference_type n) { m_pPtr += n; return *this; } + const_iterator operator+(difference_type n) const { const_iterator tmp = *this; return tmp += n; } + friend const_iterator operator+(difference_type n, const_iterator it) { return it + n; } + + const_iterator& operator-=(difference_type n) { return *this += -n; } + const_iterator operator-(difference_type n) const { const_iterator tmp = *this; return tmp -= n; } + difference_type operator-(const const_iterator& other) const { return m_pPtr - other.m_pPtr; } + + reference operator[](difference_type n) const { return *(*this + n); } + + bool operator==(const const_iterator& other) const { return m_pPtr == other.m_pPtr; } + bool operator!=(const const_iterator& other) const { return !(*this == other); } + bool operator<(const const_iterator& other) const { return m_pPtr < other.m_pPtr; } + bool operator<=(const const_iterator& other) const { return !(other < *this); } + bool operator>(const const_iterator& other) const { return other < *this; } + bool operator>=(const const_iterator& other) const { return !(*this < other); } + + private: + T* m_pPtr; + friend class vector; + }; + + using reverse_iterator = std::reverse_iterator; + using const_reverse_iterator = std::reverse_iterator; + + allocator_type get_allocator() const + { + return m_Alloc; + } + + reference at(size_type pos) + { + return m_pFirst[pos]; + } + + const_reference at(size_type pos) const + { + return m_pFirst[pos]; + } + + reference operator[](size_type pos) + { + return m_pFirst[pos]; + } + + const_reference operator[](size_type pos) const + { + return m_pFirst[pos]; + } + + reference front() + { + return m_pFirst[0]; + } + + const_reference front() const + { + return m_pFirst[0]; + } + + reference back() + { + return m_pLast[-1]; + } + + const_reference back() const + { + return m_pLast[-1]; + } + + T* data() + { + return m_pFirst; + } + + const T* data() const + { + return m_pFirst; + } + + iterator begin() + { + return iterator(m_pFirst); + } + + const_iterator begin() const + { + return const_iterator(m_pFirst); + } + + const_iterator cbegin() const + { + return const_iterator(m_pFirst); + } + + iterator end() + { + return iterator(m_pLast); + } + + const_iterator end() const + { + return const_iterator(m_pLast); + } + + const_iterator cend() const + { + return const_iterator(m_pLast); + } + + reverse_iterator rbegin() + { + return reverse_iterator(end()); + } + + const_reverse_iterator rbegin() const + { + return const_reverse_iterator(end()); + } + + const_reverse_iterator crbegin() const + { + return const_reverse_iterator(cend()); + } + + reverse_iterator rend() + { + return reverse_iterator(begin()); + } + + const_reverse_iterator rend() const + { + return const_reverse_iterator(begin()); + } + + const_reverse_iterator crend() const + { + return const_reverse_iterator(cbegin()); + } + + bool empty() const + { + return m_pFirst == m_pLast; + } + + size_type size() const + { + return m_pLast - m_pFirst; + } + + size_type max_size() const + { + return ~0u; + } + + size_type capacity() const + { + return m_pEnd - m_pFirst; + } + }; + + SWA_ASSERT_SIZEOF(vector, 0x10); +} diff --git a/UnleashedRecomp/api/Hedgehog/Base/System/hhSymbol.h b/UnleashedRecomp/api/Hedgehog/Base/System/hhSymbol.h new file mode 100644 index 00000000..8aaeb4de --- /dev/null +++ b/UnleashedRecomp/api/Hedgehog/Base/System/hhSymbol.h @@ -0,0 +1,38 @@ +#pragma once + +#include + +namespace Hedgehog::Base +{ + struct SSymbolNode + { + xpointer pPrev; + xpointer pNext; + be Hash; + + const char* GetValue() const; + }; + + class CSharedString; + + class CStringSymbol + { + public: + xpointer m_pSymbolNode; + + CStringSymbol(); + CStringSymbol(const char* in_pName); + CStringSymbol(const CSharedString& in_rName); + + const char* GetValue() const; + + bool operator==(const CStringSymbol& in_rOther) const; + bool operator!=(const CStringSymbol& in_rOther) const; + bool operator<(const CStringSymbol& in_rOther) const; + }; + + SWA_ASSERT_OFFSETOF(CStringSymbol, m_pSymbolNode, 0); + SWA_ASSERT_SIZEOF(CStringSymbol, 4); +} + +#include diff --git a/UnleashedRecomp/api/Hedgehog/Base/System/hhSymbol.inl b/UnleashedRecomp/api/Hedgehog/Base/System/hhSymbol.inl new file mode 100644 index 00000000..ddacb302 --- /dev/null +++ b/UnleashedRecomp/api/Hedgehog/Base/System/hhSymbol.inl @@ -0,0 +1,41 @@ +namespace Hedgehog::Base +{ + inline const char* SSymbolNode::GetValue() const + { + return reinterpret_cast(this) + sizeof(SSymbolNode); + } + + inline CStringSymbol::CStringSymbol() + { + } + + inline CStringSymbol::CStringSymbol(const char* in_pName) + { + GuestToHostFunction(sub_82E014D8, this, in_pName); + } + + inline CStringSymbol::CStringSymbol(const CSharedString& in_rName) + { + GuestToHostFunction(sub_82E013B0, this, &in_rName); + } + + inline const char* CStringSymbol::GetValue() const + { + return m_pSymbolNode->GetValue(); + } + + inline bool CStringSymbol::operator==(const CStringSymbol& in_rOther) const + { + return m_pSymbolNode == in_rOther.m_pSymbolNode; + } + + inline bool CStringSymbol::operator!=(const CStringSymbol& in_rOther) const + { + return m_pSymbolNode != in_rOther.m_pSymbolNode; + } + + inline bool CStringSymbol::operator<(const CStringSymbol& in_rOther) const + { + return m_pSymbolNode < in_rOther.m_pSymbolNode; + } +} diff --git a/UnleashedRecomp/api/Hedgehog/Base/Type/detail/hhStringHolder.h b/UnleashedRecomp/api/Hedgehog/Base/Type/detail/hhStringHolder.h index 087de601..4fd1cd25 100644 --- a/UnleashedRecomp/api/Hedgehog/Base/Type/detail/hhStringHolder.h +++ b/UnleashedRecomp/api/Hedgehog/Base/Type/detail/hhStringHolder.h @@ -1,6 +1,6 @@ #pragma once -#include "SWA.inl" +#include namespace Hedgehog::Base { @@ -41,4 +41,4 @@ namespace Hedgehog::Base }; } -#include "Hedgehog/Base/Type/detail/hhStringHolder.inl" +#include diff --git a/UnleashedRecomp/api/Hedgehog/Database/System/hhDatabaseData.h b/UnleashedRecomp/api/Hedgehog/Database/System/hhDatabaseData.h index 8552a514..3a7ac2b0 100644 --- a/UnleashedRecomp/api/Hedgehog/Database/System/hhDatabaseData.h +++ b/UnleashedRecomp/api/Hedgehog/Database/System/hhDatabaseData.h @@ -1,6 +1,7 @@ #pragma once -#include "Hedgehog/Base/hhObject.h" +#include +#include namespace Hedgehog::Database { diff --git a/UnleashedRecomp/api/Hedgehog/Database/System/hhDatabaseData.inl b/UnleashedRecomp/api/Hedgehog/Database/System/hhDatabaseData.inl index 7e3e383f..6132b394 100644 --- a/UnleashedRecomp/api/Hedgehog/Database/System/hhDatabaseData.inl +++ b/UnleashedRecomp/api/Hedgehog/Database/System/hhDatabaseData.inl @@ -7,7 +7,7 @@ namespace Hedgehog::Database inline bool CDatabaseData::CheckMadeAll() { - return true; + return GuestToHostFunction(m_pVftable->m_fpCheckMadeAll, this); } inline bool CDatabaseData::IsMadeOne() const diff --git a/UnleashedRecomp/api/Hedgehog/MirageCore/Misc/hhVertexDeclarationPtr.h b/UnleashedRecomp/api/Hedgehog/MirageCore/Misc/hhVertexDeclarationPtr.h new file mode 100644 index 00000000..bf0c4917 --- /dev/null +++ b/UnleashedRecomp/api/Hedgehog/MirageCore/Misc/hhVertexDeclarationPtr.h @@ -0,0 +1,19 @@ +#pragma once + +#include + +namespace Hedgehog::Mirage +{ + class CRenderingInfrastructure; + + class CVertexDeclarationPtr + { + public: + xpointer m_pD3DVertexDeclaration; + xpointer m_pRenderingInfrastructure; + }; + + SWA_ASSERT_OFFSETOF(CVertexDeclarationPtr, m_pD3DVertexDeclaration, 0x0); + SWA_ASSERT_OFFSETOF(CVertexDeclarationPtr, m_pRenderingInfrastructure, 0x4); + SWA_ASSERT_SIZEOF(CVertexDeclarationPtr, 0x8); +} diff --git a/UnleashedRecomp/api/Hedgehog/MirageCore/RenderData/hhMaterialData.h b/UnleashedRecomp/api/Hedgehog/MirageCore/RenderData/hhMaterialData.h new file mode 100644 index 00000000..cd536d80 --- /dev/null +++ b/UnleashedRecomp/api/Hedgehog/MirageCore/RenderData/hhMaterialData.h @@ -0,0 +1,39 @@ +#pragma once + +#include + +#include +#include + +namespace Hedgehog::Mirage +{ + class CMaterialData; + class CTexsetData; + class CShaderListData; + class CParameterFloat4Element; + class CParameterInt4Element; + class CParameterBoolElement; + + class CMaterialData : public Database::CDatabaseData + { + public: + boost::shared_ptr m_spTexsetData; + boost::shared_ptr m_spShaderListData; + hh::vector> m_Float4Params; + hh::vector> m_Int4Params; + hh::vector> m_Bool4Params; + uint8_t m_AlphaThreshold; + bool m_DoubleSided; + bool m_Additive; + }; + + SWA_ASSERT_OFFSETOF(CMaterialData, m_spTexsetData, 0xC); + SWA_ASSERT_OFFSETOF(CMaterialData, m_spShaderListData, 0x14); + SWA_ASSERT_OFFSETOF(CMaterialData, m_Float4Params, 0x1C); + SWA_ASSERT_OFFSETOF(CMaterialData, m_Int4Params, 0x2C); + SWA_ASSERT_OFFSETOF(CMaterialData, m_Bool4Params, 0x3C); + SWA_ASSERT_OFFSETOF(CMaterialData, m_AlphaThreshold, 0x4C); + SWA_ASSERT_OFFSETOF(CMaterialData, m_DoubleSided, 0x4D); + SWA_ASSERT_OFFSETOF(CMaterialData, m_Additive, 0x4E); + SWA_ASSERT_SIZEOF(CMaterialData, 0x50); +} diff --git a/UnleashedRecomp/api/Hedgehog/MirageCore/RenderData/hhMeshData.h b/UnleashedRecomp/api/Hedgehog/MirageCore/RenderData/hhMeshData.h new file mode 100644 index 00000000..3fc6a9f9 --- /dev/null +++ b/UnleashedRecomp/api/Hedgehog/MirageCore/RenderData/hhMeshData.h @@ -0,0 +1,43 @@ +#pragma once + +#include + +#include +#include +#include + +namespace Hedgehog::Mirage +{ + class CMaterialData; + + class CMeshData : public Database::CDatabaseData + { + public: + be m_IndexNum; + be m_VertexNum; + be m_VertexSize; + be m_NodeNum; + xpointer m_pNodeIndices; + be m_VertexOffset; + be m_IndexOffset; + xpointer m_pD3DIndexBuffer; + xpointer m_pD3DVertexBuffer; + CVertexDeclarationPtr m_VertexDeclarationPtr; + SWA_INSERT_PADDING(0x4); + boost::shared_ptr m_spMaterial; + SWA_INSERT_PADDING(0xC); + }; + + SWA_ASSERT_OFFSETOF(CMeshData, m_IndexNum, 0xC); + SWA_ASSERT_OFFSETOF(CMeshData, m_VertexNum, 0x10); + SWA_ASSERT_OFFSETOF(CMeshData, m_VertexSize, 0x14); + SWA_ASSERT_OFFSETOF(CMeshData, m_NodeNum, 0x18); + SWA_ASSERT_OFFSETOF(CMeshData, m_pNodeIndices, 0x1C); + SWA_ASSERT_OFFSETOF(CMeshData, m_VertexOffset, 0x20); + SWA_ASSERT_OFFSETOF(CMeshData, m_IndexOffset, 0x24); + SWA_ASSERT_OFFSETOF(CMeshData, m_pD3DIndexBuffer, 0x28); + SWA_ASSERT_OFFSETOF(CMeshData, m_pD3DVertexBuffer, 0x2C); + SWA_ASSERT_OFFSETOF(CMeshData, m_VertexDeclarationPtr, 0x30); + SWA_ASSERT_OFFSETOF(CMeshData, m_spMaterial, 0x3C); + SWA_ASSERT_SIZEOF(CMeshData, 0x50); +} diff --git a/UnleashedRecomp/api/Hedgehog/MirageCore/RenderData/hhModelData.h b/UnleashedRecomp/api/Hedgehog/MirageCore/RenderData/hhModelData.h new file mode 100644 index 00000000..d29bc11f --- /dev/null +++ b/UnleashedRecomp/api/Hedgehog/MirageCore/RenderData/hhModelData.h @@ -0,0 +1,46 @@ +#pragma once + +#include +#include + +namespace Hedgehog::Mirage +{ + class CNodeGroupModelData; + class CMeshData; + class CModelNodeData; + class CMatrixData; + class CAabbData; + class CSphereData; + class CMorphModelData; + + class CModelData : public Database::CDatabaseData + { + public: + be m_NodeGroupModelNum; + hh::vector> m_NodeGroupModels; + hh::vector> m_OpaqueMeshes; + hh::vector> m_TransparentMeshes; + hh::vector> m_PunchThroughMeshes; + be m_NodeNum; + boost::shared_ptr m_spNodeParentIndices; + boost::shared_ptr m_spNodes; + boost::shared_ptr m_spNodeMatrices; + boost::shared_ptr m_spAabb; + boost::shared_ptr m_spSphere; + hh::vector> m_MorphModels; + }; + + SWA_ASSERT_OFFSETOF(CModelData, m_NodeGroupModelNum, 0xC); + SWA_ASSERT_OFFSETOF(CModelData, m_NodeGroupModels, 0x10); + SWA_ASSERT_OFFSETOF(CModelData, m_OpaqueMeshes, 0x20); + SWA_ASSERT_OFFSETOF(CModelData, m_TransparentMeshes, 0x30); + SWA_ASSERT_OFFSETOF(CModelData, m_PunchThroughMeshes, 0x40); + SWA_ASSERT_OFFSETOF(CModelData, m_NodeNum, 0x50); + SWA_ASSERT_OFFSETOF(CModelData, m_spNodeParentIndices, 0x54); + SWA_ASSERT_OFFSETOF(CModelData, m_spNodes, 0x5C); + SWA_ASSERT_OFFSETOF(CModelData, m_spNodeMatrices, 0x64); + SWA_ASSERT_OFFSETOF(CModelData, m_spAabb, 0x6C); + SWA_ASSERT_OFFSETOF(CModelData, m_spSphere, 0x74); + SWA_ASSERT_OFFSETOF(CModelData, m_MorphModels, 0x7C); + SWA_ASSERT_SIZEOF(CModelData, 0x8C); +} diff --git a/UnleashedRecomp/api/Hedgehog/MirageCore/RenderData/hhNodeGroupModelData.h b/UnleashedRecomp/api/Hedgehog/MirageCore/RenderData/hhNodeGroupModelData.h new file mode 100644 index 00000000..1c37548b --- /dev/null +++ b/UnleashedRecomp/api/Hedgehog/MirageCore/RenderData/hhNodeGroupModelData.h @@ -0,0 +1,30 @@ +#pragma once + +#include +#include + +namespace Hedgehog::Mirage +{ + class CMeshData; + + class CNodeGroupModelData : public Database::CDatabaseData + { + public: + hh::vector> m_OpaqueMeshes; + hh::vector> m_TransparentMeshes; + hh::vector> m_PunchThroughMeshes; + be m_SpecialMeshGroupNum; + boost::shared_ptr> m_SpecialMeshGroupModes; + hh::vector>> m_SpecialMeshGroups; + Base::CSharedString m_Name; + }; + + SWA_ASSERT_OFFSETOF(CNodeGroupModelData, m_OpaqueMeshes, 0xC); + SWA_ASSERT_OFFSETOF(CNodeGroupModelData, m_TransparentMeshes, 0x1C); + SWA_ASSERT_OFFSETOF(CNodeGroupModelData, m_PunchThroughMeshes, 0x2C); + SWA_ASSERT_OFFSETOF(CNodeGroupModelData, m_SpecialMeshGroupNum, 0x3C); + SWA_ASSERT_OFFSETOF(CNodeGroupModelData, m_SpecialMeshGroupModes, 0x40); + SWA_ASSERT_OFFSETOF(CNodeGroupModelData, m_SpecialMeshGroups, 0x48); + SWA_ASSERT_OFFSETOF(CNodeGroupModelData, m_Name, 0x58); + SWA_ASSERT_SIZEOF(CNodeGroupModelData, 0x5C); +} diff --git a/UnleashedRecomp/api/Hedgehog/MirageCore/RenderData/hhPixelShaderCodeData.h b/UnleashedRecomp/api/Hedgehog/MirageCore/RenderData/hhPixelShaderCodeData.h new file mode 100644 index 00000000..ab275e28 --- /dev/null +++ b/UnleashedRecomp/api/Hedgehog/MirageCore/RenderData/hhPixelShaderCodeData.h @@ -0,0 +1,30 @@ +#pragma once + +#include + +#include + +namespace Hedgehog::Base +{ + class CCriticalSectionD3D9; +} + +namespace Hedgehog::Mirage +{ + class CRenderingInfrastructure; + + class CPixelShaderCodeData : public Database::CDatabaseData + { + public: + xpointer m_pD3DPixelShader; + xpointer m_spFunction; + boost::shared_ptr m_spCriticalSection; + xpointer m_pRenderingInfrastructure; + }; + + SWA_ASSERT_OFFSETOF(CPixelShaderCodeData, m_pD3DPixelShader, 0xC); + SWA_ASSERT_OFFSETOF(CPixelShaderCodeData, m_spFunction, 0x10); + SWA_ASSERT_OFFSETOF(CPixelShaderCodeData, m_spCriticalSection, 0x14); + SWA_ASSERT_OFFSETOF(CPixelShaderCodeData, m_pRenderingInfrastructure, 0x1C); + SWA_ASSERT_SIZEOF(CPixelShaderCodeData, 0x20); +} diff --git a/UnleashedRecomp/api/Hedgehog/MirageCore/RenderData/hhPixelShaderData.h b/UnleashedRecomp/api/Hedgehog/MirageCore/RenderData/hhPixelShaderData.h new file mode 100644 index 00000000..e2740243 --- /dev/null +++ b/UnleashedRecomp/api/Hedgehog/MirageCore/RenderData/hhPixelShaderData.h @@ -0,0 +1,22 @@ +#pragma once + +#include +#include + +namespace Hedgehog::Mirage +{ + class CPixelShaderCodeData; + class CPixelShaderParameterData; + + class CPixelShaderData : public Hedgehog::Database::CDatabaseData + { + public: + boost::shared_ptr m_spCode; + SWA_INSERT_PADDING(0x4); + hh::vector> m_ParameterList; + }; + + SWA_ASSERT_OFFSETOF(CPixelShaderData, m_spCode, 0xC); + SWA_ASSERT_OFFSETOF(CPixelShaderData, m_ParameterList, 0x18); + SWA_ASSERT_SIZEOF(CPixelShaderData, 0x28); +} diff --git a/UnleashedRecomp/api/Hedgehog/MirageCore/RenderData/hhShaderListData.h b/UnleashedRecomp/api/Hedgehog/MirageCore/RenderData/hhShaderListData.h new file mode 100644 index 00000000..6b94128d --- /dev/null +++ b/UnleashedRecomp/api/Hedgehog/MirageCore/RenderData/hhShaderListData.h @@ -0,0 +1,46 @@ +#pragma once + +#include + +#include +#include +#include + +namespace Hedgehog::Mirage +{ + class CVertexShaderData; + class CPixelShaderData; + + class CVertexShaderPermutationData + { + public: + hh::map, boost::shared_ptr> m_VertexShaders; + be m_SubPermutations; + }; + + SWA_ASSERT_OFFSETOF(CVertexShaderPermutationData, m_VertexShaders, 0x0); + SWA_ASSERT_OFFSETOF(CVertexShaderPermutationData, m_SubPermutations, 0xC); + SWA_ASSERT_SIZEOF(CVertexShaderPermutationData, 0x10); + + class CPixelShaderPermutationData + { + public: + hh::map> m_VertexShaderPermutations; + hh::map, boost::shared_ptr> m_PixelShaders; + uint32_t m_SubPermutations; + }; + + SWA_ASSERT_OFFSETOF(CPixelShaderPermutationData, m_VertexShaderPermutations, 0x0); + SWA_ASSERT_OFFSETOF(CPixelShaderPermutationData, m_PixelShaders, 0xC); + SWA_ASSERT_OFFSETOF(CPixelShaderPermutationData, m_SubPermutations, 0x18); + SWA_ASSERT_SIZEOF(CPixelShaderPermutationData, 0x1C); + + class CShaderListData : public Database::CDatabaseData + { + public: + hh::map m_PixelShaderPermutations; + }; + + SWA_ASSERT_OFFSETOF(CShaderListData, m_PixelShaderPermutations, 0xC); + SWA_ASSERT_SIZEOF(CShaderListData, 0x18); +} diff --git a/UnleashedRecomp/api/Hedgehog/MirageCore/RenderData/hhTerrainModelData.h b/UnleashedRecomp/api/Hedgehog/MirageCore/RenderData/hhTerrainModelData.h new file mode 100644 index 00000000..5f0d6b33 --- /dev/null +++ b/UnleashedRecomp/api/Hedgehog/MirageCore/RenderData/hhTerrainModelData.h @@ -0,0 +1,29 @@ +#pragma once + +#include +#include + +namespace Hedgehog::Mirage +{ + class CSphereData; + class CNodeGroupModelData; + class CMeshData; + + class CTerrainModelData : public Database::CDatabaseData + { + public: + SWA_INSERT_PADDING(0x4); + hh::vector> m_NodeGroupModels; + hh::vector> m_OpaqueMeshes; + hh::vector> m_TransparentMeshes; + hh::vector> m_PunchThroughMeshes; + boost::shared_ptr m_spSphere; + }; + + SWA_ASSERT_OFFSETOF(CTerrainModelData, m_NodeGroupModels, 0x10); + SWA_ASSERT_OFFSETOF(CTerrainModelData, m_OpaqueMeshes, 0x20); + SWA_ASSERT_OFFSETOF(CTerrainModelData, m_TransparentMeshes, 0x30); + SWA_ASSERT_OFFSETOF(CTerrainModelData, m_PunchThroughMeshes, 0x40); + SWA_ASSERT_OFFSETOF(CTerrainModelData, m_spSphere, 0x50); + SWA_ASSERT_SIZEOF(CTerrainModelData, 0x58); +} diff --git a/UnleashedRecomp/api/Hedgehog/MirageCore/RenderData/hhVertexShaderCodeData.h b/UnleashedRecomp/api/Hedgehog/MirageCore/RenderData/hhVertexShaderCodeData.h new file mode 100644 index 00000000..9956d2e2 --- /dev/null +++ b/UnleashedRecomp/api/Hedgehog/MirageCore/RenderData/hhVertexShaderCodeData.h @@ -0,0 +1,30 @@ +#pragma once + +#include + +#include + +namespace Hedgehog::Base +{ + class CCriticalSectionD3D9; +} + +namespace Hedgehog::Mirage +{ + class CRenderingInfrastructure; + + class CVertexShaderCodeData : public Database::CDatabaseData + { + public: + xpointer m_pD3DVertexShader; + xpointer m_spFunction; + boost::shared_ptr m_spCriticalSection; + xpointer m_pRenderingInfrastructure; + }; + + SWA_ASSERT_OFFSETOF(CVertexShaderCodeData, m_pD3DVertexShader, 0xC); + SWA_ASSERT_OFFSETOF(CVertexShaderCodeData, m_spFunction, 0x10); + SWA_ASSERT_OFFSETOF(CVertexShaderCodeData, m_spCriticalSection, 0x14); + SWA_ASSERT_OFFSETOF(CVertexShaderCodeData, m_pRenderingInfrastructure, 0x1C); + SWA_ASSERT_SIZEOF(CVertexShaderCodeData, 0x20); +} diff --git a/UnleashedRecomp/api/Hedgehog/MirageCore/RenderData/hhVertexShaderData.h b/UnleashedRecomp/api/Hedgehog/MirageCore/RenderData/hhVertexShaderData.h new file mode 100644 index 00000000..f9509952 --- /dev/null +++ b/UnleashedRecomp/api/Hedgehog/MirageCore/RenderData/hhVertexShaderData.h @@ -0,0 +1,22 @@ +#pragma once + +#include +#include + +namespace Hedgehog::Mirage +{ + class CVertexShaderCodeData; + class CVertexShaderParameterData; + + class CVertexShaderData : public Hedgehog::Database::CDatabaseData + { + public: + boost::shared_ptr m_spCode; + SWA_INSERT_PADDING(0x4); + hh::vector> m_ParameterList; + }; + + SWA_ASSERT_OFFSETOF(CVertexShaderData, m_spCode, 0xC); + SWA_ASSERT_OFFSETOF(CVertexShaderData, m_ParameterList, 0x18); + SWA_ASSERT_SIZEOF(CVertexShaderData, 0x28); +} diff --git a/UnleashedRecomp/api/SWA.h b/UnleashedRecomp/api/SWA.h index bf18f4b2..48434de9 100644 --- a/UnleashedRecomp/api/SWA.h +++ b/UnleashedRecomp/api/SWA.h @@ -15,7 +15,10 @@ #include "CSD/Manager/csdmSceneObserver.h" #include "CSD/Manager/csdmSubjectBase.h" #include "CSD/Platform/csdTexList.h" +#include "Hedgehog/Base/Container/hhMap.h" +#include "Hedgehog/Base/Container/hhVector.h" #include "Hedgehog/Base/System/hhAllocator.h" +#include "Hedgehog/Base/System/hhSymbol.h" #include "Hedgehog/Base/Thread/hhHolder.h" #include "Hedgehog/Base/Thread/hhHolderBase.h" #include "Hedgehog/Base/Thread/hhSynchronizedObject.h" @@ -25,6 +28,17 @@ #include "Hedgehog/Base/hhObject.h" #include "Hedgehog/Database/System/hhDatabaseData.h" #include "Hedgehog/Math/Vector2.h" +#include "Hedgehog/MirageCore/Misc/hhVertexDeclarationPtr.h" +#include "Hedgehog/MirageCore/RenderData/hhMaterialData.h" +#include "Hedgehog/MirageCore/RenderData/hhMeshData.h" +#include "Hedgehog/MirageCore/RenderData/hhModelData.h" +#include "Hedgehog/MirageCore/RenderData/hhNodeGroupModelData.h" +#include "Hedgehog/MirageCore/RenderData/hhPixelShaderCodeData.h" +#include "Hedgehog/MirageCore/RenderData/hhPixelShaderData.h" +#include "Hedgehog/MirageCore/RenderData/hhShaderListData.h" +#include "Hedgehog/MirageCore/RenderData/hhTerrainModelData.h" +#include "Hedgehog/MirageCore/RenderData/hhVertexShaderCodeData.h" +#include "Hedgehog/MirageCore/RenderData/hhVertexShaderData.h" #include "Hedgehog/MirageCore/Renderable/hhRenderable.h" #include "Hedgehog/Universe/Engine/hhMessageActor.h" #include "Hedgehog/Universe/Engine/hhMessageProcess.h" diff --git a/UnleashedRecomp/gpu/shader/gamma_correction_ps.hlsl b/UnleashedRecomp/gpu/shader/gamma_correction_ps.hlsl index dfed91b0..b1e2f993 100644 --- a/UnleashedRecomp/gpu/shader/gamma_correction_ps.hlsl +++ b/UnleashedRecomp/gpu/shader/gamma_correction_ps.hlsl @@ -1,4 +1,4 @@ -#include "../../../thirdparty/ShaderRecomp/ShaderRecomp/shader_common.hlsli" +#include "../../../thirdparty/ShaderRecomp/ShaderRecomp/shader_common.h" #ifdef __spirv__ diff --git a/thirdparty/ShaderRecomp b/thirdparty/ShaderRecomp index 11128441..31513fbf 160000 --- a/thirdparty/ShaderRecomp +++ b/thirdparty/ShaderRecomp @@ -1 +1 @@ -Subproject commit 11128441c618f7c8ff3f9520f0b6c5e868473ae2 +Subproject commit 31513fbfbbd91a2062c700e4ac060bd0e92b6f2e