Introduce LPD3DRM_APPDATA typedef for setting d3drm appdata

This commit is contained in:
Anonymous Maarten 2024-06-25 16:46:22 +02:00
parent c9c130eb87
commit aa82c95b5c
5 changed files with 15 additions and 8 deletions

View File

@ -430,6 +430,7 @@ if (ISLE_USE_SMARTHEAP)
endif()
foreach(tgt IN LISTS lego1_targets)
target_link_libraries(${tgt} PRIVATE $<$<BOOL:${ISLE_USE_DX5}>:DirectX5::DirectX5>)
target_compile_definitions(${tgt} PRIVATE $<$<BOOL:${ISLE_USE_DX5}>:DIRECTX5_SDK>)
endforeach()
# Make sure filenames are ALL CAPS

View File

@ -5,6 +5,12 @@
#include <d3drm.h>
#ifdef DIRECTX5_SDK
typedef DWORD LPD3DRM_APPDATA;
#else
typedef LPVOID LPD3DRM_APPDATA;
#endif
// Forward declare D3D types
struct IDirect3DRM2;
struct IDirect3DRMDevice2;

View File

@ -15,16 +15,16 @@ void TextureDestroyCallback(IDirect3DRMObject* pObject, void* pArg);
// FUNCTION: LEGO1 0x100a12a0
Result TextureImpl::SetImage(IDirect3DRMTexture* pSelf, TglD3DRMIMAGE* pImage)
{
unsigned long appData;
void* appData;
Result result;
appData = reinterpret_cast<unsigned long>(pImage);
appData = pImage;
// This is here because in the original code they asserted
// on the return value being NULL.
TextureGetImage(pSelf);
result = ResultVal(pSelf->SetAppData(appData));
result = ResultVal(pSelf->SetAppData((LPD3DRM_APPDATA) appData));
if (Succeeded(result) && pImage) {
result = ResultVal(pSelf->AddDestroyCallback(TextureDestroyCallback, NULL));
if (!Succeeded(result)) {

View File

@ -50,7 +50,7 @@ Result ViewImpl::ViewportCreateAppData(IDirect3DRM2* pDevice, IDirect3DRMViewpor
{
ViewportAppData* data = new ViewportAppData(pDevice);
data->m_pCamera = pCamera;
Result result = ResultVal(pView->SetAppData(reinterpret_cast<unsigned long>(data)));
Result result = ResultVal(pView->SetAppData(reinterpret_cast<LPD3DRM_APPDATA>(data)));
if (Succeeded(result)) {
result = ResultVal(pView->AddDestroyCallback(ViewportDestroyCallback, data));
}

View File

@ -29,7 +29,7 @@ float g_unk0x1010105c = 0.000125F;
// GLOBAL: LEGO1 0x10101060
float g_elapsedSeconds = 0;
inline void SetAppData(ViewROI* p_roi, DWORD data);
inline void SetAppData(ViewROI* p_roi, LPD3DRM_APPDATA data);
inline undefined4 GetD3DRM(IDirect3DRM2*& d3drm, Tgl::Renderer* pRenderer);
inline undefined4 GetFrame(IDirect3DRMFrame2*& frame, Tgl::Group* scene);
@ -165,7 +165,7 @@ void ViewManager::UpdateROIDetailBasedOnLOD(ViewROI* p_roi, int p_und)
if (lod->GetUnknown0x08() & ViewLOD::c_bit4) {
scene->Add((Tgl::MeshBuilder*) group);
SetAppData(p_roi, (DWORD) p_roi);
SetAppData(p_roi, reinterpret_cast<LPD3DRM_APPDATA>(p_roi));
}
}
else {
@ -187,7 +187,7 @@ void ViewManager::UpdateROIDetailBasedOnLOD(ViewROI* p_roi, int p_und)
if (meshBuilder != NULL) {
group->Add(meshBuilder);
SetAppData(p_roi, (DWORD) p_roi);
SetAppData(p_roi, reinterpret_cast<LPD3DRM_APPDATA>(p_roi));
p_roi->SetUnknown0xe0(p_und);
return;
}
@ -533,7 +533,7 @@ ViewROI* ViewManager::Pick(Tgl::View* p_view, unsigned long x, unsigned long y)
return result;
}
inline void SetAppData(ViewROI* p_roi, DWORD data)
inline void SetAppData(ViewROI* p_roi, LPD3DRM_APPDATA data)
{
IDirect3DRMFrame2* frame = NULL;