mirror of
https://github.com/isledecomp/isle.git
synced 2024-11-22 23:57:54 -05:00
Implement MxVideoManager::Destroy / destructor (#207)
* MxVideoManager::Destroy / destructor * Consistency * Add missing override
This commit is contained in:
parent
f062543f87
commit
5ddfaab9e7
3 changed files with 51 additions and 6 deletions
|
@ -1,6 +1,8 @@
|
|||
#include "mxvideomanager.h"
|
||||
#include "mxautolocker.h"
|
||||
#include "mxpresenter.h"
|
||||
#include "mxticklemanager.h"
|
||||
#include "legoomni.h"
|
||||
|
||||
// OFFSET: LEGO1 0x100be1f0
|
||||
MxVideoManager::MxVideoManager()
|
||||
|
@ -8,10 +10,10 @@ MxVideoManager::MxVideoManager()
|
|||
Init();
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x100be2a0 STUB
|
||||
// OFFSET: LEGO1 0x100be2a0
|
||||
MxVideoManager::~MxVideoManager()
|
||||
{
|
||||
// TODO
|
||||
Destroy(TRUE);
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x100bea90
|
||||
|
@ -50,6 +52,41 @@ MxResult MxVideoManager::Init()
|
|||
return SUCCESS;
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x100be340
|
||||
void MxVideoManager::Destroy(MxBool p_fromDestructor)
|
||||
{
|
||||
if (m_thread) {
|
||||
m_thread->Terminate();
|
||||
delete m_thread;
|
||||
}
|
||||
else
|
||||
TickleManager()->UnregisterClient(this);
|
||||
|
||||
m_criticalSection.Enter();
|
||||
|
||||
if (m_displaySurface)
|
||||
delete m_displaySurface;
|
||||
|
||||
if (m_region)
|
||||
delete m_region;
|
||||
|
||||
if (m_videoParam.GetPalette())
|
||||
delete m_videoParam.GetPalette();
|
||||
|
||||
if (m_unk60) {
|
||||
if (m_pDirectDraw)
|
||||
m_pDirectDraw->Release();
|
||||
if (m_pDDSurface)
|
||||
m_pDDSurface->Release();
|
||||
}
|
||||
|
||||
Init();
|
||||
m_criticalSection.Leave();
|
||||
|
||||
if (!p_fromDestructor)
|
||||
MxMediaManager::Destroy();
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x100be440
|
||||
void MxVideoManager::SortPresenterList()
|
||||
{
|
||||
|
@ -89,6 +126,12 @@ void MxVideoManager::UpdateRegion()
|
|||
// TODO
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x100bea50
|
||||
void MxVideoManager::Destroy()
|
||||
{
|
||||
Destroy(FALSE);
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x100bea60 STUB
|
||||
void MxVideoManager::InvalidateRect(MxRect32 &p_rect)
|
||||
{
|
||||
|
|
|
@ -11,9 +11,10 @@
|
|||
class MxVideoManager : public MxMediaManager
|
||||
{
|
||||
public:
|
||||
virtual ~MxVideoManager();
|
||||
virtual ~MxVideoManager() override;
|
||||
|
||||
virtual MxResult Tickle() override; // vtable+0x8
|
||||
virtual void Destroy() override; // vtable+0x18
|
||||
virtual void vtable0x28(); // vtable+0x28 (TODO ARGUMENTS)
|
||||
virtual MxResult vtable0x2c(MxVideoParam& p_videoParam, undefined4 p_unknown1, MxU8 p_unknown2); // vtable+0x2c
|
||||
|
||||
|
@ -23,6 +24,7 @@ class MxVideoManager : public MxMediaManager
|
|||
MxVideoManager();
|
||||
|
||||
MxResult Init();
|
||||
void Destroy(MxBool p_fromDestructor);
|
||||
void SortPresenterList();
|
||||
void UpdateRegion();
|
||||
|
||||
|
|
|
@ -65,11 +65,11 @@ MxVideoParam &MxVideoParam::operator=(const MxVideoParam &p_videoParam)
|
|||
void MxVideoParam::SetDeviceName(char *id)
|
||||
{
|
||||
if (this->m_deviceId != 0)
|
||||
free(this->m_deviceId);
|
||||
delete[] this->m_deviceId;
|
||||
|
||||
if (id != 0)
|
||||
{
|
||||
this->m_deviceId = (char *)malloc(strlen(id) + 1);
|
||||
this->m_deviceId = new char[strlen(id) + 1];
|
||||
|
||||
if (this->m_deviceId != 0) {
|
||||
strcpy(this->m_deviceId, id);
|
||||
|
@ -84,5 +84,5 @@ void MxVideoParam::SetDeviceName(char *id)
|
|||
MxVideoParam::~MxVideoParam()
|
||||
{
|
||||
if (this->m_deviceId != 0)
|
||||
free(this->m_deviceId);
|
||||
delete[] this->m_deviceId;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue