mirror of
https://github.com/isledecomp/isle.git
synced 2026-01-24 08:41:16 +00:00
* This PR kicks off work on decompiling the D3D Retained Mode (D3DRM) rendering part of the codebase. * High level overview: * There is a base IMxDirect3DRMObject class which all of the D3DRM rendering objects inherit from. Its only virtual method is one to get the underlying object handle. * A hierarchy of abstract classes inherits from this base class, which I've called "IMxDirect3DRM<class>". These classes only have pure virtual methods on them and don't contain any data. * Each one of the abstract classes has exactly one concrete implementation, which I've called "MxDirect3DRM<class>". These classes have exactly one piece of data, which is a pointer to the underlying D3D Retained Mode object. * If the classes need to store additional data, they store it in a userdata blob which is attached to the D3DRM object rather than the additional data being stored in the class itself. * I've worked out about twice this many classes related to D3DRM rendering so far but the PR was getting large enough as is, so I'm cutting it here for now. * I decomped sufficiently many methods of these classe to convince myself that the above observations are correct. About 60% of the decomped methods here are perfect matches, including at least one non-trivial method per class.
106 lines
2.4 KiB
C++
106 lines
2.4 KiB
C++
#include "mxdirect3drmdevice.h"
|
|
|
|
#include "d3drmwin.h"
|
|
|
|
#include "decomp.h"
|
|
|
|
DECOMP_SIZE_ASSERT(IMxDirect3DRMDevice, 0x4);
|
|
DECOMP_SIZE_ASSERT(MxDirect3DRMDevice, 0x8);
|
|
|
|
// OFFSET: LEGO1 0x100a2bf0
|
|
IUnknown **MxDirect3DRMDevice::GetHandle()
|
|
{
|
|
return (IUnknown**)&m_pD3DRMDevice;
|
|
}
|
|
|
|
// OFFSET: LEGO1 0x100a2c00
|
|
int MxDirect3DRMDevice::GetWidth()
|
|
{
|
|
return m_pD3DRMDevice->GetWidth();
|
|
}
|
|
|
|
// OFFSET: LEGO1 0x100a2c10
|
|
int MxDirect3DRMDevice::GetHeight()
|
|
{
|
|
return m_pD3DRMDevice->GetHeight();
|
|
}
|
|
|
|
// OFFSET: LEGO1 0x100a2c20
|
|
int MxDirect3DRMDevice::unknown1()
|
|
{
|
|
return 1;
|
|
}
|
|
|
|
// Matching behavior, codegen differs in register alloc and timing of access.
|
|
// OFFSET: LEGO1 0x100a2c30
|
|
int MxDirect3DRMDevice::SetQuality(MxDirect3DRMDeviceQuality p_quality)
|
|
{
|
|
D3DRMRENDERQUALITY quality;
|
|
switch (p_quality)
|
|
{
|
|
case Wireframe:
|
|
quality = D3DRMRENDER_WIREFRAME;
|
|
break;
|
|
case UnlitFlat:
|
|
quality = D3DRMRENDER_UNLITFLAT;
|
|
break;
|
|
case Flat:
|
|
quality = D3DRMRENDER_FLAT;
|
|
break;
|
|
case Gouraud:
|
|
quality = D3DRMRENDER_GOURAUD;
|
|
break;
|
|
case Phong:
|
|
quality = D3DRMRENDER_PHONG;
|
|
break;
|
|
default:
|
|
quality = D3DRMRENDER_FLAT;
|
|
}
|
|
return SUCCEEDED(m_pD3DRMDevice->SetQuality(quality));
|
|
}
|
|
|
|
// OFFSET: LEGO1 0x100a2ca0
|
|
int MxDirect3DRMDevice::SetShades(MxU32 p_shades)
|
|
{
|
|
return SUCCEEDED(m_pD3DRMDevice->SetShades(p_shades));
|
|
}
|
|
|
|
// OFFSET: LEGO1 0x100a2cc0
|
|
int MxDirect3DRMDevice::SetDither(int p_dither)
|
|
{
|
|
return SUCCEEDED(m_pD3DRMDevice->SetDither(p_dither));
|
|
}
|
|
|
|
// OFFSET: LEGO1 0x100a2d60
|
|
int MxDirect3DRMDevice::Update()
|
|
{
|
|
return SUCCEEDED(m_pD3DRMDevice->Update());
|
|
}
|
|
|
|
// Probably wrong, not sure what's going on in this method.
|
|
// OFFSET: LEGO1 0x100a2ce0
|
|
void MxDirect3DRMDevice::InitFromD3D()
|
|
{
|
|
IDirect3DRMWinDevice *winDevice;
|
|
if (SUCCEEDED(m_pD3DRMDevice->QueryInterface(IID_IDirect3DRMWinDevice, (LPVOID*)&winDevice)))
|
|
{
|
|
m_pD3DRMDevice->InitFromD3D((LPDIRECT3D)&winDevice, (LPDIRECT3DDEVICE)m_pD3DRMDevice);
|
|
winDevice->Release();
|
|
}
|
|
}
|
|
|
|
// Really don't know what's going on here. Seems it will call down to Init
|
|
// but the decomp suggests it otherwise looks the same as InitFromD3D but Init
|
|
// takes widly different parameters.
|
|
// OFFSET: LEGO1 0x100a2d20
|
|
void MxDirect3DRMDevice::Init()
|
|
{
|
|
IDirect3DRMWinDevice *winDevice;
|
|
if (SUCCEEDED(m_pD3DRMDevice->QueryInterface(IID_IDirect3DRMWinDevice, (LPVOID*)&winDevice)))
|
|
{
|
|
//m_pD3DRMDevice->Init();
|
|
winDevice->Release();
|
|
}
|
|
}
|
|
|