isle-portable/LEGO1/omni/src/video/mxvideoparam.cpp
Anonymous Maarten 9e686e2a87
cmake+ci: run clang-tidy (#512)
* cmake+ci: run clang-tidy

* Remove DESCRIPTION from LEGO1/LegoOmni.mingw.def

* Add initial .clang-tidy and fixes

* fix file perms

* Comment out DESCRIPTION

* Remove LegoEntity::~LegoEntity and MxPresenter::~MxPresenter from mingw's LEGO1.def

* Looks like clang is allergic to the libs in the directx5 SDK

* Update .clang-tidy

* Fix typo in .clang-tidy

* Attempt to generate an action error

* Revert "Attempt to generate an action error"

This reverts commit 96c4c65fedbc4102837f4bcbbb9ee83a7d14cba3.

* cmake: test with -Wparentheses + optionally with -Werror

* ci: -k0 is a Ninja argument

* Use -Werror only for msys2 builds

* cmake: only emit warnings for specific warnings

* cmake: and don't do -Werror/-WX anymore

* Fix warnings

* Fix mingw warnings

---------

Co-authored-by: Christian Semmler <mail@csemmler.com>
2024-02-01 21:42:10 +01:00

85 lines
1.9 KiB
C++

#include "mxvideoparam.h"
#include "decomp.h"
#include <stdlib.h>
#include <string.h>
DECOMP_SIZE_ASSERT(MxVideoParam, 0x24);
// FUNCTION: LEGO1 0x100bec70
MxVideoParam::MxVideoParam()
{
this->m_rect.SetRight(640);
this->m_rect.SetBottom(480);
this->m_rect.SetLeft(0);
this->m_rect.SetTop(0);
this->m_palette = NULL;
this->m_backBuffers = 0;
this->m_unk0x1c = 0;
this->m_deviceId = NULL;
}
// FUNCTION: LEGO1 0x100beca0
MxVideoParam::MxVideoParam(MxRect32& p_rect, MxPalette* p_palette, MxULong p_backBuffers, MxVideoParamFlags& p_flags)
{
this->m_rect = p_rect;
this->m_palette = p_palette;
this->m_backBuffers = p_backBuffers;
this->m_flags = p_flags;
this->m_unk0x1c = 0;
this->m_deviceId = NULL;
}
// FUNCTION: LEGO1 0x100becf0
MxVideoParam::MxVideoParam(MxVideoParam& p_videoParam)
{
this->m_rect = p_videoParam.m_rect;
this->m_palette = p_videoParam.m_palette;
this->m_backBuffers = p_videoParam.m_backBuffers;
this->m_flags = p_videoParam.m_flags;
this->m_unk0x1c = p_videoParam.m_unk0x1c;
this->m_deviceId = NULL;
SetDeviceName(p_videoParam.m_deviceId);
}
// FUNCTION: LEGO1 0x100bed50
MxVideoParam::~MxVideoParam()
{
if (this->m_deviceId != NULL) {
delete[] this->m_deviceId;
}
}
// FUNCTION: LEGO1 0x100bed70
void MxVideoParam::SetDeviceName(char* p_deviceId)
{
if (this->m_deviceId != NULL) {
delete[] this->m_deviceId;
}
if (p_deviceId != NULL) {
this->m_deviceId = new char[strlen(p_deviceId) + 1];
if (this->m_deviceId != NULL) {
strcpy(this->m_deviceId, p_deviceId);
}
}
else {
this->m_deviceId = NULL;
}
}
// FUNCTION: LEGO1 0x100bede0
MxVideoParam& MxVideoParam::operator=(const MxVideoParam& p_videoParam)
{
this->m_rect = p_videoParam.m_rect;
this->m_palette = p_videoParam.m_palette;
this->m_backBuffers = p_videoParam.m_backBuffers;
this->m_flags = p_videoParam.m_flags;
this->m_unk0x1c = p_videoParam.m_unk0x1c;
SetDeviceName(p_videoParam.m_deviceId);
return *this;
}