CModel destructor & frame list fixes

This commit is contained in:
Luke Street 2022-03-09 02:23:56 -05:00
parent 8d83afa102
commit d62336b813
6 changed files with 19 additions and 2 deletions

View File

@ -2099,7 +2099,10 @@ void CStateManager::UpdateAreaSounds() {
CSfxManager::SetActiveAreas(areas); CSfxManager::SetActiveAreas(areas);
} }
void CStateManager::FrameEnd() { g_SimplePool->Flush(); } void CStateManager::FrameEnd() {
CModel::FrameDone();
g_SimplePool->Flush();
}
void CStateManager::ProcessPlayerInput() { void CStateManager::ProcessPlayerInput() {
if (x84c_player) { if (x84c_player) {

View File

@ -102,6 +102,8 @@ IObj* CToken::GetObj() {
return x0_objRef->GetObject(); return x0_objRef->GetObject();
} }
CToken& CToken::operator=(const CToken& other) { CToken& CToken::operator=(const CToken& other) {
if (this == &other)
return *this;
Unlock(); Unlock();
RemoveRef(); RemoveRef();
x0_objRef = other.x0_objRef; x0_objRef = other.x0_objRef;

View File

@ -133,6 +133,11 @@ CModel::CModel(std::unique_ptr<u8[]> in, u32 dataLen, IObjectStore* store)
// DCFlushRange(x0_data, dataLen); // DCFlushRange(x0_data, dataLen);
} }
CModel::~CModel() {
RemoveFromList();
sTotalMemory -= x4_dataLen;
}
void CModel::UpdateLastFrame() { x38_lastFrame = CGraphics::GetFrameCounter(); } void CModel::UpdateLastFrame() { x38_lastFrame = CGraphics::GetFrameCounter(); }
void CModel::MoveToThisFrameList() { void CModel::MoveToThisFrameList() {

View File

@ -92,6 +92,7 @@ private:
public: public:
CModel(std::unique_ptr<u8[]> in, u32 dataLen, IObjectStore* store); CModel(std::unique_ptr<u8[]> in, u32 dataLen, IObjectStore* store);
~CModel();
void UpdateLastFrame(); void UpdateLastFrame();
void MoveToThisFrameList(); void MoveToThisFrameList();

View File

@ -168,7 +168,10 @@ void CInGameGuiManager::DoStateTransition(CStateManager& stateMgr) {
} }
} }
void CInGameGuiManager::DestroyAreaTextures(CStateManager& stateMgr) {} void CInGameGuiManager::DestroyAreaTextures(CStateManager& stateMgr) {
// TODO
CModel::DisableTextureTimeout();
}
void CInGameGuiManager::TryReloadAreaTextures() {} void CInGameGuiManager::TryReloadAreaTextures() {}
@ -270,6 +273,7 @@ void CInGameGuiManager::OnNewPauseScreenState(CArchitectureQueue& archQueue) {
if (x1c0_nextState >= EInGameGuiState::Zero && x1c0_nextState <= EInGameGuiState::InGame) { if (x1c0_nextState >= EInGameGuiState::Zero && x1c0_nextState <= EInGameGuiState::InGame) {
if (x44_messageScreen) if (x44_messageScreen)
x44_messageScreen.reset(); x44_messageScreen.reset();
CModel::EnableTextureTimeout();
RefreshHudOptions(); RefreshHudOptions();
} }
x1bc_prevState = x1c0_nextState; x1bc_prevState = x1c0_nextState;

View File

@ -255,6 +255,7 @@ void CMFGame::EnterMapScreen() {
} }
CMFGameLoader::CMFGameLoader() : CMFGameLoaderBase("CMFGameLoader") { CMFGameLoader::CMFGameLoader() : CMFGameLoaderBase("CMFGameLoader") {
CModel::DisableTextureTimeout();
auto* m = static_cast<CMain*>(g_Main); auto* m = static_cast<CMain*>(g_Main);
switch (m->GetFlowState()) { switch (m->GetFlowState()) {
case EClientFlowStates::Default: case EClientFlowStates::Default:
@ -357,6 +358,7 @@ CIOWin::EMessageReturn CMFGameLoader::OnMessage(const CArchitectureMessage& msg,
if (x2c_25_transitionFinished) { if (x2c_25_transitionFinished) {
queue.Push(MakeMsg::CreateCreateIOWin(EArchMsgTarget::IOWinManager, 10, 1000, queue.Push(MakeMsg::CreateCreateIOWin(EArchMsgTarget::IOWinManager, 10, 1000,
std::make_shared<CMFGame>(x14_stateMgr, x18_guiMgr, queue))); std::make_shared<CMFGame>(x14_stateMgr, x18_guiMgr, queue)));
CModel::EnableTextureTimeout();
return EMessageReturn::RemoveIOWinAndExit; return EMessageReturn::RemoveIOWinAndExit;
} }
break; break;