mirror of
https://github.com/isledecomp/isle.git
synced 2026-02-03 13:41:15 +00:00
Implement LegoVideoManager::EnableRMDevice
This commit is contained in:
parent
1a903f06e0
commit
215f3b0bc8
@ -6,11 +6,13 @@
|
|||||||
#include "mxvideomanager.h"
|
#include "mxvideomanager.h"
|
||||||
|
|
||||||
#include <ddraw.h>
|
#include <ddraw.h>
|
||||||
|
#include <d3drm.h>
|
||||||
|
|
||||||
class Lego3DManager;
|
class Lego3DManager;
|
||||||
class LegoROI;
|
class LegoROI;
|
||||||
class MxDirect3D;
|
class MxDirect3D;
|
||||||
class MxStopWatch;
|
class MxStopWatch;
|
||||||
|
struct ViewportAppData;
|
||||||
|
|
||||||
namespace Tgl
|
namespace Tgl
|
||||||
{
|
{
|
||||||
@ -103,7 +105,21 @@ class LegoVideoManager : public MxVideoManager {
|
|||||||
MxFloat m_unk0x550; // 0x550
|
MxFloat m_unk0x550; // 0x550
|
||||||
MxBool m_unk0x554; // 0x554
|
MxBool m_unk0x554; // 0x554
|
||||||
MxBool m_paused; // 0x555
|
MxBool m_paused; // 0x555
|
||||||
undefined m_pad0x556[0x39]; // 0x556
|
undefined m_pad0x556[0x2]; // 0x556
|
||||||
|
D3DVALUE m_back_0x558; // 0x558
|
||||||
|
D3DVALUE m_front_0x55c; // 0x55c
|
||||||
|
float m_camera_width_0x560; // 0x560
|
||||||
|
float m_camera_height_0x564; // 0x564
|
||||||
|
D3DVALUE m_fov_0x568; // 0x55c
|
||||||
|
IDirect3DRMFrame *m_camera_0x56c; // 0x56c
|
||||||
|
D3DRMPROJECTIONTYPE m_projection_0x570; // 0x570
|
||||||
|
ViewportAppData *m_appdata_0x574; // 0x574
|
||||||
|
D3DRMRENDERQUALITY m_quality_0x578; // 0x578
|
||||||
|
DWORD m_shades_0x57c; // 0x57c
|
||||||
|
D3DRMTEXTUREQUALITY m_texture_quality_0x580; // 0x580
|
||||||
|
D3DRMTEXTUREQUALITY m_rendermode_0x584; // 0x584
|
||||||
|
BOOL m_dither_0x588; // 0x588
|
||||||
|
DWORD m_buffer_count_0x58c; // 0x58c
|
||||||
};
|
};
|
||||||
|
|
||||||
// SYNTHETIC: LEGO1 0x1007ab20
|
// SYNTHETIC: LEGO1 0x1007ab20
|
||||||
|
|||||||
@ -561,11 +561,49 @@ void LegoVideoManager::FUN_1007c520()
|
|||||||
InputManager()->SetUnknown335(TRUE);
|
InputManager()->SetUnknown335(TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
// STUB: LEGO1 0x1007c560
|
extern void ViewportDestroyCallback(IDirect3DRMObject* pObject, void* pArg);
|
||||||
|
|
||||||
|
// FUNCTION: LEGO1 0x1007c560
|
||||||
int LegoVideoManager::EnableRMDevice()
|
int LegoVideoManager::EnableRMDevice()
|
||||||
{
|
{
|
||||||
// TODO
|
IDirect3DRMViewport *viewport;
|
||||||
return 0;
|
if (!m_paused) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
int result = -1;
|
||||||
|
TglImpl::DeviceImpl *device_impl = (TglImpl::DeviceImpl*)m_3dManager->GetLego3DView()->GetDevice();
|
||||||
|
IDirect3DRM2 *d3drm2 = ((TglImpl::RendererImpl*)m_renderer)->ImplementationData();
|
||||||
|
IDirect3D2 *d3d2 = m_direct3d->Direct3D();
|
||||||
|
IDirect3DDevice2 *d3d_dev2 = m_direct3d->Direct3DDevice();
|
||||||
|
m_direct3d->RestoreSurfaces();
|
||||||
|
IDirect3DRMDevice2 *d3drm_dev2 = NULL;
|
||||||
|
HRESULT res = d3drm2->CreateDeviceFromD3D(d3d2, d3d_dev2, &d3drm_dev2);
|
||||||
|
if (res == D3DRM_OK) {
|
||||||
|
viewport = NULL;
|
||||||
|
device_impl->SetImplementationData(d3drm_dev2);
|
||||||
|
res = d3drm2->CreateViewport(d3drm_dev2, m_camera_0x56c, 0, 0, m_camera_width_0x560, m_camera_height_0x564, &viewport);
|
||||||
|
if (res == D3DRM_OK) {
|
||||||
|
viewport->SetBack(m_back_0x558);
|
||||||
|
viewport->SetFront(m_front_0x55c);
|
||||||
|
viewport->SetField(m_fov_0x568);
|
||||||
|
viewport->SetCamera(m_camera_0x56c);
|
||||||
|
viewport->SetProjection(m_projection_0x570);
|
||||||
|
viewport->SetAppData((DWORD)m_appdata_0x574);
|
||||||
|
d3drm_dev2->SetQuality(m_quality_0x578);
|
||||||
|
d3drm_dev2->SetShades(m_shades_0x57c);
|
||||||
|
d3drm_dev2->SetTextureQuality(m_texture_quality_0x580);
|
||||||
|
d3drm_dev2->SetRenderMode(m_rendermode_0x584);
|
||||||
|
d3drm_dev2->SetDither(m_dither_0x588);
|
||||||
|
d3drm_dev2->SetBufferCount(m_buffer_count_0x58c);
|
||||||
|
m_camera_0x56c->Release();
|
||||||
|
if (viewport->AddDestroyCallback(ViewportDestroyCallback, m_appdata_0x574) == D3DRM_OK) {
|
||||||
|
((TglImpl::ViewImpl*)m_3dManager->GetLego3DView()->GetView())->SetImplementationData(viewport);
|
||||||
|
m_paused = 0;
|
||||||
|
result = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
// STUB: LEGO1 0x1007c740
|
// STUB: LEGO1 0x1007c740
|
||||||
|
|||||||
@ -149,6 +149,7 @@ class DeviceImpl : public Device {
|
|||||||
void InitFromWindowsDevice(Device*) override;
|
void InitFromWindowsDevice(Device*) override;
|
||||||
|
|
||||||
IDirect3DRMDevice2* ImplementationData() const { return m_data; }
|
IDirect3DRMDevice2* ImplementationData() const { return m_data; }
|
||||||
|
void SetImplementationData(IDirect3DRMDevice2* device) { m_data = device; }
|
||||||
|
|
||||||
friend class RendererImpl;
|
friend class RendererImpl;
|
||||||
|
|
||||||
@ -199,6 +200,7 @@ class ViewImpl : public View {
|
|||||||
) override;
|
) override;
|
||||||
|
|
||||||
IDirect3DRMViewport* ImplementationData() const { return m_data; }
|
IDirect3DRMViewport* ImplementationData() const { return m_data; }
|
||||||
|
void SetImplementationData(IDirect3DRMViewport* viewport) { m_data = viewport; }
|
||||||
|
|
||||||
static Result ViewportCreateAppData(IDirect3DRM2*, IDirect3DRMViewport*, IDirect3DRMFrame2*);
|
static Result ViewportCreateAppData(IDirect3DRM2*, IDirect3DRMViewport*, IDirect3DRMFrame2*);
|
||||||
|
|
||||||
|
|||||||
@ -80,6 +80,8 @@ inline Result ViewRestoreFrameAfterRender(
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FIXME: from LEGO1/tgl/d3drm/view.cpp
|
||||||
|
|
||||||
// FUNCTION: LEGO1 0x100a1240
|
// FUNCTION: LEGO1 0x100a1240
|
||||||
void ViewportDestroyCallback(IDirect3DRMObject* pObject, void* pArg)
|
void ViewportDestroyCallback(IDirect3DRMObject* pObject, void* pArg)
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user