diff --git a/CMakeLists.txt b/CMakeLists.txt index ba7af5ee..8661dabf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -430,6 +430,7 @@ if (ISLE_USE_SMARTHEAP) endif() foreach(tgt IN LISTS lego1_targets) target_link_libraries(${tgt} PRIVATE $<$:DirectX5::DirectX5>) + target_compile_definitions(${tgt} PRIVATE $<$:DIRECTX5_SDK>) endforeach() # Make sure filenames are ALL CAPS diff --git a/LEGO1/tgl/d3drm/impl.h b/LEGO1/tgl/d3drm/impl.h index c49ffd1a..413f7110 100644 --- a/LEGO1/tgl/d3drm/impl.h +++ b/LEGO1/tgl/d3drm/impl.h @@ -5,6 +5,12 @@ #include +#ifdef DIRECTX5_SDK +typedef DWORD LPD3DRM_APPDATA; +#else +typedef LPVOID LPD3DRM_APPDATA; +#endif + // Forward declare D3D types struct IDirect3DRM2; struct IDirect3DRMDevice2; diff --git a/LEGO1/tgl/d3drm/texture.cpp b/LEGO1/tgl/d3drm/texture.cpp index b0ee3813..a51a5c0b 100644 --- a/LEGO1/tgl/d3drm/texture.cpp +++ b/LEGO1/tgl/d3drm/texture.cpp @@ -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(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)) { diff --git a/LEGO1/tgl/d3drm/view.cpp b/LEGO1/tgl/d3drm/view.cpp index 457c54d2..b9fca8e9 100644 --- a/LEGO1/tgl/d3drm/view.cpp +++ b/LEGO1/tgl/d3drm/view.cpp @@ -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(data))); + Result result = ResultVal(pView->SetAppData(reinterpret_cast(data))); if (Succeeded(result)) { result = ResultVal(pView->AddDestroyCallback(ViewportDestroyCallback, data)); } diff --git a/LEGO1/viewmanager/viewmanager.cpp b/LEGO1/viewmanager/viewmanager.cpp index 3531381c..c0691587 100644 --- a/LEGO1/viewmanager/viewmanager.cpp +++ b/LEGO1/viewmanager/viewmanager.cpp @@ -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(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(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;