Beta addrs for ViewLODList (#898)

* Beta addrs for ViewLODList

* unsigned char
This commit is contained in:
MS 2024-05-09 22:16:12 -04:00 committed by GitHub
parent 172db7b5d8
commit 79791be574
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 141 additions and 24 deletions

View file

@ -20,6 +20,7 @@ class LODObject;
// //
// VTABLE: LEGO1 0x100dbdc8 // VTABLE: LEGO1 0x100dbdc8
// VTABLE: BETA10 0x101c3500
// SIZE 0x10 // SIZE 0x10
class LODListBase { class LODListBase {
protected: protected:
@ -39,6 +40,7 @@ class LODListBase {
size_t Capacity() const; size_t Capacity() const;
// SYNTHETIC: LEGO1 0x100a77b0 // SYNTHETIC: LEGO1 0x100a77b0
// SYNTHETIC: BETA10 0x1017b410
// LODListBase::`scalar deleting destructor' // LODListBase::`scalar deleting destructor'
#ifdef _DEBUG #ifdef _DEBUG
@ -76,6 +78,7 @@ class LODList : public LODListBase {
// //
// LODListBase implementation // LODListBase implementation
// FUNCTION: BETA10 0x1017b390
inline LODListBase::LODListBase(size_t capacity) inline LODListBase::LODListBase(size_t capacity)
: m_capacity(capacity), m_size(0), m_ppLODObject(new const LODObject*[capacity]) : m_capacity(capacity), m_size(0), m_ppLODObject(new const LODObject*[capacity])
{ {
@ -88,6 +91,8 @@ inline LODListBase::LODListBase(size_t capacity)
#endif #endif
} }
// FUNCTION: LEGO1 0x100a77e0
// FUNCTION: BETA10 0x1017b450
inline LODListBase::~LODListBase() inline LODListBase::~LODListBase()
{ {
// all LODObject* should have been popped by client // all LODObject* should have been popped by client
@ -96,16 +101,19 @@ inline LODListBase::~LODListBase()
delete[] m_ppLODObject; delete[] m_ppLODObject;
} }
// FUNCTION: BETA10 0x1005c480
inline size_t LODListBase::Size() const inline size_t LODListBase::Size() const
{ {
return m_size; return m_size;
} }
// FUNCTION: BETA10 0x10178b40
inline size_t LODListBase::Capacity() const inline size_t LODListBase::Capacity() const
{ {
return m_capacity; return m_capacity;
} }
// FUNCTION: BETA10 0x1007b6a0
inline const LODObject* LODListBase::operator[](int i) const inline const LODObject* LODListBase::operator[](int i) const
{ {
assert((0 <= i) && (i < (int) m_size)); assert((0 <= i) && (i < (int) m_size));
@ -113,6 +121,7 @@ inline const LODObject* LODListBase::operator[](int i) const
return m_ppLODObject[i]; return m_ppLODObject[i];
} }
// FUNCTION: BETA10 0x1007bb40
inline const LODObject* LODListBase::PushBack(const LODObject* pLOD) inline const LODObject* LODListBase::PushBack(const LODObject* pLOD)
{ {
assert(m_size < m_capacity); assert(m_size < m_capacity);
@ -121,6 +130,7 @@ inline const LODObject* LODListBase::PushBack(const LODObject* pLOD)
return pLOD; return pLOD;
} }
// FUNCTION: BETA10 0x10178b60
inline const LODObject* LODListBase::PopBack() inline const LODObject* LODListBase::PopBack()
{ {
const LODObject* pLOD; const LODObject* pLOD;
@ -137,6 +147,7 @@ inline const LODObject* LODListBase::PopBack()
} }
#ifdef _DEBUG #ifdef _DEBUG
// FUNCTION: BETA10 0x1017b4c0
inline void LODListBase::Dump(void (*pTracer)(const char*, ...)) const inline void LODListBase::Dump(void (*pTracer)(const char*, ...)) const
{ {
int i; int i;
@ -181,11 +192,26 @@ inline const T* LODList<T>::PopBack()
} }
// VTABLE: LEGO1 0x100dbdc0 // VTABLE: LEGO1 0x100dbdc0
// VTABLE: BETA10 0x101c34f8
// class LODList<ViewLOD> // class LODList<ViewLOD>
// SYNTHETIC: LEGO1 0x100a7740 // SYNTHETIC: LEGO1 0x100a7740
// SYNTHETIC: BETA10 0x1017b350
// LODList<ViewLOD>::`scalar deleting destructor' // LODList<ViewLOD>::`scalar deleting destructor'
// TEMPLATE: BETA10 0x10178b20
// LODList<ViewLOD>::PopBack
// TEMPLATE: BETA10 0x1017b2d0
// LODList<ViewLOD>::LODList<ViewLOD>
// TEMPLATE: LEGO1 0x100a8160
// TEMPLATE: BETA10 0x1017b5d0
// LODList<ViewLOD>::~LODList<ViewLOD>
// TEMPLATE: BETA10 0x1007bae0
// LODList<ViewLOD>::operator[]
// re-enable: identifier was truncated to '255' characters in the debug information // re-enable: identifier was truncated to '255' characters in the debug information
#pragma warning(default : 4786) #pragma warning(default : 4786)

View file

@ -11,14 +11,31 @@ DECOMP_SIZE_ASSERT(LODList<ViewLOD>, 0x10)
DECOMP_SIZE_ASSERT(ViewLODList, 0x18) DECOMP_SIZE_ASSERT(ViewLODList, 0x18)
// GLOBAL: LEGO1 0x10101064 // GLOBAL: LEGO1 0x10101064
int g_unk0x10101064 = 0; // GLOBAL: BETA10 0x10205d08
int ViewLODListManager::g_ROINameUID = 0;
#ifdef _DEBUG
// FUNCTION: BETA10 0x10178310
inline void ViewLODList::Dump(void (*pTracer)(const char*, ...)) const
{
pTracer(" ViewLODList<0x%x>: Capacity=%d, Size=%d, RefCount=%d\n", this, Capacity(), Size(), m_refCount);
for (int i = 0; i < (int) Size(); i++) {
ViewLOD* lod = const_cast<ViewLOD*>(this->operator[](i));
pTracer(" [%d]: ViewLOD<0x%x>: Vertices=%d\n", i, lod, lod->NVerts());
}
}
#endif
// FUNCTION: LEGO1 0x100a6fd0 // FUNCTION: LEGO1 0x100a6fd0
// FUNCTION: BETA10 0x101783a3
ViewLODListManager::ViewLODListManager() ViewLODListManager::ViewLODListManager()
{ {
} }
// FUNCTION: LEGO1 0x100a7130 // FUNCTION: LEGO1 0x100a7130
// FUNCTION: BETA10 0x1017841c
// FUNCTION: ALPHA 0x100e3402
ViewLODListManager::~ViewLODListManager() ViewLODListManager::~ViewLODListManager()
{ {
ViewLODListMap::iterator iterator; ViewLODListMap::iterator iterator;
@ -28,9 +45,6 @@ ViewLODListManager::~ViewLODListManager()
const ROIName& rROIName = (*iterator).first; const ROIName& rROIName = (*iterator).first;
ViewLODList* pLODList = (*iterator).second; ViewLODList* pLODList = (*iterator).second;
// LODList's refCount should be 0
assert(pLODList->m_refCount == 0);
// ???who pops and deletes LODObjects // ???who pops and deletes LODObjects
while (pLODList->Size() > 0) { while (pLODList->Size() > 0) {
delete const_cast<ViewLOD*>(pLODList->PopBack()); delete const_cast<ViewLOD*>(pLODList->PopBack());
@ -48,6 +62,8 @@ ViewLODListManager::~ViewLODListManager()
} }
// FUNCTION: LEGO1 0x100a72c0 // FUNCTION: LEGO1 0x100a72c0
// FUNCTION: BETA10 0x101785ef
// FUNCTION: ALPHA 0x100e35d2
ViewLODList* ViewLODListManager::Create(const ROIName& rROIName, int lodCount) ViewLODList* ViewLODListManager::Create(const ROIName& rROIName, int lodCount)
{ {
// returned ViewLODList has a refCount of 1, i.e. caller must call Release() // returned ViewLODList has a refCount of 1, i.e. caller must call Release()
@ -57,7 +73,7 @@ ViewLODList* ViewLODListManager::Create(const ROIName& rROIName, int lodCount)
int refCount; int refCount;
char* pROIName; char* pROIName;
assert(!Lookup(rROIName)); // assert(!Lookup(rROIName)); // alpha only
pLODList = new ViewLODList(lodCount, this); pLODList = new ViewLODList(lodCount, this);
refCount = pLODList->AddRef(); refCount = pLODList->AddRef();
@ -68,11 +84,11 @@ ViewLODList* ViewLODListManager::Create(const ROIName& rROIName, int lodCount)
list->Release(); list->Release();
char num[12]; char num[12];
sprintf(num, "%d", g_unk0x10101064); sprintf(num, "%d", g_ROINameUID);
pROIName = new char[strlen(rROIName) + strlen(num) + 1]; pROIName = new char[strlen(rROIName) + strlen(num) + 1];
strcpy(pROIName, rROIName); strcpy(pROIName, rROIName);
strcat(pROIName, num); strcat(pROIName, num);
g_unk0x10101064++; g_ROINameUID++;
} }
else { else {
pROIName = new char[strlen(rROIName) + 1]; pROIName = new char[strlen(rROIName) + 1];
@ -82,12 +98,13 @@ ViewLODList* ViewLODListManager::Create(const ROIName& rROIName, int lodCount)
m_map[pROIName] = pLODList; m_map[pROIName] = pLODList;
// NOTE: Lookup() adds a refCount // NOTE: Lookup() adds a refCount
assert((Lookup(rROIName) == pLODList) && (pLODList->Release() == 1)); assert((Lookup(pROIName) == pLODList) && (pLODList->Release() == 1));
return pLODList; return pLODList;
} }
// FUNCTION: LEGO1 0x100a75b0 // FUNCTION: LEGO1 0x100a75b0
// FUNCTION: BETA10 0x101787d8
ViewLODList* ViewLODListManager::Lookup(const ROIName& p_roiName) const ViewLODList* ViewLODListManager::Lookup(const ROIName& p_roiName) const
{ {
// returned ViewLODList's refCount is increased, i.e. caller must call Release() // returned ViewLODList's refCount is increased, i.e. caller must call Release()
@ -106,7 +123,30 @@ ViewLODList* ViewLODListManager::Lookup(const ROIName& p_roiName) const
return pLODList; return pLODList;
} }
// STUB: LEGO1 0x100a7680 // FUNCTION: LEGO1 0x100a7680
void ViewLODListManager::Destroy(ViewLODList* lodList) // FUNCTION: BETA10 0x1017886b
unsigned char ViewLODListManager::Destroy(ViewLODList* lodList)
{ {
ViewLODListMap::iterator iterator;
char deleted = FALSE;
for (iterator = m_map.begin(); !(iterator == m_map.end()); ++iterator) {
const ROIName& rROIName = (*iterator).first;
ViewLODList* pLODList = (*iterator).second;
if (lodList == pLODList) {
while (pLODList->Size() > 0) {
delete const_cast<ViewLOD*>(pLODList->PopBack());
}
delete pLODList;
delete[] const_cast<char*>(rROIName);
m_map.erase(iterator);
deleted = TRUE;
break;
}
}
return deleted;
} }

View file

@ -23,6 +23,7 @@ class ViewLODListManager;
// //
// VTABLE: LEGO1 0x100dbdc4 // VTABLE: LEGO1 0x100dbdc4
// VTABLE: BETA10 0x101c34f0
// SIZE 0x18 // SIZE 0x18
class ViewLODList : public LODList<ViewLOD> { class ViewLODList : public LODList<ViewLOD> {
friend ViewLODListManager; friend ViewLODListManager;
@ -32,6 +33,7 @@ class ViewLODList : public LODList<ViewLOD> {
~ViewLODList() override; ~ViewLODList() override;
// SYNTHETIC: LEGO1 0x100a80f0 // SYNTHETIC: LEGO1 0x100a80f0
// SYNTHETIC: BETA10 0x1017b590
// ViewLODList::`scalar deleting destructor' // ViewLODList::`scalar deleting destructor'
public: public:
@ -53,6 +55,7 @@ class ViewLODList : public LODList<ViewLOD> {
// ??? for now, until we have symbol management // ??? for now, until we have symbol management
typedef const char* ROIName; typedef const char* ROIName;
struct ROINameComparator { struct ROINameComparator {
// FUNCTION: BETA10 0x101794c0
unsigned char operator()(const ROIName& rName1, const ROIName& rName2) const unsigned char operator()(const ROIName& rName1, const ROIName& rName2) const
{ {
return strcmp((const char*) rName1, (const char*) rName2) > 0; return strcmp((const char*) rName1, (const char*) rName2) > 0;
@ -68,6 +71,7 @@ struct ROINameComparator {
// the ViewLODList belongs. // the ViewLODList belongs.
// VTABLE: LEGO1 0x100dbdbc // VTABLE: LEGO1 0x100dbdbc
// VTABLE: BETA10 0x101c34ec
// SIZE 0x14 // SIZE 0x14
class ViewLODListManager { class ViewLODListManager {
@ -88,29 +92,31 @@ class ViewLODListManager {
// returned LODList's refCount is increased, i.e. caller must call Release() // returned LODList's refCount is increased, i.e. caller must call Release()
// when it no longer holds on to the list // when it no longer holds on to the list
ViewLODList* Lookup(const ROIName&) const; ViewLODList* Lookup(const ROIName&) const;
void Destroy(ViewLODList* lodList); unsigned char Destroy(ViewLODList* lodList);
#ifdef _DEBUG #ifdef _DEBUG
void Dump(void (*pTracer)(const char*, ...)) const; void Dump(void (*pTracer)(const char*, ...)) const;
#endif #endif
// SYNTHETIC: LEGO1 0x100a70c0 // SYNTHETIC: LEGO1 0x100a70c0
// SYNTHETIC: BETA10 0x10178a80
// ViewLODListManager::`scalar deleting destructor' // ViewLODListManager::`scalar deleting destructor'
private: private:
static int g_ROINameUID;
ViewLODListMap m_map; ViewLODListMap m_map;
}; };
// clang-format off // clang-format off
// FUNCTION: LEGO1 0x1001dde0 // FUNCTION: LEGO1 0x1001dde0
// FUNCTION: BETA10 0x100223c0
// _Lockit::~_Lockit // _Lockit::~_Lockit
// TEMPLATE: LEGO1 0x100a70e0 // TEMPLATE: LEGO1 0x100a70e0
// TEMPLATE: BETA10 0x10178ac0
// Map<char const *,ViewLODList *,ROINameComparator>::~Map<char const *,ViewLODList *,ROINameComparator> // Map<char const *,ViewLODList *,ROINameComparator>::~Map<char const *,ViewLODList *,ROINameComparator>
// TEMPLATE: LEGO1 0x100a77e0
// LODListBase::~LODListBase
// TEMPLATE: LEGO1 0x100a7800 // TEMPLATE: LEGO1 0x100a7800
// _Tree<char const *,pair<char const * const,ViewLODList *>,map<char const *,ViewLODList *,ROINameComparator,allocator<ViewLODList *> >::_Kfn,ROINameComparator,allocator<ViewLODList *> >::iterator::_Dec // _Tree<char const *,pair<char const * const,ViewLODList *>,map<char const *,ViewLODList *,ROINameComparator,allocator<ViewLODList *> >::_Kfn,ROINameComparator,allocator<ViewLODList *> >::iterator::_Dec
@ -121,28 +127,76 @@ class ViewLODListManager {
// _Tree<char const *,pair<char const * const,ViewLODList *>,map<char const *,ViewLODList *,ROINameComparator,allocator<ViewLODList *> >::_Kfn,ROINameComparator,allocator<ViewLODList *> >::~_Tree<char const *,pair<char const * const,ViewLODList *>,map<char c // _Tree<char const *,pair<char const * const,ViewLODList *>,map<char const *,ViewLODList *,ROINameComparator,allocator<ViewLODList *> >::_Kfn,ROINameComparator,allocator<ViewLODList *> >::~_Tree<char const *,pair<char const * const,ViewLODList *>,map<char c
// TEMPLATE: LEGO1 0x100a7960 // TEMPLATE: LEGO1 0x100a7960
// TEMPLATE: BETA10 0x1017ab40
// _Tree<char const *,pair<char const * const,ViewLODList *>,map<char const *,ViewLODList *,ROINameComparator,allocator<ViewLODList *> >::_Kfn,ROINameComparator,allocator<ViewLODList *> >::erase // _Tree<char const *,pair<char const * const,ViewLODList *>,map<char const *,ViewLODList *,ROINameComparator,allocator<ViewLODList *> >::_Kfn,ROINameComparator,allocator<ViewLODList *> >::erase
// TEMPLATE: LEGO1 0x100a7db0 // TEMPLATE: LEGO1 0x100a7db0
// TEMPLATE: BETA10 0x1017aca0
// _Tree<char const *,pair<char const * const,ViewLODList *>,map<char const *,ViewLODList *,ROINameComparator,allocator<ViewLODList *> >::_Kfn,ROINameComparator,allocator<ViewLODList *> >::_Erase // _Tree<char const *,pair<char const * const,ViewLODList *>,map<char const *,ViewLODList *,ROINameComparator,allocator<ViewLODList *> >::_Kfn,ROINameComparator,allocator<ViewLODList *> >::_Erase
// TEMPLATE: LEGO1 0x100a7df0 // TEMPLATE: LEGO1 0x100a7df0
// TEMPLATE: BETA10 0x101796b0
// _Tree<char const *,pair<char const * const,ViewLODList *>,map<char const *,ViewLODList *,ROINameComparator,allocator<ViewLODList *> >::_Kfn,ROINameComparator,allocator<ViewLODList *> >::_Insert // _Tree<char const *,pair<char const * const,ViewLODList *>,map<char const *,ViewLODList *,ROINameComparator,allocator<ViewLODList *> >::_Kfn,ROINameComparator,allocator<ViewLODList *> >::_Insert
// TEMPLATE: LEGO1 0x100a80a0 // TEMPLATE: LEGO1 0x100a80a0
// TEMPLATE: BETA10 0x1017b1e0
// map<char const *,ViewLODList *,ROINameComparator,allocator<ViewLODList *> >::~map<char const *,ViewLODList *,ROINameComparator,allocator<ViewLODList *> > // map<char const *,ViewLODList *,ROINameComparator,allocator<ViewLODList *> >::~map<char const *,ViewLODList *,ROINameComparator,allocator<ViewLODList *> >
// TEMPLATE: LEGO1 0x100a8160
// LODList<ViewLOD>::~LODList<ViewLOD>
// GLOBAL: LEGO1 0x10101068 // GLOBAL: LEGO1 0x10101068
// GLOBAL: BETA10 0x10205eb4
// _Tree<char const *,pair<char const * const,ViewLODList *>,map<char const *,ViewLODList *,ROINameComparator,allocator<ViewLODList *> >::_Kfn,ROINameComparator,allocator<ViewLODList *> >::_Nil // _Tree<char const *,pair<char const * const,ViewLODList *>,map<char const *,ViewLODList *,ROINameComparator,allocator<ViewLODList *> >::_Kfn,ROINameComparator,allocator<ViewLODList *> >::_Nil
// TEMPLATE: BETA10 0x101791f0
// map<char const *,ViewLODList *,ROINameComparator,allocator<ViewLODList *> >::operator[]
// TEMPLATE: BETA10 0x10178c80
// _Tree<char const *,pair<char const * const,ViewLODList *>,map<char const *,ViewLODList *,ROINameComparator,allocator<ViewLODList *> >::_Kfn,ROINameComparator,allocator<ViewLODList *> >::iterator::operator==
// TEMPLATE: BETA10 0x10178ef0
// map<char const *,ViewLODList *,ROINameComparator,allocator<ViewLODList *> >::begin
// TEMPLATE: BETA10 0x10179070
// map<char const *,ViewLODList *,ROINameComparator,allocator<ViewLODList *> >::end
// TEMPLATE: BETA10 0x10179250
// pair<char const * const,ViewLODList *>::pair<char const * const,ViewLODList *>
// TEMPLATE: BETA10 0x10179280
// map<char const *,ViewLODList *,ROINameComparator,allocator<ViewLODList *> >::insert
// TEMPLATE: BETA10 0x101792c0
// _Tree<char const *,pair<char const * const,ViewLODList *>,map<char const *,ViewLODList *,ROINameComparator,allocator<ViewLODList *> >::_Kfn,ROINameComparator,allocator<ViewLODList *> >::insert
// TEMPLATE: BETA10 0x10178c00
// _Tree<char const *,pair<char const * const,ViewLODList *>,map<char const *,ViewLODList *,ROINameComparator,allocator<ViewLODList *> >::_Kfn,ROINameComparator,allocator<ViewLODList *> >::iterator::operator*
// TEMPLATE: BETA10 0x1017ab10
// map<char const *,ViewLODList *,ROINameComparator,allocator<ViewLODList *> >::erase
// Two iterators
// TEMPLATE: BETA10 0x1017a040
// map<char const *,ViewLODList *,ROINameComparator,allocator<ViewLODList *> >::erase
// One iterator
// TEMPLATE: BETA10 0x10178f80
// _Tree<char const *,pair<char const * const,ViewLODList *>,map<char const *,ViewLODList *,ROINameComparator,allocator<ViewLODList *> >::_Kfn,ROINameComparator,allocator<ViewLODList *> >::_Lmost
// TEMPLATE: BETA10 0x10179e70
// _Tree<char const *,pair<char const * const,ViewLODList *>,map<char const *,ViewLODList *,ROINameComparator,allocator<ViewLODList *> >::_Kfn,ROINameComparator,allocator<ViewLODList *> >::_Rmost
// TEMPLATE: BETA10 0x10179670
// _Tree<char const *,pair<char const * const,ViewLODList *>,map<char const *,ViewLODList *,ROINameComparator,allocator<ViewLODList *> >::_Kfn,ROINameComparator,allocator<ViewLODList *> >::_Color
// TEMPLATE: BETA10 0x1017aa30
// ?swap@@YAXAAW4_Redbl@?$_Tree@PBDU?$pair@QBDPAVViewLODList@@@@U_Kfn@?$map@PBDPAVViewLODList@@UROINameComparator@@V?$allocator@PAVViewLODList@@@@@@UROINameComparator@@V?$allocator@PAVViewLODList@@@@@@0@Z
// clang-format on // clang-format on
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// //
// ViewLODList implementation // ViewLODList implementation
// FUNCTION: BETA10 0x1017b240
inline ViewLODList::ViewLODList(size_t capacity, ViewLODListManager* owner) : LODList<ViewLOD>(capacity), m_refCount(0) inline ViewLODList::ViewLODList(size_t capacity, ViewLODListManager* owner) : LODList<ViewLOD>(capacity), m_refCount(0)
{ {
m_owner = owner; m_owner = owner;
@ -153,25 +207,22 @@ inline ViewLODList::~ViewLODList()
assert(m_refCount == 0); assert(m_refCount == 0);
} }
// FUNCTION: BETA10 0x1007b5b0
inline int ViewLODList::AddRef() inline int ViewLODList::AddRef()
{ {
return ++m_refCount; return ++m_refCount;
} }
// FUNCTION: BETA10 0x1007ad70
inline int ViewLODList::Release() inline int ViewLODList::Release()
{ {
assert(m_refCount > 0); assert(m_refCount > 0);
if (!--m_refCount) { if (!--m_refCount) {
m_owner->Destroy(this); m_owner->Destroy(this);
return 0;
} }
return m_refCount; return m_refCount;
} }
#ifdef _DEBUG
inline void ViewLODList::Dump(void (*pTracer)(const char*, ...)) const
{
// FIXME: dump something
}
#endif
#endif // VIEWLODLIST_H #endif // VIEWLODLIST_H