diff --git a/LEGO1/tgl/d3drm/renderer.cpp b/LEGO1/tgl/d3drm/renderer.cpp index 77901d34..c11b311a 100644 --- a/LEGO1/tgl/d3drm/renderer.cpp +++ b/LEGO1/tgl/d3drm/renderer.cpp @@ -13,7 +13,7 @@ Renderer* CreateRenderer() return renderer; } -// OFFSET: LEGO1 0x1010103c +// GLOBAL OFFSET: LEGO1 0x1010103c IDirect3DRM* g_pD3DRM = NULL; // Inlined only @@ -53,7 +53,7 @@ Device* RendererImpl::CreateDevice(const DeviceDirect3DCreateData& p_data) return device; } -// OFFSET: LEGO1 0x10101040 +// GLOBAL OFFSET: LEGO1 0x10101040 static int gSetBufferCount = 1; // OFFSET: LEGO1 0x100a1900 diff --git a/LEGO1/tgl/d3drm/texture.cpp b/LEGO1/tgl/d3drm/texture.cpp index 780243c7..d69fec86 100644 --- a/LEGO1/tgl/d3drm/texture.cpp +++ b/LEGO1/tgl/d3drm/texture.cpp @@ -4,6 +4,14 @@ using namespace TglImpl; DECOMP_SIZE_ASSERT(TglD3DRMIMAGE, 0x40); +inline TglD3DRMIMAGE* TextureGetImage(IDirect3DRMTexture* p_texture) +{ + return reinterpret_cast(p_texture->GetAppData()); +} + +// Forward declare to satisfy order check +void TextureDestroyCallback(IDirect3DRMObject* pObject, void* pArg); + // OFFSET: LEGO1 0x100a12a0 Result TextureImpl::SetImage(IDirect3DRMTexture* p_self, TglD3DRMIMAGE* p_image) { @@ -127,11 +135,6 @@ TextureImpl::~TextureImpl() } } -inline TglD3DRMIMAGE* TextureGetImage(IDirect3DRMTexture* p_texture) -{ - return reinterpret_cast(p_texture->GetAppData()); -} - // OFFSET: LEGO1 0x100a3c10 Result TextureImpl::SetTexels(int p_width, int p_height, int p_bitsPerTexel, void* p_texels) { diff --git a/LEGO1/tgl/d3drm/view.cpp b/LEGO1/tgl/d3drm/view.cpp index db357880..68f76a3a 100644 --- a/LEGO1/tgl/d3drm/view.cpp +++ b/LEGO1/tgl/d3drm/view.cpp @@ -42,6 +42,9 @@ ViewportAppData::~ViewportAppData() m_pLightFrame->Release(); } +// Forward declare to satisfy order check +void ViewportDestroyCallback(IDirect3DRMObject* p_object, void* p_arg); + // OFFSET: LEGO1 0x100a1160 Result ViewImpl::ViewportCreateAppData(IDirect3DRM* p_device, IDirect3DRMViewport* p_view, IDirect3DRMFrame* p_camera) { @@ -58,6 +61,25 @@ Result ViewImpl::ViewportCreateAppData(IDirect3DRM* p_device, IDirect3DRMViewpor return result; } +inline Result ViewRestoreFrameAfterRender( + IDirect3DRMFrame* pFrame, + IDirect3DRMFrame* pCamera, + IDirect3DRMFrame* pLightFrame +) +{ + Result result = Success; + if (pFrame) { + // remove camera and light frame from frame that was rendered + // this doesn't destroy the camera as it is still the camera of the viewport... + result = ResultVal(pFrame->DeleteChild(pCamera)); + result = ResultVal(pFrame->DeleteChild(pLightFrame)); + + // decrease frame's ref count (it was increased in ViewPrepareFrameForRender()) + pFrame->Release(); + } + return result; +} + // OFFSET: LEGO1 0x100a1240 void ViewportDestroyCallback(IDirect3DRMObject* p_object, void* p_arg) { @@ -128,25 +150,6 @@ Result ViewImpl::Remove(const Light* p_light) return ResultVal(ViewportGetLightFrame(m_data)->DeleteChild(frame)); } -inline Result ViewRestoreFrameAfterRender( - IDirect3DRMFrame* pFrame, - IDirect3DRMFrame* pCamera, - IDirect3DRMFrame* pLightFrame -) -{ - Result result = Success; - if (pFrame) { - // remove camera and light frame from frame that was rendered - // this doesn't destroy the camera as it is still the camera of the viewport... - result = ResultVal(pFrame->DeleteChild(pCamera)); - result = ResultVal(pFrame->DeleteChild(pLightFrame)); - - // decrease frame's ref count (it was increased in ViewPrepareFrameForRender()) - pFrame->Release(); - } - return result; -} - // OFFSET: LEGO1 0x100a2df0 Result ViewImpl::SetCamera(const Camera* p_camera) {