Full fix for ordering problems

This commit is contained in:
Mark Langen 2023-11-29 00:22:55 -08:00
parent ce22c366e3
commit 8dad24301a
3 changed files with 32 additions and 26 deletions

View File

@ -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

View File

@ -4,6 +4,14 @@ using namespace TglImpl;
DECOMP_SIZE_ASSERT(TglD3DRMIMAGE, 0x40);
inline TglD3DRMIMAGE* TextureGetImage(IDirect3DRMTexture* p_texture)
{
return reinterpret_cast<TglD3DRMIMAGE*>(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<TglD3DRMIMAGE*>(p_texture->GetAppData());
}
// OFFSET: LEGO1 0x100a3c10
Result TextureImpl::SetTexels(int p_width, int p_height, int p_bitsPerTexel, void* p_texels)
{

View File

@ -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)
{