isle/LEGO1/mxvideoparam.cpp
2023-06-14 01:22:42 +01:00

54 lines
1.2 KiB
C++

#include "mxvideoparam.h"
MxVideoParam::MxVideoParam()
{
this->m_flags = MxVideoParamFlags();
this->m_right = 640;
this->m_bottom = 480;
this->m_left = 0;
this->m_top = 0;
this->m_palette = 0;
this->m_backBuffers = 0;
this->m_unk1c = 0;
this->m_deviceId = 0;
}
MxVideoParam &MxVideoParam::operator=(const MxVideoParam &other)
{
m_flags = MxVideoParamFlags();
m_left = other.m_left;
m_top = other.m_top;
m_right = other.m_right;
m_bottom = other.m_bottom;
m_palette = other.m_palette;
m_backBuffers = other.m_backBuffers;
m_flags = other.m_flags;
m_unk1c = other.m_unk1c;
m_deviceId = other.m_deviceId;
SetDeviceName(other.m_deviceId);
return *this;
}
// TODO: this doesn't match exactly, something weird with the conditional on id
void MxVideoParam::SetDeviceName(char *id)
{
if (this->m_deviceId != 0)
free(this->m_deviceId);
if (id == 0)
{
this->m_deviceId = 0;
}
else
{
this->m_deviceId = (char *)malloc(strlen(id) + 1);
strcpy(this->m_deviceId, id);
}
}
MxVideoParam::~MxVideoParam()
{
if (this->m_deviceId != 0)
free(this->m_deviceId);
}