diff --git a/CMakeLists.txt b/CMakeLists.txt index 3650c718..cdf37ff1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -47,6 +47,7 @@ add_library(lego1 SHARED LEGO1/jukebox.cpp LEGO1/jukeboxentity.cpp LEGO1/jukeboxstate.cpp + LEGO1/lego3dmanager.cpp LEGO1/lego3dview.cpp LEGO1/legoact2state.cpp LEGO1/legoactioncontrolpresenter.cpp @@ -161,6 +162,7 @@ add_library(lego1 SHARED LEGO1/mxramstreamcontroller.cpp LEGO1/mxramstreamprovider.cpp LEGO1/mxregion.cpp + LEGO1/mxrendersettings.cpp LEGO1/mxscheduler.cpp LEGO1/mxsemaphore.cpp LEGO1/mxsmack.cpp diff --git a/LEGO1/lego3dmanager.cpp b/LEGO1/lego3dmanager.cpp new file mode 100644 index 00000000..c399b1a8 --- /dev/null +++ b/LEGO1/lego3dmanager.cpp @@ -0,0 +1,46 @@ +#include "lego3dmanager.h" + +#include "decomp.h" +#include "mxrendersettings.h" +#include "mxunknown100dbdbc.h" +#include "tgl/tgl.h" + +DECOMP_SIZE_ASSERT(Lego3DManager, 0x10); + +// FUNCTION: LEGO1 0x100ab320 +Lego3DManager::Lego3DManager() +{ + m_render = NULL; + m_3dView = NULL; + m_unk0x0c = NULL; +} + +// FUNCTION: LEGO1 0x100ab360 +Lego3DManager::~Lego3DManager() +{ + Destroy(); +} + +// FUNCTION: LEGO1 0x100ab370 +void Lego3DManager::Init(MxRenderSettings& p_settings) +{ + m_unk0x0c = new MxUnknown100dbdbc(); + m_render = Tgl::CreateRenderer(); + m_3dView = new Lego3DView(); + + MxRenderSettings settings; + MxRenderSettings::CopyFrom(settings, p_settings); + + m_3dView->Init(settings, *m_render); +} + +// FUNCTION: LEGO1 0x100ab460 +void Lego3DManager::Destroy() +{ + delete m_3dView; + m_3dView = NULL; + delete m_render; + m_render = NULL; + delete m_unk0x0c; + m_unk0x0c = NULL; +} diff --git a/LEGO1/lego3dmanager.h b/LEGO1/lego3dmanager.h index 3e1cf202..78c532a5 100644 --- a/LEGO1/lego3dmanager.h +++ b/LEGO1/lego3dmanager.h @@ -3,14 +3,27 @@ #include "lego3dview.h" +class MxUnknown100dbdbc; + +// VTABLE: LEGO1 0x100dbfa4 +// SIZE 0x10 class Lego3DManager { public: + Lego3DManager(); + virtual ~Lego3DManager(); + inline Lego3DView* GetLego3DView() { return this->m_3dView; } private: - undefined4 m_unk0x00; // 0x00 - undefined4 m_unk0x04; // 0x04 - Lego3DView* m_3dView; // 0x08 + Tgl::Renderer* m_render; // 0x04 + Lego3DView* m_3dView; // 0x08 + MxUnknown100dbdbc* m_unk0x0c; // 0x0c + + void Init(MxRenderSettings& p_settings); + void Destroy(); }; +// SYNTHETIC: LEGO1 0x100ab340 +// Lego3DManager::`scalar deleting destructor' + #endif // LEGO3DMANAGER_H diff --git a/LEGO1/lego3dview.cpp b/LEGO1/lego3dview.cpp index 0bb384e8..096e7b9e 100644 --- a/LEGO1/lego3dview.cpp +++ b/LEGO1/lego3dview.cpp @@ -1,6 +1,25 @@ #include "lego3dview.h" #include "legoroi.h" +#include "tgl/tgl.h" + +DECOMP_SIZE_ASSERT(Lego3DView, 0xa8) + +// STUB: LEGO1 0x100aae90 +Lego3DView::Lego3DView() +{ +} + +// STUB: LEGO1 0x100aaf30 +Lego3DView::~Lego3DView() +{ +} + +// STUB: LEGO1 0x100aaf90 +MxBool Lego3DView::Init(MxRenderSettings& p_renderSettings, Tgl::Renderer& p_render) +{ + return FALSE; +} // STUB: LEGO1 0x100ab2b0 LegoROI* Lego3DView::PickROI(MxLong p_a, MxLong p_b) diff --git a/LEGO1/lego3dview.h b/LEGO1/lego3dview.h index b984ad0f..0681003f 100644 --- a/LEGO1/lego3dview.h +++ b/LEGO1/lego3dview.h @@ -1,27 +1,38 @@ #ifndef LEGO3DVIEW_H #define LEGO3DVIEW_H +#include "mxrendersettings.h" #include "mxtypes.h" #include "tgl/d3drm/impl.h" #include "viewmanager/viewmanager.h" class LegoROI; +class Tgl::Renderer; +// VTABLE: LEGO1 0x100dbf78 +// SIZE 0xa8 class Lego3DView { public: + Lego3DView(); + virtual ~Lego3DView(); + inline ViewManager* GetViewManager() { return this->m_viewManager; } inline TglImpl::ViewImpl* GetViewPort() { return this->m_viewPort; } + MxBool Init(MxRenderSettings& p_renderSettings, Tgl::Renderer& p_render); LegoROI* PickROI(MxLong p_a, MxLong p_b); private: // 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 + undefined4 m_unk0x4; // 0x04 + TglImpl::RendererImpl* m_renderImpl; // 0x08 + TglImpl::DeviceImpl* m_deviceImpl; // 0x0c TglImpl::ViewImpl* m_viewPort; // 0x10 - char m_pad[0x78]; // 0x14 + undefined m_unk0x14[0x74]; // 0x14 ViewManager* m_viewManager; // 0x88 + undefined m_unk0x8c[0x1c]; // 0x8c }; +// SYNTHETIC: LEGO1 0x100aaf10 +// Lego3DView::`scalar deleting destructor' + #endif // LEGO3DVIEW_H diff --git a/LEGO1/mxrendersettings.cpp b/LEGO1/mxrendersettings.cpp new file mode 100644 index 00000000..4d4476ec --- /dev/null +++ b/LEGO1/mxrendersettings.cpp @@ -0,0 +1,21 @@ +#include "mxrendersettings.h" + +#include "decomp.h" + +DECOMP_SIZE_ASSERT(MxRenderSettings, 0x28) + +// FUNCTION: LEGO1 0x100ab2d0 +MxU32 MxRenderSettings::CopyFrom(MxRenderSettings& p_dest, const MxRenderSettings& p_src) +{ + p_dest.m_unk0x00 = p_src.m_unk0x00; + p_dest.m_hwnd = p_src.m_hwnd; + p_dest.m_directDraw = p_src.m_directDraw; + p_dest.m_ddSurface1 = p_src.m_ddSurface1; + p_dest.m_ddSurface2 = p_src.m_ddSurface2; + p_dest.m_flags = p_src.m_flags; + p_dest.m_unk0x18 = p_src.m_unk0x18; + p_dest.m_flags2 = p_src.m_flags2; + p_dest.m_direct3d = p_src.m_direct3d; + p_dest.m_d3dDevice = p_src.m_d3dDevice; + return 1; +} diff --git a/LEGO1/mxrendersettings.h b/LEGO1/mxrendersettings.h new file mode 100644 index 00000000..14909ade --- /dev/null +++ b/LEGO1/mxrendersettings.h @@ -0,0 +1,28 @@ +#ifndef MXRENDERSETTINGS_H +#define MXRENDERSETTINGS_H + +#include "decomp.h" +#include "mxtypes.h" + +#include +#include +#include + +// SIZE 0x28 +struct MxRenderSettings { +public: + static MxU32 CopyFrom(MxRenderSettings& p_dest, const MxRenderSettings& p_src); + + undefined4 m_unk0x00; // 0x00 + HWND m_hwnd; // 0x04 + IDirectDraw* m_directDraw; // 0x08 + IDirectDrawSurface* m_ddSurface1; // 0x0c + IDirectDrawSurface* m_ddSurface2; // 0x10 + MxU32 m_flags; // 0x14 + undefined4 m_unk0x18; // 0x18 + MxU32 m_flags2; // 0x1c + IDirect3D* m_direct3d; // 0x20 + IDirect3DDevice* m_d3dDevice; // 0x24 +}; + +#endif // MXRENDERSETTINGS_H diff --git a/LEGO1/mxunknown100dbdbc.cpp b/LEGO1/mxunknown100dbdbc.cpp index a420454a..64254f0b 100644 --- a/LEGO1/mxunknown100dbdbc.cpp +++ b/LEGO1/mxunknown100dbdbc.cpp @@ -9,3 +9,9 @@ MxUnknown100dbdbc::MxUnknown100dbdbc() { // TODO } + +// STUB: LEGO1 0x100a7130 +MxUnknown100dbdbc::~MxUnknown100dbdbc() +{ + // TODO +} diff --git a/LEGO1/mxunknown100dbdbc.h b/LEGO1/mxunknown100dbdbc.h index 157058a7..b5049760 100644 --- a/LEGO1/mxunknown100dbdbc.h +++ b/LEGO1/mxunknown100dbdbc.h @@ -9,9 +9,10 @@ class MxUnknown100dbdbc { public: MxUnknown100dbdbc(); + virtual ~MxUnknown100dbdbc(); private: - undefined m_unk0x4[0x14]; // TODO: change to 0x10 once scalar deconstructor is added + undefined m_unk0x4[0x10]; }; #endif // MXUNKNOWN100DBDBC_H