mirror of
https://github.com/isledecomp/isle.git
synced 2026-02-01 04:31:16 +00:00
Formatting
This commit is contained in:
parent
c15ca8a34d
commit
09ccc4b83d
@ -9,17 +9,14 @@ DECOMP_SIZE_ASSERT(MxDirect3DRM, 0x8);
|
|||||||
IDirect3DRM* g_pD3DRM = NULL;
|
IDirect3DRM* g_pD3DRM = NULL;
|
||||||
|
|
||||||
// Inlined only
|
// Inlined only
|
||||||
MxDirect3DRM::MxDirect3DRM()
|
MxDirect3DRM::MxDirect3DRM() : m_pD3DRM(NULL)
|
||||||
: m_pD3DRM(NULL)
|
|
||||||
{
|
|
||||||
if (g_pD3DRM == NULL)
|
|
||||||
{
|
{
|
||||||
|
if (g_pD3DRM == NULL) {
|
||||||
LPDIRECT3DRM handle;
|
LPDIRECT3DRM handle;
|
||||||
Direct3DRMCreate(&handle);
|
Direct3DRMCreate(&handle);
|
||||||
handle->QueryInterface(IID_IDirect3DRM2, (LPVOID*) &g_pD3DRM);
|
handle->QueryInterface(IID_IDirect3DRM2, (LPVOID*) &g_pD3DRM);
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
m_pD3DRM->AddRef();
|
m_pD3DRM->AddRef();
|
||||||
}
|
}
|
||||||
m_pD3DRM = g_pD3DRM;
|
m_pD3DRM = g_pD3DRM;
|
||||||
@ -28,8 +25,7 @@ MxDirect3DRM::MxDirect3DRM()
|
|||||||
// Inlined only
|
// Inlined only
|
||||||
MxDirect3DRM::~MxDirect3DRM()
|
MxDirect3DRM::~MxDirect3DRM()
|
||||||
{
|
{
|
||||||
if (m_pD3DRM)
|
if (m_pD3DRM) {
|
||||||
{
|
|
||||||
if (m_pD3DRM->Release() == 0)
|
if (m_pD3DRM->Release() == 0)
|
||||||
g_pD3DRM = NULL;
|
g_pD3DRM = NULL;
|
||||||
m_pD3DRM = NULL;
|
m_pD3DRM = NULL;
|
||||||
|
|||||||
@ -1,27 +1,23 @@
|
|||||||
|
|
||||||
#include "mxdirect3drmdevice.h"
|
|
||||||
|
|
||||||
#include "ddraw.h"
|
#include "ddraw.h"
|
||||||
|
#include "mxdirect3drmdevice.h"
|
||||||
|
|
||||||
// Not sure what the deal is with these small holder structs. They might
|
// Not sure what the deal is with these small holder structs. They might
|
||||||
// actually be the first part of a larger class because I haven't worked out
|
// actually be the first part of a larger class because I haven't worked out
|
||||||
// enough code further up the call chain to work my way back to a constructor.
|
// enough code further up the call chain to work my way back to a constructor.
|
||||||
struct D3DHolder
|
struct D3DHolder {
|
||||||
{
|
|
||||||
IDirect3D* m_pDirect3D;
|
IDirect3D* m_pDirect3D;
|
||||||
IDirect3DDevice* m_pDirect3DDevice;
|
IDirect3DDevice* m_pDirect3DDevice;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct D3DSurfaceHolder
|
struct D3DSurfaceHolder {
|
||||||
{
|
|
||||||
IDirectDraw* m_pDirectDraw;
|
IDirectDraw* m_pDirectDraw;
|
||||||
int unk;
|
int unk;
|
||||||
IDirectDrawSurface* m_pDirectDrawSurface;
|
IDirectDrawSurface* m_pDirectDrawSurface;
|
||||||
};
|
};
|
||||||
|
|
||||||
// VTABLE 0x100db948
|
// VTABLE 0x100db948
|
||||||
class IMxDirect3DRM : public IMxDirect3DRMObject
|
class IMxDirect3DRM : public IMxDirect3DRMObject {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
virtual ~IMxDirect3DRM() {}
|
virtual ~IMxDirect3DRM() {}
|
||||||
|
|
||||||
@ -30,8 +26,7 @@ class IMxDirect3DRM : public IMxDirect3DRMObject
|
|||||||
};
|
};
|
||||||
|
|
||||||
// VTABLE 0x100db910
|
// VTABLE 0x100db910
|
||||||
class MxDirect3DRM : public IMxDirect3DRM
|
class MxDirect3DRM : public IMxDirect3DRM {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
inline MxDirect3DRM();
|
inline MxDirect3DRM();
|
||||||
virtual ~MxDirect3DRM();
|
virtual ~MxDirect3DRM();
|
||||||
|
|||||||
@ -60,7 +60,15 @@ IUnknown **MxDirect3DRMMesh::GetHandle()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// OFFSET: LEGO1 0x100a3840 STUB
|
// OFFSET: LEGO1 0x100a3840 STUB
|
||||||
int MxDirect3DRMMesh::SetMeshData(int p_faceCount, int p_vertexCount, void *p_positions, void *p_normals, void *p_uvs, int p_unk1, int *p_unk2)
|
int MxDirect3DRMMesh::SetMeshData(
|
||||||
|
int p_faceCount,
|
||||||
|
int p_vertexCount,
|
||||||
|
void* p_positions,
|
||||||
|
void* p_normals,
|
||||||
|
void* p_uvs,
|
||||||
|
int p_unk1,
|
||||||
|
int* p_unk2
|
||||||
|
)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -70,8 +78,7 @@ int MxDirect3DRMMesh::GetBox(float *p_minVec3, float *p_maxVec3)
|
|||||||
{
|
{
|
||||||
D3DRMBOX box;
|
D3DRMBOX box;
|
||||||
int ret = SUCCEEDED(m_pDirect3DRMMesh->GetBox(&box));
|
int ret = SUCCEEDED(m_pDirect3DRMMesh->GetBox(&box));
|
||||||
if (ret == TRUE)
|
if (ret == TRUE) {
|
||||||
{
|
|
||||||
p_minVec3[0] = box.min.x;
|
p_minVec3[0] = box.min.x;
|
||||||
p_minVec3[1] = box.min.y;
|
p_minVec3[1] = box.min.y;
|
||||||
p_minVec3[2] = box.min.z;
|
p_minVec3[2] = box.min.z;
|
||||||
@ -87,8 +94,7 @@ IMxDirect3DRMMesh *MxDirect3DRMMesh::Clone()
|
|||||||
{
|
{
|
||||||
MxDirect3DRMMesh* mesh = new MxDirect3DRMMesh();
|
MxDirect3DRMMesh* mesh = new MxDirect3DRMMesh();
|
||||||
int ret = m_pDirect3DRMMesh->Clone(0, IID_IDirect3DRMMeshBuilder, (void**) &mesh->m_pDirect3DRMMesh);
|
int ret = m_pDirect3DRMMesh->Clone(0, IID_IDirect3DRMMeshBuilder, (void**) &mesh->m_pDirect3DRMMesh);
|
||||||
if (ret < 0)
|
if (ret < 0) {
|
||||||
{
|
|
||||||
delete mesh;
|
delete mesh;
|
||||||
mesh = NULL;
|
mesh = NULL;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,8 +2,7 @@
|
|||||||
#include "mxdirect3drmobject.h"
|
#include "mxdirect3drmobject.h"
|
||||||
|
|
||||||
// VTABLE 0x100dbae8
|
// VTABLE 0x100dbae8
|
||||||
class IMxDirect3DRMFrame : public IMxDirect3DRMObject
|
class IMxDirect3DRMFrame : public IMxDirect3DRMObject {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
virtual ~IMxDirect3DRMFrame() {}
|
virtual ~IMxDirect3DRMFrame() {}
|
||||||
|
|
||||||
@ -14,8 +13,7 @@ class IMxDirect3DRMFrame : public IMxDirect3DRMObject
|
|||||||
};
|
};
|
||||||
|
|
||||||
// VTABLE 0x100dbad8
|
// VTABLE 0x100dbad8
|
||||||
class MxDirect3DRMFrame : IMxDirect3DRMFrame
|
class MxDirect3DRMFrame : IMxDirect3DRMFrame {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
MxDirect3DRMFrame() {}
|
MxDirect3DRMFrame() {}
|
||||||
virtual ~MxDirect3DRMFrame() {}
|
virtual ~MxDirect3DRMFrame() {}
|
||||||
@ -32,8 +30,7 @@ class MxDirect3DRMFrame : IMxDirect3DRMFrame
|
|||||||
};
|
};
|
||||||
|
|
||||||
// VTABLE 0x100dbb08
|
// VTABLE 0x100dbb08
|
||||||
class IMxDirect3DRMLight : public IMxDirect3DRMObject
|
class IMxDirect3DRMLight : public IMxDirect3DRMObject {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
virtual ~IMxDirect3DRMLight() {}
|
virtual ~IMxDirect3DRMLight() {}
|
||||||
|
|
||||||
@ -45,8 +42,7 @@ class IMxDirect3DRMLight : public IMxDirect3DRMObject
|
|||||||
};
|
};
|
||||||
|
|
||||||
// VTABLE 0x100dbaf8
|
// VTABLE 0x100dbaf8
|
||||||
class MxDirect3DRMLight : public IMxDirect3DRMLight
|
class MxDirect3DRMLight : public IMxDirect3DRMLight {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
MxDirect3DRMLight() {}
|
MxDirect3DRMLight() {}
|
||||||
virtual ~MxDirect3DRMLight() {}
|
virtual ~MxDirect3DRMLight() {}
|
||||||
@ -63,22 +59,28 @@ class MxDirect3DRMLight : public IMxDirect3DRMLight
|
|||||||
};
|
};
|
||||||
|
|
||||||
// VTABLE 0x100dbb30
|
// VTABLE 0x100dbb30
|
||||||
class IMxDirect3DRMMesh : public IMxDirect3DRMObject
|
class IMxDirect3DRMMesh : public IMxDirect3DRMObject {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
virtual ~IMxDirect3DRMMesh() {}
|
virtual ~IMxDirect3DRMMesh() {}
|
||||||
|
|
||||||
virtual IUnknown** GetHandle() = 0;
|
virtual IUnknown** GetHandle() = 0;
|
||||||
|
|
||||||
// vtable+0x08
|
// vtable+0x08
|
||||||
virtual int SetMeshData(int p_faceCount, int p_vertexCount, void *p_positions, void *p_normals, void *p_uvs, int p_unk1, int *p_unk2) = 0;
|
virtual int SetMeshData(
|
||||||
|
int p_faceCount,
|
||||||
|
int p_vertexCount,
|
||||||
|
void* p_positions,
|
||||||
|
void* p_normals,
|
||||||
|
void* p_uvs,
|
||||||
|
int p_unk1,
|
||||||
|
int* p_unk2
|
||||||
|
) = 0;
|
||||||
virtual int GetBox(float* p_minVec3, float* p_maxVec3) = 0;
|
virtual int GetBox(float* p_minVec3, float* p_maxVec3) = 0;
|
||||||
virtual IMxDirect3DRMMesh* Clone() = 0;
|
virtual IMxDirect3DRMMesh* Clone() = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
// VTABLE 0x100dbb18
|
// VTABLE 0x100dbb18
|
||||||
class MxDirect3DRMMesh : public IMxDirect3DRMMesh
|
class MxDirect3DRMMesh : public IMxDirect3DRMMesh {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
MxDirect3DRMMesh() : m_pDirect3DRMMesh(NULL) {}
|
MxDirect3DRMMesh() : m_pDirect3DRMMesh(NULL) {}
|
||||||
virtual ~MxDirect3DRMMesh() {}
|
virtual ~MxDirect3DRMMesh() {}
|
||||||
@ -86,7 +88,15 @@ class MxDirect3DRMMesh : public IMxDirect3DRMMesh
|
|||||||
virtual IUnknown** GetHandle();
|
virtual IUnknown** GetHandle();
|
||||||
|
|
||||||
// vtable+0x08
|
// vtable+0x08
|
||||||
virtual int SetMeshData(int p_faceCount, int p_vertexCount, void *p_positions, void *p_normals, void *p_uvs, int p_unk1, int *p_unk2);
|
virtual int SetMeshData(
|
||||||
|
int p_faceCount,
|
||||||
|
int p_vertexCount,
|
||||||
|
void* p_positions,
|
||||||
|
void* p_normals,
|
||||||
|
void* p_uvs,
|
||||||
|
int p_unk1,
|
||||||
|
int* p_unk2
|
||||||
|
);
|
||||||
virtual int GetBox(float* p_minVec3, float* p_maxVec3);
|
virtual int GetBox(float* p_minVec3, float* p_maxVec3);
|
||||||
virtual IMxDirect3DRMMesh* Clone();
|
virtual IMxDirect3DRMMesh* Clone();
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
#include "mxdirect3drmdevice.h"
|
#include "mxdirect3drmdevice.h"
|
||||||
|
|
||||||
#include "d3drmwin.h"
|
#include "d3drmwin.h"
|
||||||
|
|
||||||
#include "decomp.h"
|
#include "decomp.h"
|
||||||
|
|
||||||
DECOMP_SIZE_ASSERT(IMxDirect3DRMDevice, 0x4);
|
DECOMP_SIZE_ASSERT(IMxDirect3DRMDevice, 0x4);
|
||||||
@ -36,8 +35,7 @@ int MxDirect3DRMDevice::unknown1()
|
|||||||
int MxDirect3DRMDevice::SetQuality(MxDirect3DRMDeviceQuality p_quality)
|
int MxDirect3DRMDevice::SetQuality(MxDirect3DRMDeviceQuality p_quality)
|
||||||
{
|
{
|
||||||
D3DRMRENDERQUALITY quality;
|
D3DRMRENDERQUALITY quality;
|
||||||
switch (p_quality)
|
switch (p_quality) {
|
||||||
{
|
|
||||||
case Wireframe:
|
case Wireframe:
|
||||||
quality = D3DRMRENDER_WIREFRAME;
|
quality = D3DRMRENDER_WIREFRAME;
|
||||||
break;
|
break;
|
||||||
@ -82,8 +80,7 @@ int MxDirect3DRMDevice::Update()
|
|||||||
void MxDirect3DRMDevice::InitFromD3D()
|
void MxDirect3DRMDevice::InitFromD3D()
|
||||||
{
|
{
|
||||||
IDirect3DRMWinDevice* winDevice;
|
IDirect3DRMWinDevice* winDevice;
|
||||||
if (SUCCEEDED(m_pD3DRMDevice->QueryInterface(IID_IDirect3DRMWinDevice, (LPVOID*)&winDevice)))
|
if (SUCCEEDED(m_pD3DRMDevice->QueryInterface(IID_IDirect3DRMWinDevice, (LPVOID*) &winDevice))) {
|
||||||
{
|
|
||||||
m_pD3DRMDevice->InitFromD3D((LPDIRECT3D) &winDevice, (LPDIRECT3DDEVICE) m_pD3DRMDevice);
|
m_pD3DRMDevice->InitFromD3D((LPDIRECT3D) &winDevice, (LPDIRECT3DDEVICE) m_pD3DRMDevice);
|
||||||
winDevice->Release();
|
winDevice->Release();
|
||||||
}
|
}
|
||||||
@ -96,10 +93,8 @@ void MxDirect3DRMDevice::InitFromD3D()
|
|||||||
void MxDirect3DRMDevice::Init()
|
void MxDirect3DRMDevice::Init()
|
||||||
{
|
{
|
||||||
IDirect3DRMWinDevice* winDevice;
|
IDirect3DRMWinDevice* winDevice;
|
||||||
if (SUCCEEDED(m_pD3DRMDevice->QueryInterface(IID_IDirect3DRMWinDevice, (LPVOID*)&winDevice)))
|
if (SUCCEEDED(m_pD3DRMDevice->QueryInterface(IID_IDirect3DRMWinDevice, (LPVOID*) &winDevice))) {
|
||||||
{
|
|
||||||
// m_pD3DRMDevice->Init();
|
// m_pD3DRMDevice->Init();
|
||||||
winDevice->Release();
|
winDevice->Release();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,21 +1,17 @@
|
|||||||
|
|
||||||
#include "mxtypes.h"
|
|
||||||
|
|
||||||
#include "d3drm.h"
|
#include "d3drm.h"
|
||||||
|
|
||||||
#include "mxdirect3drmobject.h"
|
#include "mxdirect3drmobject.h"
|
||||||
|
#include "mxtypes.h"
|
||||||
|
|
||||||
// VTABLE 0x100db9b8
|
// VTABLE 0x100db9b8
|
||||||
class IMxDirect3DRMDevice : public IMxDirect3DRMObject
|
class IMxDirect3DRMDevice : public IMxDirect3DRMObject {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
virtual ~IMxDirect3DRMDevice() {}
|
virtual ~IMxDirect3DRMDevice() {}
|
||||||
|
|
||||||
virtual IUnknown** GetHandle() = 0;
|
virtual IUnknown** GetHandle() = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum MxDirect3DRMDeviceQuality
|
enum MxDirect3DRMDeviceQuality {
|
||||||
{
|
|
||||||
Wireframe = 0x0,
|
Wireframe = 0x0,
|
||||||
UnlitFlat = 0x1,
|
UnlitFlat = 0x1,
|
||||||
Flat = 0x2,
|
Flat = 0x2,
|
||||||
@ -24,8 +20,7 @@ enum MxDirect3DRMDeviceQuality
|
|||||||
};
|
};
|
||||||
|
|
||||||
// VTABLE 0x100db988
|
// VTABLE 0x100db988
|
||||||
class MxDirect3DRMDevice : public IMxDirect3DRMDevice
|
class MxDirect3DRMDevice : public IMxDirect3DRMDevice {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
MxDirect3DRMDevice() {}
|
MxDirect3DRMDevice() {}
|
||||||
virtual ~MxDirect3DRMDevice() {}
|
virtual ~MxDirect3DRMDevice() {}
|
||||||
|
|||||||
@ -1,12 +1,10 @@
|
|||||||
|
|
||||||
#include "mxtypes.h"
|
|
||||||
#include "d3d.h"
|
#include "d3d.h"
|
||||||
|
|
||||||
#include "d3drm.h"
|
#include "d3drm.h"
|
||||||
|
#include "mxtypes.h"
|
||||||
|
|
||||||
// VTABLE 0x100db980
|
// VTABLE 0x100db980
|
||||||
class IMxDirect3DRMObject
|
class IMxDirect3DRMObject {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
virtual ~IMxDirect3DRMObject() {}
|
virtual ~IMxDirect3DRMObject() {}
|
||||||
|
|
||||||
|
|||||||
@ -7,7 +7,15 @@ DECOMP_SIZE_ASSERT(MxDirect3DRMTexture, 0x8);
|
|||||||
DECOMP_SIZE_ASSERT(MxD3DRMIMAGE, 0x40);
|
DECOMP_SIZE_ASSERT(MxD3DRMIMAGE, 0x40);
|
||||||
|
|
||||||
// OFFSET: LEGO1 0x100a1330
|
// OFFSET: LEGO1 0x100a1330
|
||||||
MxD3DRMIMAGE::MxD3DRMIMAGE(int p_width, int p_height, int p_depth, void *p_buffer, int p_useBuffer, int p_paletteSize, PaletteEntry *p_palette)
|
MxD3DRMIMAGE::MxD3DRMIMAGE(
|
||||||
|
int p_width,
|
||||||
|
int p_height,
|
||||||
|
int p_depth,
|
||||||
|
void* p_buffer,
|
||||||
|
int p_useBuffer,
|
||||||
|
int p_paletteSize,
|
||||||
|
PaletteEntry* p_palette
|
||||||
|
)
|
||||||
{
|
{
|
||||||
m_image.aspectx = 1;
|
m_image.aspectx = 1;
|
||||||
m_image.aspecty = 1;
|
m_image.aspecty = 1;
|
||||||
@ -25,12 +33,10 @@ MxD3DRMIMAGE::MxD3DRMIMAGE(int p_width, int p_height, int p_depth, void *p_buffe
|
|||||||
m_image.palette_size = 0;
|
m_image.palette_size = 0;
|
||||||
m_image.palette = NULL;
|
m_image.palette = NULL;
|
||||||
m_extra = 0;
|
m_extra = 0;
|
||||||
if (p_buffer != NULL)
|
if (p_buffer != NULL) {
|
||||||
{
|
|
||||||
CreateBuffer(p_width, p_height, p_depth, p_buffer, p_useBuffer);
|
CreateBuffer(p_width, p_height, p_depth, p_buffer, p_useBuffer);
|
||||||
}
|
}
|
||||||
if (p_palette != NULL)
|
if (p_palette != NULL) {
|
||||||
{
|
|
||||||
InitializePalette(p_paletteSize, p_palette);
|
InitializePalette(p_paletteSize, p_palette);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -44,8 +50,7 @@ int MxD3DRMIMAGE::CreateBuffer(int p_width, int p_height, int p_depth, void *p_b
|
|||||||
// OFFSET: LEGO1 0x100a13b0
|
// OFFSET: LEGO1 0x100a13b0
|
||||||
void MxD3DRMIMAGE::Destroy()
|
void MxD3DRMIMAGE::Destroy()
|
||||||
{
|
{
|
||||||
if (m_extra == 0)
|
if (m_extra == 0) {
|
||||||
{
|
|
||||||
free(m_image.buffer1);
|
free(m_image.buffer1);
|
||||||
}
|
}
|
||||||
free(m_image.palette);
|
free(m_image.palette);
|
||||||
@ -55,32 +60,25 @@ void MxD3DRMIMAGE::Destroy()
|
|||||||
void MxD3DRMIMAGE::FillRowsOfTexture(int p_y, int p_height, char* p_content)
|
void MxD3DRMIMAGE::FillRowsOfTexture(int p_y, int p_height, char* p_content)
|
||||||
{
|
{
|
||||||
// The purpose is clearly this but I can't get the assembly to line up.
|
// The purpose is clearly this but I can't get the assembly to line up.
|
||||||
memcpy((char*)m_image.buffer1 + (p_y * m_image.bytes_per_line),
|
memcpy((char*) m_image.buffer1 + (p_y * m_image.bytes_per_line), p_content, p_height * m_image.bytes_per_line);
|
||||||
p_content,
|
|
||||||
p_height * m_image.bytes_per_line);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// OFFSET: LEGO1 0x100a1550
|
// OFFSET: LEGO1 0x100a1550
|
||||||
int MxD3DRMIMAGE::InitializePalette(int p_paletteSize, PaletteEntry* p_palette)
|
int MxD3DRMIMAGE::InitializePalette(int p_paletteSize, PaletteEntry* p_palette)
|
||||||
{
|
{
|
||||||
if (m_image.palette_size != p_paletteSize)
|
if (m_image.palette_size != p_paletteSize) {
|
||||||
{
|
if (m_image.palette != NULL) {
|
||||||
if (m_image.palette != NULL)
|
|
||||||
{
|
|
||||||
free(m_image.palette);
|
free(m_image.palette);
|
||||||
m_image.palette = NULL;
|
m_image.palette = NULL;
|
||||||
m_image.palette_size = 0;
|
m_image.palette_size = 0;
|
||||||
}
|
}
|
||||||
if (p_paletteSize > 0)
|
if (p_paletteSize > 0) {
|
||||||
{
|
|
||||||
m_image.palette = (D3DRMPALETTEENTRY*) malloc(4 * p_paletteSize);
|
m_image.palette = (D3DRMPALETTEENTRY*) malloc(4 * p_paletteSize);
|
||||||
m_image.palette_size = p_paletteSize;
|
m_image.palette_size = p_paletteSize;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (p_paletteSize > 0)
|
if (p_paletteSize > 0) {
|
||||||
{
|
for (int i = 0; i < p_paletteSize; i++) {
|
||||||
for (int i = 0; i < p_paletteSize; i++)
|
|
||||||
{
|
|
||||||
m_image.palette[i].red = p_palette[i].r;
|
m_image.palette[i].red = p_palette[i].r;
|
||||||
m_image.palette[i].green = p_palette[i].g;
|
m_image.palette[i].green = p_palette[i].g;
|
||||||
m_image.palette[i].blue = p_palette[i].b;
|
m_image.palette[i].blue = p_palette[i].b;
|
||||||
@ -103,10 +101,8 @@ int MxDirect3DRMTexture::SetBuffer(int p_width, int p_height, int p_depth, void
|
|||||||
// flow for the result handling is a bit annoying.
|
// flow for the result handling is a bit annoying.
|
||||||
MxD3DRMIMAGE* image = GetImageData();
|
MxD3DRMIMAGE* image = GetImageData();
|
||||||
int result = image->CreateBuffer(p_width, p_height, p_depth, p_buffer, TRUE);
|
int result = image->CreateBuffer(p_width, p_height, p_depth, p_buffer, TRUE);
|
||||||
if (result == TRUE)
|
if (result == TRUE) {
|
||||||
{
|
if (!SUCCEEDED(m_pDirect3DRMTexture->Changed(TRUE, FALSE))) {
|
||||||
if (!SUCCEEDED(m_pDirect3DRMTexture->Changed(TRUE, FALSE)))
|
|
||||||
{
|
|
||||||
result = FALSE;
|
result = FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -127,7 +123,14 @@ int MxDirect3DRMTexture::Changed(int p_pixelsChanged, int p_paletteChanged)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// OFFSET: LEGO1 0x100a3d00
|
// OFFSET: LEGO1 0x100a3d00
|
||||||
int MxDirect3DRMTexture::GetBufferAndPalette(int *p_width, int *p_height, int *p_depth, void **p_buffer, int *p_paletteSize, MxD3DRMIMAGE::PaletteEntry **p_palette)
|
int MxDirect3DRMTexture::GetBufferAndPalette(
|
||||||
|
int* p_width,
|
||||||
|
int* p_height,
|
||||||
|
int* p_depth,
|
||||||
|
void** p_buffer,
|
||||||
|
int* p_paletteSize,
|
||||||
|
MxD3DRMIMAGE::PaletteEntry** p_palette
|
||||||
|
)
|
||||||
{
|
{
|
||||||
// Something really doesn't match here, not sure what's up.
|
// Something really doesn't match here, not sure what's up.
|
||||||
MxD3DRMIMAGE* image = GetImageData();
|
MxD3DRMIMAGE* image = GetImageData();
|
||||||
@ -136,8 +139,7 @@ int MxDirect3DRMTexture::GetBufferAndPalette(int *p_width, int *p_height, int *p
|
|||||||
*p_depth = image->m_image.depth;
|
*p_depth = image->m_image.depth;
|
||||||
*p_buffer = image->m_image.buffer1;
|
*p_buffer = image->m_image.buffer1;
|
||||||
*p_paletteSize = image->m_image.palette_size;
|
*p_paletteSize = image->m_image.palette_size;
|
||||||
for (int i = 0; i < image->m_image.palette_size; i++)
|
for (int i = 0; i < image->m_image.palette_size; i++) {
|
||||||
{
|
|
||||||
p_palette[i]->r = image->m_image.palette[i].red;
|
p_palette[i]->r = image->m_image.palette[i].red;
|
||||||
p_palette[i]->g = image->m_image.palette[i].green;
|
p_palette[i]->g = image->m_image.palette[i].green;
|
||||||
p_palette[i]->b = image->m_image.palette[i].blue;
|
p_palette[i]->b = image->m_image.palette[i].blue;
|
||||||
@ -162,5 +164,3 @@ void MxDirect3DRMTexture::OnDestroyed()
|
|||||||
delete GetImageData();
|
delete GetImageData();
|
||||||
m_pDirect3DRMTexture->SetAppData(NULL);
|
m_pDirect3DRMTexture->SetAppData(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -2,17 +2,23 @@
|
|||||||
#include "mxdirect3drmobject.h"
|
#include "mxdirect3drmobject.h"
|
||||||
|
|
||||||
// No vtable, this is just a simple wrapper around D3DRMIMAGE
|
// No vtable, this is just a simple wrapper around D3DRMIMAGE
|
||||||
class MxD3DRMIMAGE
|
class MxD3DRMIMAGE {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
struct PaletteEntry
|
struct PaletteEntry {
|
||||||
{
|
|
||||||
unsigned char r;
|
unsigned char r;
|
||||||
unsigned char g;
|
unsigned char g;
|
||||||
unsigned char b;
|
unsigned char b;
|
||||||
};
|
};
|
||||||
|
|
||||||
MxD3DRMIMAGE(int p_width, int p_height, int p_depth, void *p_buffer, int p_useBuffer, int p_paletteSize, PaletteEntry *p_palette);
|
MxD3DRMIMAGE(
|
||||||
|
int p_width,
|
||||||
|
int p_height,
|
||||||
|
int p_depth,
|
||||||
|
void* p_buffer,
|
||||||
|
int p_useBuffer,
|
||||||
|
int p_paletteSize,
|
||||||
|
PaletteEntry* p_palette
|
||||||
|
);
|
||||||
~MxD3DRMIMAGE() { Destroy(); }
|
~MxD3DRMIMAGE() { Destroy(); }
|
||||||
|
|
||||||
int CreateBuffer(int p_width, int p_height, int p_depth, void* p_buffer, int p_useBuffer);
|
int CreateBuffer(int p_width, int p_height, int p_depth, void* p_buffer, int p_useBuffer);
|
||||||
@ -25,8 +31,7 @@ class MxD3DRMIMAGE
|
|||||||
};
|
};
|
||||||
|
|
||||||
// VTABLE 0x100dbb68
|
// VTABLE 0x100dbb68
|
||||||
class IMxDirect3DRMTexture : public IMxDirect3DRMObject
|
class IMxDirect3DRMTexture : public IMxDirect3DRMObject {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
virtual ~IMxDirect3DRMTexture() {}
|
virtual ~IMxDirect3DRMTexture() {}
|
||||||
|
|
||||||
@ -38,13 +43,19 @@ class IMxDirect3DRMTexture : public IMxDirect3DRMObject
|
|||||||
|
|
||||||
// vtable+0x10
|
// vtable+0x10
|
||||||
virtual int Changed(int p_pixelsChanged, int p_paletteChanged) = 0;
|
virtual int Changed(int p_pixelsChanged, int p_paletteChanged) = 0;
|
||||||
virtual int GetBufferAndPalette(int *p_width, int *p_height, int *p_depth, void **p_buffer, int *p_paletteSize, MxD3DRMIMAGE::PaletteEntry **p_palette) = 0;
|
virtual int GetBufferAndPalette(
|
||||||
|
int* p_width,
|
||||||
|
int* p_height,
|
||||||
|
int* p_depth,
|
||||||
|
void** p_buffer,
|
||||||
|
int* p_paletteSize,
|
||||||
|
MxD3DRMIMAGE::PaletteEntry** p_palette
|
||||||
|
) = 0;
|
||||||
virtual int InitializePalette(int p_paletteSize, MxD3DRMIMAGE::PaletteEntry* p_palette) = 0;
|
virtual int InitializePalette(int p_paletteSize, MxD3DRMIMAGE::PaletteEntry* p_palette) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
// VTABLE 0x100dbb48
|
// VTABLE 0x100dbb48
|
||||||
class MxDirect3DRMTexture : public IMxDirect3DRMTexture
|
class MxDirect3DRMTexture : public IMxDirect3DRMTexture {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
MxDirect3DRMTexture() {}
|
MxDirect3DRMTexture() {}
|
||||||
virtual ~MxDirect3DRMTexture() {}
|
virtual ~MxDirect3DRMTexture() {}
|
||||||
@ -57,17 +68,21 @@ class MxDirect3DRMTexture : public IMxDirect3DRMTexture
|
|||||||
|
|
||||||
// vtable+0x10
|
// vtable+0x10
|
||||||
virtual int Changed(int p_pixelsChanged, int p_paletteChanged);
|
virtual int Changed(int p_pixelsChanged, int p_paletteChanged);
|
||||||
virtual int GetBufferAndPalette(int *p_width, int *p_height, int *p_depth, void **p_buffer, int *p_paletteSize, MxD3DRMIMAGE::PaletteEntry **p_palette);
|
virtual int GetBufferAndPalette(
|
||||||
|
int* p_width,
|
||||||
|
int* p_height,
|
||||||
|
int* p_depth,
|
||||||
|
void** p_buffer,
|
||||||
|
int* p_paletteSize,
|
||||||
|
MxD3DRMIMAGE::PaletteEntry** p_palette
|
||||||
|
);
|
||||||
virtual int InitializePalette(int p_paletteSize, MxD3DRMIMAGE::PaletteEntry* p_palette);
|
virtual int InitializePalette(int p_paletteSize, MxD3DRMIMAGE::PaletteEntry* p_palette);
|
||||||
|
|
||||||
// Not virtual
|
// Not virtual
|
||||||
void OnDestroyed();
|
void OnDestroyed();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
inline MxD3DRMIMAGE *GetImageData()
|
inline MxD3DRMIMAGE* GetImageData() { return (MxD3DRMIMAGE*) m_pDirect3DRMTexture->GetAppData(); }
|
||||||
{
|
|
||||||
return (MxD3DRMIMAGE*)m_pDirect3DRMTexture->GetAppData();
|
|
||||||
}
|
|
||||||
|
|
||||||
IDirect3DRMTexture* m_pDirect3DRMTexture;
|
IDirect3DRMTexture* m_pDirect3DRMTexture;
|
||||||
};
|
};
|
||||||
|
|||||||
@ -7,8 +7,7 @@
|
|||||||
DECOMP_SIZE_ASSERT(IMxDirect3DRMViewport, 0x4);
|
DECOMP_SIZE_ASSERT(IMxDirect3DRMViewport, 0x4);
|
||||||
DECOMP_SIZE_ASSERT(MxDirect3DRMViewport, 0x8);
|
DECOMP_SIZE_ASSERT(MxDirect3DRMViewport, 0x8);
|
||||||
|
|
||||||
struct MxDirect3DRMViewportData
|
struct MxDirect3DRMViewportData {
|
||||||
{
|
|
||||||
IDirect3DRMFrame* m_pDirect3DRMFrame;
|
IDirect3DRMFrame* m_pDirect3DRMFrame;
|
||||||
IDirect3DRMFrame* m_pCamera;
|
IDirect3DRMFrame* m_pCamera;
|
||||||
IDirect3DRMFrame* m_pCameraParent;
|
IDirect3DRMFrame* m_pCameraParent;
|
||||||
@ -42,8 +41,7 @@ int MxDirect3DRMViewport::SetCamera(MxDirect3DRMFrame *p_camera)
|
|||||||
IDirect3DRMViewport* viewport = GetViewport();
|
IDirect3DRMViewport* viewport = GetViewport();
|
||||||
IDirect3DRMFrame* camera = p_camera->GetFrame();
|
IDirect3DRMFrame* camera = p_camera->GetFrame();
|
||||||
MxDirect3DRMViewportData* data = GetViewportData();
|
MxDirect3DRMViewportData* data = GetViewportData();
|
||||||
if (data->m_pCameraParent)
|
if (data->m_pCameraParent) {
|
||||||
{
|
|
||||||
data->m_pCameraParent->DeleteChild(data->m_pCamera);
|
data->m_pCameraParent->DeleteChild(data->m_pCamera);
|
||||||
// Another call goes here, not sure what.
|
// Another call goes here, not sure what.
|
||||||
data->m_pCameraParent->Release();
|
data->m_pCameraParent->Release();
|
||||||
@ -57,8 +55,7 @@ int MxDirect3DRMViewport::SetCamera(MxDirect3DRMFrame *p_camera)
|
|||||||
int MxDirect3DRMViewport::SetProjection(int p_type)
|
int MxDirect3DRMViewport::SetProjection(int p_type)
|
||||||
{
|
{
|
||||||
D3DRMPROJECTIONTYPE proj;
|
D3DRMPROJECTIONTYPE proj;
|
||||||
switch (p_type)
|
switch (p_type) {
|
||||||
{
|
|
||||||
case 0:
|
case 0:
|
||||||
proj = D3DRMPROJECT_PERSPECTIVE;
|
proj = D3DRMPROJECT_PERSPECTIVE;
|
||||||
break;
|
break;
|
||||||
@ -78,10 +75,8 @@ int MxDirect3DRMViewport::SetPlanes(float p_near, float p_far, float p_FoV)
|
|||||||
float field = tanf(((p_FoV * 0.5f) * (5 / 9)) * 3.141592653589793);
|
float field = tanf(((p_FoV * 0.5f) * (5 / 9)) * 3.141592653589793);
|
||||||
// Not very confident about this code, seems like p_near may actually be
|
// Not very confident about this code, seems like p_near may actually be
|
||||||
// multiplied by something before being passed to SetFront.
|
// multiplied by something before being passed to SetFront.
|
||||||
if (ret = SUCCEEDED(m_pDirect3DRMViewport->SetFront(p_near)))
|
if (ret = SUCCEEDED(m_pDirect3DRMViewport->SetFront(p_near))) {
|
||||||
{
|
if (ret = SUCCEEDED(m_pDirect3DRMViewport->SetBack(p_far))) {
|
||||||
if (ret = SUCCEEDED(m_pDirect3DRMViewport->SetBack(p_far)))
|
|
||||||
{
|
|
||||||
ret = SUCCEEDED(m_pDirect3DRMViewport->SetField(field));
|
ret = SUCCEEDED(m_pDirect3DRMViewport->SetField(field));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -96,8 +91,7 @@ int MxDirect3DRMViewport::SetBackgroundRGB(float p_r, float p_g, float p_b)
|
|||||||
data->m_backgroundRGB[0] = p_r;
|
data->m_backgroundRGB[0] = p_r;
|
||||||
data->m_backgroundRGB[1] = p_g;
|
data->m_backgroundRGB[1] = p_g;
|
||||||
data->m_backgroundRGB[2] = p_b;
|
data->m_backgroundRGB[2] = p_b;
|
||||||
if (data->m_pCameraParent)
|
if (data->m_pCameraParent) {
|
||||||
{
|
|
||||||
ret = data->m_pCameraParent->SetSceneBackgroundRGB(p_r, p_g, p_b) < 0 ? FALSE : TRUE;
|
ret = data->m_pCameraParent->SetSceneBackgroundRGB(p_r, p_g, p_b) < 0 ? FALSE : TRUE;
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
@ -127,19 +121,17 @@ int MxDirect3DRMViewport::SetCameraParent(MxDirect3DRMFrame *p_frame)
|
|||||||
IDirect3DRMFrame* newParent = p_frame->GetFrame();
|
IDirect3DRMFrame* newParent = p_frame->GetFrame();
|
||||||
MxDirect3DRMViewportData* data = GetViewportData();
|
MxDirect3DRMViewportData* data = GetViewportData();
|
||||||
IDirect3DRMFrame* oldParent = data->m_pCameraParent;
|
IDirect3DRMFrame* oldParent = data->m_pCameraParent;
|
||||||
if (newParent != oldParent)
|
if (newParent != oldParent) {
|
||||||
{
|
if (oldParent != NULL) {
|
||||||
if (oldParent != NULL)
|
|
||||||
{
|
|
||||||
oldParent->DeleteChild(data->m_pCamera);
|
oldParent->DeleteChild(data->m_pCamera);
|
||||||
// Another call goes here, not sure what.
|
// Another call goes here, not sure what.
|
||||||
oldParent->Release();
|
oldParent->Release();
|
||||||
}
|
}
|
||||||
data->m_pCameraParent = newParent;
|
data->m_pCameraParent = newParent;
|
||||||
oldParent = data->m_pDirect3DRMFrame;
|
oldParent = data->m_pDirect3DRMFrame;
|
||||||
if (newParent != NULL)
|
if (newParent != NULL) {
|
||||||
{
|
newParent
|
||||||
newParent->SetSceneBackgroundRGB(data->m_backgroundRGB[0], data->m_backgroundRGB[1], data->m_backgroundRGB[2]);
|
->SetSceneBackgroundRGB(data->m_backgroundRGB[0], data->m_backgroundRGB[1], data->m_backgroundRGB[2]);
|
||||||
newParent->AddChild(data->m_pCamera);
|
newParent->AddChild(data->m_pCamera);
|
||||||
// Another call goes here, not sure what.
|
// Another call goes here, not sure what.
|
||||||
newParent->AddRef();
|
newParent->AddRef();
|
||||||
@ -164,8 +156,7 @@ int MxDirect3DRMViewport::Transform(float *p_shiftByVector3, float *p_out)
|
|||||||
|
|
||||||
D3DRMVECTOR4D d;
|
D3DRMVECTOR4D d;
|
||||||
int ret = m_pDirect3DRMViewport->Transform(&d, &s);
|
int ret = m_pDirect3DRMViewport->Transform(&d, &s);
|
||||||
if (SUCCEEDED(ret) == TRUE)
|
if (SUCCEEDED(ret) == TRUE) {
|
||||||
{
|
|
||||||
p_out[0] = d.x;
|
p_out[0] = d.x;
|
||||||
p_out[1] = d.y;
|
p_out[1] = d.y;
|
||||||
p_out[2] = d.z;
|
p_out[2] = d.z;
|
||||||
@ -174,7 +165,6 @@ int MxDirect3DRMViewport::Transform(float *p_shiftByVector3, float *p_out)
|
|||||||
return SUCCEEDED(ret);
|
return SUCCEEDED(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Don't know the types of the parameters for this.
|
// Don't know the types of the parameters for this.
|
||||||
// OFFSET: LEGO1 0x100a30c0
|
// OFFSET: LEGO1 0x100a30c0
|
||||||
int MxDirect3DRMViewport::unk(int p_1, int p_2, int p_3, int p_4, int p_5, int p_6)
|
int MxDirect3DRMViewport::unk(int p_1, int p_2, int p_3, int p_4, int p_5, int p_6)
|
||||||
@ -183,7 +173,15 @@ int MxDirect3DRMViewport::unk(int p_1, int p_2, int p_3, int p_4, int p_5, int p
|
|||||||
}
|
}
|
||||||
|
|
||||||
// OFFSET: LEGO1 0x100a1290
|
// OFFSET: LEGO1 0x100a1290
|
||||||
int MxDirect3DRMViewport::unkInternal(IDirect3DRMViewport* p_viewport, int p_1, int p_2, int p_3, int p_4, int p_5, int p_6)
|
int MxDirect3DRMViewport::unkInternal(
|
||||||
|
IDirect3DRMViewport* p_viewport,
|
||||||
|
int p_1,
|
||||||
|
int p_2,
|
||||||
|
int p_3,
|
||||||
|
int p_4,
|
||||||
|
int p_5,
|
||||||
|
int p_6
|
||||||
|
)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,8 +2,7 @@
|
|||||||
#include "mxdirect3drmclasses.h"
|
#include "mxdirect3drmclasses.h"
|
||||||
|
|
||||||
// VTABLE 0x100dba28
|
// VTABLE 0x100dba28
|
||||||
class IMxDirect3DRMViewport : public IMxDirect3DRMObject
|
class IMxDirect3DRMViewport : public IMxDirect3DRMObject {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
virtual ~IMxDirect3DRMViewport() {}
|
virtual ~IMxDirect3DRMViewport() {}
|
||||||
|
|
||||||
@ -34,8 +33,7 @@ class IMxDirect3DRMViewport : public IMxDirect3DRMObject
|
|||||||
struct MxDirect3DRMViewportData;
|
struct MxDirect3DRMViewportData;
|
||||||
|
|
||||||
// VTABLE 0x100db9e8
|
// VTABLE 0x100db9e8
|
||||||
class MxDirect3DRMViewport : public IMxDirect3DRMViewport
|
class MxDirect3DRMViewport : public IMxDirect3DRMViewport {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
MxDirect3DRMViewport() {}
|
MxDirect3DRMViewport() {}
|
||||||
virtual ~MxDirect3DRMViewport() {}
|
virtual ~MxDirect3DRMViewport() {}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user