video/legohideanimpresenter: Init, dtor, most of destroy function (#447)

* video/legohideanimpresenter: Init, dtor, most of destroy function

* Format

* Finish Destroy

---------

Co-authored-by: Christian Semmler <mail@csemmler.com>
This commit is contained in:
Joshua Peisach 2024-01-17 12:24:05 -05:00 committed by GitHub
parent b25239f22d
commit d369429e98
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 34 additions and 3 deletions

View file

@ -1,6 +1,7 @@
#ifndef LEGOHIDEANIMPRESENTER_H
#define LEGOHIDEANIMPRESENTER_H
#include "decomp.h"
#include "legoloopinganimpresenter.h"
// VTABLE: LEGO1 0x100d9278
@ -23,8 +24,13 @@ class LegoHideAnimPresenter : public LegoLoopingAnimPresenter {
return !strcmp(p_name, ClassName()) || LegoAnimPresenter::IsA(p_name);
}
virtual void Destroy() override; // vtable+0x38
private:
void Init();
void Destroy(MxBool p_fromDestructor);
undefined4* m_unk0xc0; // 0xc0
};
// SYNTHETIC: LEGO1 0x1006d9d0

View file

@ -1,18 +1,43 @@
#include "legohideanimpresenter.h"
DECOMP_SIZE_ASSERT(LegoHideAnimPresenter, 0xc4)
// FUNCTION: LEGO1 0x1006d7e0
LegoHideAnimPresenter::LegoHideAnimPresenter()
{
Init();
}
// STUB: LEGO1 0x1006d9f0
// FUNCTION: LEGO1 0x1006d9f0
LegoHideAnimPresenter::~LegoHideAnimPresenter()
{
// TODO
Destroy(TRUE);
}
// STUB: LEGO1 0x1006da50
// FUNCTION: LEGO1 0x1006da50
void LegoHideAnimPresenter::Init()
{
m_unk0xc0 = NULL;
}
// FUNCTION: LEGO1 0x1006da60
void LegoHideAnimPresenter::Destroy(MxBool p_fromDestructor)
{
m_criticalSection.Enter();
if (m_unk0xc0)
delete m_unk0xc0;
Init();
m_criticalSection.Leave();
// This appears to be a bug, since it results in an endless loop
if (!p_fromDestructor)
LegoHideAnimPresenter::Destroy();
}
// FUNCTION: LEGO1 0x1006dac0
void LegoHideAnimPresenter::Destroy()
{
Destroy(FALSE);
}