isle-portable/LEGO1/mxvideoparam.cpp
Anonymous Maarten 302b3f66f0
Get Isle building on MinGW32 (#63)
* Add MxUnknown100dc6b0::~MxUnknown100dc6b0 stub

* Declare destructor of MxOmni and MxTransitionManager in class

* inline attribute must go first

* Stub LegoState::Vtable0x14 for Act3State

* MxStreamer::VTable0x14 is not an override

* Stub MxEntity::Destroy for LegoState::Destroy

* Stub MxUnknown100dc6e0 for MxSoundManager

* ::ClassName and ::IsA are const methods

* methods in the class body don't need a namespace

* MxSoundManager subclasses MxUnknown100dc6e0

* LegoInputManager subclasses MxPresenter

* NotificationId is an enum, and does not need __declspec(dllexport)

* Fix final #endif of legoomni.h and mxobjectfactory.h

* Add const alternative for LegoOmni::Create and MxVideoParam, only available for MinGW

* Alternative approach to MinGW compatibility

* MinGW on Linux is case sensitve

* Don't delete a member variable. C++ automatically destructs member variables

---------

Co-authored-by: MattKC <34096995+itsmattkc@users.noreply.github.com>
2023-07-01 23:53:54 -07:00

88 lines
2.3 KiB
C++

#include "mxvideoparam.h"
#include <stdlib.h>
#include <string.h>
// OFFSET: LEGO1 0x100bec70
MxVideoParam::MxVideoParam()
{
this->m_rect.m_right = 640;
this->m_rect.m_bottom = 480;
this->m_rect.m_left = 0;
this->m_rect.m_top = 0;
this->m_palette = 0;
this->m_backBuffers = 0;
this->m_unk1c = 0;
this->m_deviceId = 0;
}
// OFFSET: LEGO1 0x100beca0
MxVideoParam::MxVideoParam(COMPAT_CONST MxRect32 &p_rect, MxPalette *p_pal, unsigned long p_backBuffers, COMPAT_CONST MxVideoParamFlags &p_flags)
{
this->m_rect.m_left = p_rect.m_left;
this->m_rect.m_top = p_rect.m_top;
this->m_rect.m_right = p_rect.m_right;
this->m_rect.m_bottom = p_rect.m_bottom;
this->m_palette = p_pal;
this->m_backBuffers = p_backBuffers;
this->m_flags = p_flags;
this->m_unk1c = 0;
this->m_deviceId = NULL;
}
// OFFSET: LEGO1 0x100becf0
MxVideoParam::MxVideoParam(MxVideoParam &p_videoParam)
{
this->m_rect.m_left = p_videoParam.m_rect.m_left;
this->m_rect.m_top = p_videoParam.m_rect.m_top;
this->m_rect.m_right = p_videoParam.m_rect.m_right;
this->m_rect.m_bottom = p_videoParam.m_rect.m_bottom;
this->m_palette = p_videoParam.m_palette;
this->m_backBuffers = p_videoParam.m_backBuffers;
this->m_flags = p_videoParam.m_flags;
this->m_unk1c = p_videoParam.m_unk1c;
this->m_deviceId = NULL;
SetDeviceName(p_videoParam.m_deviceId);
}
// OFFSET: LEGO1 0x100bede0
MxVideoParam &MxVideoParam::operator=(const MxVideoParam &p_videoParam)
{
this->m_rect.m_left = p_videoParam.m_rect.m_left;
this->m_rect.m_top = p_videoParam.m_rect.m_top;
this->m_rect.m_right = p_videoParam.m_rect.m_right;
this->m_rect.m_bottom = p_videoParam.m_rect.m_bottom;
this->m_palette = p_videoParam.m_palette;
this->m_backBuffers = p_videoParam.m_backBuffers;
this->m_flags = p_videoParam.m_flags;
this->m_unk1c = p_videoParam.m_unk1c;
SetDeviceName(p_videoParam.m_deviceId);
return *this;
}
// OFFSET: LEGO1 0x100bed70
void MxVideoParam::SetDeviceName(char *id)
{
if (this->m_deviceId != 0)
free(this->m_deviceId);
if (id != 0)
{
this->m_deviceId = (char *)malloc(strlen(id) + 1);
if (this->m_deviceId != 0) {
strcpy(this->m_deviceId, id);
}
}
else {
this->m_deviceId = 0;
}
}
// OFFSET: LEGO1 0x100bed50
MxVideoParam::~MxVideoParam()
{
if (this->m_deviceId != 0)
free(this->m_deviceId);
}