diff --git a/LEGO1/tgl/d3drm/device.cpp b/LEGO1/tgl/d3drm/device.cpp index 2d17a5c9..39502d1e 100644 --- a/LEGO1/tgl/d3drm/device.cpp +++ b/LEGO1/tgl/d3drm/device.cpp @@ -12,22 +12,49 @@ void* DeviceImpl::ImplementationDataPtr() return reinterpret_cast(&m_data); } +// FUNCTION: BETA10 0x1016dea0 +inline unsigned long DeviceGetWidth(IDirect3DRMDevice2* pDevice) +{ + return pDevice->GetWidth(); +} + // FUNCTION: LEGO1 0x100a2c00 +// FUNCTION: BETA10 0x1016de40 unsigned long DeviceImpl::GetWidth() { - return m_data->GetWidth(); + assert(m_data); + + return DeviceGetWidth(m_data); +} + +// FUNCTION: BETA10 0x1016df20 +inline unsigned long DeviceGetHeight(IDirect3DRMDevice2* pDevice) +{ + return pDevice->GetHeight(); } // FUNCTION: LEGO1 0x100a2c10 +// FUNCTION: BETA10 0x1016dec0 unsigned long DeviceImpl::GetHeight() { - return m_data->GetHeight(); + assert(m_data); + + return DeviceGetHeight(m_data); +} + +// FUNCTION: BETA10 0x1016dfa0 +inline Result DeviceSetColorModel(IDirect3DRMDevice2* pDevice, ColorModel) +{ + return Success; } // FUNCTION: LEGO1 0x100a2c20 -Result DeviceImpl::SetColorModel(ColorModel) +// FUNCTION: BETA10 0x1016df40 +Result DeviceImpl::SetColorModel(ColorModel p_model) { - return Success; + assert(m_data); + + return DeviceSetColorModel(m_data, p_model); } // FUNCTION: BETA10 0x1016e020 @@ -46,44 +73,96 @@ Result DeviceImpl::SetShadingModel(ShadingModel model) return DeviceSetShadingModel(m_data, model); } +// FUNCTION: BETA10 0x1016e140 +inline Result DeviceSetShadeCount(IDirect3DRMDevice2* pDevice, unsigned long shadeCount) +{ + return ResultVal(pDevice->SetShades(shadeCount)); +} + // FUNCTION: LEGO1 0x100a2ca0 +// FUNCTION: BETA10 0x1016e0e0 Result DeviceImpl::SetShadeCount(unsigned long shadeCount) { - return ResultVal(m_data->SetShades(shadeCount)); + assert(m_data); + + return DeviceSetShadeCount(m_data, shadeCount); +} + +// FUNCTION: BETA10 0x1016e1d0 +inline Result DeviceSetDither(IDirect3DRMDevice2* pDevice, int dither) +{ + return ResultVal(pDevice->SetDither(dither)); } // FUNCTION: LEGO1 0x100a2cc0 +// FUNCTION: BETA10 0x1016e170 Result DeviceImpl::SetDither(int dither) { - return ResultVal(m_data->SetDither(dither)); + assert(m_data); + + return DeviceSetDither(m_data, dither); +} + +// FUNCTION: BETA10 0x1016e260 +inline void DeviceHandleActivate(IDirect3DRMDevice2* pDevice, WORD wParam) +{ + IDirect3DRMWinDevice* winDevice; + + Result result = ResultVal(pDevice->QueryInterface(IID_IDirect3DRMWinDevice, (LPVOID*) &winDevice)); + if (Succeeded(result)) { + winDevice->HandleActivate(wParam); + int refCount = winDevice->Release(); + assert(refCount == 1); + } } // FUNCTION: LEGO1 0x100a2ce0 +// FUNCTION: BETA10 0x1016e200 void DeviceImpl::HandleActivate(WORD wParam) { - // Device argument is intentionally unused. + assert(m_data); + + DeviceHandleActivate(m_data, wParam); +} + +// FUNCTION: BETA10 0x1016e360 +inline void DeviceHandlePaint(IDirect3DRMDevice2* pDevice, void* p_data) +{ IDirect3DRMWinDevice* winDevice; - if (ResultVal(m_data->QueryInterface(IID_IDirect3DRMWinDevice, (LPVOID*) &winDevice))) { - winDevice->HandleActivate(wParam); - winDevice->Release(); + + Result result = ResultVal(pDevice->QueryInterface(IID_IDirect3DRMWinDevice, (LPVOID*) &winDevice)); + if (Succeeded(result)) { + HDC hdc = (HDC) p_data; + winDevice->HandlePaint(hdc); + int refCount = winDevice->Release(); + assert(refCount == 1); } } // FUNCTION: LEGO1 0x100a2d20 -void DeviceImpl::HandlePaint(HDC p_dc) +// FUNCTION: BETA10 0x1016e300 +void DeviceImpl::HandlePaint(void* p_data) { - IDirect3DRMWinDevice* winDevice; - if (SUCCEEDED(m_data->QueryInterface(IID_IDirect3DRMWinDevice, (LPVOID*) &winDevice))) { - winDevice->HandlePaint(p_dc); - winDevice->Release(); - } + assert(m_data); + + DeviceHandlePaint(m_data, p_data); +} + +// FUNCTION: BETA10 0x1016e460 +inline Result DeviceUpdate(IDirect3DRMDevice2* pDevice) +{ + return ResultVal(pDevice->Update()); } // FUNCTION: LEGO1 0x100a2d60 +// FUNCTION: BETA10 0x1016e400 Result DeviceImpl::Update() { - return ResultVal(m_data->Update()); + assert(m_data); + + return DeviceUpdate(m_data); } // GLOBAL: LEGO1 0x100dd1d0 +// GLOBAL: BETA10 0x101c30b0 // IID_IDirect3DRMWinDevice diff --git a/LEGO1/tgl/d3drm/impl.h b/LEGO1/tgl/d3drm/impl.h index d1e6ce2c..fe79e01b 100644 --- a/LEGO1/tgl/d3drm/impl.h +++ b/LEGO1/tgl/d3drm/impl.h @@ -183,7 +183,7 @@ public: // vtable+0x20 Result Update() override; void HandleActivate(WORD) override; - void HandlePaint(HDC) override; + void HandlePaint(void*) override; typedef IDirect3DRMDevice2* DeviceDataType; diff --git a/LEGO1/tgl/tgl.h b/LEGO1/tgl/tgl.h index c519cf05..3d27881e 100644 --- a/LEGO1/tgl/tgl.h +++ b/LEGO1/tgl/tgl.h @@ -186,7 +186,7 @@ public: // vtable+0x20 virtual Result Update() = 0; virtual void HandleActivate(WORD) = 0; - virtual void HandlePaint(HDC) = 0; + virtual void HandlePaint(void*) = 0; // SYNTHETIC: BETA10 0x1016b740 // Tgl::Device::Device