From eeb980fa0ffb129781edea5882e01912925e36fb Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Thu, 4 Jan 2024 16:46:16 -0500 Subject: [PATCH] Let game boot again (#404) --- LEGO1/lego3dview.cpp | 2 +- LEGO1/viewmanager/viewlodlist.cpp | 26 +++++++++++++++++++++++--- LEGO1/viewmanager/viewlodlist.h | 2 +- 3 files changed, 25 insertions(+), 5 deletions(-) diff --git a/LEGO1/lego3dview.cpp b/LEGO1/lego3dview.cpp index efe79db1..b9576815 100644 --- a/LEGO1/lego3dview.cpp +++ b/LEGO1/lego3dview.cpp @@ -18,7 +18,7 @@ Lego3DView::~Lego3DView() // STUB: LEGO1 0x100aaf90 BOOL Lego3DView::Create(TglSurface::CreateStruct& p_createStruct, Tgl::Renderer* p_renderer) { - return FALSE; + return TRUE; } // STUB: LEGO1 0x100ab100 diff --git a/LEGO1/viewmanager/viewlodlist.cpp b/LEGO1/viewmanager/viewlodlist.cpp index 50628b18..9a8456fc 100644 --- a/LEGO1/viewmanager/viewlodlist.cpp +++ b/LEGO1/viewmanager/viewlodlist.cpp @@ -16,10 +16,30 @@ ViewLODListManager::~ViewLODListManager() } // STUB: LEGO1 0x100a72c0 -ViewLODList* ViewLODListManager::Create(const ROIName&, int lodCount) +ViewLODList* ViewLODListManager::Create(const ROIName& rROIName, int lodCount) { - // TODO - return NULL; + // returned ViewLODList has a refCount of 1, i.e. caller must call Release() + // when it no longer holds on to the list + + ViewLODList* pLODList; + int refCount; + char* pROIName; + + assert(!Lookup(rROIName)); + + pLODList = new ViewLODList(lodCount); + refCount = pLODList->AddRef(); + assert(refCount == 1); + + pROIName = new char[strlen(rROIName) + 1]; + strcpy(pROIName, rROIName); + + m_map[pROIName] = pLODList; + + // NOTE: Lookup() adds a refCount + assert((Lookup(rROIName) == pLODList) && (pLODList->Release() == 1)); + + return pLODList; } // STUB: LEGO1 0x100a7680 diff --git a/LEGO1/viewmanager/viewlodlist.h b/LEGO1/viewmanager/viewlodlist.h index fe86f04e..c0d5ed82 100644 --- a/LEGO1/viewmanager/viewlodlist.h +++ b/LEGO1/viewmanager/viewlodlist.h @@ -75,7 +75,7 @@ class ViewLODListManager { // creates an LODList with room for lodCount LODs for a named ROI // returned LODList has a refCount of 1, i.e. caller must call Release() // when it no longer holds on to the list - ViewLODList* Create(const ROIName&, int lodCount); + ViewLODList* Create(const ROIName& rROIName, int lodCount); // returns an LODList for a named ROI // returned LODList's refCount is increased, i.e. caller must call Release()