mirror of
https://github.com/isledecomp/isle.git
synced 2024-11-29 19:16:05 -05:00
Implement a few LegoVideoManager/MxDisplaySurface functions (#364)
* implement a few functions * fixes * Fixes * Add annotations --------- Co-authored-by: Christian Semmler <mail@csemmler.com>
This commit is contained in:
parent
e824e321e8
commit
ceca2aac31
5 changed files with 123 additions and 9 deletions
|
@ -2,6 +2,7 @@
|
|||
#define LEGO3DVIEW_H
|
||||
|
||||
#include "mxtypes.h"
|
||||
#include "tgl/d3drm/impl.h"
|
||||
#include "viewmanager/viewmanager.h"
|
||||
|
||||
class LegoROI;
|
||||
|
@ -9,11 +10,18 @@ class LegoROI;
|
|||
class Lego3DView {
|
||||
public:
|
||||
inline ViewManager* GetViewManager() { return this->m_viewManager; }
|
||||
inline TglImpl::ViewImpl* GetViewPort() { return this->m_viewPort; }
|
||||
LegoROI* PickROI(MxLong p_a, MxLong p_b);
|
||||
|
||||
private:
|
||||
char m_pad[0x88];
|
||||
ViewManager* m_viewManager;
|
||||
// TODO: all of these fields are in various base classes
|
||||
undefined4 m_vtable; // 0x0 (TODO: remove once virtual function added)
|
||||
undefined4 m_unk0x4; // 0x4
|
||||
TglImpl::RendererImpl* m_renderImpl; // 0x8
|
||||
TglImpl::DeviceImpl* m_deviceImpl; // 0xc
|
||||
TglImpl::ViewImpl* m_viewPort; // 0x10
|
||||
char m_pad[0x78]; // 0x14
|
||||
ViewManager* m_viewManager; // 0x88
|
||||
};
|
||||
|
||||
#endif // LEGO3DVIEW_H
|
||||
|
|
|
@ -37,6 +37,13 @@ LegoVideoManager::~LegoVideoManager()
|
|||
delete m_palette;
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x1007ac40
|
||||
MxResult LegoVideoManager::Create(MxVideoParam& p_videoParam, MxU32 p_frequencyMS, MxBool p_createThread)
|
||||
{
|
||||
// TODO
|
||||
return MxVideoManager::Create(p_videoParam, p_frequencyMS, p_createThread);
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x1007b5e0
|
||||
void LegoVideoManager::Destroy()
|
||||
{
|
||||
|
@ -69,6 +76,31 @@ void LegoVideoManager::MoveCursor(MxS32 p_cursorX, MxS32 p_cursorY)
|
|||
m_cursorY = 463;
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x1007b770
|
||||
MxResult LegoVideoManager::Tickle()
|
||||
{
|
||||
// TODO
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x1007c080
|
||||
void LegoVideoManager::VTable0x38(undefined4, undefined4)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x1007c290
|
||||
MxResult LegoVideoManager::RealizePalette(MxPalette* p_pallete)
|
||||
{
|
||||
if (p_pallete && m_videoParam.GetPalette()) {
|
||||
p_pallete->GetEntries(m_paletteEntries);
|
||||
m_videoParam.GetPalette()->SetEntries(m_paletteEntries);
|
||||
m_displaySurface->SetPalette(m_videoParam.GetPalette());
|
||||
}
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x1007c300
|
||||
void LegoVideoManager::EnableFullScreenMovie(MxBool p_enable)
|
||||
{
|
||||
|
@ -135,9 +167,7 @@ void LegoVideoManager::SetSkyColor(float p_red, float p_green, float p_blue)
|
|||
colorStrucure.peFlags = -124;
|
||||
m_videoParam.GetPalette()->SetSkyColor(&colorStrucure);
|
||||
m_videoParam.GetPalette()->SetOverrideSkyColor(TRUE);
|
||||
|
||||
// TODO 3d manager
|
||||
// m_3dManager->m_pViewport->VTable0x1c(red, green, blue)
|
||||
m_3dManager->GetLego3DView()->GetViewPort()->SetBackgroundColor(p_red, p_green, p_blue);
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x1007c4c0
|
||||
|
@ -146,6 +176,21 @@ void LegoVideoManager::OverrideSkyColor(MxBool p_shouldOverride)
|
|||
this->m_videoParam.GetPalette()->SetOverrideSkyColor(p_shouldOverride);
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x1007c4d0
|
||||
void LegoVideoManager::VTable0x34(MxU32 p_x, MxU32 p_y, MxU32 p_width, MxU32 p_height)
|
||||
{
|
||||
if (p_width == 0) {
|
||||
p_width = m_videoParam.GetRect().GetWidth();
|
||||
}
|
||||
if (p_height == 0) {
|
||||
p_height = m_videoParam.GetRect().GetHeight();
|
||||
}
|
||||
|
||||
if (!m_initialized) {
|
||||
m_3dManager->GetLego3DView()->GetViewPort()->ForceUpdate(p_x, p_y, p_width, p_height);
|
||||
}
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x1007c560
|
||||
int LegoVideoManager::EnableRMDevice()
|
||||
{
|
||||
|
|
|
@ -21,7 +21,15 @@ class LegoVideoManager : public MxVideoManager {
|
|||
__declspec(dllexport) void EnableFullScreenMovie(MxBool p_enable, MxBool p_scale);
|
||||
__declspec(dllexport) void MoveCursor(MxS32 p_cursorX, MxS32 p_cursorY);
|
||||
|
||||
virtual MxResult Tickle() override; // vtable+0x8
|
||||
virtual void Destroy() override; // vtable+0x18
|
||||
virtual MxResult Create(MxVideoParam& p_videoParam, MxU32 p_frequencyMS, MxBool p_createThread)
|
||||
override; // vtable+0x2c
|
||||
virtual MxResult RealizePalette(MxPalette*) override; // vtable+0x30
|
||||
virtual void VTable0x34(MxU32 p_x, MxU32 p_y, MxU32 p_width, MxU32 p_height) override; // vtable+0x34
|
||||
virtual void VTable0x38(undefined4, undefined4); // vtable+0x38
|
||||
// FUNCTION: LGEO1 0x1007ab10
|
||||
virtual undefined4 VTable0x3c() { return m_unk0x4e8; } // vtable+0x3c
|
||||
|
||||
void SetSkyColor(float p_red, float p_green, float p_blue);
|
||||
void OverrideSkyColor(MxBool p_shouldOverride);
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
|
||||
DECOMP_SIZE_ASSERT(MxDisplaySurface, 0xac);
|
||||
|
||||
MxU32 g_unk0x1010215c = 0;
|
||||
|
||||
// FUNCTION: LEGO1 0x100ba500
|
||||
MxDisplaySurface::MxDisplaySurface()
|
||||
{
|
||||
|
@ -248,9 +250,60 @@ undefined4 MxDisplaySurface::VTable0x34(undefined4, undefined4, undefined4, unde
|
|||
return 0;
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x100bba50
|
||||
void MxDisplaySurface::Display(undefined4, undefined4, undefined4, undefined4, undefined4, undefined4)
|
||||
// FUNCTION: LEGO1 0x100bba50
|
||||
void MxDisplaySurface::Display(MxS32 p_left, MxS32 p_top, MxS32 p_left2, MxS32 p_top2, MxS32 p_width, MxS32 p_height)
|
||||
{
|
||||
if (m_videoParam.Flags().GetF2bit1()) {
|
||||
if (m_videoParam.Flags().GetFlipSurfaces()) {
|
||||
if (g_unk0x1010215c < 2) {
|
||||
g_unk0x1010215c++;
|
||||
|
||||
DDSURFACEDESC ddsd;
|
||||
memset(&ddsd, 0, sizeof(ddsd));
|
||||
ddsd.dwSize = sizeof(ddsd);
|
||||
if (m_ddSurface2->Lock(NULL, &ddsd, 1, NULL) == S_OK) {
|
||||
MxU8* surface = (MxU8*) ddsd.lpSurface;
|
||||
MxS32 height = m_videoParam.GetRect().GetHeight();
|
||||
|
||||
for (MxU32 i = 0; i < ddsd.dwHeight; i++) {
|
||||
memset(surface, 0, ddsd.dwWidth * ddsd.ddpfPixelFormat.dwRGBBitCount / 8);
|
||||
surface += ddsd.lPitch;
|
||||
}
|
||||
|
||||
m_ddSurface2->Unlock(ddsd.lpSurface);
|
||||
}
|
||||
else {
|
||||
OutputDebugString("MxDisplaySurface::Display error\n");
|
||||
}
|
||||
}
|
||||
m_ddSurface1->Flip(NULL, 1);
|
||||
}
|
||||
else {
|
||||
POINT point = {0, 0};
|
||||
ClientToScreen(MxOmni::GetInstance()->GetWindowHandle(), &point);
|
||||
|
||||
// TODO: Match
|
||||
RECT rect1, rect2;
|
||||
rect1.left = p_left2 + m_videoParam.GetRect().GetLeft() + point.x;
|
||||
rect2.left = p_left;
|
||||
rect1.top = p_top2 + m_videoParam.GetRect().GetTop() + point.y;
|
||||
rect2.right = p_left + p_width;
|
||||
rect2.top = p_top;
|
||||
rect2.bottom = p_top + p_height;
|
||||
rect1.right = rect1.left + p_width;
|
||||
rect1.bottom = rect1.top + p_height;
|
||||
|
||||
DDBLTFX data;
|
||||
memset(&data, 0, sizeof(data));
|
||||
data.dwSize = sizeof(data);
|
||||
data.dwDDFX = 8;
|
||||
|
||||
if (m_ddSurface1->Blt(&rect1, m_ddSurface2, &rect2, 0, &data) == DDERR_SURFACELOST) {
|
||||
m_ddSurface1->Restore();
|
||||
m_ddSurface1->Blt(&rect1, m_ddSurface2, &rect2, 0, &data);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100bbc10
|
||||
|
|
|
@ -62,7 +62,7 @@ class MxDisplaySurface : public MxCore {
|
|||
MxBool
|
||||
);
|
||||
virtual undefined4 VTable0x34(undefined4, undefined4, undefined4, undefined4, undefined4, undefined4);
|
||||
virtual void Display(undefined4, undefined4, undefined4, undefined4, undefined4, undefined4);
|
||||
virtual void Display(MxS32 p_left, MxS32 p_top, MxS32 p_left2, MxS32 p_top2, MxS32 p_width, MxS32 p_height);
|
||||
virtual void GetDC(HDC* p_hdc);
|
||||
virtual void ReleaseDC(HDC p_hdc);
|
||||
virtual LPDIRECTDRAWSURFACE VTable0x44(MxBitmap*, undefined4*, undefined4, undefined4);
|
||||
|
|
Loading…
Reference in a new issue