diff --git a/Include/d3d.h b/Include/d3d.h new file mode 100644 index 0000000..eea7dff --- /dev/null +++ b/Include/d3d.h @@ -0,0 +1,1688 @@ +/*==========================================================================; + * + * Copyright (C) Microsoft Corporation. All Rights Reserved. + * + * File: d3d.h + * Content: Direct3D include file + * + ****************************************************************************/ + +#ifndef _D3D_H_ +#define _D3D_H_ + +#ifndef DIRECT3D_VERSION +#define DIRECT3D_VERSION 0x0700 +#endif + +// include this file content only if compiling for <=DX7 interfaces +#if(DIRECT3D_VERSION < 0x0800) + + +#include + +#define COM_NO_WINDOWS_H +#include + +#define D3DAPI WINAPI + +/* + * Interface IID's + */ +#if defined( _WIN32 ) && !defined( _NO_COM) +DEFINE_GUID( IID_IDirect3D, 0x3BBA0080,0x2421,0x11CF,0xA3,0x1A,0x00,0xAA,0x00,0xB9,0x33,0x56 ); +#if(DIRECT3D_VERSION >= 0x0500) +DEFINE_GUID( IID_IDirect3D2, 0x6aae1ec1,0x662a,0x11d0,0x88,0x9d,0x00,0xaa,0x00,0xbb,0xb7,0x6a); +#endif /* DIRECT3D_VERSION >= 0x0500 */ +#if(DIRECT3D_VERSION >= 0x0600) +DEFINE_GUID( IID_IDirect3D3, 0xbb223240,0xe72b,0x11d0,0xa9,0xb4,0x00,0xaa,0x00,0xc0,0x99,0x3e); +#endif /* DIRECT3D_VERSION >= 0x0600 */ +#if(DIRECT3D_VERSION >= 0x0700) +DEFINE_GUID( IID_IDirect3D7, 0xf5049e77,0x4861,0x11d2,0xa4,0x7,0x0,0xa0,0xc9,0x6,0x29,0xa8); +#endif /* DIRECT3D_VERSION >= 0x0700 */ + +#if(DIRECT3D_VERSION >= 0x0500) +DEFINE_GUID( IID_IDirect3DRampDevice, 0xF2086B20,0x259F,0x11CF,0xA3,0x1A,0x00,0xAA,0x00,0xB9,0x33,0x56 ); +DEFINE_GUID( IID_IDirect3DRGBDevice, 0xA4665C60,0x2673,0x11CF,0xA3,0x1A,0x00,0xAA,0x00,0xB9,0x33,0x56 ); +DEFINE_GUID( IID_IDirect3DHALDevice, 0x84E63dE0,0x46AA,0x11CF,0x81,0x6F,0x00,0x00,0xC0,0x20,0x15,0x6E ); +DEFINE_GUID( IID_IDirect3DMMXDevice, 0x881949a1,0xd6f3,0x11d0,0x89,0xab,0x00,0xa0,0xc9,0x05,0x41,0x29 ); +#endif /* DIRECT3D_VERSION >= 0x0500 */ + +#if(DIRECT3D_VERSION >= 0x0600) +DEFINE_GUID( IID_IDirect3DRefDevice, 0x50936643, 0x13e9, 0x11d1, 0x89, 0xaa, 0x0, 0xa0, 0xc9, 0x5, 0x41, 0x29); +DEFINE_GUID( IID_IDirect3DNullDevice, 0x8767df22, 0xbacc, 0x11d1, 0x89, 0x69, 0x0, 0xa0, 0xc9, 0x6, 0x29, 0xa8); +#endif /* DIRECT3D_VERSION >= 0x0600 */ +#if(DIRECT3D_VERSION >= 0x0700) +DEFINE_GUID( IID_IDirect3DTnLHalDevice, 0xf5049e78, 0x4861, 0x11d2, 0xa4, 0x7, 0x0, 0xa0, 0xc9, 0x6, 0x29, 0xa8); +#endif /* DIRECT3D_VERSION >= 0x0700 */ + +/* + * Internal Guid to distinguish requested MMX from MMX being used as an RGB rasterizer + */ + +DEFINE_GUID( IID_IDirect3DDevice, 0x64108800,0x957d,0X11d0,0x89,0xab,0x00,0xa0,0xc9,0x05,0x41,0x29 ); +#if(DIRECT3D_VERSION >= 0x0500) +DEFINE_GUID( IID_IDirect3DDevice2, 0x93281501, 0x8cf8, 0x11d0, 0x89, 0xab, 0x0, 0xa0, 0xc9, 0x5, 0x41, 0x29); +#endif /* DIRECT3D_VERSION >= 0x0500 */ +#if(DIRECT3D_VERSION >= 0x0600) +DEFINE_GUID( IID_IDirect3DDevice3, 0xb0ab3b60, 0x33d7, 0x11d1, 0xa9, 0x81, 0x0, 0xc0, 0x4f, 0xd7, 0xb1, 0x74); +#endif /* DIRECT3D_VERSION >= 0x0600 */ +#if(DIRECT3D_VERSION >= 0x0700) +DEFINE_GUID( IID_IDirect3DDevice7, 0xf5049e79, 0x4861, 0x11d2, 0xa4, 0x7, 0x0, 0xa0, 0xc9, 0x6, 0x29, 0xa8); +#endif /* DIRECT3D_VERSION >= 0x0700 */ + +DEFINE_GUID( IID_IDirect3DTexture, 0x2CDCD9E0,0x25A0,0x11CF,0xA3,0x1A,0x00,0xAA,0x00,0xB9,0x33,0x56 ); +#if(DIRECT3D_VERSION >= 0x0500) +DEFINE_GUID( IID_IDirect3DTexture2, 0x93281502, 0x8cf8, 0x11d0, 0x89, 0xab, 0x0, 0xa0, 0xc9, 0x5, 0x41, 0x29); +#endif /* DIRECT3D_VERSION >= 0x0500 */ + +DEFINE_GUID( IID_IDirect3DLight, 0x4417C142,0x33AD,0x11CF,0x81,0x6F,0x00,0x00,0xC0,0x20,0x15,0x6E ); + +DEFINE_GUID( IID_IDirect3DMaterial, 0x4417C144,0x33AD,0x11CF,0x81,0x6F,0x00,0x00,0xC0,0x20,0x15,0x6E ); +#if(DIRECT3D_VERSION >= 0x0500) +DEFINE_GUID( IID_IDirect3DMaterial2, 0x93281503, 0x8cf8, 0x11d0, 0x89, 0xab, 0x0, 0xa0, 0xc9, 0x5, 0x41, 0x29); +#endif /* DIRECT3D_VERSION >= 0x0500 */ +#if(DIRECT3D_VERSION >= 0x0600) +DEFINE_GUID( IID_IDirect3DMaterial3, 0xca9c46f4, 0xd3c5, 0x11d1, 0xb7, 0x5a, 0x0, 0x60, 0x8, 0x52, 0xb3, 0x12); +#endif /* DIRECT3D_VERSION >= 0x0600 */ + +DEFINE_GUID( IID_IDirect3DExecuteBuffer,0x4417C145,0x33AD,0x11CF,0x81,0x6F,0x00,0x00,0xC0,0x20,0x15,0x6E ); +DEFINE_GUID( IID_IDirect3DViewport, 0x4417C146,0x33AD,0x11CF,0x81,0x6F,0x00,0x00,0xC0,0x20,0x15,0x6E ); +#if(DIRECT3D_VERSION >= 0x0500) +DEFINE_GUID( IID_IDirect3DViewport2, 0x93281500, 0x8cf8, 0x11d0, 0x89, 0xab, 0x0, 0xa0, 0xc9, 0x5, 0x41, 0x29); +#endif /* DIRECT3D_VERSION >= 0x0500 */ +#if(DIRECT3D_VERSION >= 0x0600) +DEFINE_GUID( IID_IDirect3DViewport3, 0xb0ab3b61, 0x33d7, 0x11d1, 0xa9, 0x81, 0x0, 0xc0, 0x4f, 0xd7, 0xb1, 0x74); +#endif /* DIRECT3D_VERSION >= 0x0600 */ +#if(DIRECT3D_VERSION >= 0x0600) +DEFINE_GUID( IID_IDirect3DVertexBuffer, 0x7a503555, 0x4a83, 0x11d1, 0xa5, 0xdb, 0x0, 0xa0, 0xc9, 0x3, 0x67, 0xf8); +#endif /* DIRECT3D_VERSION >= 0x0600 */ +#if(DIRECT3D_VERSION >= 0x0700) +DEFINE_GUID( IID_IDirect3DVertexBuffer7, 0xf5049e7d, 0x4861, 0x11d2, 0xa4, 0x7, 0x0, 0xa0, 0xc9, 0x6, 0x29, 0xa8); +#endif /* DIRECT3D_VERSION >= 0x0700 */ +#endif + +#ifdef __cplusplus +struct IDirect3D; +struct IDirect3DDevice; +struct IDirect3DLight; +struct IDirect3DMaterial; +struct IDirect3DExecuteBuffer; +struct IDirect3DTexture; +struct IDirect3DViewport; +typedef struct IDirect3D *LPDIRECT3D; +typedef struct IDirect3DDevice *LPDIRECT3DDEVICE; +typedef struct IDirect3DExecuteBuffer *LPDIRECT3DEXECUTEBUFFER; +typedef struct IDirect3DLight *LPDIRECT3DLIGHT; +typedef struct IDirect3DMaterial *LPDIRECT3DMATERIAL; +typedef struct IDirect3DTexture *LPDIRECT3DTEXTURE; +typedef struct IDirect3DViewport *LPDIRECT3DVIEWPORT; + +#if(DIRECT3D_VERSION >= 0x0500) +struct IDirect3D2; +struct IDirect3DDevice2; +struct IDirect3DMaterial2; +struct IDirect3DTexture2; +struct IDirect3DViewport2; +typedef struct IDirect3D2 *LPDIRECT3D2; +typedef struct IDirect3DDevice2 *LPDIRECT3DDEVICE2; +typedef struct IDirect3DMaterial2 *LPDIRECT3DMATERIAL2; +typedef struct IDirect3DTexture2 *LPDIRECT3DTEXTURE2; +typedef struct IDirect3DViewport2 *LPDIRECT3DVIEWPORT2; +#endif /* DIRECT3D_VERSION >= 0x0500 */ + +#if(DIRECT3D_VERSION >= 0x0600) +struct IDirect3D3; +struct IDirect3DDevice3; +struct IDirect3DMaterial3; +struct IDirect3DViewport3; +struct IDirect3DVertexBuffer; +typedef struct IDirect3D3 *LPDIRECT3D3; +typedef struct IDirect3DDevice3 *LPDIRECT3DDEVICE3; +typedef struct IDirect3DMaterial3 *LPDIRECT3DMATERIAL3; +typedef struct IDirect3DViewport3 *LPDIRECT3DVIEWPORT3; +typedef struct IDirect3DVertexBuffer *LPDIRECT3DVERTEXBUFFER; +#endif /* DIRECT3D_VERSION >= 0x0600 */ + +#if(DIRECT3D_VERSION >= 0x0700) +struct IDirect3D7; +struct IDirect3DDevice7; +struct IDirect3DVertexBuffer7; +typedef struct IDirect3D7 *LPDIRECT3D7; +typedef struct IDirect3DDevice7 *LPDIRECT3DDEVICE7; +typedef struct IDirect3DVertexBuffer7 *LPDIRECT3DVERTEXBUFFER7; +#endif /* DIRECT3D_VERSION >= 0x0700 */ + +#else + +typedef struct IDirect3D *LPDIRECT3D; +typedef struct IDirect3DDevice *LPDIRECT3DDEVICE; +typedef struct IDirect3DExecuteBuffer *LPDIRECT3DEXECUTEBUFFER; +typedef struct IDirect3DLight *LPDIRECT3DLIGHT; +typedef struct IDirect3DMaterial *LPDIRECT3DMATERIAL; +typedef struct IDirect3DTexture *LPDIRECT3DTEXTURE; +typedef struct IDirect3DViewport *LPDIRECT3DVIEWPORT; + +#if(DIRECT3D_VERSION >= 0x0500) +typedef struct IDirect3D2 *LPDIRECT3D2; +typedef struct IDirect3DDevice2 *LPDIRECT3DDEVICE2; +typedef struct IDirect3DMaterial2 *LPDIRECT3DMATERIAL2; +typedef struct IDirect3DTexture2 *LPDIRECT3DTEXTURE2; +typedef struct IDirect3DViewport2 *LPDIRECT3DVIEWPORT2; +#endif /* DIRECT3D_VERSION >= 0x0500 */ + +#if(DIRECT3D_VERSION >= 0x0600) +typedef struct IDirect3D3 *LPDIRECT3D3; +typedef struct IDirect3DDevice3 *LPDIRECT3DDEVICE3; +typedef struct IDirect3DMaterial3 *LPDIRECT3DMATERIAL3; +typedef struct IDirect3DViewport3 *LPDIRECT3DVIEWPORT3; +typedef struct IDirect3DVertexBuffer *LPDIRECT3DVERTEXBUFFER; +#endif /* DIRECT3D_VERSION >= 0x0600 */ + +#if(DIRECT3D_VERSION >= 0x0700) +typedef struct IDirect3D7 *LPDIRECT3D7; +typedef struct IDirect3DDevice7 *LPDIRECT3DDEVICE7; +typedef struct IDirect3DVertexBuffer7 *LPDIRECT3DVERTEXBUFFER7; +#endif /* DIRECT3D_VERSION >= 0x0700 */ + +#endif + +#include "d3dtypes.h" +#include "d3dcaps.h" + + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Direct3D interfaces + */ +#undef INTERFACE +#define INTERFACE IDirect3D + +DECLARE_INTERFACE_(IDirect3D, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3D methods ***/ + STDMETHOD(Initialize)(THIS_ REFCLSID) PURE; + STDMETHOD(EnumDevices)(THIS_ LPD3DENUMDEVICESCALLBACK,LPVOID) PURE; + STDMETHOD(CreateLight)(THIS_ LPDIRECT3DLIGHT*,IUnknown*) PURE; + STDMETHOD(CreateMaterial)(THIS_ LPDIRECT3DMATERIAL*,IUnknown*) PURE; + STDMETHOD(CreateViewport)(THIS_ LPDIRECT3DVIEWPORT*,IUnknown*) PURE; + STDMETHOD(FindDevice)(THIS_ LPD3DFINDDEVICESEARCH,LPD3DFINDDEVICERESULT) PURE; +}; + +typedef struct IDirect3D *LPDIRECT3D; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3D_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3D_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3D_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3D_Initialize(p,a) (p)->lpVtbl->Initialize(p,a) +#define IDirect3D_EnumDevices(p,a,b) (p)->lpVtbl->EnumDevices(p,a,b) +#define IDirect3D_CreateLight(p,a,b) (p)->lpVtbl->CreateLight(p,a,b) +#define IDirect3D_CreateMaterial(p,a,b) (p)->lpVtbl->CreateMaterial(p,a,b) +#define IDirect3D_CreateViewport(p,a,b) (p)->lpVtbl->CreateViewport(p,a,b) +#define IDirect3D_FindDevice(p,a,b) (p)->lpVtbl->FindDevice(p,a,b) +#else +#define IDirect3D_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3D_AddRef(p) (p)->AddRef() +#define IDirect3D_Release(p) (p)->Release() +#define IDirect3D_Initialize(p,a) (p)->Initialize(a) +#define IDirect3D_EnumDevices(p,a,b) (p)->EnumDevices(a,b) +#define IDirect3D_CreateLight(p,a,b) (p)->CreateLight(a,b) +#define IDirect3D_CreateMaterial(p,a,b) (p)->CreateMaterial(a,b) +#define IDirect3D_CreateViewport(p,a,b) (p)->CreateViewport(a,b) +#define IDirect3D_FindDevice(p,a,b) (p)->FindDevice(a,b) +#endif + +#if(DIRECT3D_VERSION >= 0x0500) +#undef INTERFACE +#define INTERFACE IDirect3D2 + +DECLARE_INTERFACE_(IDirect3D2, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3D2 methods ***/ + STDMETHOD(EnumDevices)(THIS_ LPD3DENUMDEVICESCALLBACK,LPVOID) PURE; + STDMETHOD(CreateLight)(THIS_ LPDIRECT3DLIGHT*,IUnknown*) PURE; + STDMETHOD(CreateMaterial)(THIS_ LPDIRECT3DMATERIAL2*,IUnknown*) PURE; + STDMETHOD(CreateViewport)(THIS_ LPDIRECT3DVIEWPORT2*,IUnknown*) PURE; + STDMETHOD(FindDevice)(THIS_ LPD3DFINDDEVICESEARCH,LPD3DFINDDEVICERESULT) PURE; + STDMETHOD(CreateDevice)(THIS_ REFCLSID,LPDIRECTDRAWSURFACE,LPDIRECT3DDEVICE2*) PURE; +}; + +typedef struct IDirect3D2 *LPDIRECT3D2; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3D2_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3D2_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3D2_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3D2_EnumDevices(p,a,b) (p)->lpVtbl->EnumDevices(p,a,b) +#define IDirect3D2_CreateLight(p,a,b) (p)->lpVtbl->CreateLight(p,a,b) +#define IDirect3D2_CreateMaterial(p,a,b) (p)->lpVtbl->CreateMaterial(p,a,b) +#define IDirect3D2_CreateViewport(p,a,b) (p)->lpVtbl->CreateViewport(p,a,b) +#define IDirect3D2_FindDevice(p,a,b) (p)->lpVtbl->FindDevice(p,a,b) +#define IDirect3D2_CreateDevice(p,a,b,c) (p)->lpVtbl->CreateDevice(p,a,b,c) +#else +#define IDirect3D2_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3D2_AddRef(p) (p)->AddRef() +#define IDirect3D2_Release(p) (p)->Release() +#define IDirect3D2_EnumDevices(p,a,b) (p)->EnumDevices(a,b) +#define IDirect3D2_CreateLight(p,a,b) (p)->CreateLight(a,b) +#define IDirect3D2_CreateMaterial(p,a,b) (p)->CreateMaterial(a,b) +#define IDirect3D2_CreateViewport(p,a,b) (p)->CreateViewport(a,b) +#define IDirect3D2_FindDevice(p,a,b) (p)->FindDevice(a,b) +#define IDirect3D2_CreateDevice(p,a,b,c) (p)->CreateDevice(a,b,c) +#endif +#endif /* DIRECT3D_VERSION >= 0x0500 */ + +#if(DIRECT3D_VERSION >= 0x0600) +#undef INTERFACE +#define INTERFACE IDirect3D3 + +DECLARE_INTERFACE_(IDirect3D3, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3D3 methods ***/ + STDMETHOD(EnumDevices)(THIS_ LPD3DENUMDEVICESCALLBACK,LPVOID) PURE; + STDMETHOD(CreateLight)(THIS_ LPDIRECT3DLIGHT*,LPUNKNOWN) PURE; + STDMETHOD(CreateMaterial)(THIS_ LPDIRECT3DMATERIAL3*,LPUNKNOWN) PURE; + STDMETHOD(CreateViewport)(THIS_ LPDIRECT3DVIEWPORT3*,LPUNKNOWN) PURE; + STDMETHOD(FindDevice)(THIS_ LPD3DFINDDEVICESEARCH,LPD3DFINDDEVICERESULT) PURE; + STDMETHOD(CreateDevice)(THIS_ REFCLSID,LPDIRECTDRAWSURFACE4,LPDIRECT3DDEVICE3*,LPUNKNOWN) PURE; + STDMETHOD(CreateVertexBuffer)(THIS_ LPD3DVERTEXBUFFERDESC,LPDIRECT3DVERTEXBUFFER*,DWORD,LPUNKNOWN) PURE; + STDMETHOD(EnumZBufferFormats)(THIS_ REFCLSID,LPD3DENUMPIXELFORMATSCALLBACK,LPVOID) PURE; + STDMETHOD(EvictManagedTextures)(THIS) PURE; +}; + +typedef struct IDirect3D3 *LPDIRECT3D3; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3D3_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3D3_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3D3_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3D3_EnumDevices(p,a,b) (p)->lpVtbl->EnumDevices(p,a,b) +#define IDirect3D3_CreateLight(p,a,b) (p)->lpVtbl->CreateLight(p,a,b) +#define IDirect3D3_CreateMaterial(p,a,b) (p)->lpVtbl->CreateMaterial(p,a,b) +#define IDirect3D3_CreateViewport(p,a,b) (p)->lpVtbl->CreateViewport(p,a,b) +#define IDirect3D3_FindDevice(p,a,b) (p)->lpVtbl->FindDevice(p,a,b) +#define IDirect3D3_CreateDevice(p,a,b,c,d) (p)->lpVtbl->CreateDevice(p,a,b,c,d) +#define IDirect3D3_CreateVertexBuffer(p,a,b,c,d) (p)->lpVtbl->CreateVertexBuffer(p,a,b,c,d) +#define IDirect3D3_EnumZBufferFormats(p,a,b,c) (p)->lpVtbl->EnumZBufferFormats(p,a,b,c) +#define IDirect3D3_EvictManagedTextures(p) (p)->lpVtbl->EvictManagedTextures(p) +#else +#define IDirect3D3_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3D3_AddRef(p) (p)->AddRef() +#define IDirect3D3_Release(p) (p)->Release() +#define IDirect3D3_EnumDevices(p,a,b) (p)->EnumDevices(a,b) +#define IDirect3D3_CreateLight(p,a,b) (p)->CreateLight(a,b) +#define IDirect3D3_CreateMaterial(p,a,b) (p)->CreateMaterial(a,b) +#define IDirect3D3_CreateViewport(p,a,b) (p)->CreateViewport(a,b) +#define IDirect3D3_FindDevice(p,a,b) (p)->FindDevice(a,b) +#define IDirect3D3_CreateDevice(p,a,b,c,d) (p)->CreateDevice(a,b,c,d) +#define IDirect3D3_CreateVertexBuffer(p,a,b,c,d) (p)->CreateVertexBuffer(a,b,c,d) +#define IDirect3D3_EnumZBufferFormats(p,a,b,c) (p)->EnumZBufferFormats(a,b,c) +#define IDirect3D3_EvictManagedTextures(p) (p)->EvictManagedTextures() +#endif +#endif /* DIRECT3D_VERSION >= 0x0600 */ + +#if(DIRECT3D_VERSION >= 0x0700) +#undef INTERFACE +#define INTERFACE IDirect3D7 + +DECLARE_INTERFACE_(IDirect3D7, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3D7 methods ***/ + STDMETHOD(EnumDevices)(THIS_ LPD3DENUMDEVICESCALLBACK7,LPVOID) PURE; + STDMETHOD(CreateDevice)(THIS_ REFCLSID,LPDIRECTDRAWSURFACE7,LPDIRECT3DDEVICE7*) PURE; + STDMETHOD(CreateVertexBuffer)(THIS_ LPD3DVERTEXBUFFERDESC,LPDIRECT3DVERTEXBUFFER7*,DWORD) PURE; + STDMETHOD(EnumZBufferFormats)(THIS_ REFCLSID,LPD3DENUMPIXELFORMATSCALLBACK,LPVOID) PURE; + STDMETHOD(EvictManagedTextures)(THIS) PURE; +}; + +typedef struct IDirect3D7 *LPDIRECT3D7; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3D7_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3D7_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3D7_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3D7_EnumDevices(p,a,b) (p)->lpVtbl->EnumDevices(p,a,b) +#define IDirect3D7_CreateDevice(p,a,b,c) (p)->lpVtbl->CreateDevice(p,a,b,c) +#define IDirect3D7_CreateVertexBuffer(p,a,b,c) (p)->lpVtbl->CreateVertexBuffer(p,a,b,c) +#define IDirect3D7_EnumZBufferFormats(p,a,b,c) (p)->lpVtbl->EnumZBufferFormats(p,a,b,c) +#define IDirect3D7_EvictManagedTextures(p) (p)->lpVtbl->EvictManagedTextures(p) +#else +#define IDirect3D7_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3D7_AddRef(p) (p)->AddRef() +#define IDirect3D7_Release(p) (p)->Release() +#define IDirect3D7_EnumDevices(p,a,b) (p)->EnumDevices(a,b) +#define IDirect3D7_CreateDevice(p,a,b,c) (p)->CreateDevice(a,b,c) +#define IDirect3D7_CreateVertexBuffer(p,a,b,c) (p)->CreateVertexBuffer(a,b,c) +#define IDirect3D7_EnumZBufferFormats(p,a,b,c) (p)->EnumZBufferFormats(a,b,c) +#define IDirect3D7_EvictManagedTextures(p) (p)->EvictManagedTextures() +#endif +#endif /* DIRECT3D_VERSION >= 0x0700 */ +/* + * Direct3D Device interfaces + */ +#undef INTERFACE +#define INTERFACE IDirect3DDevice + +DECLARE_INTERFACE_(IDirect3DDevice, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DDevice methods ***/ + STDMETHOD(Initialize)(THIS_ LPDIRECT3D,LPGUID,LPD3DDEVICEDESC) PURE; + STDMETHOD(GetCaps)(THIS_ LPD3DDEVICEDESC,LPD3DDEVICEDESC) PURE; + STDMETHOD(SwapTextureHandles)(THIS_ LPDIRECT3DTEXTURE,LPDIRECT3DTEXTURE) PURE; + STDMETHOD(CreateExecuteBuffer)(THIS_ LPD3DEXECUTEBUFFERDESC,LPDIRECT3DEXECUTEBUFFER*,IUnknown*) PURE; + STDMETHOD(GetStats)(THIS_ LPD3DSTATS) PURE; + STDMETHOD(Execute)(THIS_ LPDIRECT3DEXECUTEBUFFER,LPDIRECT3DVIEWPORT,DWORD) PURE; + STDMETHOD(AddViewport)(THIS_ LPDIRECT3DVIEWPORT) PURE; + STDMETHOD(DeleteViewport)(THIS_ LPDIRECT3DVIEWPORT) PURE; + STDMETHOD(NextViewport)(THIS_ LPDIRECT3DVIEWPORT,LPDIRECT3DVIEWPORT*,DWORD) PURE; + STDMETHOD(Pick)(THIS_ LPDIRECT3DEXECUTEBUFFER,LPDIRECT3DVIEWPORT,DWORD,LPD3DRECT) PURE; + STDMETHOD(GetPickRecords)(THIS_ LPDWORD,LPD3DPICKRECORD) PURE; + STDMETHOD(EnumTextureFormats)(THIS_ LPD3DENUMTEXTUREFORMATSCALLBACK,LPVOID) PURE; + STDMETHOD(CreateMatrix)(THIS_ LPD3DMATRIXHANDLE) PURE; + STDMETHOD(SetMatrix)(THIS_ D3DMATRIXHANDLE,const LPD3DMATRIX) PURE; + STDMETHOD(GetMatrix)(THIS_ D3DMATRIXHANDLE,LPD3DMATRIX) PURE; + STDMETHOD(DeleteMatrix)(THIS_ D3DMATRIXHANDLE) PURE; + STDMETHOD(BeginScene)(THIS) PURE; + STDMETHOD(EndScene)(THIS) PURE; + STDMETHOD(GetDirect3D)(THIS_ LPDIRECT3D*) PURE; +}; + +typedef struct IDirect3DDevice *LPDIRECT3DDEVICE; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DDevice_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DDevice_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DDevice_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DDevice_Initialize(p,a,b,c) (p)->lpVtbl->Initialize(p,a,b,c) +#define IDirect3DDevice_GetCaps(p,a,b) (p)->lpVtbl->GetCaps(p,a,b) +#define IDirect3DDevice_SwapTextureHandles(p,a,b) (p)->lpVtbl->SwapTextureHandles(p,a,b) +#define IDirect3DDevice_CreateExecuteBuffer(p,a,b,c) (p)->lpVtbl->CreateExecuteBuffer(p,a,b,c) +#define IDirect3DDevice_GetStats(p,a) (p)->lpVtbl->GetStats(p,a) +#define IDirect3DDevice_Execute(p,a,b,c) (p)->lpVtbl->Execute(p,a,b,c) +#define IDirect3DDevice_AddViewport(p,a) (p)->lpVtbl->AddViewport(p,a) +#define IDirect3DDevice_DeleteViewport(p,a) (p)->lpVtbl->DeleteViewport(p,a) +#define IDirect3DDevice_NextViewport(p,a,b,c) (p)->lpVtbl->NextViewport(p,a,b,c) +#define IDirect3DDevice_Pick(p,a,b,c,d) (p)->lpVtbl->Pick(p,a,b,c,d) +#define IDirect3DDevice_GetPickRecords(p,a,b) (p)->lpVtbl->GetPickRecords(p,a,b) +#define IDirect3DDevice_EnumTextureFormats(p,a,b) (p)->lpVtbl->EnumTextureFormats(p,a,b) +#define IDirect3DDevice_CreateMatrix(p,a) (p)->lpVtbl->CreateMatrix(p,a) +#define IDirect3DDevice_SetMatrix(p,a,b) (p)->lpVtbl->SetMatrix(p,a,b) +#define IDirect3DDevice_GetMatrix(p,a,b) (p)->lpVtbl->GetMatrix(p,a,b) +#define IDirect3DDevice_DeleteMatrix(p,a) (p)->lpVtbl->DeleteMatrix(p,a) +#define IDirect3DDevice_BeginScene(p) (p)->lpVtbl->BeginScene(p) +#define IDirect3DDevice_EndScene(p) (p)->lpVtbl->EndScene(p) +#define IDirect3DDevice_GetDirect3D(p,a) (p)->lpVtbl->GetDirect3D(p,a) +#else +#define IDirect3DDevice_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DDevice_AddRef(p) (p)->AddRef() +#define IDirect3DDevice_Release(p) (p)->Release() +#define IDirect3DDevice_Initialize(p,a,b,c) (p)->Initialize(a,b,c) +#define IDirect3DDevice_GetCaps(p,a,b) (p)->GetCaps(a,b) +#define IDirect3DDevice_SwapTextureHandles(p,a,b) (p)->SwapTextureHandles(a,b) +#define IDirect3DDevice_CreateExecuteBuffer(p,a,b,c) (p)->CreateExecuteBuffer(a,b,c) +#define IDirect3DDevice_GetStats(p,a) (p)->GetStats(a) +#define IDirect3DDevice_Execute(p,a,b,c) (p)->Execute(a,b,c) +#define IDirect3DDevice_AddViewport(p,a) (p)->AddViewport(a) +#define IDirect3DDevice_DeleteViewport(p,a) (p)->DeleteViewport(a) +#define IDirect3DDevice_NextViewport(p,a,b,c) (p)->NextViewport(a,b,c) +#define IDirect3DDevice_Pick(p,a,b,c,d) (p)->Pick(a,b,c,d) +#define IDirect3DDevice_GetPickRecords(p,a,b) (p)->GetPickRecords(a,b) +#define IDirect3DDevice_EnumTextureFormats(p,a,b) (p)->EnumTextureFormats(a,b) +#define IDirect3DDevice_CreateMatrix(p,a) (p)->CreateMatrix(a) +#define IDirect3DDevice_SetMatrix(p,a,b) (p)->SetMatrix(a,b) +#define IDirect3DDevice_GetMatrix(p,a,b) (p)->GetMatrix(a,b) +#define IDirect3DDevice_DeleteMatrix(p,a) (p)->DeleteMatrix(a) +#define IDirect3DDevice_BeginScene(p) (p)->BeginScene() +#define IDirect3DDevice_EndScene(p) (p)->EndScene() +#define IDirect3DDevice_GetDirect3D(p,a) (p)->GetDirect3D(a) +#endif + +#if(DIRECT3D_VERSION >= 0x0500) +#undef INTERFACE +#define INTERFACE IDirect3DDevice2 + +DECLARE_INTERFACE_(IDirect3DDevice2, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DDevice2 methods ***/ + STDMETHOD(GetCaps)(THIS_ LPD3DDEVICEDESC,LPD3DDEVICEDESC) PURE; + STDMETHOD(SwapTextureHandles)(THIS_ LPDIRECT3DTEXTURE2,LPDIRECT3DTEXTURE2) PURE; + STDMETHOD(GetStats)(THIS_ LPD3DSTATS) PURE; + STDMETHOD(AddViewport)(THIS_ LPDIRECT3DVIEWPORT2) PURE; + STDMETHOD(DeleteViewport)(THIS_ LPDIRECT3DVIEWPORT2) PURE; + STDMETHOD(NextViewport)(THIS_ LPDIRECT3DVIEWPORT2,LPDIRECT3DVIEWPORT2*,DWORD) PURE; + STDMETHOD(EnumTextureFormats)(THIS_ LPD3DENUMTEXTUREFORMATSCALLBACK,LPVOID) PURE; + STDMETHOD(BeginScene)(THIS) PURE; + STDMETHOD(EndScene)(THIS) PURE; + STDMETHOD(GetDirect3D)(THIS_ LPDIRECT3D2*) PURE; + STDMETHOD(SetCurrentViewport)(THIS_ LPDIRECT3DVIEWPORT2) PURE; + STDMETHOD(GetCurrentViewport)(THIS_ LPDIRECT3DVIEWPORT2 *) PURE; + STDMETHOD(SetRenderTarget)(THIS_ LPDIRECTDRAWSURFACE,DWORD) PURE; + STDMETHOD(GetRenderTarget)(THIS_ LPDIRECTDRAWSURFACE *) PURE; + STDMETHOD(Begin)(THIS_ D3DPRIMITIVETYPE,D3DVERTEXTYPE,DWORD) PURE; + STDMETHOD(BeginIndexed)(THIS_ D3DPRIMITIVETYPE,D3DVERTEXTYPE,LPVOID,DWORD,DWORD) PURE; + STDMETHOD(Vertex)(THIS_ LPVOID) PURE; + STDMETHOD(Index)(THIS_ WORD) PURE; + STDMETHOD(End)(THIS_ DWORD) PURE; + STDMETHOD(GetRenderState)(THIS_ D3DRENDERSTATETYPE,LPDWORD) PURE; + STDMETHOD(SetRenderState)(THIS_ D3DRENDERSTATETYPE,DWORD) PURE; + STDMETHOD(GetLightState)(THIS_ D3DLIGHTSTATETYPE,LPDWORD) PURE; + STDMETHOD(SetLightState)(THIS_ D3DLIGHTSTATETYPE,DWORD) PURE; + STDMETHOD(SetTransform)(THIS_ D3DTRANSFORMSTATETYPE,LPD3DMATRIX) PURE; + STDMETHOD(GetTransform)(THIS_ D3DTRANSFORMSTATETYPE,LPD3DMATRIX) PURE; + STDMETHOD(MultiplyTransform)(THIS_ D3DTRANSFORMSTATETYPE,LPD3DMATRIX) PURE; + STDMETHOD(DrawPrimitive)(THIS_ D3DPRIMITIVETYPE,D3DVERTEXTYPE,LPVOID,DWORD,DWORD) PURE; + STDMETHOD(DrawIndexedPrimitive)(THIS_ D3DPRIMITIVETYPE,D3DVERTEXTYPE,LPVOID,DWORD,LPWORD,DWORD,DWORD) PURE; + STDMETHOD(SetClipStatus)(THIS_ LPD3DCLIPSTATUS) PURE; + STDMETHOD(GetClipStatus)(THIS_ LPD3DCLIPSTATUS) PURE; +}; + +typedef struct IDirect3DDevice2 *LPDIRECT3DDEVICE2; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DDevice2_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DDevice2_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DDevice2_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DDevice2_GetCaps(p,a,b) (p)->lpVtbl->GetCaps(p,a,b) +#define IDirect3DDevice2_SwapTextureHandles(p,a,b) (p)->lpVtbl->SwapTextureHandles(p,a,b) +#define IDirect3DDevice2_GetStats(p,a) (p)->lpVtbl->GetStats(p,a) +#define IDirect3DDevice2_AddViewport(p,a) (p)->lpVtbl->AddViewport(p,a) +#define IDirect3DDevice2_DeleteViewport(p,a) (p)->lpVtbl->DeleteViewport(p,a) +#define IDirect3DDevice2_NextViewport(p,a,b,c) (p)->lpVtbl->NextViewport(p,a,b,c) +#define IDirect3DDevice2_EnumTextureFormats(p,a,b) (p)->lpVtbl->EnumTextureFormats(p,a,b) +#define IDirect3DDevice2_BeginScene(p) (p)->lpVtbl->BeginScene(p) +#define IDirect3DDevice2_EndScene(p) (p)->lpVtbl->EndScene(p) +#define IDirect3DDevice2_GetDirect3D(p,a) (p)->lpVtbl->GetDirect3D(p,a) +#define IDirect3DDevice2_SetCurrentViewport(p,a) (p)->lpVtbl->SetCurrentViewport(p,a) +#define IDirect3DDevice2_GetCurrentViewport(p,a) (p)->lpVtbl->GetCurrentViewport(p,a) +#define IDirect3DDevice2_SetRenderTarget(p,a,b) (p)->lpVtbl->SetRenderTarget(p,a,b) +#define IDirect3DDevice2_GetRenderTarget(p,a) (p)->lpVtbl->GetRenderTarget(p,a) +#define IDirect3DDevice2_Begin(p,a,b,c) (p)->lpVtbl->Begin(p,a,b,c) +#define IDirect3DDevice2_BeginIndexed(p,a,b,c,d,e) (p)->lpVtbl->BeginIndexed(p,a,b,c,d,e) +#define IDirect3DDevice2_Vertex(p,a) (p)->lpVtbl->Vertex(p,a) +#define IDirect3DDevice2_Index(p,a) (p)->lpVtbl->Index(p,a) +#define IDirect3DDevice2_End(p,a) (p)->lpVtbl->End(p,a) +#define IDirect3DDevice2_GetRenderState(p,a,b) (p)->lpVtbl->GetRenderState(p,a,b) +#define IDirect3DDevice2_SetRenderState(p,a,b) (p)->lpVtbl->SetRenderState(p,a,b) +#define IDirect3DDevice2_GetLightState(p,a,b) (p)->lpVtbl->GetLightState(p,a,b) +#define IDirect3DDevice2_SetLightState(p,a,b) (p)->lpVtbl->SetLightState(p,a,b) +#define IDirect3DDevice2_SetTransform(p,a,b) (p)->lpVtbl->SetTransform(p,a,b) +#define IDirect3DDevice2_GetTransform(p,a,b) (p)->lpVtbl->GetTransform(p,a,b) +#define IDirect3DDevice2_MultiplyTransform(p,a,b) (p)->lpVtbl->MultiplyTransform(p,a,b) +#define IDirect3DDevice2_DrawPrimitive(p,a,b,c,d,e) (p)->lpVtbl->DrawPrimitive(p,a,b,c,d,e) +#define IDirect3DDevice2_DrawIndexedPrimitive(p,a,b,c,d,e,f,g) (p)->lpVtbl->DrawIndexedPrimitive(p,a,b,c,d,e,f,g) +#define IDirect3DDevice2_SetClipStatus(p,a) (p)->lpVtbl->SetClipStatus(p,a) +#define IDirect3DDevice2_GetClipStatus(p,a) (p)->lpVtbl->GetClipStatus(p,a) +#else +#define IDirect3DDevice2_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DDevice2_AddRef(p) (p)->AddRef() +#define IDirect3DDevice2_Release(p) (p)->Release() +#define IDirect3DDevice2_GetCaps(p,a,b) (p)->GetCaps(a,b) +#define IDirect3DDevice2_SwapTextureHandles(p,a,b) (p)->SwapTextureHandles(a,b) +#define IDirect3DDevice2_GetStats(p,a) (p)->GetStats(a) +#define IDirect3DDevice2_AddViewport(p,a) (p)->AddViewport(a) +#define IDirect3DDevice2_DeleteViewport(p,a) (p)->DeleteViewport(a) +#define IDirect3DDevice2_NextViewport(p,a,b,c) (p)->NextViewport(a,b,c) +#define IDirect3DDevice2_EnumTextureFormats(p,a,b) (p)->EnumTextureFormats(a,b) +#define IDirect3DDevice2_BeginScene(p) (p)->BeginScene() +#define IDirect3DDevice2_EndScene(p) (p)->EndScene() +#define IDirect3DDevice2_GetDirect3D(p,a) (p)->GetDirect3D(a) +#define IDirect3DDevice2_SetCurrentViewport(p,a) (p)->SetCurrentViewport(a) +#define IDirect3DDevice2_GetCurrentViewport(p,a) (p)->GetCurrentViewport(a) +#define IDirect3DDevice2_SetRenderTarget(p,a,b) (p)->SetRenderTarget(a,b) +#define IDirect3DDevice2_GetRenderTarget(p,a) (p)->GetRenderTarget(a) +#define IDirect3DDevice2_Begin(p,a,b,c) (p)->Begin(a,b,c) +#define IDirect3DDevice2_BeginIndexed(p,a,b,c,d,e) (p)->BeginIndexed(a,b,c,d,e) +#define IDirect3DDevice2_Vertex(p,a) (p)->Vertex(a) +#define IDirect3DDevice2_Index(p,a) (p)->Index(a) +#define IDirect3DDevice2_End(p,a) (p)->End(a) +#define IDirect3DDevice2_GetRenderState(p,a,b) (p)->GetRenderState(a,b) +#define IDirect3DDevice2_SetRenderState(p,a,b) (p)->SetRenderState(a,b) +#define IDirect3DDevice2_GetLightState(p,a,b) (p)->GetLightState(a,b) +#define IDirect3DDevice2_SetLightState(p,a,b) (p)->SetLightState(a,b) +#define IDirect3DDevice2_SetTransform(p,a,b) (p)->SetTransform(a,b) +#define IDirect3DDevice2_GetTransform(p,a,b) (p)->GetTransform(a,b) +#define IDirect3DDevice2_MultiplyTransform(p,a,b) (p)->MultiplyTransform(a,b) +#define IDirect3DDevice2_DrawPrimitive(p,a,b,c,d,e) (p)->DrawPrimitive(a,b,c,d,e) +#define IDirect3DDevice2_DrawIndexedPrimitive(p,a,b,c,d,e,f,g) (p)->DrawIndexedPrimitive(a,b,c,d,e,f,g) +#define IDirect3DDevice2_SetClipStatus(p,a) (p)->SetClipStatus(a) +#define IDirect3DDevice2_GetClipStatus(p,a) (p)->GetClipStatus(a) +#endif +#endif /* DIRECT3D_VERSION >= 0x0500 */ + +#if(DIRECT3D_VERSION >= 0x0600) +#undef INTERFACE +#define INTERFACE IDirect3DDevice3 + +DECLARE_INTERFACE_(IDirect3DDevice3, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DDevice3 methods ***/ + STDMETHOD(GetCaps)(THIS_ LPD3DDEVICEDESC,LPD3DDEVICEDESC) PURE; + STDMETHOD(GetStats)(THIS_ LPD3DSTATS) PURE; + STDMETHOD(AddViewport)(THIS_ LPDIRECT3DVIEWPORT3) PURE; + STDMETHOD(DeleteViewport)(THIS_ LPDIRECT3DVIEWPORT3) PURE; + STDMETHOD(NextViewport)(THIS_ LPDIRECT3DVIEWPORT3,LPDIRECT3DVIEWPORT3*,DWORD) PURE; + STDMETHOD(EnumTextureFormats)(THIS_ LPD3DENUMPIXELFORMATSCALLBACK,LPVOID) PURE; + STDMETHOD(BeginScene)(THIS) PURE; + STDMETHOD(EndScene)(THIS) PURE; + STDMETHOD(GetDirect3D)(THIS_ LPDIRECT3D3*) PURE; + STDMETHOD(SetCurrentViewport)(THIS_ LPDIRECT3DVIEWPORT3) PURE; + STDMETHOD(GetCurrentViewport)(THIS_ LPDIRECT3DVIEWPORT3 *) PURE; + STDMETHOD(SetRenderTarget)(THIS_ LPDIRECTDRAWSURFACE4,DWORD) PURE; + STDMETHOD(GetRenderTarget)(THIS_ LPDIRECTDRAWSURFACE4 *) PURE; + STDMETHOD(Begin)(THIS_ D3DPRIMITIVETYPE,DWORD,DWORD) PURE; + STDMETHOD(BeginIndexed)(THIS_ D3DPRIMITIVETYPE,DWORD,LPVOID,DWORD,DWORD) PURE; + STDMETHOD(Vertex)(THIS_ LPVOID) PURE; + STDMETHOD(Index)(THIS_ WORD) PURE; + STDMETHOD(End)(THIS_ DWORD) PURE; + STDMETHOD(GetRenderState)(THIS_ D3DRENDERSTATETYPE,LPDWORD) PURE; + STDMETHOD(SetRenderState)(THIS_ D3DRENDERSTATETYPE,DWORD) PURE; + STDMETHOD(GetLightState)(THIS_ D3DLIGHTSTATETYPE,LPDWORD) PURE; + STDMETHOD(SetLightState)(THIS_ D3DLIGHTSTATETYPE,DWORD) PURE; + STDMETHOD(SetTransform)(THIS_ D3DTRANSFORMSTATETYPE,LPD3DMATRIX) PURE; + STDMETHOD(GetTransform)(THIS_ D3DTRANSFORMSTATETYPE,LPD3DMATRIX) PURE; + STDMETHOD(MultiplyTransform)(THIS_ D3DTRANSFORMSTATETYPE,LPD3DMATRIX) PURE; + STDMETHOD(DrawPrimitive)(THIS_ D3DPRIMITIVETYPE,DWORD,LPVOID,DWORD,DWORD) PURE; + STDMETHOD(DrawIndexedPrimitive)(THIS_ D3DPRIMITIVETYPE,DWORD,LPVOID,DWORD,LPWORD,DWORD,DWORD) PURE; + STDMETHOD(SetClipStatus)(THIS_ LPD3DCLIPSTATUS) PURE; + STDMETHOD(GetClipStatus)(THIS_ LPD3DCLIPSTATUS) PURE; + STDMETHOD(DrawPrimitiveStrided)(THIS_ D3DPRIMITIVETYPE,DWORD,LPD3DDRAWPRIMITIVESTRIDEDDATA,DWORD,DWORD) PURE; + STDMETHOD(DrawIndexedPrimitiveStrided)(THIS_ D3DPRIMITIVETYPE,DWORD,LPD3DDRAWPRIMITIVESTRIDEDDATA,DWORD,LPWORD,DWORD,DWORD) PURE; + STDMETHOD(DrawPrimitiveVB)(THIS_ D3DPRIMITIVETYPE,LPDIRECT3DVERTEXBUFFER,DWORD,DWORD,DWORD) PURE; + STDMETHOD(DrawIndexedPrimitiveVB)(THIS_ D3DPRIMITIVETYPE,LPDIRECT3DVERTEXBUFFER,LPWORD,DWORD,DWORD) PURE; + STDMETHOD(ComputeSphereVisibility)(THIS_ LPD3DVECTOR,LPD3DVALUE,DWORD,DWORD,LPDWORD) PURE; + STDMETHOD(GetTexture)(THIS_ DWORD,LPDIRECT3DTEXTURE2 *) PURE; + STDMETHOD(SetTexture)(THIS_ DWORD,LPDIRECT3DTEXTURE2) PURE; + STDMETHOD(GetTextureStageState)(THIS_ DWORD,D3DTEXTURESTAGESTATETYPE,LPDWORD) PURE; + STDMETHOD(SetTextureStageState)(THIS_ DWORD,D3DTEXTURESTAGESTATETYPE,DWORD) PURE; + STDMETHOD(ValidateDevice)(THIS_ LPDWORD) PURE; +}; + +typedef struct IDirect3DDevice3 *LPDIRECT3DDEVICE3; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DDevice3_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DDevice3_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DDevice3_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DDevice3_GetCaps(p,a,b) (p)->lpVtbl->GetCaps(p,a,b) +#define IDirect3DDevice3_GetStats(p,a) (p)->lpVtbl->GetStats(p,a) +#define IDirect3DDevice3_AddViewport(p,a) (p)->lpVtbl->AddViewport(p,a) +#define IDirect3DDevice3_DeleteViewport(p,a) (p)->lpVtbl->DeleteViewport(p,a) +#define IDirect3DDevice3_NextViewport(p,a,b,c) (p)->lpVtbl->NextViewport(p,a,b,c) +#define IDirect3DDevice3_EnumTextureFormats(p,a,b) (p)->lpVtbl->EnumTextureFormats(p,a,b) +#define IDirect3DDevice3_BeginScene(p) (p)->lpVtbl->BeginScene(p) +#define IDirect3DDevice3_EndScene(p) (p)->lpVtbl->EndScene(p) +#define IDirect3DDevice3_GetDirect3D(p,a) (p)->lpVtbl->GetDirect3D(p,a) +#define IDirect3DDevice3_SetCurrentViewport(p,a) (p)->lpVtbl->SetCurrentViewport(p,a) +#define IDirect3DDevice3_GetCurrentViewport(p,a) (p)->lpVtbl->GetCurrentViewport(p,a) +#define IDirect3DDevice3_SetRenderTarget(p,a,b) (p)->lpVtbl->SetRenderTarget(p,a,b) +#define IDirect3DDevice3_GetRenderTarget(p,a) (p)->lpVtbl->GetRenderTarget(p,a) +#define IDirect3DDevice3_Begin(p,a,b,c) (p)->lpVtbl->Begin(p,a,b,c) +#define IDirect3DDevice3_BeginIndexed(p,a,b,c,d,e) (p)->lpVtbl->BeginIndexed(p,a,b,c,d,e) +#define IDirect3DDevice3_Vertex(p,a) (p)->lpVtbl->Vertex(p,a) +#define IDirect3DDevice3_Index(p,a) (p)->lpVtbl->Index(p,a) +#define IDirect3DDevice3_End(p,a) (p)->lpVtbl->End(p,a) +#define IDirect3DDevice3_GetRenderState(p,a,b) (p)->lpVtbl->GetRenderState(p,a,b) +#define IDirect3DDevice3_SetRenderState(p,a,b) (p)->lpVtbl->SetRenderState(p,a,b) +#define IDirect3DDevice3_GetLightState(p,a,b) (p)->lpVtbl->GetLightState(p,a,b) +#define IDirect3DDevice3_SetLightState(p,a,b) (p)->lpVtbl->SetLightState(p,a,b) +#define IDirect3DDevice3_SetTransform(p,a,b) (p)->lpVtbl->SetTransform(p,a,b) +#define IDirect3DDevice3_GetTransform(p,a,b) (p)->lpVtbl->GetTransform(p,a,b) +#define IDirect3DDevice3_MultiplyTransform(p,a,b) (p)->lpVtbl->MultiplyTransform(p,a,b) +#define IDirect3DDevice3_DrawPrimitive(p,a,b,c,d,e) (p)->lpVtbl->DrawPrimitive(p,a,b,c,d,e) +#define IDirect3DDevice3_DrawIndexedPrimitive(p,a,b,c,d,e,f,g) (p)->lpVtbl->DrawIndexedPrimitive(p,a,b,c,d,e,f,g) +#define IDirect3DDevice3_SetClipStatus(p,a) (p)->lpVtbl->SetClipStatus(p,a) +#define IDirect3DDevice3_GetClipStatus(p,a) (p)->lpVtbl->GetClipStatus(p,a) +#define IDirect3DDevice3_DrawPrimitiveStrided(p,a,b,c,d,e) (p)->lpVtbl->DrawPrimitiveStrided(p,a,b,c,d,e) +#define IDirect3DDevice3_DrawIndexedPrimitiveStrided(p,a,b,c,d,e,f,g) (p)->lpVtbl->DrawIndexedPrimitiveStrided(p,a,b,c,d,e,f,g) +#define IDirect3DDevice3_DrawPrimitiveVB(p,a,b,c,d,e) (p)->lpVtbl->DrawPrimitiveVB(p,a,b,c,d,e) +#define IDirect3DDevice3_DrawIndexedPrimitiveVB(p,a,b,c,d,e) (p)->lpVtbl->DrawIndexedPrimitiveVB(p,a,b,c,d,e) +#define IDirect3DDevice3_ComputeSphereVisibility(p,a,b,c,d,e) (p)->lpVtbl->ComputeSphereVisibility(p,a,b,c,d,e) +#define IDirect3DDevice3_GetTexture(p,a,b) (p)->lpVtbl->GetTexture(p,a,b) +#define IDirect3DDevice3_SetTexture(p,a,b) (p)->lpVtbl->SetTexture(p,a,b) +#define IDirect3DDevice3_GetTextureStageState(p,a,b,c) (p)->lpVtbl->GetTextureStageState(p,a,b,c) +#define IDirect3DDevice3_SetTextureStageState(p,a,b,c) (p)->lpVtbl->SetTextureStageState(p,a,b,c) +#define IDirect3DDevice3_ValidateDevice(p,a) (p)->lpVtbl->ValidateDevice(p,a) +#else +#define IDirect3DDevice3_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DDevice3_AddRef(p) (p)->AddRef() +#define IDirect3DDevice3_Release(p) (p)->Release() +#define IDirect3DDevice3_GetCaps(p,a,b) (p)->GetCaps(a,b) +#define IDirect3DDevice3_GetStats(p,a) (p)->GetStats(a) +#define IDirect3DDevice3_AddViewport(p,a) (p)->AddViewport(a) +#define IDirect3DDevice3_DeleteViewport(p,a) (p)->DeleteViewport(a) +#define IDirect3DDevice3_NextViewport(p,a,b,c) (p)->NextViewport(a,b,c) +#define IDirect3DDevice3_EnumTextureFormats(p,a,b) (p)->EnumTextureFormats(a,b) +#define IDirect3DDevice3_BeginScene(p) (p)->BeginScene() +#define IDirect3DDevice3_EndScene(p) (p)->EndScene() +#define IDirect3DDevice3_GetDirect3D(p,a) (p)->GetDirect3D(a) +#define IDirect3DDevice3_SetCurrentViewport(p,a) (p)->SetCurrentViewport(a) +#define IDirect3DDevice3_GetCurrentViewport(p,a) (p)->GetCurrentViewport(a) +#define IDirect3DDevice3_SetRenderTarget(p,a,b) (p)->SetRenderTarget(a,b) +#define IDirect3DDevice3_GetRenderTarget(p,a) (p)->GetRenderTarget(a) +#define IDirect3DDevice3_Begin(p,a,b,c) (p)->Begin(a,b,c) +#define IDirect3DDevice3_BeginIndexed(p,a,b,c,d,e) (p)->BeginIndexed(a,b,c,d,e) +#define IDirect3DDevice3_Vertex(p,a) (p)->Vertex(a) +#define IDirect3DDevice3_Index(p,a) (p)->Index(a) +#define IDirect3DDevice3_End(p,a) (p)->End(a) +#define IDirect3DDevice3_GetRenderState(p,a,b) (p)->GetRenderState(a,b) +#define IDirect3DDevice3_SetRenderState(p,a,b) (p)->SetRenderState(a,b) +#define IDirect3DDevice3_GetLightState(p,a,b) (p)->GetLightState(a,b) +#define IDirect3DDevice3_SetLightState(p,a,b) (p)->SetLightState(a,b) +#define IDirect3DDevice3_SetTransform(p,a,b) (p)->SetTransform(a,b) +#define IDirect3DDevice3_GetTransform(p,a,b) (p)->GetTransform(a,b) +#define IDirect3DDevice3_MultiplyTransform(p,a,b) (p)->MultiplyTransform(a,b) +#define IDirect3DDevice3_DrawPrimitive(p,a,b,c,d,e) (p)->DrawPrimitive(a,b,c,d,e) +#define IDirect3DDevice3_DrawIndexedPrimitive(p,a,b,c,d,e,f,g) (p)->DrawIndexedPrimitive(a,b,c,d,e,f,g) +#define IDirect3DDevice3_SetClipStatus(p,a) (p)->SetClipStatus(a) +#define IDirect3DDevice3_GetClipStatus(p,a) (p)->GetClipStatus(a) +#define IDirect3DDevice3_DrawPrimitiveStrided(p,a,b,c,d,e) (p)->DrawPrimitiveStrided(a,b,c,d,e) +#define IDirect3DDevice3_DrawIndexedPrimitiveStrided(p,a,b,c,d,e,f,g) (p)->DrawIndexedPrimitiveStrided(a,b,c,d,e,f,g) +#define IDirect3DDevice3_DrawPrimitiveVB(p,a,b,c,d,e) (p)->DrawPrimitiveVB(a,b,c,d,e) +#define IDirect3DDevice3_DrawIndexedPrimitiveVB(p,a,b,c,d,e) (p)->DrawIndexedPrimitiveVB(a,b,c,d,e) +#define IDirect3DDevice3_ComputeSphereVisibility(p,a,b,c,d,e) (p)->ComputeSphereVisibility(a,b,c,d,e) +#define IDirect3DDevice3_GetTexture(p,a,b) (p)->GetTexture(a,b) +#define IDirect3DDevice3_SetTexture(p,a,b) (p)->SetTexture(a,b) +#define IDirect3DDevice3_GetTextureStageState(p,a,b,c) (p)->GetTextureStageState(a,b,c) +#define IDirect3DDevice3_SetTextureStageState(p,a,b,c) (p)->SetTextureStageState(a,b,c) +#define IDirect3DDevice3_ValidateDevice(p,a) (p)->ValidateDevice(a) +#endif +#endif /* DIRECT3D_VERSION >= 0x0600 */ + +#if(DIRECT3D_VERSION >= 0x0700) +#undef INTERFACE +#define INTERFACE IDirect3DDevice7 + +DECLARE_INTERFACE_(IDirect3DDevice7, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DDevice7 methods ***/ + STDMETHOD(GetCaps)(THIS_ LPD3DDEVICEDESC7) PURE; + STDMETHOD(EnumTextureFormats)(THIS_ LPD3DENUMPIXELFORMATSCALLBACK,LPVOID) PURE; + STDMETHOD(BeginScene)(THIS) PURE; + STDMETHOD(EndScene)(THIS) PURE; + STDMETHOD(GetDirect3D)(THIS_ LPDIRECT3D7*) PURE; + STDMETHOD(SetRenderTarget)(THIS_ LPDIRECTDRAWSURFACE7,DWORD) PURE; + STDMETHOD(GetRenderTarget)(THIS_ LPDIRECTDRAWSURFACE7 *) PURE; + STDMETHOD(Clear)(THIS_ DWORD,LPD3DRECT,DWORD,D3DCOLOR,D3DVALUE,DWORD) PURE; + STDMETHOD(SetTransform)(THIS_ D3DTRANSFORMSTATETYPE,LPD3DMATRIX) PURE; + STDMETHOD(GetTransform)(THIS_ D3DTRANSFORMSTATETYPE,LPD3DMATRIX) PURE; + STDMETHOD(SetViewport)(THIS_ LPD3DVIEWPORT7) PURE; + STDMETHOD(MultiplyTransform)(THIS_ D3DTRANSFORMSTATETYPE,LPD3DMATRIX) PURE; + STDMETHOD(GetViewport)(THIS_ LPD3DVIEWPORT7) PURE; + STDMETHOD(SetMaterial)(THIS_ LPD3DMATERIAL7) PURE; + STDMETHOD(GetMaterial)(THIS_ LPD3DMATERIAL7) PURE; + STDMETHOD(SetLight)(THIS_ DWORD,LPD3DLIGHT7) PURE; + STDMETHOD(GetLight)(THIS_ DWORD,LPD3DLIGHT7) PURE; + STDMETHOD(SetRenderState)(THIS_ D3DRENDERSTATETYPE,DWORD) PURE; + STDMETHOD(GetRenderState)(THIS_ D3DRENDERSTATETYPE,LPDWORD) PURE; + STDMETHOD(BeginStateBlock)(THIS) PURE; + STDMETHOD(EndStateBlock)(THIS_ LPDWORD) PURE; + STDMETHOD(PreLoad)(THIS_ LPDIRECTDRAWSURFACE7) PURE; + STDMETHOD(DrawPrimitive)(THIS_ D3DPRIMITIVETYPE,DWORD,LPVOID,DWORD,DWORD) PURE; + STDMETHOD(DrawIndexedPrimitive)(THIS_ D3DPRIMITIVETYPE,DWORD,LPVOID,DWORD,LPWORD,DWORD,DWORD) PURE; + STDMETHOD(SetClipStatus)(THIS_ LPD3DCLIPSTATUS) PURE; + STDMETHOD(GetClipStatus)(THIS_ LPD3DCLIPSTATUS) PURE; + STDMETHOD(DrawPrimitiveStrided)(THIS_ D3DPRIMITIVETYPE,DWORD,LPD3DDRAWPRIMITIVESTRIDEDDATA,DWORD,DWORD) PURE; + STDMETHOD(DrawIndexedPrimitiveStrided)(THIS_ D3DPRIMITIVETYPE,DWORD,LPD3DDRAWPRIMITIVESTRIDEDDATA,DWORD,LPWORD,DWORD,DWORD) PURE; + STDMETHOD(DrawPrimitiveVB)(THIS_ D3DPRIMITIVETYPE,LPDIRECT3DVERTEXBUFFER7,DWORD,DWORD,DWORD) PURE; + STDMETHOD(DrawIndexedPrimitiveVB)(THIS_ D3DPRIMITIVETYPE,LPDIRECT3DVERTEXBUFFER7,DWORD,DWORD,LPWORD,DWORD,DWORD) PURE; + STDMETHOD(ComputeSphereVisibility)(THIS_ LPD3DVECTOR,LPD3DVALUE,DWORD,DWORD,LPDWORD) PURE; + STDMETHOD(GetTexture)(THIS_ DWORD,LPDIRECTDRAWSURFACE7 *) PURE; + STDMETHOD(SetTexture)(THIS_ DWORD,LPDIRECTDRAWSURFACE7) PURE; + STDMETHOD(GetTextureStageState)(THIS_ DWORD,D3DTEXTURESTAGESTATETYPE,LPDWORD) PURE; + STDMETHOD(SetTextureStageState)(THIS_ DWORD,D3DTEXTURESTAGESTATETYPE,DWORD) PURE; + STDMETHOD(ValidateDevice)(THIS_ LPDWORD) PURE; + STDMETHOD(ApplyStateBlock)(THIS_ DWORD) PURE; + STDMETHOD(CaptureStateBlock)(THIS_ DWORD) PURE; + STDMETHOD(DeleteStateBlock)(THIS_ DWORD) PURE; + STDMETHOD(CreateStateBlock)(THIS_ D3DSTATEBLOCKTYPE,LPDWORD) PURE; + STDMETHOD(Load)(THIS_ LPDIRECTDRAWSURFACE7,LPPOINT,LPDIRECTDRAWSURFACE7,LPRECT,DWORD) PURE; + STDMETHOD(LightEnable)(THIS_ DWORD,BOOL) PURE; + STDMETHOD(GetLightEnable)(THIS_ DWORD,BOOL*) PURE; + STDMETHOD(SetClipPlane)(THIS_ DWORD,D3DVALUE*) PURE; + STDMETHOD(GetClipPlane)(THIS_ DWORD,D3DVALUE*) PURE; + STDMETHOD(GetInfo)(THIS_ DWORD,LPVOID,DWORD) PURE; +}; + +typedef struct IDirect3DDevice7 *LPDIRECT3DDEVICE7; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DDevice7_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DDevice7_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DDevice7_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DDevice7_GetCaps(p,a) (p)->lpVtbl->GetCaps(p,a) +#define IDirect3DDevice7_EnumTextureFormats(p,a,b) (p)->lpVtbl->EnumTextureFormats(p,a,b) +#define IDirect3DDevice7_BeginScene(p) (p)->lpVtbl->BeginScene(p) +#define IDirect3DDevice7_EndScene(p) (p)->lpVtbl->EndScene(p) +#define IDirect3DDevice7_GetDirect3D(p,a) (p)->lpVtbl->GetDirect3D(p,a) +#define IDirect3DDevice7_SetRenderTarget(p,a,b) (p)->lpVtbl->SetRenderTarget(p,a,b) +#define IDirect3DDevice7_GetRenderTarget(p,a) (p)->lpVtbl->GetRenderTarget(p,a) +#define IDirect3DDevice7_Clear(p,a,b,c,d,e,f) (p)->lpVtbl->Clear(p,a,b,c,d,e,f) +#define IDirect3DDevice7_SetTransform(p,a,b) (p)->lpVtbl->SetTransform(p,a,b) +#define IDirect3DDevice7_GetTransform(p,a,b) (p)->lpVtbl->GetTransform(p,a,b) +#define IDirect3DDevice7_SetViewport(p,a) (p)->lpVtbl->SetViewport(p,a) +#define IDirect3DDevice7_MultiplyTransform(p,a,b) (p)->lpVtbl->MultiplyTransform(p,a,b) +#define IDirect3DDevice7_GetViewport(p,a) (p)->lpVtbl->GetViewport(p,a) +#define IDirect3DDevice7_SetMaterial(p,a) (p)->lpVtbl->SetMaterial(p,a) +#define IDirect3DDevice7_GetMaterial(p,a) (p)->lpVtbl->GetMaterial(p,a) +#define IDirect3DDevice7_SetLight(p,a,b) (p)->lpVtbl->SetLight(p,a,b) +#define IDirect3DDevice7_GetLight(p,a,b) (p)->lpVtbl->GetLight(p,a,b) +#define IDirect3DDevice7_SetRenderState(p,a,b) (p)->lpVtbl->SetRenderState(p,a,b) +#define IDirect3DDevice7_GetRenderState(p,a,b) (p)->lpVtbl->GetRenderState(p,a,b) +#define IDirect3DDevice7_BeginStateBlock(p) (p)->lpVtbl->BeginStateBlock(p) +#define IDirect3DDevice7_EndStateBlock(p,a) (p)->lpVtbl->EndStateBlock(p,a) +#define IDirect3DDevice7_PreLoad(p,a) (p)->lpVtbl->PreLoad(p,a) +#define IDirect3DDevice7_DrawPrimitive(p,a,b,c,d,e) (p)->lpVtbl->DrawPrimitive(p,a,b,c,d,e) +#define IDirect3DDevice7_DrawIndexedPrimitive(p,a,b,c,d,e,f,g) (p)->lpVtbl->DrawIndexedPrimitive(p,a,b,c,d,e,f,g) +#define IDirect3DDevice7_SetClipStatus(p,a) (p)->lpVtbl->SetClipStatus(p,a) +#define IDirect3DDevice7_GetClipStatus(p,a) (p)->lpVtbl->GetClipStatus(p,a) +#define IDirect3DDevice7_DrawPrimitiveStrided(p,a,b,c,d,e) (p)->lpVtbl->DrawPrimitiveStrided(p,a,b,c,d,e) +#define IDirect3DDevice7_DrawIndexedPrimitiveStrided(p,a,b,c,d,e,f,g) (p)->lpVtbl->DrawIndexedPrimitiveStrided(p,a,b,c,d,e,f,g) +#define IDirect3DDevice7_DrawPrimitiveVB(p,a,b,c,d,e) (p)->lpVtbl->DrawPrimitiveVB(p,a,b,c,d,e) +#define IDirect3DDevice7_DrawIndexedPrimitiveVB(p,a,b,c,d,e,f,g) (p)->lpVtbl->DrawIndexedPrimitiveVB(p,a,b,c,d,e,f,g) +#define IDirect3DDevice7_ComputeSphereVisibility(p,a,b,c,d,e) (p)->lpVtbl->ComputeSphereVisibility(p,a,b,c,d,e) +#define IDirect3DDevice7_GetTexture(p,a,b) (p)->lpVtbl->GetTexture(p,a,b) +#define IDirect3DDevice7_SetTexture(p,a,b) (p)->lpVtbl->SetTexture(p,a,b) +#define IDirect3DDevice7_GetTextureStageState(p,a,b,c) (p)->lpVtbl->GetTextureStageState(p,a,b,c) +#define IDirect3DDevice7_SetTextureStageState(p,a,b,c) (p)->lpVtbl->SetTextureStageState(p,a,b,c) +#define IDirect3DDevice7_ValidateDevice(p,a) (p)->lpVtbl->ValidateDevice(p,a) +#define IDirect3DDevice7_ApplyStateBlock(p,a) (p)->lpVtbl->ApplyStateBlock(p,a) +#define IDirect3DDevice7_CaptureStateBlock(p,a) (p)->lpVtbl->CaptureStateBlock(p,a) +#define IDirect3DDevice7_DeleteStateBlock(p,a) (p)->lpVtbl->DeleteStateBlock(p,a) +#define IDirect3DDevice7_CreateStateBlock(p,a,b) (p)->lpVtbl->CreateStateBlock(p,a,b) +#define IDirect3DDevice7_Load(p,a,b,c,d,e) (p)->lpVtbl->Load(p,a,b,c,d,e) +#define IDirect3DDevice7_LightEnable(p,a,b) (p)->lpVtbl->LightEnable(p,a,b) +#define IDirect3DDevice7_GetLightEnable(p,a,b) (p)->lpVtbl->GetLightEnable(p,a,b) +#define IDirect3DDevice7_SetClipPlane(p,a,b) (p)->lpVtbl->SetClipPlane(p,a,b) +#define IDirect3DDevice7_GetClipPlane(p,a,b) (p)->lpVtbl->GetClipPlane(p,a,b) +#define IDirect3DDevice7_GetInfo(p,a,b,c) (p)->lpVtbl->GetInfo(p,a,b,c) +#else +#define IDirect3DDevice7_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DDevice7_AddRef(p) (p)->AddRef() +#define IDirect3DDevice7_Release(p) (p)->Release() +#define IDirect3DDevice7_GetCaps(p,a) (p)->GetCaps(a) +#define IDirect3DDevice7_EnumTextureFormats(p,a,b) (p)->EnumTextureFormats(a,b) +#define IDirect3DDevice7_BeginScene(p) (p)->BeginScene() +#define IDirect3DDevice7_EndScene(p) (p)->EndScene() +#define IDirect3DDevice7_GetDirect3D(p,a) (p)->GetDirect3D(a) +#define IDirect3DDevice7_SetRenderTarget(p,a,b) (p)->SetRenderTarget(a,b) +#define IDirect3DDevice7_GetRenderTarget(p,a) (p)->GetRenderTarget(a) +#define IDirect3DDevice7_Clear(p,a,b,c,d,e,f) (p)->Clear(a,b,c,d,e,f) +#define IDirect3DDevice7_SetTransform(p,a,b) (p)->SetTransform(a,b) +#define IDirect3DDevice7_GetTransform(p,a,b) (p)->GetTransform(a,b) +#define IDirect3DDevice7_SetViewport(p,a) (p)->SetViewport(a) +#define IDirect3DDevice7_MultiplyTransform(p,a,b) (p)->MultiplyTransform(a,b) +#define IDirect3DDevice7_GetViewport(p,a) (p)->GetViewport(a) +#define IDirect3DDevice7_SetMaterial(p,a) (p)->SetMaterial(a) +#define IDirect3DDevice7_GetMaterial(p,a) (p)->GetMaterial(a) +#define IDirect3DDevice7_SetLight(p,a,b) (p)->SetLight(a,b) +#define IDirect3DDevice7_GetLight(p,a,b) (p)->GetLight(a,b) +#define IDirect3DDevice7_SetRenderState(p,a,b) (p)->SetRenderState(a,b) +#define IDirect3DDevice7_GetRenderState(p,a,b) (p)->GetRenderState(a,b) +#define IDirect3DDevice7_BeginStateBlock(p) (p)->BeginStateBlock() +#define IDirect3DDevice7_EndStateBlock(p,a) (p)->EndStateBlock(a) +#define IDirect3DDevice7_PreLoad(p,a) (p)->PreLoad(a) +#define IDirect3DDevice7_DrawPrimitive(p,a,b,c,d,e) (p)->DrawPrimitive(a,b,c,d,e) +#define IDirect3DDevice7_DrawIndexedPrimitive(p,a,b,c,d,e,f,g) (p)->DrawIndexedPrimitive(a,b,c,d,e,f,g) +#define IDirect3DDevice7_SetClipStatus(p,a) (p)->SetClipStatus(a) +#define IDirect3DDevice7_GetClipStatus(p,a) (p)->GetClipStatus(a) +#define IDirect3DDevice7_DrawPrimitiveStrided(p,a,b,c,d,e) (p)->DrawPrimitiveStrided(a,b,c,d,e) +#define IDirect3DDevice7_DrawIndexedPrimitiveStrided(p,a,b,c,d,e,f,g) (p)->DrawIndexedPrimitiveStrided(a,b,c,d,e,f,g) +#define IDirect3DDevice7_DrawPrimitiveVB(p,a,b,c,d,e) (p)->DrawPrimitiveVB(a,b,c,d,e) +#define IDirect3DDevice7_DrawIndexedPrimitiveVB(p,a,b,c,d,e,f,g) (p)->DrawIndexedPrimitiveVB(a,b,c,d,e,f,g) +#define IDirect3DDevice7_ComputeSphereVisibility(p,a,b,c,d,e) (p)->ComputeSphereVisibility(a,b,c,d,e) +#define IDirect3DDevice7_GetTexture(p,a,b) (p)->GetTexture(a,b) +#define IDirect3DDevice7_SetTexture(p,a,b) (p)->SetTexture(a,b) +#define IDirect3DDevice7_GetTextureStageState(p,a,b,c) (p)->GetTextureStageState(a,b,c) +#define IDirect3DDevice7_SetTextureStageState(p,a,b,c) (p)->SetTextureStageState(a,b,c) +#define IDirect3DDevice7_ValidateDevice(p,a) (p)->ValidateDevice(a) +#define IDirect3DDevice7_ApplyStateBlock(p,a) (p)->ApplyStateBlock(a) +#define IDirect3DDevice7_CaptureStateBlock(p,a) (p)->CaptureStateBlock(a) +#define IDirect3DDevice7_DeleteStateBlock(p,a) (p)->DeleteStateBlock(a) +#define IDirect3DDevice7_CreateStateBlock(p,a,b) (p)->CreateStateBlock(a,b) +#define IDirect3DDevice7_Load(p,a,b,c,d,e) (p)->Load(a,b,c,d,e) +#define IDirect3DDevice7_LightEnable(p,a,b) (p)->LightEnable(a,b) +#define IDirect3DDevice7_GetLightEnable(p,a,b) (p)->GetLightEnable(a,b) +#define IDirect3DDevice7_SetClipPlane(p,a,b) (p)->SetClipPlane(a,b) +#define IDirect3DDevice7_GetClipPlane(p,a,b) (p)->GetClipPlane(a,b) +#define IDirect3DDevice7_GetInfo(p,a,b,c) (p)->GetInfo(a,b,c) +#endif +#endif /* DIRECT3D_VERSION >= 0x0700 */ + +/* + * Execute Buffer interface + */ +#undef INTERFACE +#define INTERFACE IDirect3DExecuteBuffer + +DECLARE_INTERFACE_(IDirect3DExecuteBuffer, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DExecuteBuffer methods ***/ + STDMETHOD(Initialize)(THIS_ LPDIRECT3DDEVICE,LPD3DEXECUTEBUFFERDESC) PURE; + STDMETHOD(Lock)(THIS_ LPD3DEXECUTEBUFFERDESC) PURE; + STDMETHOD(Unlock)(THIS) PURE; + STDMETHOD(SetExecuteData)(THIS_ LPD3DEXECUTEDATA) PURE; + STDMETHOD(GetExecuteData)(THIS_ LPD3DEXECUTEDATA) PURE; + STDMETHOD(Validate)(THIS_ LPDWORD,LPD3DVALIDATECALLBACK,LPVOID,DWORD) PURE; + STDMETHOD(Optimize)(THIS_ DWORD) PURE; +}; + +typedef struct IDirect3DExecuteBuffer *LPDIRECT3DEXECUTEBUFFER; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DExecuteBuffer_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DExecuteBuffer_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DExecuteBuffer_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DExecuteBuffer_Initialize(p,a,b) (p)->lpVtbl->Initialize(p,a,b) +#define IDirect3DExecuteBuffer_Lock(p,a) (p)->lpVtbl->Lock(p,a) +#define IDirect3DExecuteBuffer_Unlock(p) (p)->lpVtbl->Unlock(p) +#define IDirect3DExecuteBuffer_SetExecuteData(p,a) (p)->lpVtbl->SetExecuteData(p,a) +#define IDirect3DExecuteBuffer_GetExecuteData(p,a) (p)->lpVtbl->GetExecuteData(p,a) +#define IDirect3DExecuteBuffer_Validate(p,a,b,c,d) (p)->lpVtbl->Validate(p,a,b,c,d) +#define IDirect3DExecuteBuffer_Optimize(p,a) (p)->lpVtbl->Optimize(p,a) +#else +#define IDirect3DExecuteBuffer_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DExecuteBuffer_AddRef(p) (p)->AddRef() +#define IDirect3DExecuteBuffer_Release(p) (p)->Release() +#define IDirect3DExecuteBuffer_Initialize(p,a,b) (p)->Initialize(a,b) +#define IDirect3DExecuteBuffer_Lock(p,a) (p)->Lock(a) +#define IDirect3DExecuteBuffer_Unlock(p) (p)->Unlock() +#define IDirect3DExecuteBuffer_SetExecuteData(p,a) (p)->SetExecuteData(a) +#define IDirect3DExecuteBuffer_GetExecuteData(p,a) (p)->GetExecuteData(a) +#define IDirect3DExecuteBuffer_Validate(p,a,b,c,d) (p)->Validate(a,b,c,d) +#define IDirect3DExecuteBuffer_Optimize(p,a) (p)->Optimize(a) +#endif + +/* + * Light interfaces + */ +#undef INTERFACE +#define INTERFACE IDirect3DLight + +DECLARE_INTERFACE_(IDirect3DLight, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DLight methods ***/ + STDMETHOD(Initialize)(THIS_ LPDIRECT3D) PURE; + STDMETHOD(SetLight)(THIS_ LPD3DLIGHT) PURE; + STDMETHOD(GetLight)(THIS_ LPD3DLIGHT) PURE; +}; + +typedef struct IDirect3DLight *LPDIRECT3DLIGHT; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DLight_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DLight_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DLight_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DLight_Initialize(p,a) (p)->lpVtbl->Initialize(p,a) +#define IDirect3DLight_SetLight(p,a) (p)->lpVtbl->SetLight(p,a) +#define IDirect3DLight_GetLight(p,a) (p)->lpVtbl->GetLight(p,a) +#else +#define IDirect3DLight_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DLight_AddRef(p) (p)->AddRef() +#define IDirect3DLight_Release(p) (p)->Release() +#define IDirect3DLight_Initialize(p,a) (p)->Initialize(a) +#define IDirect3DLight_SetLight(p,a) (p)->SetLight(a) +#define IDirect3DLight_GetLight(p,a) (p)->GetLight(a) +#endif + +/* + * Material interfaces + */ +#undef INTERFACE +#define INTERFACE IDirect3DMaterial + +DECLARE_INTERFACE_(IDirect3DMaterial, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DMaterial methods ***/ + STDMETHOD(Initialize)(THIS_ LPDIRECT3D) PURE; + STDMETHOD(SetMaterial)(THIS_ LPD3DMATERIAL) PURE; + STDMETHOD(GetMaterial)(THIS_ LPD3DMATERIAL) PURE; + STDMETHOD(GetHandle)(THIS_ LPDIRECT3DDEVICE,LPD3DMATERIALHANDLE) PURE; + STDMETHOD(Reserve)(THIS) PURE; + STDMETHOD(Unreserve)(THIS) PURE; +}; + +typedef struct IDirect3DMaterial *LPDIRECT3DMATERIAL; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DMaterial_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DMaterial_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DMaterial_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DMaterial_Initialize(p,a) (p)->lpVtbl->Initialize(p,a) +#define IDirect3DMaterial_SetMaterial(p,a) (p)->lpVtbl->SetMaterial(p,a) +#define IDirect3DMaterial_GetMaterial(p,a) (p)->lpVtbl->GetMaterial(p,a) +#define IDirect3DMaterial_GetHandle(p,a,b) (p)->lpVtbl->GetHandle(p,a,b) +#define IDirect3DMaterial_Reserve(p) (p)->lpVtbl->Reserve(p) +#define IDirect3DMaterial_Unreserve(p) (p)->lpVtbl->Unreserve(p) +#else +#define IDirect3DMaterial_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DMaterial_AddRef(p) (p)->AddRef() +#define IDirect3DMaterial_Release(p) (p)->Release() +#define IDirect3DMaterial_Initialize(p,a) (p)->Initialize(a) +#define IDirect3DMaterial_SetMaterial(p,a) (p)->SetMaterial(a) +#define IDirect3DMaterial_GetMaterial(p,a) (p)->GetMaterial(a) +#define IDirect3DMaterial_GetHandle(p,a,b) (p)->GetHandle(a,b) +#define IDirect3DMaterial_Reserve(p) (p)->Reserve() +#define IDirect3DMaterial_Unreserve(p) (p)->Unreserve() +#endif + +#if(DIRECT3D_VERSION >= 0x0500) +#undef INTERFACE +#define INTERFACE IDirect3DMaterial2 + +DECLARE_INTERFACE_(IDirect3DMaterial2, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DMaterial2 methods ***/ + STDMETHOD(SetMaterial)(THIS_ LPD3DMATERIAL) PURE; + STDMETHOD(GetMaterial)(THIS_ LPD3DMATERIAL) PURE; + STDMETHOD(GetHandle)(THIS_ LPDIRECT3DDEVICE2,LPD3DMATERIALHANDLE) PURE; +}; + +typedef struct IDirect3DMaterial2 *LPDIRECT3DMATERIAL2; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DMaterial2_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DMaterial2_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DMaterial2_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DMaterial2_SetMaterial(p,a) (p)->lpVtbl->SetMaterial(p,a) +#define IDirect3DMaterial2_GetMaterial(p,a) (p)->lpVtbl->GetMaterial(p,a) +#define IDirect3DMaterial2_GetHandle(p,a,b) (p)->lpVtbl->GetHandle(p,a,b) +#else +#define IDirect3DMaterial2_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DMaterial2_AddRef(p) (p)->AddRef() +#define IDirect3DMaterial2_Release(p) (p)->Release() +#define IDirect3DMaterial2_SetMaterial(p,a) (p)->SetMaterial(a) +#define IDirect3DMaterial2_GetMaterial(p,a) (p)->GetMaterial(a) +#define IDirect3DMaterial2_GetHandle(p,a,b) (p)->GetHandle(a,b) +#endif +#endif /* DIRECT3D_VERSION >= 0x0500 */ + +#if(DIRECT3D_VERSION >= 0x0600) +#undef INTERFACE +#define INTERFACE IDirect3DMaterial3 + +DECLARE_INTERFACE_(IDirect3DMaterial3, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DMaterial3 methods ***/ + STDMETHOD(SetMaterial)(THIS_ LPD3DMATERIAL) PURE; + STDMETHOD(GetMaterial)(THIS_ LPD3DMATERIAL) PURE; + STDMETHOD(GetHandle)(THIS_ LPDIRECT3DDEVICE3,LPD3DMATERIALHANDLE) PURE; +}; + +typedef struct IDirect3DMaterial3 *LPDIRECT3DMATERIAL3; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DMaterial3_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DMaterial3_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DMaterial3_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DMaterial3_SetMaterial(p,a) (p)->lpVtbl->SetMaterial(p,a) +#define IDirect3DMaterial3_GetMaterial(p,a) (p)->lpVtbl->GetMaterial(p,a) +#define IDirect3DMaterial3_GetHandle(p,a,b) (p)->lpVtbl->GetHandle(p,a,b) +#else +#define IDirect3DMaterial3_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DMaterial3_AddRef(p) (p)->AddRef() +#define IDirect3DMaterial3_Release(p) (p)->Release() +#define IDirect3DMaterial3_SetMaterial(p,a) (p)->SetMaterial(a) +#define IDirect3DMaterial3_GetMaterial(p,a) (p)->GetMaterial(a) +#define IDirect3DMaterial3_GetHandle(p,a,b) (p)->GetHandle(a,b) +#endif +#endif /* DIRECT3D_VERSION >= 0x0600 */ + +/* + * Texture interfaces + */ +#undef INTERFACE +#define INTERFACE IDirect3DTexture + +DECLARE_INTERFACE_(IDirect3DTexture, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DTexture methods ***/ + STDMETHOD(Initialize)(THIS_ LPDIRECT3DDEVICE,LPDIRECTDRAWSURFACE) PURE; + STDMETHOD(GetHandle)(THIS_ LPDIRECT3DDEVICE,LPD3DTEXTUREHANDLE) PURE; + STDMETHOD(PaletteChanged)(THIS_ DWORD,DWORD) PURE; + STDMETHOD(Load)(THIS_ LPDIRECT3DTEXTURE) PURE; + STDMETHOD(Unload)(THIS) PURE; +}; + +typedef struct IDirect3DTexture *LPDIRECT3DTEXTURE; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DTexture_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DTexture_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DTexture_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DTexture_Initialize(p,a,b) (p)->lpVtbl->Initialize(p,a,b) +#define IDirect3DTexture_GetHandle(p,a,b) (p)->lpVtbl->GetHandle(p,a,b) +#define IDirect3DTexture_PaletteChanged(p,a,b) (p)->lpVtbl->PaletteChanged(p,a,b) +#define IDirect3DTexture_Load(p,a) (p)->lpVtbl->Load(p,a) +#define IDirect3DTexture_Unload(p) (p)->lpVtbl->Unload(p) +#else +#define IDirect3DTexture_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DTexture_AddRef(p) (p)->AddRef() +#define IDirect3DTexture_Release(p) (p)->Release() +#define IDirect3DTexture_Initialize(p,a,b) (p)->Initialize(a,b) +#define IDirect3DTexture_GetHandle(p,a,b) (p)->GetHandle(a,b) +#define IDirect3DTexture_PaletteChanged(p,a,b) (p)->PaletteChanged(a,b) +#define IDirect3DTexture_Load(p,a) (p)->Load(a) +#define IDirect3DTexture_Unload(p) (p)->Unload() +#endif + +#if(DIRECT3D_VERSION >= 0x0500) +#undef INTERFACE +#define INTERFACE IDirect3DTexture2 + +DECLARE_INTERFACE_(IDirect3DTexture2, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DTexture2 methods ***/ + STDMETHOD(GetHandle)(THIS_ LPDIRECT3DDEVICE2,LPD3DTEXTUREHANDLE) PURE; + STDMETHOD(PaletteChanged)(THIS_ DWORD,DWORD) PURE; + STDMETHOD(Load)(THIS_ LPDIRECT3DTEXTURE2) PURE; +}; + +typedef struct IDirect3DTexture2 *LPDIRECT3DTEXTURE2; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DTexture2_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DTexture2_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DTexture2_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DTexture2_GetHandle(p,a,b) (p)->lpVtbl->GetHandle(p,a,b) +#define IDirect3DTexture2_PaletteChanged(p,a,b) (p)->lpVtbl->PaletteChanged(p,a,b) +#define IDirect3DTexture2_Load(p,a) (p)->lpVtbl->Load(p,a) +#else +#define IDirect3DTexture2_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DTexture2_AddRef(p) (p)->AddRef() +#define IDirect3DTexture2_Release(p) (p)->Release() +#define IDirect3DTexture2_GetHandle(p,a,b) (p)->GetHandle(a,b) +#define IDirect3DTexture2_PaletteChanged(p,a,b) (p)->PaletteChanged(a,b) +#define IDirect3DTexture2_Load(p,a) (p)->Load(a) +#endif +#endif /* DIRECT3D_VERSION >= 0x0500 */ + +/* + * Viewport interfaces + */ +#undef INTERFACE +#define INTERFACE IDirect3DViewport + +DECLARE_INTERFACE_(IDirect3DViewport, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DViewport methods ***/ + STDMETHOD(Initialize)(THIS_ LPDIRECT3D) PURE; + STDMETHOD(GetViewport)(THIS_ LPD3DVIEWPORT) PURE; + STDMETHOD(SetViewport)(THIS_ LPD3DVIEWPORT) PURE; + STDMETHOD(TransformVertices)(THIS_ DWORD,LPD3DTRANSFORMDATA,DWORD,LPDWORD) PURE; + STDMETHOD(LightElements)(THIS_ DWORD,LPD3DLIGHTDATA) PURE; + STDMETHOD(SetBackground)(THIS_ D3DMATERIALHANDLE) PURE; + STDMETHOD(GetBackground)(THIS_ LPD3DMATERIALHANDLE,LPBOOL) PURE; + STDMETHOD(SetBackgroundDepth)(THIS_ LPDIRECTDRAWSURFACE) PURE; + STDMETHOD(GetBackgroundDepth)(THIS_ LPDIRECTDRAWSURFACE*,LPBOOL) PURE; + STDMETHOD(Clear)(THIS_ DWORD,LPD3DRECT,DWORD) PURE; + STDMETHOD(AddLight)(THIS_ LPDIRECT3DLIGHT) PURE; + STDMETHOD(DeleteLight)(THIS_ LPDIRECT3DLIGHT) PURE; + STDMETHOD(NextLight)(THIS_ LPDIRECT3DLIGHT,LPDIRECT3DLIGHT*,DWORD) PURE; +}; + +typedef struct IDirect3DViewport *LPDIRECT3DVIEWPORT; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DViewport_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DViewport_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DViewport_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DViewport_Initialize(p,a) (p)->lpVtbl->Initialize(p,a) +#define IDirect3DViewport_GetViewport(p,a) (p)->lpVtbl->GetViewport(p,a) +#define IDirect3DViewport_SetViewport(p,a) (p)->lpVtbl->SetViewport(p,a) +#define IDirect3DViewport_TransformVertices(p,a,b,c,d) (p)->lpVtbl->TransformVertices(p,a,b,c,d) +#define IDirect3DViewport_LightElements(p,a,b) (p)->lpVtbl->LightElements(p,a,b) +#define IDirect3DViewport_SetBackground(p,a) (p)->lpVtbl->SetBackground(p,a) +#define IDirect3DViewport_GetBackground(p,a,b) (p)->lpVtbl->GetBackground(p,a,b) +#define IDirect3DViewport_SetBackgroundDepth(p,a) (p)->lpVtbl->SetBackgroundDepth(p,a) +#define IDirect3DViewport_GetBackgroundDepth(p,a,b) (p)->lpVtbl->GetBackgroundDepth(p,a,b) +#define IDirect3DViewport_Clear(p,a,b,c) (p)->lpVtbl->Clear(p,a,b,c) +#define IDirect3DViewport_AddLight(p,a) (p)->lpVtbl->AddLight(p,a) +#define IDirect3DViewport_DeleteLight(p,a) (p)->lpVtbl->DeleteLight(p,a) +#define IDirect3DViewport_NextLight(p,a,b,c) (p)->lpVtbl->NextLight(p,a,b,c) +#else +#define IDirect3DViewport_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DViewport_AddRef(p) (p)->AddRef() +#define IDirect3DViewport_Release(p) (p)->Release() +#define IDirect3DViewport_Initialize(p,a) (p)->Initialize(a) +#define IDirect3DViewport_GetViewport(p,a) (p)->GetViewport(a) +#define IDirect3DViewport_SetViewport(p,a) (p)->SetViewport(a) +#define IDirect3DViewport_TransformVertices(p,a,b,c,d) (p)->TransformVertices(a,b,c,d) +#define IDirect3DViewport_LightElements(p,a,b) (p)->LightElements(a,b) +#define IDirect3DViewport_SetBackground(p,a) (p)->SetBackground(a) +#define IDirect3DViewport_GetBackground(p,a,b) (p)->GetBackground(a,b) +#define IDirect3DViewport_SetBackgroundDepth(p,a) (p)->SetBackgroundDepth(a) +#define IDirect3DViewport_GetBackgroundDepth(p,a,b) (p)->GetBackgroundDepth(a,b) +#define IDirect3DViewport_Clear(p,a,b,c) (p)->Clear(a,b,c) +#define IDirect3DViewport_AddLight(p,a) (p)->AddLight(a) +#define IDirect3DViewport_DeleteLight(p,a) (p)->DeleteLight(a) +#define IDirect3DViewport_NextLight(p,a,b,c) (p)->NextLight(a,b,c) +#endif + +#if(DIRECT3D_VERSION >= 0x0500) +#undef INTERFACE +#define INTERFACE IDirect3DViewport2 + +DECLARE_INTERFACE_(IDirect3DViewport2, IDirect3DViewport) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DViewport methods ***/ + STDMETHOD(Initialize)(THIS_ LPDIRECT3D) PURE; + STDMETHOD(GetViewport)(THIS_ LPD3DVIEWPORT) PURE; + STDMETHOD(SetViewport)(THIS_ LPD3DVIEWPORT) PURE; + STDMETHOD(TransformVertices)(THIS_ DWORD,LPD3DTRANSFORMDATA,DWORD,LPDWORD) PURE; + STDMETHOD(LightElements)(THIS_ DWORD,LPD3DLIGHTDATA) PURE; + STDMETHOD(SetBackground)(THIS_ D3DMATERIALHANDLE) PURE; + STDMETHOD(GetBackground)(THIS_ LPD3DMATERIALHANDLE,LPBOOL) PURE; + STDMETHOD(SetBackgroundDepth)(THIS_ LPDIRECTDRAWSURFACE) PURE; + STDMETHOD(GetBackgroundDepth)(THIS_ LPDIRECTDRAWSURFACE*,LPBOOL) PURE; + STDMETHOD(Clear)(THIS_ DWORD,LPD3DRECT,DWORD) PURE; + STDMETHOD(AddLight)(THIS_ LPDIRECT3DLIGHT) PURE; + STDMETHOD(DeleteLight)(THIS_ LPDIRECT3DLIGHT) PURE; + STDMETHOD(NextLight)(THIS_ LPDIRECT3DLIGHT,LPDIRECT3DLIGHT*,DWORD) PURE; + STDMETHOD(GetViewport2)(THIS_ LPD3DVIEWPORT2) PURE; + STDMETHOD(SetViewport2)(THIS_ LPD3DVIEWPORT2) PURE; +}; + +typedef struct IDirect3DViewport2 *LPDIRECT3DVIEWPORT2; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DViewport2_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DViewport2_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DViewport2_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DViewport2_Initialize(p,a) (p)->lpVtbl->Initialize(p,a) +#define IDirect3DViewport2_GetViewport(p,a) (p)->lpVtbl->GetViewport(p,a) +#define IDirect3DViewport2_SetViewport(p,a) (p)->lpVtbl->SetViewport(p,a) +#define IDirect3DViewport2_TransformVertices(p,a,b,c,d) (p)->lpVtbl->TransformVertices(p,a,b,c,d) +#define IDirect3DViewport2_LightElements(p,a,b) (p)->lpVtbl->LightElements(p,a,b) +#define IDirect3DViewport2_SetBackground(p,a) (p)->lpVtbl->SetBackground(p,a) +#define IDirect3DViewport2_GetBackground(p,a,b) (p)->lpVtbl->GetBackground(p,a,b) +#define IDirect3DViewport2_SetBackgroundDepth(p,a) (p)->lpVtbl->SetBackgroundDepth(p,a) +#define IDirect3DViewport2_GetBackgroundDepth(p,a,b) (p)->lpVtbl->GetBackgroundDepth(p,a,b) +#define IDirect3DViewport2_Clear(p,a,b,c) (p)->lpVtbl->Clear(p,a,b,c) +#define IDirect3DViewport2_AddLight(p,a) (p)->lpVtbl->AddLight(p,a) +#define IDirect3DViewport2_DeleteLight(p,a) (p)->lpVtbl->DeleteLight(p,a) +#define IDirect3DViewport2_NextLight(p,a,b,c) (p)->lpVtbl->NextLight(p,a,b,c) +#define IDirect3DViewport2_GetViewport2(p,a) (p)->lpVtbl->GetViewport2(p,a) +#define IDirect3DViewport2_SetViewport2(p,a) (p)->lpVtbl->SetViewport2(p,a) +#else +#define IDirect3DViewport2_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DViewport2_AddRef(p) (p)->AddRef() +#define IDirect3DViewport2_Release(p) (p)->Release() +#define IDirect3DViewport2_Initialize(p,a) (p)->Initialize(a) +#define IDirect3DViewport2_GetViewport(p,a) (p)->GetViewport(a) +#define IDirect3DViewport2_SetViewport(p,a) (p)->SetViewport(a) +#define IDirect3DViewport2_TransformVertices(p,a,b,c,d) (p)->TransformVertices(a,b,c,d) +#define IDirect3DViewport2_LightElements(p,a,b) (p)->LightElements(a,b) +#define IDirect3DViewport2_SetBackground(p,a) (p)->SetBackground(a) +#define IDirect3DViewport2_GetBackground(p,a,b) (p)->GetBackground(a,b) +#define IDirect3DViewport2_SetBackgroundDepth(p,a) (p)->SetBackgroundDepth(a) +#define IDirect3DViewport2_GetBackgroundDepth(p,a,b) (p)->GetBackgroundDepth(a,b) +#define IDirect3DViewport2_Clear(p,a,b,c) (p)->Clear(a,b,c) +#define IDirect3DViewport2_AddLight(p,a) (p)->AddLight(a) +#define IDirect3DViewport2_DeleteLight(p,a) (p)->DeleteLight(a) +#define IDirect3DViewport2_NextLight(p,a,b,c) (p)->NextLight(a,b,c) +#define IDirect3DViewport2_GetViewport2(p,a) (p)->GetViewport2(a) +#define IDirect3DViewport2_SetViewport2(p,a) (p)->SetViewport2(a) +#endif +#endif /* DIRECT3D_VERSION >= 0x0500 */ + +#if(DIRECT3D_VERSION >= 0x0600) + +#undef INTERFACE +#define INTERFACE IDirect3DViewport3 + +DECLARE_INTERFACE_(IDirect3DViewport3, IDirect3DViewport2) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DViewport2 methods ***/ + STDMETHOD(Initialize)(THIS_ LPDIRECT3D) PURE; + STDMETHOD(GetViewport)(THIS_ LPD3DVIEWPORT) PURE; + STDMETHOD(SetViewport)(THIS_ LPD3DVIEWPORT) PURE; + STDMETHOD(TransformVertices)(THIS_ DWORD,LPD3DTRANSFORMDATA,DWORD,LPDWORD) PURE; + STDMETHOD(LightElements)(THIS_ DWORD,LPD3DLIGHTDATA) PURE; + STDMETHOD(SetBackground)(THIS_ D3DMATERIALHANDLE) PURE; + STDMETHOD(GetBackground)(THIS_ LPD3DMATERIALHANDLE,LPBOOL) PURE; + STDMETHOD(SetBackgroundDepth)(THIS_ LPDIRECTDRAWSURFACE) PURE; + STDMETHOD(GetBackgroundDepth)(THIS_ LPDIRECTDRAWSURFACE*,LPBOOL) PURE; + STDMETHOD(Clear)(THIS_ DWORD,LPD3DRECT,DWORD) PURE; + STDMETHOD(AddLight)(THIS_ LPDIRECT3DLIGHT) PURE; + STDMETHOD(DeleteLight)(THIS_ LPDIRECT3DLIGHT) PURE; + STDMETHOD(NextLight)(THIS_ LPDIRECT3DLIGHT,LPDIRECT3DLIGHT*,DWORD) PURE; + STDMETHOD(GetViewport2)(THIS_ LPD3DVIEWPORT2) PURE; + STDMETHOD(SetViewport2)(THIS_ LPD3DVIEWPORT2) PURE; + STDMETHOD(SetBackgroundDepth2)(THIS_ LPDIRECTDRAWSURFACE4) PURE; + STDMETHOD(GetBackgroundDepth2)(THIS_ LPDIRECTDRAWSURFACE4*,LPBOOL) PURE; + STDMETHOD(Clear2)(THIS_ DWORD,LPD3DRECT,DWORD,D3DCOLOR,D3DVALUE,DWORD) PURE; +}; + +typedef struct IDirect3DViewport3 *LPDIRECT3DVIEWPORT3; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DViewport3_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DViewport3_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DViewport3_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DViewport3_Initialize(p,a) (p)->lpVtbl->Initialize(p,a) +#define IDirect3DViewport3_GetViewport(p,a) (p)->lpVtbl->GetViewport(p,a) +#define IDirect3DViewport3_SetViewport(p,a) (p)->lpVtbl->SetViewport(p,a) +#define IDirect3DViewport3_TransformVertices(p,a,b,c,d) (p)->lpVtbl->TransformVertices(p,a,b,c,d) +#define IDirect3DViewport3_LightElements(p,a,b) (p)->lpVtbl->LightElements(p,a,b) +#define IDirect3DViewport3_SetBackground(p,a) (p)->lpVtbl->SetBackground(p,a) +#define IDirect3DViewport3_GetBackground(p,a,b) (p)->lpVtbl->GetBackground(p,a,b) +#define IDirect3DViewport3_SetBackgroundDepth(p,a) (p)->lpVtbl->SetBackgroundDepth(p,a) +#define IDirect3DViewport3_GetBackgroundDepth(p,a,b) (p)->lpVtbl->GetBackgroundDepth(p,a,b) +#define IDirect3DViewport3_Clear(p,a,b,c) (p)->lpVtbl->Clear(p,a,b,c) +#define IDirect3DViewport3_AddLight(p,a) (p)->lpVtbl->AddLight(p,a) +#define IDirect3DViewport3_DeleteLight(p,a) (p)->lpVtbl->DeleteLight(p,a) +#define IDirect3DViewport3_NextLight(p,a,b,c) (p)->lpVtbl->NextLight(p,a,b,c) +#define IDirect3DViewport3_GetViewport2(p,a) (p)->lpVtbl->GetViewport2(p,a) +#define IDirect3DViewport3_SetViewport2(p,a) (p)->lpVtbl->SetViewport2(p,a) +#define IDirect3DViewport3_SetBackgroundDepth2(p,a) (p)->lpVtbl->SetBackgroundDepth2(p,a) +#define IDirect3DViewport3_GetBackgroundDepth2(p,a,b) (p)->lpVtbl->GetBackgroundDepth2(p,a,b) +#define IDirect3DViewport3_Clear2(p,a,b,c,d,e,f) (p)->lpVtbl->Clear2(p,a,b,c,d,e,f) +#else +#define IDirect3DViewport3_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DViewport3_AddRef(p) (p)->AddRef() +#define IDirect3DViewport3_Release(p) (p)->Release() +#define IDirect3DViewport3_Initialize(p,a) (p)->Initialize(a) +#define IDirect3DViewport3_GetViewport(p,a) (p)->GetViewport(a) +#define IDirect3DViewport3_SetViewport(p,a) (p)->SetViewport(a) +#define IDirect3DViewport3_TransformVertices(p,a,b,c,d) (p)->TransformVertices(a,b,c,d) +#define IDirect3DViewport3_LightElements(p,a,b) (p)->LightElements(a,b) +#define IDirect3DViewport3_SetBackground(p,a) (p)->SetBackground(a) +#define IDirect3DViewport3_GetBackground(p,a,b) (p)->GetBackground(a,b) +#define IDirect3DViewport3_SetBackgroundDepth(p,a) (p)->SetBackgroundDepth(a) +#define IDirect3DViewport3_GetBackgroundDepth(p,a,b) (p)->GetBackgroundDepth(a,b) +#define IDirect3DViewport3_Clear(p,a,b,c) (p)->Clear(a,b,c) +#define IDirect3DViewport3_AddLight(p,a) (p)->AddLight(a) +#define IDirect3DViewport3_DeleteLight(p,a) (p)->DeleteLight(a) +#define IDirect3DViewport3_NextLight(p,a,b,c) (p)->NextLight(a,b,c) +#define IDirect3DViewport3_GetViewport2(p,a) (p)->GetViewport2(a) +#define IDirect3DViewport3_SetViewport2(p,a) (p)->SetViewport2(a) +#define IDirect3DViewport3_SetBackgroundDepth2(p,a) (p)->SetBackgroundDepth2(a) +#define IDirect3DViewport3_GetBackgroundDepth2(p,a,b) (p)->GetBackgroundDepth2(a,b) +#define IDirect3DViewport3_Clear2(p,a,b,c,d,e,f) (p)->Clear2(a,b,c,d,e,f) +#endif +#endif /* DIRECT3D_VERSION >= 0x0600 */ + +#if(DIRECT3D_VERSION >= 0x0600) +#undef INTERFACE +#define INTERFACE IDirect3DVertexBuffer + +DECLARE_INTERFACE_(IDirect3DVertexBuffer, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DVertexBuffer methods ***/ + STDMETHOD(Lock)(THIS_ DWORD,LPVOID*,LPDWORD) PURE; + STDMETHOD(Unlock)(THIS) PURE; + STDMETHOD(ProcessVertices)(THIS_ DWORD,DWORD,DWORD,LPDIRECT3DVERTEXBUFFER,DWORD,LPDIRECT3DDEVICE3,DWORD) PURE; + STDMETHOD(GetVertexBufferDesc)(THIS_ LPD3DVERTEXBUFFERDESC) PURE; + STDMETHOD(Optimize)(THIS_ LPDIRECT3DDEVICE3,DWORD) PURE; +}; + +typedef struct IDirect3DVertexBuffer *LPDIRECT3DVERTEXBUFFER; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DVertexBuffer_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DVertexBuffer_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DVertexBuffer_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DVertexBuffer_Lock(p,a,b,c) (p)->lpVtbl->Lock(p,a,b,c) +#define IDirect3DVertexBuffer_Unlock(p) (p)->lpVtbl->Unlock(p) +#define IDirect3DVertexBuffer_ProcessVertices(p,a,b,c,d,e,f,g) (p)->lpVtbl->ProcessVertices(p,a,b,c,d,e,f,g) +#define IDirect3DVertexBuffer_GetVertexBufferDesc(p,a) (p)->lpVtbl->GetVertexBufferDesc(p,a) +#define IDirect3DVertexBuffer_Optimize(p,a,b) (p)->lpVtbl->Optimize(p,a,b) +#else +#define IDirect3DVertexBuffer_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DVertexBuffer_AddRef(p) (p)->AddRef() +#define IDirect3DVertexBuffer_Release(p) (p)->Release() +#define IDirect3DVertexBuffer_Lock(p,a,b,c) (p)->Lock(a,b,c) +#define IDirect3DVertexBuffer_Unlock(p) (p)->Unlock() +#define IDirect3DVertexBuffer_ProcessVertices(p,a,b,c,d,e,f,g) (p)->ProcessVertices(a,b,c,d,e,f,g) +#define IDirect3DVertexBuffer_GetVertexBufferDesc(p,a) (p)->GetVertexBufferDesc(a) +#define IDirect3DVertexBuffer_Optimize(p,a,b) (p)->Optimize(a,b) +#endif +#endif /* DIRECT3D_VERSION >= 0x0600 */ + +#if(DIRECT3D_VERSION >= 0x0700) +#undef INTERFACE +#define INTERFACE IDirect3DVertexBuffer7 + +DECLARE_INTERFACE_(IDirect3DVertexBuffer7, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DVertexBuffer7 methods ***/ + STDMETHOD(Lock)(THIS_ DWORD,LPVOID*,LPDWORD) PURE; + STDMETHOD(Unlock)(THIS) PURE; + STDMETHOD(ProcessVertices)(THIS_ DWORD,DWORD,DWORD,LPDIRECT3DVERTEXBUFFER7,DWORD,LPDIRECT3DDEVICE7,DWORD) PURE; + STDMETHOD(GetVertexBufferDesc)(THIS_ LPD3DVERTEXBUFFERDESC) PURE; + STDMETHOD(Optimize)(THIS_ LPDIRECT3DDEVICE7,DWORD) PURE; + STDMETHOD(ProcessVerticesStrided)(THIS_ DWORD,DWORD,DWORD,LPD3DDRAWPRIMITIVESTRIDEDDATA,DWORD,LPDIRECT3DDEVICE7,DWORD) PURE; +}; + +typedef struct IDirect3DVertexBuffer7 *LPDIRECT3DVERTEXBUFFER7; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DVertexBuffer7_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DVertexBuffer7_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DVertexBuffer7_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DVertexBuffer7_Lock(p,a,b,c) (p)->lpVtbl->Lock(p,a,b,c) +#define IDirect3DVertexBuffer7_Unlock(p) (p)->lpVtbl->Unlock(p) +#define IDirect3DVertexBuffer7_ProcessVertices(p,a,b,c,d,e,f,g) (p)->lpVtbl->ProcessVertices(p,a,b,c,d,e,f,g) +#define IDirect3DVertexBuffer7_GetVertexBufferDesc(p,a) (p)->lpVtbl->GetVertexBufferDesc(p,a) +#define IDirect3DVertexBuffer7_Optimize(p,a,b) (p)->lpVtbl->Optimize(p,a,b) +#define IDirect3DVertexBuffer7_ProcessVerticesStrided(p,a,b,c,d,e,f,g) (p)->lpVtbl->ProcessVerticesStrided(p,a,b,c,d,e,f,g) +#else +#define IDirect3DVertexBuffer7_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DVertexBuffer7_AddRef(p) (p)->AddRef() +#define IDirect3DVertexBuffer7_Release(p) (p)->Release() +#define IDirect3DVertexBuffer7_Lock(p,a,b,c) (p)->Lock(a,b,c) +#define IDirect3DVertexBuffer7_Unlock(p) (p)->Unlock() +#define IDirect3DVertexBuffer7_ProcessVertices(p,a,b,c,d,e,f,g) (p)->ProcessVertices(a,b,c,d,e,f,g) +#define IDirect3DVertexBuffer7_GetVertexBufferDesc(p,a) (p)->GetVertexBufferDesc(a) +#define IDirect3DVertexBuffer7_Optimize(p,a,b) (p)->Optimize(a,b) +#define IDirect3DVertexBuffer7_ProcessVerticesStrided(p,a,b,c,d,e,f,g) (p)->ProcessVerticesStrided(a,b,c,d,e,f,g) +#endif +#endif /* DIRECT3D_VERSION >= 0x0700 */ + +#if(DIRECT3D_VERSION >= 0x0500) +/**************************************************************************** + * + * Flags for IDirect3DDevice::NextViewport + * + ****************************************************************************/ + +/* + * Return the next viewport + */ +#define D3DNEXT_NEXT 0x00000001l + +/* + * Return the first viewport + */ +#define D3DNEXT_HEAD 0x00000002l + +/* + * Return the last viewport + */ +#define D3DNEXT_TAIL 0x00000004l + + +/**************************************************************************** + * + * Flags for DrawPrimitive/DrawIndexedPrimitive + * Also valid for Begin/BeginIndexed + * Also valid for VertexBuffer::CreateVertexBuffer + ****************************************************************************/ + +/* + * Wait until the device is ready to draw the primitive + * This will cause DP to not return DDERR_WASSTILLDRAWING + */ +#define D3DDP_WAIT 0x00000001l +#endif /* DIRECT3D_VERSION >= 0x0500 */ + +#if (DIRECT3D_VERSION == 0x0500) +/* + * Hint that it is acceptable to render the primitive out of order. + */ +#define D3DDP_OUTOFORDER 0x00000002l +#endif + + +#if(DIRECT3D_VERSION >= 0x0500) +/* + * Hint that the primitives have been clipped by the application. + */ +#define D3DDP_DONOTCLIP 0x00000004l + +/* + * Hint that the extents need not be updated. + */ +#define D3DDP_DONOTUPDATEEXTENTS 0x00000008l +#endif /* DIRECT3D_VERSION >= 0x0500 */ + +#if(DIRECT3D_VERSION >= 0x0600) + +/* + * Hint that the lighting should not be applied on vertices. + */ + +#define D3DDP_DONOTLIGHT 0x00000010l + +#endif /* DIRECT3D_VERSION >= 0x0600 */ + +/* + * Direct3D Errors + * DirectDraw error codes are used when errors not specified here. + */ +#define D3D_OK DD_OK +#define D3DERR_BADMAJORVERSION MAKE_DDHRESULT(700) +#define D3DERR_BADMINORVERSION MAKE_DDHRESULT(701) + +#if(DIRECT3D_VERSION >= 0x0500) +/* + * An invalid device was requested by the application. + */ +#define D3DERR_INVALID_DEVICE MAKE_DDHRESULT(705) +#define D3DERR_INITFAILED MAKE_DDHRESULT(706) + +/* + * SetRenderTarget attempted on a device that was + * QI'd off the render target. + */ +#define D3DERR_DEVICEAGGREGATED MAKE_DDHRESULT(707) +#endif /* DIRECT3D_VERSION >= 0x0500 */ + +#define D3DERR_EXECUTE_CREATE_FAILED MAKE_DDHRESULT(710) +#define D3DERR_EXECUTE_DESTROY_FAILED MAKE_DDHRESULT(711) +#define D3DERR_EXECUTE_LOCK_FAILED MAKE_DDHRESULT(712) +#define D3DERR_EXECUTE_UNLOCK_FAILED MAKE_DDHRESULT(713) +#define D3DERR_EXECUTE_LOCKED MAKE_DDHRESULT(714) +#define D3DERR_EXECUTE_NOT_LOCKED MAKE_DDHRESULT(715) + +#define D3DERR_EXECUTE_FAILED MAKE_DDHRESULT(716) +#define D3DERR_EXECUTE_CLIPPED_FAILED MAKE_DDHRESULT(717) + +#define D3DERR_TEXTURE_NO_SUPPORT MAKE_DDHRESULT(720) +#define D3DERR_TEXTURE_CREATE_FAILED MAKE_DDHRESULT(721) +#define D3DERR_TEXTURE_DESTROY_FAILED MAKE_DDHRESULT(722) +#define D3DERR_TEXTURE_LOCK_FAILED MAKE_DDHRESULT(723) +#define D3DERR_TEXTURE_UNLOCK_FAILED MAKE_DDHRESULT(724) +#define D3DERR_TEXTURE_LOAD_FAILED MAKE_DDHRESULT(725) +#define D3DERR_TEXTURE_SWAP_FAILED MAKE_DDHRESULT(726) +#define D3DERR_TEXTURE_LOCKED MAKE_DDHRESULT(727) +#define D3DERR_TEXTURE_NOT_LOCKED MAKE_DDHRESULT(728) +#define D3DERR_TEXTURE_GETSURF_FAILED MAKE_DDHRESULT(729) + +#define D3DERR_MATRIX_CREATE_FAILED MAKE_DDHRESULT(730) +#define D3DERR_MATRIX_DESTROY_FAILED MAKE_DDHRESULT(731) +#define D3DERR_MATRIX_SETDATA_FAILED MAKE_DDHRESULT(732) +#define D3DERR_MATRIX_GETDATA_FAILED MAKE_DDHRESULT(733) +#define D3DERR_SETVIEWPORTDATA_FAILED MAKE_DDHRESULT(734) + +#if(DIRECT3D_VERSION >= 0x0500) +#define D3DERR_INVALIDCURRENTVIEWPORT MAKE_DDHRESULT(735) +#define D3DERR_INVALIDPRIMITIVETYPE MAKE_DDHRESULT(736) +#define D3DERR_INVALIDVERTEXTYPE MAKE_DDHRESULT(737) +#define D3DERR_TEXTURE_BADSIZE MAKE_DDHRESULT(738) +#define D3DERR_INVALIDRAMPTEXTURE MAKE_DDHRESULT(739) +#endif /* DIRECT3D_VERSION >= 0x0500 */ + +#define D3DERR_MATERIAL_CREATE_FAILED MAKE_DDHRESULT(740) +#define D3DERR_MATERIAL_DESTROY_FAILED MAKE_DDHRESULT(741) +#define D3DERR_MATERIAL_SETDATA_FAILED MAKE_DDHRESULT(742) +#define D3DERR_MATERIAL_GETDATA_FAILED MAKE_DDHRESULT(743) + +#if(DIRECT3D_VERSION >= 0x0500) +#define D3DERR_INVALIDPALETTE MAKE_DDHRESULT(744) + +#define D3DERR_ZBUFF_NEEDS_SYSTEMMEMORY MAKE_DDHRESULT(745) +#define D3DERR_ZBUFF_NEEDS_VIDEOMEMORY MAKE_DDHRESULT(746) +#define D3DERR_SURFACENOTINVIDMEM MAKE_DDHRESULT(747) +#endif /* DIRECT3D_VERSION >= 0x0500 */ + +#define D3DERR_LIGHT_SET_FAILED MAKE_DDHRESULT(750) +#if(DIRECT3D_VERSION >= 0x0500) +#define D3DERR_LIGHTHASVIEWPORT MAKE_DDHRESULT(751) +#define D3DERR_LIGHTNOTINTHISVIEWPORT MAKE_DDHRESULT(752) +#endif /* DIRECT3D_VERSION >= 0x0500 */ + +#define D3DERR_SCENE_IN_SCENE MAKE_DDHRESULT(760) +#define D3DERR_SCENE_NOT_IN_SCENE MAKE_DDHRESULT(761) +#define D3DERR_SCENE_BEGIN_FAILED MAKE_DDHRESULT(762) +#define D3DERR_SCENE_END_FAILED MAKE_DDHRESULT(763) + +#if(DIRECT3D_VERSION >= 0x0500) +#define D3DERR_INBEGIN MAKE_DDHRESULT(770) +#define D3DERR_NOTINBEGIN MAKE_DDHRESULT(771) +#define D3DERR_NOVIEWPORTS MAKE_DDHRESULT(772) +#define D3DERR_VIEWPORTDATANOTSET MAKE_DDHRESULT(773) +#define D3DERR_VIEWPORTHASNODEVICE MAKE_DDHRESULT(774) +#define D3DERR_NOCURRENTVIEWPORT MAKE_DDHRESULT(775) +#endif /* DIRECT3D_VERSION >= 0x0500 */ + +#if(DIRECT3D_VERSION >= 0x0600) +#define D3DERR_INVALIDVERTEXFORMAT MAKE_DDHRESULT(2048) + +/* + * Attempted to CreateTexture on a surface that had a color key + */ +#define D3DERR_COLORKEYATTACHED MAKE_DDHRESULT(2050) + +#define D3DERR_VERTEXBUFFEROPTIMIZED MAKE_DDHRESULT(2060) +#define D3DERR_VBUF_CREATE_FAILED MAKE_DDHRESULT(2061) +#define D3DERR_VERTEXBUFFERLOCKED MAKE_DDHRESULT(2062) +#define D3DERR_VERTEXBUFFERUNLOCKFAILED MAKE_DDHRESULT(2063) + +#define D3DERR_ZBUFFER_NOTPRESENT MAKE_DDHRESULT(2070) +#define D3DERR_STENCILBUFFER_NOTPRESENT MAKE_DDHRESULT(2071) + +#define D3DERR_WRONGTEXTUREFORMAT MAKE_DDHRESULT(2072) +#define D3DERR_UNSUPPORTEDCOLOROPERATION MAKE_DDHRESULT(2073) +#define D3DERR_UNSUPPORTEDCOLORARG MAKE_DDHRESULT(2074) +#define D3DERR_UNSUPPORTEDALPHAOPERATION MAKE_DDHRESULT(2075) +#define D3DERR_UNSUPPORTEDALPHAARG MAKE_DDHRESULT(2076) +#define D3DERR_TOOMANYOPERATIONS MAKE_DDHRESULT(2077) +#define D3DERR_CONFLICTINGTEXTUREFILTER MAKE_DDHRESULT(2078) +#define D3DERR_UNSUPPORTEDFACTORVALUE MAKE_DDHRESULT(2079) +#define D3DERR_CONFLICTINGRENDERSTATE MAKE_DDHRESULT(2081) +#define D3DERR_UNSUPPORTEDTEXTUREFILTER MAKE_DDHRESULT(2082) +#define D3DERR_TOOMANYPRIMITIVES MAKE_DDHRESULT(2083) +#define D3DERR_INVALIDMATRIX MAKE_DDHRESULT(2084) +#define D3DERR_TOOMANYVERTICES MAKE_DDHRESULT(2085) +#define D3DERR_CONFLICTINGTEXTUREPALETTE MAKE_DDHRESULT(2086) + +#endif /* DIRECT3D_VERSION >= 0x0600 */ + +#if(DIRECT3D_VERSION >= 0x0700) +#define D3DERR_INVALIDSTATEBLOCK MAKE_DDHRESULT(2100) +#define D3DERR_INBEGINSTATEBLOCK MAKE_DDHRESULT(2101) +#define D3DERR_NOTINBEGINSTATEBLOCK MAKE_DDHRESULT(2102) +#endif /* DIRECT3D_VERSION >= 0x0700 */ + + +#ifdef __cplusplus +}; +#endif + +#endif /* (DIRECT3D_VERSION < 0x0800) */ +#endif /* _D3D_H_ */ + diff --git a/Include/d3dcaps.h b/Include/d3dcaps.h new file mode 100644 index 0000000..6066c7a --- /dev/null +++ b/Include/d3dcaps.h @@ -0,0 +1,601 @@ +/*==========================================================================; + * + * Copyright (C) Microsoft Corporation. All Rights Reserved. + * + * File: d3dcaps.h + * Content: Direct3D capabilities include file + * + ***************************************************************************/ + +#ifndef _D3DCAPS_H +#define _D3DCAPS_H + +/* + * Pull in DirectDraw include file automatically: + */ +#include "ddraw.h" + +#ifndef DIRECT3D_VERSION +#define DIRECT3D_VERSION 0x0700 +#endif + +#if defined(_X86_) || defined(_IA64_) +#pragma pack(4) +#endif + +/* Description of capabilities of transform */ + +typedef struct _D3DTRANSFORMCAPS { + DWORD dwSize; + DWORD dwCaps; +} D3DTRANSFORMCAPS, *LPD3DTRANSFORMCAPS; + +#define D3DTRANSFORMCAPS_CLIP 0x00000001L /* Will clip whilst transforming */ + +/* Description of capabilities of lighting */ + +typedef struct _D3DLIGHTINGCAPS { + DWORD dwSize; + DWORD dwCaps; /* Lighting caps */ + DWORD dwLightingModel; /* Lighting model - RGB or mono */ + DWORD dwNumLights; /* Number of lights that can be handled */ +} D3DLIGHTINGCAPS, *LPD3DLIGHTINGCAPS; + +#define D3DLIGHTINGMODEL_RGB 0x00000001L +#define D3DLIGHTINGMODEL_MONO 0x00000002L + +#define D3DLIGHTCAPS_POINT 0x00000001L /* Point lights supported */ +#define D3DLIGHTCAPS_SPOT 0x00000002L /* Spot lights supported */ +#define D3DLIGHTCAPS_DIRECTIONAL 0x00000004L /* Directional lights supported */ +#if(DIRECT3D_VERSION < 0x700) +#define D3DLIGHTCAPS_PARALLELPOINT 0x00000008L /* Parallel point lights supported */ +#endif +#if(DIRECT3D_VERSION < 0x500) +#define D3DLIGHTCAPS_GLSPOT 0x00000010L /* GL syle spot lights supported */ +#endif + +/* Description of capabilities for each primitive type */ + +typedef struct _D3DPrimCaps { + DWORD dwSize; + DWORD dwMiscCaps; /* Capability flags */ + DWORD dwRasterCaps; + DWORD dwZCmpCaps; + DWORD dwSrcBlendCaps; + DWORD dwDestBlendCaps; + DWORD dwAlphaCmpCaps; + DWORD dwShadeCaps; + DWORD dwTextureCaps; + DWORD dwTextureFilterCaps; + DWORD dwTextureBlendCaps; + DWORD dwTextureAddressCaps; + DWORD dwStippleWidth; /* maximum width and height of */ + DWORD dwStippleHeight; /* of supported stipple (up to 32x32) */ +} D3DPRIMCAPS, *LPD3DPRIMCAPS; + +/* D3DPRIMCAPS dwMiscCaps */ + +#define D3DPMISCCAPS_MASKPLANES 0x00000001L +#define D3DPMISCCAPS_MASKZ 0x00000002L +#define D3DPMISCCAPS_LINEPATTERNREP 0x00000004L +#define D3DPMISCCAPS_CONFORMANT 0x00000008L +#define D3DPMISCCAPS_CULLNONE 0x00000010L +#define D3DPMISCCAPS_CULLCW 0x00000020L +#define D3DPMISCCAPS_CULLCCW 0x00000040L + +/* D3DPRIMCAPS dwRasterCaps */ + +#define D3DPRASTERCAPS_DITHER 0x00000001L +#define D3DPRASTERCAPS_ROP2 0x00000002L +#define D3DPRASTERCAPS_XOR 0x00000004L +#define D3DPRASTERCAPS_PAT 0x00000008L +#define D3DPRASTERCAPS_ZTEST 0x00000010L +#define D3DPRASTERCAPS_SUBPIXEL 0x00000020L +#define D3DPRASTERCAPS_SUBPIXELX 0x00000040L +#define D3DPRASTERCAPS_FOGVERTEX 0x00000080L +#define D3DPRASTERCAPS_FOGTABLE 0x00000100L +#define D3DPRASTERCAPS_STIPPLE 0x00000200L +#if(DIRECT3D_VERSION >= 0x0500) +#define D3DPRASTERCAPS_ANTIALIASSORTDEPENDENT 0x00000400L +#define D3DPRASTERCAPS_ANTIALIASSORTINDEPENDENT 0x00000800L +#define D3DPRASTERCAPS_ANTIALIASEDGES 0x00001000L +#define D3DPRASTERCAPS_MIPMAPLODBIAS 0x00002000L +#define D3DPRASTERCAPS_ZBIAS 0x00004000L +#define D3DPRASTERCAPS_ZBUFFERLESSHSR 0x00008000L +#define D3DPRASTERCAPS_FOGRANGE 0x00010000L +#define D3DPRASTERCAPS_ANISOTROPY 0x00020000L +#endif /* DIRECT3D_VERSION >= 0x0500 */ +#if(DIRECT3D_VERSION >= 0x0600) +#define D3DPRASTERCAPS_WBUFFER 0x00040000L +#define D3DPRASTERCAPS_TRANSLUCENTSORTINDEPENDENT 0x00080000L +#define D3DPRASTERCAPS_WFOG 0x00100000L +#define D3DPRASTERCAPS_ZFOG 0x00200000L +#endif /* DIRECT3D_VERSION >= 0x0600 */ + +/* D3DPRIMCAPS dwZCmpCaps, dwAlphaCmpCaps */ + +#define D3DPCMPCAPS_NEVER 0x00000001L +#define D3DPCMPCAPS_LESS 0x00000002L +#define D3DPCMPCAPS_EQUAL 0x00000004L +#define D3DPCMPCAPS_LESSEQUAL 0x00000008L +#define D3DPCMPCAPS_GREATER 0x00000010L +#define D3DPCMPCAPS_NOTEQUAL 0x00000020L +#define D3DPCMPCAPS_GREATEREQUAL 0x00000040L +#define D3DPCMPCAPS_ALWAYS 0x00000080L + +/* D3DPRIMCAPS dwSourceBlendCaps, dwDestBlendCaps */ + +#define D3DPBLENDCAPS_ZERO 0x00000001L +#define D3DPBLENDCAPS_ONE 0x00000002L +#define D3DPBLENDCAPS_SRCCOLOR 0x00000004L +#define D3DPBLENDCAPS_INVSRCCOLOR 0x00000008L +#define D3DPBLENDCAPS_SRCALPHA 0x00000010L +#define D3DPBLENDCAPS_INVSRCALPHA 0x00000020L +#define D3DPBLENDCAPS_DESTALPHA 0x00000040L +#define D3DPBLENDCAPS_INVDESTALPHA 0x00000080L +#define D3DPBLENDCAPS_DESTCOLOR 0x00000100L +#define D3DPBLENDCAPS_INVDESTCOLOR 0x00000200L +#define D3DPBLENDCAPS_SRCALPHASAT 0x00000400L +#define D3DPBLENDCAPS_BOTHSRCALPHA 0x00000800L +#define D3DPBLENDCAPS_BOTHINVSRCALPHA 0x00001000L + +/* D3DPRIMCAPS dwShadeCaps */ + +#define D3DPSHADECAPS_COLORFLATMONO 0x00000001L +#define D3DPSHADECAPS_COLORFLATRGB 0x00000002L +#define D3DPSHADECAPS_COLORGOURAUDMONO 0x00000004L +#define D3DPSHADECAPS_COLORGOURAUDRGB 0x00000008L +#define D3DPSHADECAPS_COLORPHONGMONO 0x00000010L +#define D3DPSHADECAPS_COLORPHONGRGB 0x00000020L + +#define D3DPSHADECAPS_SPECULARFLATMONO 0x00000040L +#define D3DPSHADECAPS_SPECULARFLATRGB 0x00000080L +#define D3DPSHADECAPS_SPECULARGOURAUDMONO 0x00000100L +#define D3DPSHADECAPS_SPECULARGOURAUDRGB 0x00000200L +#define D3DPSHADECAPS_SPECULARPHONGMONO 0x00000400L +#define D3DPSHADECAPS_SPECULARPHONGRGB 0x00000800L + +#define D3DPSHADECAPS_ALPHAFLATBLEND 0x00001000L +#define D3DPSHADECAPS_ALPHAFLATSTIPPLED 0x00002000L +#define D3DPSHADECAPS_ALPHAGOURAUDBLEND 0x00004000L +#define D3DPSHADECAPS_ALPHAGOURAUDSTIPPLED 0x00008000L +#define D3DPSHADECAPS_ALPHAPHONGBLEND 0x00010000L +#define D3DPSHADECAPS_ALPHAPHONGSTIPPLED 0x00020000L + +#define D3DPSHADECAPS_FOGFLAT 0x00040000L +#define D3DPSHADECAPS_FOGGOURAUD 0x00080000L +#define D3DPSHADECAPS_FOGPHONG 0x00100000L + +/* D3DPRIMCAPS dwTextureCaps */ + +/* + * Perspective-correct texturing is supported + */ +#define D3DPTEXTURECAPS_PERSPECTIVE 0x00000001L + +/* + * Power-of-2 texture dimensions are required + */ +#define D3DPTEXTURECAPS_POW2 0x00000002L + +/* + * Alpha in texture pixels is supported + */ +#define D3DPTEXTURECAPS_ALPHA 0x00000004L + +/* + * Color-keyed textures are supported + */ +#define D3DPTEXTURECAPS_TRANSPARENCY 0x00000008L + +/* + * obsolete, see D3DPTADDRESSCAPS_BORDER + */ +#define D3DPTEXTURECAPS_BORDER 0x00000010L + +/* + * Only square textures are supported + */ +#define D3DPTEXTURECAPS_SQUAREONLY 0x00000020L + +#if(DIRECT3D_VERSION >= 0x0600) +/* + * Texture indices are not scaled by the texture size prior + * to interpolation. + */ +#define D3DPTEXTURECAPS_TEXREPEATNOTSCALEDBYSIZE 0x00000040L + +/* + * Device can draw alpha from texture palettes + */ +#define D3DPTEXTURECAPS_ALPHAPALETTE 0x00000080L + +/* + * Device can use non-POW2 textures if: + * 1) D3DTEXTURE_ADDRESS is set to CLAMP for this texture's stage + * 2) D3DRS_WRAP(N) is zero for this texture's coordinates + * 3) mip mapping is not enabled (use magnification filter only) + */ +#define D3DPTEXTURECAPS_NONPOW2CONDITIONAL 0x00000100L + +#endif /* DIRECT3D_VERSION >= 0x0600 */ +#if(DIRECT3D_VERSION >= 0x0700) + +// 0x00000200L unused + +/* + * Device can divide transformed texture coordinates by the + * COUNTth texture coordinate (can do D3DTTFF_PROJECTED) + */ +#define D3DPTEXTURECAPS_PROJECTED 0x00000400L + +/* + * Device can do cubemap textures + */ +#define D3DPTEXTURECAPS_CUBEMAP 0x00000800L + +#define D3DPTEXTURECAPS_COLORKEYBLEND 0x00001000L +#endif /* DIRECT3D_VERSION >= 0x0700 */ + +/* D3DPRIMCAPS dwTextureFilterCaps */ + +#define D3DPTFILTERCAPS_NEAREST 0x00000001L +#define D3DPTFILTERCAPS_LINEAR 0x00000002L +#define D3DPTFILTERCAPS_MIPNEAREST 0x00000004L +#define D3DPTFILTERCAPS_MIPLINEAR 0x00000008L +#define D3DPTFILTERCAPS_LINEARMIPNEAREST 0x00000010L +#define D3DPTFILTERCAPS_LINEARMIPLINEAR 0x00000020L + +#if(DIRECT3D_VERSION >= 0x0600) +/* Device3 Min Filter */ +#define D3DPTFILTERCAPS_MINFPOINT 0x00000100L +#define D3DPTFILTERCAPS_MINFLINEAR 0x00000200L +#define D3DPTFILTERCAPS_MINFANISOTROPIC 0x00000400L + +/* Device3 Mip Filter */ +#define D3DPTFILTERCAPS_MIPFPOINT 0x00010000L +#define D3DPTFILTERCAPS_MIPFLINEAR 0x00020000L + +/* Device3 Mag Filter */ +#define D3DPTFILTERCAPS_MAGFPOINT 0x01000000L +#define D3DPTFILTERCAPS_MAGFLINEAR 0x02000000L +#define D3DPTFILTERCAPS_MAGFANISOTROPIC 0x04000000L +#define D3DPTFILTERCAPS_MAGFAFLATCUBIC 0x08000000L +#define D3DPTFILTERCAPS_MAGFGAUSSIANCUBIC 0x10000000L +#endif /* DIRECT3D_VERSION >= 0x0600 */ + +/* D3DPRIMCAPS dwTextureBlendCaps */ + +#define D3DPTBLENDCAPS_DECAL 0x00000001L +#define D3DPTBLENDCAPS_MODULATE 0x00000002L +#define D3DPTBLENDCAPS_DECALALPHA 0x00000004L +#define D3DPTBLENDCAPS_MODULATEALPHA 0x00000008L +#define D3DPTBLENDCAPS_DECALMASK 0x00000010L +#define D3DPTBLENDCAPS_MODULATEMASK 0x00000020L +#define D3DPTBLENDCAPS_COPY 0x00000040L +#if(DIRECT3D_VERSION >= 0x0500) +#define D3DPTBLENDCAPS_ADD 0x00000080L +#endif /* DIRECT3D_VERSION >= 0x0500 */ + +/* D3DPRIMCAPS dwTextureAddressCaps */ +#define D3DPTADDRESSCAPS_WRAP 0x00000001L +#define D3DPTADDRESSCAPS_MIRROR 0x00000002L +#define D3DPTADDRESSCAPS_CLAMP 0x00000004L +#if(DIRECT3D_VERSION >= 0x0500) +#define D3DPTADDRESSCAPS_BORDER 0x00000008L +#define D3DPTADDRESSCAPS_INDEPENDENTUV 0x00000010L +#endif /* DIRECT3D_VERSION >= 0x0500 */ + +#if(DIRECT3D_VERSION >= 0x0600) + +/* D3DDEVICEDESC dwStencilCaps */ + +#define D3DSTENCILCAPS_KEEP 0x00000001L +#define D3DSTENCILCAPS_ZERO 0x00000002L +#define D3DSTENCILCAPS_REPLACE 0x00000004L +#define D3DSTENCILCAPS_INCRSAT 0x00000008L +#define D3DSTENCILCAPS_DECRSAT 0x00000010L +#define D3DSTENCILCAPS_INVERT 0x00000020L +#define D3DSTENCILCAPS_INCR 0x00000040L +#define D3DSTENCILCAPS_DECR 0x00000080L + +/* D3DDEVICEDESC dwTextureOpCaps */ + +#define D3DTEXOPCAPS_DISABLE 0x00000001L +#define D3DTEXOPCAPS_SELECTARG1 0x00000002L +#define D3DTEXOPCAPS_SELECTARG2 0x00000004L +#define D3DTEXOPCAPS_MODULATE 0x00000008L +#define D3DTEXOPCAPS_MODULATE2X 0x00000010L +#define D3DTEXOPCAPS_MODULATE4X 0x00000020L +#define D3DTEXOPCAPS_ADD 0x00000040L +#define D3DTEXOPCAPS_ADDSIGNED 0x00000080L +#define D3DTEXOPCAPS_ADDSIGNED2X 0x00000100L +#define D3DTEXOPCAPS_SUBTRACT 0x00000200L +#define D3DTEXOPCAPS_ADDSMOOTH 0x00000400L +#define D3DTEXOPCAPS_BLENDDIFFUSEALPHA 0x00000800L +#define D3DTEXOPCAPS_BLENDTEXTUREALPHA 0x00001000L +#define D3DTEXOPCAPS_BLENDFACTORALPHA 0x00002000L +#define D3DTEXOPCAPS_BLENDTEXTUREALPHAPM 0x00004000L +#define D3DTEXOPCAPS_BLENDCURRENTALPHA 0x00008000L +#define D3DTEXOPCAPS_PREMODULATE 0x00010000L +#define D3DTEXOPCAPS_MODULATEALPHA_ADDCOLOR 0x00020000L +#define D3DTEXOPCAPS_MODULATECOLOR_ADDALPHA 0x00040000L +#define D3DTEXOPCAPS_MODULATEINVALPHA_ADDCOLOR 0x00080000L +#define D3DTEXOPCAPS_MODULATEINVCOLOR_ADDALPHA 0x00100000L +#define D3DTEXOPCAPS_BUMPENVMAP 0x00200000L +#define D3DTEXOPCAPS_BUMPENVMAPLUMINANCE 0x00400000L +#define D3DTEXOPCAPS_DOTPRODUCT3 0x00800000L + +/* D3DDEVICEDESC dwFVFCaps flags */ + +#define D3DFVFCAPS_TEXCOORDCOUNTMASK 0x0000ffffL /* mask for texture coordinate count field */ +#define D3DFVFCAPS_DONOTSTRIPELEMENTS 0x00080000L /* Device prefers that vertex elements not be stripped */ + +#endif /* DIRECT3D_VERSION >= 0x0600 */ + +/* + * Description for a device. + * This is used to describe a device that is to be created or to query + * the current device. + */ +typedef struct _D3DDeviceDesc { + DWORD dwSize; /* Size of D3DDEVICEDESC structure */ + DWORD dwFlags; /* Indicates which fields have valid data */ + D3DCOLORMODEL dcmColorModel; /* Color model of device */ + DWORD dwDevCaps; /* Capabilities of device */ + D3DTRANSFORMCAPS dtcTransformCaps; /* Capabilities of transform */ + BOOL bClipping; /* Device can do 3D clipping */ + D3DLIGHTINGCAPS dlcLightingCaps; /* Capabilities of lighting */ + D3DPRIMCAPS dpcLineCaps; + D3DPRIMCAPS dpcTriCaps; + DWORD dwDeviceRenderBitDepth; /* One of DDBB_8, 16, etc.. */ + DWORD dwDeviceZBufferBitDepth;/* One of DDBD_16, 32, etc.. */ + DWORD dwMaxBufferSize; /* Maximum execute buffer size */ + DWORD dwMaxVertexCount; /* Maximum vertex count */ +#if(DIRECT3D_VERSION >= 0x0500) + // *** New fields for DX5 *** // + + // Width and height caps are 0 for legacy HALs. + DWORD dwMinTextureWidth, dwMinTextureHeight; + DWORD dwMaxTextureWidth, dwMaxTextureHeight; + DWORD dwMinStippleWidth, dwMaxStippleWidth; + DWORD dwMinStippleHeight, dwMaxStippleHeight; +#endif /* DIRECT3D_VERSION >= 0x0500 */ + +#if(DIRECT3D_VERSION >= 0x0600) + // New fields for DX6 + DWORD dwMaxTextureRepeat; + DWORD dwMaxTextureAspectRatio; + DWORD dwMaxAnisotropy; + + // Guard band that the rasterizer can accommodate + // Screen-space vertices inside this space but outside the viewport + // will get clipped properly. + D3DVALUE dvGuardBandLeft; + D3DVALUE dvGuardBandTop; + D3DVALUE dvGuardBandRight; + D3DVALUE dvGuardBandBottom; + + D3DVALUE dvExtentsAdjust; + DWORD dwStencilCaps; + + DWORD dwFVFCaps; + DWORD dwTextureOpCaps; + WORD wMaxTextureBlendStages; + WORD wMaxSimultaneousTextures; +#endif /* DIRECT3D_VERSION >= 0x0600 */ +} D3DDEVICEDESC, *LPD3DDEVICEDESC; + +#if(DIRECT3D_VERSION >= 0x0700) +typedef struct _D3DDeviceDesc7 { + DWORD dwDevCaps; /* Capabilities of device */ + D3DPRIMCAPS dpcLineCaps; + D3DPRIMCAPS dpcTriCaps; + DWORD dwDeviceRenderBitDepth; /* One of DDBB_8, 16, etc.. */ + DWORD dwDeviceZBufferBitDepth;/* One of DDBD_16, 32, etc.. */ + + DWORD dwMinTextureWidth, dwMinTextureHeight; + DWORD dwMaxTextureWidth, dwMaxTextureHeight; + + DWORD dwMaxTextureRepeat; + DWORD dwMaxTextureAspectRatio; + DWORD dwMaxAnisotropy; + + D3DVALUE dvGuardBandLeft; + D3DVALUE dvGuardBandTop; + D3DVALUE dvGuardBandRight; + D3DVALUE dvGuardBandBottom; + + D3DVALUE dvExtentsAdjust; + DWORD dwStencilCaps; + + DWORD dwFVFCaps; + DWORD dwTextureOpCaps; + WORD wMaxTextureBlendStages; + WORD wMaxSimultaneousTextures; + + DWORD dwMaxActiveLights; + D3DVALUE dvMaxVertexW; + GUID deviceGUID; + + WORD wMaxUserClipPlanes; + WORD wMaxVertexBlendMatrices; + + DWORD dwVertexProcessingCaps; + + DWORD dwReserved1; + DWORD dwReserved2; + DWORD dwReserved3; + DWORD dwReserved4; +} D3DDEVICEDESC7, *LPD3DDEVICEDESC7; +#endif /* DIRECT3D_VERSION >= 0x0700 */ + +#define D3DDEVICEDESCSIZE (sizeof(D3DDEVICEDESC)) +#define D3DDEVICEDESC7SIZE (sizeof(D3DDEVICEDESC7)) + +typedef HRESULT (CALLBACK * LPD3DENUMDEVICESCALLBACK)(GUID FAR *lpGuid, LPSTR lpDeviceDescription, LPSTR lpDeviceName, LPD3DDEVICEDESC, LPD3DDEVICEDESC, LPVOID); + +#if(DIRECT3D_VERSION >= 0x0700) +typedef HRESULT (CALLBACK * LPD3DENUMDEVICESCALLBACK7)(LPSTR lpDeviceDescription, LPSTR lpDeviceName, LPD3DDEVICEDESC7, LPVOID); +#endif /* DIRECT3D_VERSION >= 0x0700 */ + +/* D3DDEVICEDESC dwFlags indicating valid fields */ + +#define D3DDD_COLORMODEL 0x00000001L /* dcmColorModel is valid */ +#define D3DDD_DEVCAPS 0x00000002L /* dwDevCaps is valid */ +#define D3DDD_TRANSFORMCAPS 0x00000004L /* dtcTransformCaps is valid */ +#define D3DDD_LIGHTINGCAPS 0x00000008L /* dlcLightingCaps is valid */ +#define D3DDD_BCLIPPING 0x00000010L /* bClipping is valid */ +#define D3DDD_LINECAPS 0x00000020L /* dpcLineCaps is valid */ +#define D3DDD_TRICAPS 0x00000040L /* dpcTriCaps is valid */ +#define D3DDD_DEVICERENDERBITDEPTH 0x00000080L /* dwDeviceRenderBitDepth is valid */ +#define D3DDD_DEVICEZBUFFERBITDEPTH 0x00000100L /* dwDeviceZBufferBitDepth is valid */ +#define D3DDD_MAXBUFFERSIZE 0x00000200L /* dwMaxBufferSize is valid */ +#define D3DDD_MAXVERTEXCOUNT 0x00000400L /* dwMaxVertexCount is valid */ + +/* D3DDEVICEDESC dwDevCaps flags */ + +#define D3DDEVCAPS_FLOATTLVERTEX 0x00000001L /* Device accepts floating point */ + /* for post-transform vertex data */ +#define D3DDEVCAPS_SORTINCREASINGZ 0x00000002L /* Device needs data sorted for increasing Z */ +#define D3DDEVCAPS_SORTDECREASINGZ 0X00000004L /* Device needs data sorted for decreasing Z */ +#define D3DDEVCAPS_SORTEXACT 0x00000008L /* Device needs data sorted exactly */ + +#define D3DDEVCAPS_EXECUTESYSTEMMEMORY 0x00000010L /* Device can use execute buffers from system memory */ +#define D3DDEVCAPS_EXECUTEVIDEOMEMORY 0x00000020L /* Device can use execute buffers from video memory */ +#define D3DDEVCAPS_TLVERTEXSYSTEMMEMORY 0x00000040L /* Device can use TL buffers from system memory */ +#define D3DDEVCAPS_TLVERTEXVIDEOMEMORY 0x00000080L /* Device can use TL buffers from video memory */ +#define D3DDEVCAPS_TEXTURESYSTEMMEMORY 0x00000100L /* Device can texture from system memory */ +#define D3DDEVCAPS_TEXTUREVIDEOMEMORY 0x00000200L /* Device can texture from device memory */ +#if(DIRECT3D_VERSION >= 0x0500) +#define D3DDEVCAPS_DRAWPRIMTLVERTEX 0x00000400L /* Device can draw TLVERTEX primitives */ +#define D3DDEVCAPS_CANRENDERAFTERFLIP 0x00000800L /* Device can render without waiting for flip to complete */ +#define D3DDEVCAPS_TEXTURENONLOCALVIDMEM 0x00001000L /* Device can texture from nonlocal video memory */ +#endif /* DIRECT3D_VERSION >= 0x0500 */ +#if(DIRECT3D_VERSION >= 0x0600) +#define D3DDEVCAPS_DRAWPRIMITIVES2 0x00002000L /* Device can support DrawPrimitives2 */ +#define D3DDEVCAPS_SEPARATETEXTUREMEMORIES 0x00004000L /* Device is texturing from separate memory pools */ +#define D3DDEVCAPS_DRAWPRIMITIVES2EX 0x00008000L /* Device can support Extended DrawPrimitives2 i.e. DX7 compliant driver*/ +#endif /* DIRECT3D_VERSION >= 0x0600 */ +#if(DIRECT3D_VERSION >= 0x0700) +#define D3DDEVCAPS_HWTRANSFORMANDLIGHT 0x00010000L /* Device can support transformation and lighting in hardware and DRAWPRIMITIVES2EX must be also */ +#define D3DDEVCAPS_CANBLTSYSTONONLOCAL 0x00020000L /* Device supports a Tex Blt from system memory to non-local vidmem */ +#define D3DDEVCAPS_HWRASTERIZATION 0x00080000L /* Device has HW acceleration for rasterization */ + +/* + * These are the flags in the D3DDEVICEDESC7.dwVertexProcessingCaps field + */ + +/* device can do texgen */ +#define D3DVTXPCAPS_TEXGEN 0x00000001L +/* device can do IDirect3DDevice7 colormaterialsource ops */ +#define D3DVTXPCAPS_MATERIALSOURCE7 0x00000002L +/* device can do vertex fog */ +#define D3DVTXPCAPS_VERTEXFOG 0x00000004L +/* device can do directional lights */ +#define D3DVTXPCAPS_DIRECTIONALLIGHTS 0x00000008L +/* device can do positional lights (includes point and spot) */ +#define D3DVTXPCAPS_POSITIONALLIGHTS 0x00000010L +/* device can do local viewer */ +#define D3DVTXPCAPS_LOCALVIEWER 0x00000020L + +#endif /* DIRECT3D_VERSION >= 0x0700 */ + +#define D3DFDS_COLORMODEL 0x00000001L /* Match color model */ +#define D3DFDS_GUID 0x00000002L /* Match guid */ +#define D3DFDS_HARDWARE 0x00000004L /* Match hardware/software */ +#define D3DFDS_TRIANGLES 0x00000008L /* Match in triCaps */ +#define D3DFDS_LINES 0x00000010L /* Match in lineCaps */ +#define D3DFDS_MISCCAPS 0x00000020L /* Match primCaps.dwMiscCaps */ +#define D3DFDS_RASTERCAPS 0x00000040L /* Match primCaps.dwRasterCaps */ +#define D3DFDS_ZCMPCAPS 0x00000080L /* Match primCaps.dwZCmpCaps */ +#define D3DFDS_ALPHACMPCAPS 0x00000100L /* Match primCaps.dwAlphaCmpCaps */ +#define D3DFDS_SRCBLENDCAPS 0x00000200L /* Match primCaps.dwSourceBlendCaps */ +#define D3DFDS_DSTBLENDCAPS 0x00000400L /* Match primCaps.dwDestBlendCaps */ +#define D3DFDS_SHADECAPS 0x00000800L /* Match primCaps.dwShadeCaps */ +#define D3DFDS_TEXTURECAPS 0x00001000L /* Match primCaps.dwTextureCaps */ +#define D3DFDS_TEXTUREFILTERCAPS 0x00002000L /* Match primCaps.dwTextureFilterCaps */ +#define D3DFDS_TEXTUREBLENDCAPS 0x00004000L /* Match primCaps.dwTextureBlendCaps */ +#define D3DFDS_TEXTUREADDRESSCAPS 0x00008000L /* Match primCaps.dwTextureBlendCaps */ + +/* + * FindDevice arguments + */ +typedef struct _D3DFINDDEVICESEARCH { + DWORD dwSize; + DWORD dwFlags; + BOOL bHardware; + D3DCOLORMODEL dcmColorModel; + GUID guid; + DWORD dwCaps; + D3DPRIMCAPS dpcPrimCaps; +} D3DFINDDEVICESEARCH, *LPD3DFINDDEVICESEARCH; + +typedef struct _D3DFINDDEVICERESULT { + DWORD dwSize; + GUID guid; /* guid which matched */ + D3DDEVICEDESC ddHwDesc; /* hardware D3DDEVICEDESC */ + D3DDEVICEDESC ddSwDesc; /* software D3DDEVICEDESC */ +} D3DFINDDEVICERESULT, *LPD3DFINDDEVICERESULT; + +/* + * Description of execute buffer. + */ +typedef struct _D3DExecuteBufferDesc { + DWORD dwSize; /* size of this structure */ + DWORD dwFlags; /* flags indicating which fields are valid */ + DWORD dwCaps; /* capabilities of execute buffer */ + DWORD dwBufferSize; /* size of execute buffer data */ + LPVOID lpData; /* pointer to actual data */ +} D3DEXECUTEBUFFERDESC, *LPD3DEXECUTEBUFFERDESC; + +/* D3DEXECUTEBUFFER dwFlags indicating valid fields */ + +#define D3DDEB_BUFSIZE 0x00000001l /* buffer size valid */ +#define D3DDEB_CAPS 0x00000002l /* caps valid */ +#define D3DDEB_LPDATA 0x00000004l /* lpData valid */ + +/* D3DEXECUTEBUFFER dwCaps */ + +#define D3DDEBCAPS_SYSTEMMEMORY 0x00000001l /* buffer in system memory */ +#define D3DDEBCAPS_VIDEOMEMORY 0x00000002l /* buffer in device memory */ +#define D3DDEBCAPS_MEM (D3DDEBCAPS_SYSTEMMEMORY|D3DDEBCAPS_VIDEOMEMORY) + +#if(DIRECT3D_VERSION < 0x0800) + +#if(DIRECT3D_VERSION >= 0x0700) +typedef struct _D3DDEVINFO_TEXTUREMANAGER { + BOOL bThrashing; /* indicates if thrashing */ + DWORD dwApproxBytesDownloaded; /* Approximate number of bytes downloaded by texture manager */ + DWORD dwNumEvicts; /* number of textures evicted */ + DWORD dwNumVidCreates; /* number of textures created in video memory */ + DWORD dwNumTexturesUsed; /* number of textures used */ + DWORD dwNumUsedTexInVid; /* number of used textures present in video memory */ + DWORD dwWorkingSet; /* number of textures in video memory */ + DWORD dwWorkingSetBytes; /* number of bytes in video memory */ + DWORD dwTotalManaged; /* total number of managed textures */ + DWORD dwTotalBytes; /* total number of bytes of managed textures */ + DWORD dwLastPri; /* priority of last texture evicted */ +} D3DDEVINFO_TEXTUREMANAGER, *LPD3DDEVINFO_TEXTUREMANAGER; + +typedef struct _D3DDEVINFO_TEXTURING { + DWORD dwNumLoads; /* counts Load() API calls */ + DWORD dwApproxBytesLoaded; /* Approximate number bytes loaded via Load() */ + DWORD dwNumPreLoads; /* counts PreLoad() API calls */ + DWORD dwNumSet; /* counts SetTexture() API calls */ + DWORD dwNumCreates; /* counts texture creates */ + DWORD dwNumDestroys; /* counts texture destroys */ + DWORD dwNumSetPriorities; /* counts SetPriority() API calls */ + DWORD dwNumSetLODs; /* counts SetLOD() API calls */ + DWORD dwNumLocks; /* counts number of texture locks */ + DWORD dwNumGetDCs; /* counts number of GetDCs to textures */ +} D3DDEVINFO_TEXTURING, *LPD3DDEVINFO_TEXTURING; +#endif /* DIRECT3D_VERSION >= 0x0700 */ + +#endif //(DIRECT3D_VERSION < 0x0800) + +#pragma pack() + + +#endif /* _D3DCAPS_H_ */ + diff --git a/Include/d3dtypes.h b/Include/d3dtypes.h new file mode 100644 index 0000000..7949041 --- /dev/null +++ b/Include/d3dtypes.h @@ -0,0 +1,2119 @@ +/*==========================================================================; + * + * Copyright (C) Microsoft Corporation. All Rights Reserved. + * + * File: d3dtypes.h + * Content: Direct3D types include file + * + ***************************************************************************/ + +#ifndef _D3DTYPES_H_ +#define _D3DTYPES_H_ + +#ifndef DIRECT3D_VERSION +#define DIRECT3D_VERSION 0x0700 +#endif + +#if (DIRECT3D_VERSION >= 0x0800) +#pragma message("should not include d3dtypes.h when compiling for DX8 or newer interfaces") +#endif + +#include + +#include +#include "ddraw.h" + +#pragma warning(disable:4201) // anonymous unions warning +#if defined(_X86_) || defined(_IA64_) +#pragma pack(4) +#endif + + +/* D3DVALUE is the fundamental Direct3D fractional data type */ + +#define D3DVALP(val, prec) ((float)(val)) +#define D3DVAL(val) ((float)(val)) + +#ifndef DX_SHARED_DEFINES + +/* + * This definition is shared with other DirectX components whose header files + * might already have defined it. Therefore, we don't define this type if + * someone else already has (as indicated by the definition of + * DX_SHARED_DEFINES). We don't set DX_SHARED_DEFINES here as there are + * other types in this header that are also shared. The last of these + * shared defines in this file will set DX_SHARED_DEFINES. + */ +typedef float D3DVALUE, *LPD3DVALUE; + +#endif /* DX_SHARED_DEFINES */ + +#define D3DDivide(a, b) (float)((double) (a) / (double) (b)) +#define D3DMultiply(a, b) ((a) * (b)) + +typedef LONG D3DFIXED; + +#ifndef RGB_MAKE +/* + * Format of CI colors is + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * | alpha | color index | fraction | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + */ +#define CI_GETALPHA(ci) ((ci) >> 24) +#define CI_GETINDEX(ci) (((ci) >> 8) & 0xffff) +#define CI_GETFRACTION(ci) ((ci) & 0xff) +#define CI_ROUNDINDEX(ci) CI_GETINDEX((ci) + 0x80) +#define CI_MASKALPHA(ci) ((ci) & 0xffffff) +#define CI_MAKE(a, i, f) (((a) << 24) | ((i) << 8) | (f)) + +/* + * Format of RGBA colors is + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * | alpha | red | green | blue | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + */ +#define RGBA_GETALPHA(rgb) ((rgb) >> 24) +#define RGBA_GETRED(rgb) (((rgb) >> 16) & 0xff) +#define RGBA_GETGREEN(rgb) (((rgb) >> 8) & 0xff) +#define RGBA_GETBLUE(rgb) ((rgb) & 0xff) +#define RGBA_MAKE(r, g, b, a) ((D3DCOLOR) (((a) << 24) | ((r) << 16) | ((g) << 8) | (b))) + +/* D3DRGB and D3DRGBA may be used as initialisers for D3DCOLORs + * The float values must be in the range 0..1 + */ +#define D3DRGB(r, g, b) \ + (0xff000000L | ( ((long)((r) * 255)) << 16) | (((long)((g) * 255)) << 8) | (long)((b) * 255)) +#define D3DRGBA(r, g, b, a) \ + ( (((long)((a) * 255)) << 24) | (((long)((r) * 255)) << 16) \ + | (((long)((g) * 255)) << 8) | (long)((b) * 255) \ + ) + +/* + * Format of RGB colors is + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * | ignored | red | green | blue | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + */ +#define RGB_GETRED(rgb) (((rgb) >> 16) & 0xff) +#define RGB_GETGREEN(rgb) (((rgb) >> 8) & 0xff) +#define RGB_GETBLUE(rgb) ((rgb) & 0xff) +#define RGBA_SETALPHA(rgba, x) (((x) << 24) | ((rgba) & 0x00ffffff)) +#define RGB_MAKE(r, g, b) ((D3DCOLOR) (((r) << 16) | ((g) << 8) | (b))) +#define RGBA_TORGB(rgba) ((D3DCOLOR) ((rgba) & 0xffffff)) +#define RGB_TORGBA(rgb) ((D3DCOLOR) ((rgb) | 0xff000000)) + +#endif + +/* + * Flags for Enumerate functions + */ + +/* + * Stop the enumeration + */ +#define D3DENUMRET_CANCEL DDENUMRET_CANCEL + +/* + * Continue the enumeration + */ +#define D3DENUMRET_OK DDENUMRET_OK + +typedef HRESULT (CALLBACK* LPD3DVALIDATECALLBACK)(LPVOID lpUserArg, DWORD dwOffset); +typedef HRESULT (CALLBACK* LPD3DENUMTEXTUREFORMATSCALLBACK)(LPDDSURFACEDESC lpDdsd, LPVOID lpContext); +typedef HRESULT (CALLBACK* LPD3DENUMPIXELFORMATSCALLBACK)(LPDDPIXELFORMAT lpDDPixFmt, LPVOID lpContext); + +#ifndef DX_SHARED_DEFINES + +/* + * This definition is shared with other DirectX components whose header files + * might already have defined it. Therefore, we don't define this type if + * someone else already has (as indicated by the definition of + * DX_SHARED_DEFINES). We don't set DX_SHARED_DEFINES here as there are + * other types in this header that are also shared. The last of these + * shared defines in this file will set DX_SHARED_DEFINES. + */ +#ifndef D3DCOLOR_DEFINED +typedef DWORD D3DCOLOR; +#define D3DCOLOR_DEFINED +#endif +typedef DWORD *LPD3DCOLOR; + +#endif /* DX_SHARED_DEFINES */ + +typedef DWORD D3DMATERIALHANDLE, *LPD3DMATERIALHANDLE; +typedef DWORD D3DTEXTUREHANDLE, *LPD3DTEXTUREHANDLE; +typedef DWORD D3DMATRIXHANDLE, *LPD3DMATRIXHANDLE; + +#ifndef D3DCOLORVALUE_DEFINED +typedef struct _D3DCOLORVALUE { + union { + D3DVALUE r; + D3DVALUE dvR; + }; + union { + D3DVALUE g; + D3DVALUE dvG; + }; + union { + D3DVALUE b; + D3DVALUE dvB; + }; + union { + D3DVALUE a; + D3DVALUE dvA; + }; +} D3DCOLORVALUE; +#define D3DCOLORVALUE_DEFINED +#endif +typedef struct _D3DCOLORVALUE *LPD3DCOLORVALUE; + +#ifndef D3DRECT_DEFINED +typedef struct _D3DRECT { + union { + LONG x1; + LONG lX1; + }; + union { + LONG y1; + LONG lY1; + }; + union { + LONG x2; + LONG lX2; + }; + union { + LONG y2; + LONG lY2; + }; +} D3DRECT; +#define D3DRECT_DEFINED +#endif +typedef struct _D3DRECT *LPD3DRECT; + +#ifndef DX_SHARED_DEFINES + +/* + * This definition is shared with other DirectX components whose header files + * might already have defined it. Therefore, we don't define this type if + * someone else already has (as indicated by the definition of + * DX_SHARED_DEFINES). + */ + +#ifndef D3DVECTOR_DEFINED +typedef struct _D3DVECTOR { + union { + D3DVALUE x; + D3DVALUE dvX; + }; + union { + D3DVALUE y; + D3DVALUE dvY; + }; + union { + D3DVALUE z; + D3DVALUE dvZ; + }; +#if(DIRECT3D_VERSION >= 0x0500) +#if (defined __cplusplus) && (defined D3D_OVERLOADS) + +public: + + // ===================================== + // Constructors + // ===================================== + + _D3DVECTOR() { } + _D3DVECTOR(D3DVALUE f); + _D3DVECTOR(D3DVALUE _x, D3DVALUE _y, D3DVALUE _z); + _D3DVECTOR(const D3DVALUE f[3]); + + // ===================================== + // Access grants + // ===================================== + + const D3DVALUE&operator[](int i) const; + D3DVALUE&operator[](int i); + + // ===================================== + // Assignment operators + // ===================================== + + _D3DVECTOR& operator += (const _D3DVECTOR& v); + _D3DVECTOR& operator -= (const _D3DVECTOR& v); + _D3DVECTOR& operator *= (const _D3DVECTOR& v); + _D3DVECTOR& operator /= (const _D3DVECTOR& v); + _D3DVECTOR& operator *= (D3DVALUE s); + _D3DVECTOR& operator /= (D3DVALUE s); + + // ===================================== + // Unary operators + // ===================================== + + friend _D3DVECTOR operator + (const _D3DVECTOR& v); + friend _D3DVECTOR operator - (const _D3DVECTOR& v); + + + // ===================================== + // Binary operators + // ===================================== + + // Addition and subtraction + friend _D3DVECTOR operator + (const _D3DVECTOR& v1, const _D3DVECTOR& v2); + friend _D3DVECTOR operator - (const _D3DVECTOR& v1, const _D3DVECTOR& v2); + // Scalar multiplication and division + friend _D3DVECTOR operator * (const _D3DVECTOR& v, D3DVALUE s); + friend _D3DVECTOR operator * (D3DVALUE s, const _D3DVECTOR& v); + friend _D3DVECTOR operator / (const _D3DVECTOR& v, D3DVALUE s); + // Memberwise multiplication and division + friend _D3DVECTOR operator * (const _D3DVECTOR& v1, const _D3DVECTOR& v2); + friend _D3DVECTOR operator / (const _D3DVECTOR& v1, const _D3DVECTOR& v2); + + // Vector dominance + friend int operator < (const _D3DVECTOR& v1, const _D3DVECTOR& v2); + friend int operator <= (const _D3DVECTOR& v1, const _D3DVECTOR& v2); + + // Bitwise equality + friend int operator == (const _D3DVECTOR& v1, const _D3DVECTOR& v2); + + // Length-related functions + friend D3DVALUE SquareMagnitude (const _D3DVECTOR& v); + friend D3DVALUE Magnitude (const _D3DVECTOR& v); + + // Returns vector with same direction and unit length + friend _D3DVECTOR Normalize (const _D3DVECTOR& v); + + // Return min/max component of the input vector + friend D3DVALUE Min (const _D3DVECTOR& v); + friend D3DVALUE Max (const _D3DVECTOR& v); + + // Return memberwise min/max of input vectors + friend _D3DVECTOR Minimize (const _D3DVECTOR& v1, const _D3DVECTOR& v2); + friend _D3DVECTOR Maximize (const _D3DVECTOR& v1, const _D3DVECTOR& v2); + + // Dot and cross product + friend D3DVALUE DotProduct (const _D3DVECTOR& v1, const _D3DVECTOR& v2); + friend _D3DVECTOR CrossProduct (const _D3DVECTOR& v1, const _D3DVECTOR& v2); + +#endif +#endif /* DIRECT3D_VERSION >= 0x0500 */ +} D3DVECTOR; +#define D3DVECTOR_DEFINED +#endif +typedef struct _D3DVECTOR *LPD3DVECTOR; + +/* + * As this is the last of the shared defines to be defined we now set + * D3D_SHARED_DEFINES to flag that fact that this header has defined these + * types. + */ +#define DX_SHARED_DEFINES + +#endif /* DX_SHARED_DEFINES */ + +/* + * Vertex data types supported in an ExecuteBuffer. + */ + +/* + * Homogeneous vertices + */ + +typedef struct _D3DHVERTEX { + DWORD dwFlags; /* Homogeneous clipping flags */ + union { + D3DVALUE hx; + D3DVALUE dvHX; + }; + union { + D3DVALUE hy; + D3DVALUE dvHY; + }; + union { + D3DVALUE hz; + D3DVALUE dvHZ; + }; +} D3DHVERTEX, *LPD3DHVERTEX; + +/* + * Transformed/lit vertices + */ +typedef struct _D3DTLVERTEX { + union { + D3DVALUE sx; /* Screen coordinates */ + D3DVALUE dvSX; + }; + union { + D3DVALUE sy; + D3DVALUE dvSY; + }; + union { + D3DVALUE sz; + D3DVALUE dvSZ; + }; + union { + D3DVALUE rhw; /* Reciprocal of homogeneous w */ + D3DVALUE dvRHW; + }; + union { + D3DCOLOR color; /* Vertex color */ + D3DCOLOR dcColor; + }; + union { + D3DCOLOR specular; /* Specular component of vertex */ + D3DCOLOR dcSpecular; + }; + union { + D3DVALUE tu; /* Texture coordinates */ + D3DVALUE dvTU; + }; + union { + D3DVALUE tv; + D3DVALUE dvTV; + }; +#if(DIRECT3D_VERSION >= 0x0500) +#if (defined __cplusplus) && (defined D3D_OVERLOADS) + _D3DTLVERTEX() { } + _D3DTLVERTEX(const D3DVECTOR& v, float _rhw, + D3DCOLOR _color, D3DCOLOR _specular, + float _tu, float _tv) + { sx = v.x; sy = v.y; sz = v.z; rhw = _rhw; + color = _color; specular = _specular; + tu = _tu; tv = _tv; + } +#endif +#endif /* DIRECT3D_VERSION >= 0x0500 */ +} D3DTLVERTEX, *LPD3DTLVERTEX; + +/* + * Untransformed/lit vertices + */ +typedef struct _D3DLVERTEX { + union { + D3DVALUE x; /* Homogeneous coordinates */ + D3DVALUE dvX; + }; + union { + D3DVALUE y; + D3DVALUE dvY; + }; + union { + D3DVALUE z; + D3DVALUE dvZ; + }; + DWORD dwReserved; + union { + D3DCOLOR color; /* Vertex color */ + D3DCOLOR dcColor; + }; + union { + D3DCOLOR specular; /* Specular component of vertex */ + D3DCOLOR dcSpecular; + }; + union { + D3DVALUE tu; /* Texture coordinates */ + D3DVALUE dvTU; + }; + union { + D3DVALUE tv; + D3DVALUE dvTV; + }; +#if(DIRECT3D_VERSION >= 0x0500) +#if (defined __cplusplus) && (defined D3D_OVERLOADS) + _D3DLVERTEX() { } + _D3DLVERTEX(const D3DVECTOR& v, + D3DCOLOR _color, D3DCOLOR _specular, + float _tu, float _tv) + { x = v.x; y = v.y; z = v.z; dwReserved = 0; + color = _color; specular = _specular; + tu = _tu; tv = _tv; + } +#endif +#endif /* DIRECT3D_VERSION >= 0x0500 */ +} D3DLVERTEX, *LPD3DLVERTEX; + +/* + * Untransformed/unlit vertices + */ + +typedef struct _D3DVERTEX { + union { + D3DVALUE x; /* Homogeneous coordinates */ + D3DVALUE dvX; + }; + union { + D3DVALUE y; + D3DVALUE dvY; + }; + union { + D3DVALUE z; + D3DVALUE dvZ; + }; + union { + D3DVALUE nx; /* Normal */ + D3DVALUE dvNX; + }; + union { + D3DVALUE ny; + D3DVALUE dvNY; + }; + union { + D3DVALUE nz; + D3DVALUE dvNZ; + }; + union { + D3DVALUE tu; /* Texture coordinates */ + D3DVALUE dvTU; + }; + union { + D3DVALUE tv; + D3DVALUE dvTV; + }; +#if(DIRECT3D_VERSION >= 0x0500) +#if (defined __cplusplus) && (defined D3D_OVERLOADS) + _D3DVERTEX() { } + _D3DVERTEX(const D3DVECTOR& v, const D3DVECTOR& n, float _tu, float _tv) + { x = v.x; y = v.y; z = v.z; + nx = n.x; ny = n.y; nz = n.z; + tu = _tu; tv = _tv; + } +#endif +#endif /* DIRECT3D_VERSION >= 0x0500 */ +} D3DVERTEX, *LPD3DVERTEX; + + +/* + * Matrix, viewport, and tranformation structures and definitions. + */ + +#ifndef D3DMATRIX_DEFINED +typedef struct _D3DMATRIX { +#if(DIRECT3D_VERSION >= 0x0500) +#if (defined __cplusplus) && (defined D3D_OVERLOADS) + union { + struct { +#endif + +#endif /* DIRECT3D_VERSION >= 0x0500 */ + D3DVALUE _11, _12, _13, _14; + D3DVALUE _21, _22, _23, _24; + D3DVALUE _31, _32, _33, _34; + D3DVALUE _41, _42, _43, _44; + +#if(DIRECT3D_VERSION >= 0x0500) +#if (defined __cplusplus) && (defined D3D_OVERLOADS) + }; + D3DVALUE m[4][4]; + }; + _D3DMATRIX() { } + _D3DMATRIX( D3DVALUE _m00, D3DVALUE _m01, D3DVALUE _m02, D3DVALUE _m03, + D3DVALUE _m10, D3DVALUE _m11, D3DVALUE _m12, D3DVALUE _m13, + D3DVALUE _m20, D3DVALUE _m21, D3DVALUE _m22, D3DVALUE _m23, + D3DVALUE _m30, D3DVALUE _m31, D3DVALUE _m32, D3DVALUE _m33 + ) + { + m[0][0] = _m00; m[0][1] = _m01; m[0][2] = _m02; m[0][3] = _m03; + m[1][0] = _m10; m[1][1] = _m11; m[1][2] = _m12; m[1][3] = _m13; + m[2][0] = _m20; m[2][1] = _m21; m[2][2] = _m22; m[2][3] = _m23; + m[3][0] = _m30; m[3][1] = _m31; m[3][2] = _m32; m[3][3] = _m33; + } + + D3DVALUE& operator()(int iRow, int iColumn) { return m[iRow][iColumn]; } + const D3DVALUE& operator()(int iRow, int iColumn) const { return m[iRow][iColumn]; } +#if(DIRECT3D_VERSION >= 0x0600) + friend _D3DMATRIX operator* (const _D3DMATRIX&, const _D3DMATRIX&); +#endif /* DIRECT3D_VERSION >= 0x0600 */ +#endif +#endif /* DIRECT3D_VERSION >= 0x0500 */ +} D3DMATRIX; +#define D3DMATRIX_DEFINED +#endif +typedef struct _D3DMATRIX *LPD3DMATRIX; + +#if (defined __cplusplus) && (defined D3D_OVERLOADS) +#include "d3dvec.inl" +#endif + +typedef struct _D3DVIEWPORT { + DWORD dwSize; + DWORD dwX; + DWORD dwY; /* Top left */ + DWORD dwWidth; + DWORD dwHeight; /* Dimensions */ + D3DVALUE dvScaleX; /* Scale homogeneous to screen */ + D3DVALUE dvScaleY; /* Scale homogeneous to screen */ + D3DVALUE dvMaxX; /* Min/max homogeneous x coord */ + D3DVALUE dvMaxY; /* Min/max homogeneous y coord */ + D3DVALUE dvMinZ; + D3DVALUE dvMaxZ; /* Min/max homogeneous z coord */ +} D3DVIEWPORT, *LPD3DVIEWPORT; + +#if(DIRECT3D_VERSION >= 0x0500) +typedef struct _D3DVIEWPORT2 { + DWORD dwSize; + DWORD dwX; + DWORD dwY; /* Viewport Top left */ + DWORD dwWidth; + DWORD dwHeight; /* Viewport Dimensions */ + D3DVALUE dvClipX; /* Top left of clip volume */ + D3DVALUE dvClipY; + D3DVALUE dvClipWidth; /* Clip Volume Dimensions */ + D3DVALUE dvClipHeight; + D3DVALUE dvMinZ; /* Min/max of clip Volume */ + D3DVALUE dvMaxZ; +} D3DVIEWPORT2, *LPD3DVIEWPORT2; +#endif /* DIRECT3D_VERSION >= 0x0500 */ + +#if(DIRECT3D_VERSION >= 0x0700) +typedef struct _D3DVIEWPORT7 { + DWORD dwX; + DWORD dwY; /* Viewport Top left */ + DWORD dwWidth; + DWORD dwHeight; /* Viewport Dimensions */ + D3DVALUE dvMinZ; /* Min/max of clip Volume */ + D3DVALUE dvMaxZ; +} D3DVIEWPORT7, *LPD3DVIEWPORT7; +#endif /* DIRECT3D_VERSION >= 0x0700 */ + +/* + * Values for clip fields. + */ + +#if(DIRECT3D_VERSION >= 0x0700) + +// Max number of user clipping planes, supported in D3D. +#define D3DMAXUSERCLIPPLANES 32 + +// These bits could be ORed together to use with D3DRENDERSTATE_CLIPPLANEENABLE +// +#define D3DCLIPPLANE0 (1 << 0) +#define D3DCLIPPLANE1 (1 << 1) +#define D3DCLIPPLANE2 (1 << 2) +#define D3DCLIPPLANE3 (1 << 3) +#define D3DCLIPPLANE4 (1 << 4) +#define D3DCLIPPLANE5 (1 << 5) + +#endif /* DIRECT3D_VERSION >= 0x0700 */ + +#define D3DCLIP_LEFT 0x00000001L +#define D3DCLIP_RIGHT 0x00000002L +#define D3DCLIP_TOP 0x00000004L +#define D3DCLIP_BOTTOM 0x00000008L +#define D3DCLIP_FRONT 0x00000010L +#define D3DCLIP_BACK 0x00000020L +#define D3DCLIP_GEN0 0x00000040L +#define D3DCLIP_GEN1 0x00000080L +#define D3DCLIP_GEN2 0x00000100L +#define D3DCLIP_GEN3 0x00000200L +#define D3DCLIP_GEN4 0x00000400L +#define D3DCLIP_GEN5 0x00000800L + +/* + * Values for d3d status. + */ +#define D3DSTATUS_CLIPUNIONLEFT D3DCLIP_LEFT +#define D3DSTATUS_CLIPUNIONRIGHT D3DCLIP_RIGHT +#define D3DSTATUS_CLIPUNIONTOP D3DCLIP_TOP +#define D3DSTATUS_CLIPUNIONBOTTOM D3DCLIP_BOTTOM +#define D3DSTATUS_CLIPUNIONFRONT D3DCLIP_FRONT +#define D3DSTATUS_CLIPUNIONBACK D3DCLIP_BACK +#define D3DSTATUS_CLIPUNIONGEN0 D3DCLIP_GEN0 +#define D3DSTATUS_CLIPUNIONGEN1 D3DCLIP_GEN1 +#define D3DSTATUS_CLIPUNIONGEN2 D3DCLIP_GEN2 +#define D3DSTATUS_CLIPUNIONGEN3 D3DCLIP_GEN3 +#define D3DSTATUS_CLIPUNIONGEN4 D3DCLIP_GEN4 +#define D3DSTATUS_CLIPUNIONGEN5 D3DCLIP_GEN5 + +#define D3DSTATUS_CLIPINTERSECTIONLEFT 0x00001000L +#define D3DSTATUS_CLIPINTERSECTIONRIGHT 0x00002000L +#define D3DSTATUS_CLIPINTERSECTIONTOP 0x00004000L +#define D3DSTATUS_CLIPINTERSECTIONBOTTOM 0x00008000L +#define D3DSTATUS_CLIPINTERSECTIONFRONT 0x00010000L +#define D3DSTATUS_CLIPINTERSECTIONBACK 0x00020000L +#define D3DSTATUS_CLIPINTERSECTIONGEN0 0x00040000L +#define D3DSTATUS_CLIPINTERSECTIONGEN1 0x00080000L +#define D3DSTATUS_CLIPINTERSECTIONGEN2 0x00100000L +#define D3DSTATUS_CLIPINTERSECTIONGEN3 0x00200000L +#define D3DSTATUS_CLIPINTERSECTIONGEN4 0x00400000L +#define D3DSTATUS_CLIPINTERSECTIONGEN5 0x00800000L +#define D3DSTATUS_ZNOTVISIBLE 0x01000000L +/* Do not use 0x80000000 for any status flags in future as it is reserved */ + +#define D3DSTATUS_CLIPUNIONALL ( \ + D3DSTATUS_CLIPUNIONLEFT | \ + D3DSTATUS_CLIPUNIONRIGHT | \ + D3DSTATUS_CLIPUNIONTOP | \ + D3DSTATUS_CLIPUNIONBOTTOM | \ + D3DSTATUS_CLIPUNIONFRONT | \ + D3DSTATUS_CLIPUNIONBACK | \ + D3DSTATUS_CLIPUNIONGEN0 | \ + D3DSTATUS_CLIPUNIONGEN1 | \ + D3DSTATUS_CLIPUNIONGEN2 | \ + D3DSTATUS_CLIPUNIONGEN3 | \ + D3DSTATUS_CLIPUNIONGEN4 | \ + D3DSTATUS_CLIPUNIONGEN5 \ + ) + +#define D3DSTATUS_CLIPINTERSECTIONALL ( \ + D3DSTATUS_CLIPINTERSECTIONLEFT | \ + D3DSTATUS_CLIPINTERSECTIONRIGHT | \ + D3DSTATUS_CLIPINTERSECTIONTOP | \ + D3DSTATUS_CLIPINTERSECTIONBOTTOM | \ + D3DSTATUS_CLIPINTERSECTIONFRONT | \ + D3DSTATUS_CLIPINTERSECTIONBACK | \ + D3DSTATUS_CLIPINTERSECTIONGEN0 | \ + D3DSTATUS_CLIPINTERSECTIONGEN1 | \ + D3DSTATUS_CLIPINTERSECTIONGEN2 | \ + D3DSTATUS_CLIPINTERSECTIONGEN3 | \ + D3DSTATUS_CLIPINTERSECTIONGEN4 | \ + D3DSTATUS_CLIPINTERSECTIONGEN5 \ + ) + +#define D3DSTATUS_DEFAULT ( \ + D3DSTATUS_CLIPINTERSECTIONALL | \ + D3DSTATUS_ZNOTVISIBLE) + + +/* + * Options for direct transform calls + */ +#define D3DTRANSFORM_CLIPPED 0x00000001l +#define D3DTRANSFORM_UNCLIPPED 0x00000002l + +typedef struct _D3DTRANSFORMDATA { + DWORD dwSize; + LPVOID lpIn; /* Input vertices */ + DWORD dwInSize; /* Stride of input vertices */ + LPVOID lpOut; /* Output vertices */ + DWORD dwOutSize; /* Stride of output vertices */ + LPD3DHVERTEX lpHOut; /* Output homogeneous vertices */ + DWORD dwClip; /* Clipping hint */ + DWORD dwClipIntersection; + DWORD dwClipUnion; /* Union of all clip flags */ + D3DRECT drExtent; /* Extent of transformed vertices */ +} D3DTRANSFORMDATA, *LPD3DTRANSFORMDATA; + +/* + * Structure defining position and direction properties for lighting. + */ +typedef struct _D3DLIGHTINGELEMENT { + D3DVECTOR dvPosition; /* Lightable point in model space */ + D3DVECTOR dvNormal; /* Normalised unit vector */ +} D3DLIGHTINGELEMENT, *LPD3DLIGHTINGELEMENT; + +/* + * Structure defining material properties for lighting. + */ +typedef struct _D3DMATERIAL { + DWORD dwSize; + union { + D3DCOLORVALUE diffuse; /* Diffuse color RGBA */ + D3DCOLORVALUE dcvDiffuse; + }; + union { + D3DCOLORVALUE ambient; /* Ambient color RGB */ + D3DCOLORVALUE dcvAmbient; + }; + union { + D3DCOLORVALUE specular; /* Specular 'shininess' */ + D3DCOLORVALUE dcvSpecular; + }; + union { + D3DCOLORVALUE emissive; /* Emissive color RGB */ + D3DCOLORVALUE dcvEmissive; + }; + union { + D3DVALUE power; /* Sharpness if specular highlight */ + D3DVALUE dvPower; + }; + D3DTEXTUREHANDLE hTexture; /* Handle to texture map */ + DWORD dwRampSize; +} D3DMATERIAL, *LPD3DMATERIAL; + +#if(DIRECT3D_VERSION >= 0x0700) + +typedef struct _D3DMATERIAL7 { + union { + D3DCOLORVALUE diffuse; /* Diffuse color RGBA */ + D3DCOLORVALUE dcvDiffuse; + }; + union { + D3DCOLORVALUE ambient; /* Ambient color RGB */ + D3DCOLORVALUE dcvAmbient; + }; + union { + D3DCOLORVALUE specular; /* Specular 'shininess' */ + D3DCOLORVALUE dcvSpecular; + }; + union { + D3DCOLORVALUE emissive; /* Emissive color RGB */ + D3DCOLORVALUE dcvEmissive; + }; + union { + D3DVALUE power; /* Sharpness if specular highlight */ + D3DVALUE dvPower; + }; +} D3DMATERIAL7, *LPD3DMATERIAL7; + +#endif /* DIRECT3D_VERSION >= 0x0700 */ + +#if(DIRECT3D_VERSION < 0x0800) + +typedef enum _D3DLIGHTTYPE { + D3DLIGHT_POINT = 1, + D3DLIGHT_SPOT = 2, + D3DLIGHT_DIRECTIONAL = 3, +// Note: The following light type (D3DLIGHT_PARALLELPOINT) +// is no longer supported from D3D for DX7 onwards. + D3DLIGHT_PARALLELPOINT = 4, +#if(DIRECT3D_VERSION < 0x0500) // For backward compatible headers + D3DLIGHT_GLSPOT = 5, +#endif + D3DLIGHT_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DLIGHTTYPE; + +#else +typedef enum _D3DLIGHTTYPE D3DLIGHTTYPE; +#define D3DLIGHT_PARALLELPOINT (D3DLIGHTTYPE)4 +#define D3DLIGHT_GLSPOT (D3DLIGHTTYPE)5 + +#endif //(DIRECT3D_VERSION < 0x0800) + +/* + * Structure defining a light source and its properties. + */ +typedef struct _D3DLIGHT { + DWORD dwSize; + D3DLIGHTTYPE dltType; /* Type of light source */ + D3DCOLORVALUE dcvColor; /* Color of light */ + D3DVECTOR dvPosition; /* Position in world space */ + D3DVECTOR dvDirection; /* Direction in world space */ + D3DVALUE dvRange; /* Cutoff range */ + D3DVALUE dvFalloff; /* Falloff */ + D3DVALUE dvAttenuation0; /* Constant attenuation */ + D3DVALUE dvAttenuation1; /* Linear attenuation */ + D3DVALUE dvAttenuation2; /* Quadratic attenuation */ + D3DVALUE dvTheta; /* Inner angle of spotlight cone */ + D3DVALUE dvPhi; /* Outer angle of spotlight cone */ +} D3DLIGHT, *LPD3DLIGHT; + +#if(DIRECT3D_VERSION >= 0x0700) + +typedef struct _D3DLIGHT7 { + D3DLIGHTTYPE dltType; /* Type of light source */ + D3DCOLORVALUE dcvDiffuse; /* Diffuse color of light */ + D3DCOLORVALUE dcvSpecular; /* Specular color of light */ + D3DCOLORVALUE dcvAmbient; /* Ambient color of light */ + D3DVECTOR dvPosition; /* Position in world space */ + D3DVECTOR dvDirection; /* Direction in world space */ + D3DVALUE dvRange; /* Cutoff range */ + D3DVALUE dvFalloff; /* Falloff */ + D3DVALUE dvAttenuation0; /* Constant attenuation */ + D3DVALUE dvAttenuation1; /* Linear attenuation */ + D3DVALUE dvAttenuation2; /* Quadratic attenuation */ + D3DVALUE dvTheta; /* Inner angle of spotlight cone */ + D3DVALUE dvPhi; /* Outer angle of spotlight cone */ +} D3DLIGHT7, *LPD3DLIGHT7; + +#endif /* DIRECT3D_VERSION >= 0x0700 */ + +#if(DIRECT3D_VERSION >= 0x0500) +/* + * Structure defining a light source and its properties. + */ + +/* flags bits */ +#define D3DLIGHT_ACTIVE 0x00000001 +#define D3DLIGHT_NO_SPECULAR 0x00000002 +#define D3DLIGHT_ALL (D3DLIGHT_ACTIVE | D3DLIGHT_NO_SPECULAR) + +/* maximum valid light range */ +#define D3DLIGHT_RANGE_MAX ((float)sqrt(FLT_MAX)) + +typedef struct _D3DLIGHT2 { + DWORD dwSize; + D3DLIGHTTYPE dltType; /* Type of light source */ + D3DCOLORVALUE dcvColor; /* Color of light */ + D3DVECTOR dvPosition; /* Position in world space */ + D3DVECTOR dvDirection; /* Direction in world space */ + D3DVALUE dvRange; /* Cutoff range */ + D3DVALUE dvFalloff; /* Falloff */ + D3DVALUE dvAttenuation0; /* Constant attenuation */ + D3DVALUE dvAttenuation1; /* Linear attenuation */ + D3DVALUE dvAttenuation2; /* Quadratic attenuation */ + D3DVALUE dvTheta; /* Inner angle of spotlight cone */ + D3DVALUE dvPhi; /* Outer angle of spotlight cone */ + DWORD dwFlags; +} D3DLIGHT2, *LPD3DLIGHT2; + +#endif /* DIRECT3D_VERSION >= 0x0500 */ +typedef struct _D3DLIGHTDATA { + DWORD dwSize; + LPD3DLIGHTINGELEMENT lpIn; /* Input positions and normals */ + DWORD dwInSize; /* Stride of input elements */ + LPD3DTLVERTEX lpOut; /* Output colors */ + DWORD dwOutSize; /* Stride of output colors */ +} D3DLIGHTDATA, *LPD3DLIGHTDATA; + +#if(DIRECT3D_VERSION >= 0x0500) +/* + * Before DX5, these values were in an enum called + * D3DCOLORMODEL. This was not correct, since they are + * bit flags. A driver can surface either or both flags + * in the dcmColorModel member of D3DDEVICEDESC. + */ +#define D3DCOLOR_MONO 1 +#define D3DCOLOR_RGB 2 + +typedef DWORD D3DCOLORMODEL; +#endif /* DIRECT3D_VERSION >= 0x0500 */ + +/* + * Options for clearing + */ +#define D3DCLEAR_TARGET 0x00000001l /* Clear target surface */ +#define D3DCLEAR_ZBUFFER 0x00000002l /* Clear target z buffer */ +#if(DIRECT3D_VERSION >= 0x0600) +#define D3DCLEAR_STENCIL 0x00000004l /* Clear stencil planes */ +#endif /* DIRECT3D_VERSION >= 0x0600 */ + +/* + * Execute buffers are allocated via Direct3D. These buffers may then + * be filled by the application with instructions to execute along with + * vertex data. + */ + +/* + * Supported op codes for execute instructions. + */ +typedef enum _D3DOPCODE { + D3DOP_POINT = 1, + D3DOP_LINE = 2, + D3DOP_TRIANGLE = 3, + D3DOP_MATRIXLOAD = 4, + D3DOP_MATRIXMULTIPLY = 5, + D3DOP_STATETRANSFORM = 6, + D3DOP_STATELIGHT = 7, + D3DOP_STATERENDER = 8, + D3DOP_PROCESSVERTICES = 9, + D3DOP_TEXTURELOAD = 10, + D3DOP_EXIT = 11, + D3DOP_BRANCHFORWARD = 12, + D3DOP_SPAN = 13, + D3DOP_SETSTATUS = 14, +#if(DIRECT3D_VERSION >= 0x0500) + D3DOP_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +#endif /* DIRECT3D_VERSION >= 0x0500 */ +} D3DOPCODE; + +typedef struct _D3DINSTRUCTION { + BYTE bOpcode; /* Instruction opcode */ + BYTE bSize; /* Size of each instruction data unit */ + WORD wCount; /* Count of instruction data units to follow */ +} D3DINSTRUCTION, *LPD3DINSTRUCTION; + +/* + * Structure for texture loads + */ +typedef struct _D3DTEXTURELOAD { + D3DTEXTUREHANDLE hDestTexture; + D3DTEXTUREHANDLE hSrcTexture; +} D3DTEXTURELOAD, *LPD3DTEXTURELOAD; + +/* + * Structure for picking + */ +typedef struct _D3DPICKRECORD { + BYTE bOpcode; + BYTE bPad; + DWORD dwOffset; + D3DVALUE dvZ; +} D3DPICKRECORD, *LPD3DPICKRECORD; + +/* + * The following defines the rendering states which can be set in the + * execute buffer. + */ + +#if(DIRECT3D_VERSION < 0x0800) + +typedef enum _D3DSHADEMODE { + D3DSHADE_FLAT = 1, + D3DSHADE_GOURAUD = 2, + D3DSHADE_PHONG = 3, +#if(DIRECT3D_VERSION >= 0x0500) + D3DSHADE_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +#endif /* DIRECT3D_VERSION >= 0x0500 */ +} D3DSHADEMODE; + +typedef enum _D3DFILLMODE { + D3DFILL_POINT = 1, + D3DFILL_WIREFRAME = 2, + D3DFILL_SOLID = 3, +#if(DIRECT3D_VERSION >= 0x0500) + D3DFILL_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +#endif /* DIRECT3D_VERSION >= 0x0500 */ +} D3DFILLMODE; + +typedef struct _D3DLINEPATTERN { + WORD wRepeatFactor; + WORD wLinePattern; +} D3DLINEPATTERN; + +#endif //(DIRECT3D_VERSION < 0x0800) + +typedef enum _D3DTEXTUREFILTER { + D3DFILTER_NEAREST = 1, + D3DFILTER_LINEAR = 2, + D3DFILTER_MIPNEAREST = 3, + D3DFILTER_MIPLINEAR = 4, + D3DFILTER_LINEARMIPNEAREST = 5, + D3DFILTER_LINEARMIPLINEAR = 6, +#if(DIRECT3D_VERSION >= 0x0500) + D3DFILTER_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +#endif /* DIRECT3D_VERSION >= 0x0500 */ +} D3DTEXTUREFILTER; + +#if(DIRECT3D_VERSION < 0x0800) + +typedef enum _D3DBLEND { + D3DBLEND_ZERO = 1, + D3DBLEND_ONE = 2, + D3DBLEND_SRCCOLOR = 3, + D3DBLEND_INVSRCCOLOR = 4, + D3DBLEND_SRCALPHA = 5, + D3DBLEND_INVSRCALPHA = 6, + D3DBLEND_DESTALPHA = 7, + D3DBLEND_INVDESTALPHA = 8, + D3DBLEND_DESTCOLOR = 9, + D3DBLEND_INVDESTCOLOR = 10, + D3DBLEND_SRCALPHASAT = 11, + D3DBLEND_BOTHSRCALPHA = 12, + D3DBLEND_BOTHINVSRCALPHA = 13, +#if(DIRECT3D_VERSION >= 0x0500) + D3DBLEND_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +#endif /* DIRECT3D_VERSION >= 0x0500 */ +} D3DBLEND; + +#endif //(DIRECT3D_VERSION < 0x0800) + +typedef enum _D3DTEXTUREBLEND { + D3DTBLEND_DECAL = 1, + D3DTBLEND_MODULATE = 2, + D3DTBLEND_DECALALPHA = 3, + D3DTBLEND_MODULATEALPHA = 4, + D3DTBLEND_DECALMASK = 5, + D3DTBLEND_MODULATEMASK = 6, + D3DTBLEND_COPY = 7, +#if(DIRECT3D_VERSION >= 0x0500) + D3DTBLEND_ADD = 8, + D3DTBLEND_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +#endif /* DIRECT3D_VERSION >= 0x0500 */ +} D3DTEXTUREBLEND; + +#if(DIRECT3D_VERSION < 0x0800) + +typedef enum _D3DTEXTUREADDRESS { + D3DTADDRESS_WRAP = 1, + D3DTADDRESS_MIRROR = 2, + D3DTADDRESS_CLAMP = 3, +#if(DIRECT3D_VERSION >= 0x0500) + D3DTADDRESS_BORDER = 4, + D3DTADDRESS_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +#endif /* DIRECT3D_VERSION >= 0x0500 */ +} D3DTEXTUREADDRESS; + +typedef enum _D3DCULL { + D3DCULL_NONE = 1, + D3DCULL_CW = 2, + D3DCULL_CCW = 3, +#if(DIRECT3D_VERSION >= 0x0500) + D3DCULL_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +#endif /* DIRECT3D_VERSION >= 0x0500 */ +} D3DCULL; + +typedef enum _D3DCMPFUNC { + D3DCMP_NEVER = 1, + D3DCMP_LESS = 2, + D3DCMP_EQUAL = 3, + D3DCMP_LESSEQUAL = 4, + D3DCMP_GREATER = 5, + D3DCMP_NOTEQUAL = 6, + D3DCMP_GREATEREQUAL = 7, + D3DCMP_ALWAYS = 8, +#if(DIRECT3D_VERSION >= 0x0500) + D3DCMP_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +#endif /* DIRECT3D_VERSION >= 0x0500 */ +} D3DCMPFUNC; + +#if(DIRECT3D_VERSION >= 0x0600) +typedef enum _D3DSTENCILOP { + D3DSTENCILOP_KEEP = 1, + D3DSTENCILOP_ZERO = 2, + D3DSTENCILOP_REPLACE = 3, + D3DSTENCILOP_INCRSAT = 4, + D3DSTENCILOP_DECRSAT = 5, + D3DSTENCILOP_INVERT = 6, + D3DSTENCILOP_INCR = 7, + D3DSTENCILOP_DECR = 8, + D3DSTENCILOP_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DSTENCILOP; +#endif /* DIRECT3D_VERSION >= 0x0600 */ + +typedef enum _D3DFOGMODE { + D3DFOG_NONE = 0, + D3DFOG_EXP = 1, + D3DFOG_EXP2 = 2, +#if(DIRECT3D_VERSION >= 0x0500) + D3DFOG_LINEAR = 3, + D3DFOG_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +#endif /* DIRECT3D_VERSION >= 0x0500 */ +} D3DFOGMODE; + +#if(DIRECT3D_VERSION >= 0x0600) +typedef enum _D3DZBUFFERTYPE { + D3DZB_FALSE = 0, + D3DZB_TRUE = 1, // Z buffering + D3DZB_USEW = 2, // W buffering + D3DZB_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DZBUFFERTYPE; +#endif /* DIRECT3D_VERSION >= 0x0600 */ + +#endif //(DIRECT3D_VERSION < 0x0800) + +#if(DIRECT3D_VERSION >= 0x0500) +typedef enum _D3DANTIALIASMODE { + D3DANTIALIAS_NONE = 0, + D3DANTIALIAS_SORTDEPENDENT = 1, + D3DANTIALIAS_SORTINDEPENDENT = 2, + D3DANTIALIAS_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DANTIALIASMODE; + +// Vertex types supported by Direct3D +typedef enum _D3DVERTEXTYPE { + D3DVT_VERTEX = 1, + D3DVT_LVERTEX = 2, + D3DVT_TLVERTEX = 3, + D3DVT_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DVERTEXTYPE; + +#if(DIRECT3D_VERSION < 0x0800) + +// Primitives supported by draw-primitive API +typedef enum _D3DPRIMITIVETYPE { + D3DPT_POINTLIST = 1, + D3DPT_LINELIST = 2, + D3DPT_LINESTRIP = 3, + D3DPT_TRIANGLELIST = 4, + D3DPT_TRIANGLESTRIP = 5, + D3DPT_TRIANGLEFAN = 6, + D3DPT_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DPRIMITIVETYPE; + +#endif //(DIRECT3D_VERSION < 0x0800) + +#endif /* DIRECT3D_VERSION >= 0x0500 */ +/* + * Amount to add to a state to generate the override for that state. + */ +#define D3DSTATE_OVERRIDE_BIAS 256 + +/* + * A state which sets the override flag for the specified state type. + */ +#define D3DSTATE_OVERRIDE(type) (D3DRENDERSTATETYPE)(((DWORD) (type) + D3DSTATE_OVERRIDE_BIAS)) + +#if(DIRECT3D_VERSION < 0x0800) + +typedef enum _D3DTRANSFORMSTATETYPE { + D3DTRANSFORMSTATE_WORLD = 1, + D3DTRANSFORMSTATE_VIEW = 2, + D3DTRANSFORMSTATE_PROJECTION = 3, +#if(DIRECT3D_VERSION >= 0x0700) + D3DTRANSFORMSTATE_WORLD1 = 4, // 2nd matrix to blend + D3DTRANSFORMSTATE_WORLD2 = 5, // 3rd matrix to blend + D3DTRANSFORMSTATE_WORLD3 = 6, // 4th matrix to blend + D3DTRANSFORMSTATE_TEXTURE0 = 16, + D3DTRANSFORMSTATE_TEXTURE1 = 17, + D3DTRANSFORMSTATE_TEXTURE2 = 18, + D3DTRANSFORMSTATE_TEXTURE3 = 19, + D3DTRANSFORMSTATE_TEXTURE4 = 20, + D3DTRANSFORMSTATE_TEXTURE5 = 21, + D3DTRANSFORMSTATE_TEXTURE6 = 22, + D3DTRANSFORMSTATE_TEXTURE7 = 23, +#endif /* DIRECT3D_VERSION >= 0x0700 */ +#if(DIRECT3D_VERSION >= 0x0500) + D3DTRANSFORMSTATE_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +#endif /* DIRECT3D_VERSION >= 0x0500 */ +} D3DTRANSFORMSTATETYPE; + +#else + +// +// legacy transform state names +// +typedef enum _D3DTRANSFORMSTATETYPE D3DTRANSFORMSTATETYPE; +#define D3DTRANSFORMSTATE_WORLD (D3DTRANSFORMSTATETYPE)1 +#define D3DTRANSFORMSTATE_VIEW (D3DTRANSFORMSTATETYPE)2 +#define D3DTRANSFORMSTATE_PROJECTION (D3DTRANSFORMSTATETYPE)3 +#define D3DTRANSFORMSTATE_WORLD1 (D3DTRANSFORMSTATETYPE)4 +#define D3DTRANSFORMSTATE_WORLD2 (D3DTRANSFORMSTATETYPE)5 +#define D3DTRANSFORMSTATE_WORLD3 (D3DTRANSFORMSTATETYPE)6 +#define D3DTRANSFORMSTATE_TEXTURE0 (D3DTRANSFORMSTATETYPE)16 +#define D3DTRANSFORMSTATE_TEXTURE1 (D3DTRANSFORMSTATETYPE)17 +#define D3DTRANSFORMSTATE_TEXTURE2 (D3DTRANSFORMSTATETYPE)18 +#define D3DTRANSFORMSTATE_TEXTURE3 (D3DTRANSFORMSTATETYPE)19 +#define D3DTRANSFORMSTATE_TEXTURE4 (D3DTRANSFORMSTATETYPE)20 +#define D3DTRANSFORMSTATE_TEXTURE5 (D3DTRANSFORMSTATETYPE)21 +#define D3DTRANSFORMSTATE_TEXTURE6 (D3DTRANSFORMSTATETYPE)22 +#define D3DTRANSFORMSTATE_TEXTURE7 (D3DTRANSFORMSTATETYPE)23 + +#endif //(DIRECT3D_VERSION < 0x0800) + +typedef enum _D3DLIGHTSTATETYPE { + D3DLIGHTSTATE_MATERIAL = 1, + D3DLIGHTSTATE_AMBIENT = 2, + D3DLIGHTSTATE_COLORMODEL = 3, + D3DLIGHTSTATE_FOGMODE = 4, + D3DLIGHTSTATE_FOGSTART = 5, + D3DLIGHTSTATE_FOGEND = 6, + D3DLIGHTSTATE_FOGDENSITY = 7, +#if(DIRECT3D_VERSION >= 0x0600) + D3DLIGHTSTATE_COLORVERTEX = 8, +#endif /* DIRECT3D_VERSION >= 0x0600 */ +#if(DIRECT3D_VERSION >= 0x0500) + D3DLIGHTSTATE_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +#endif /* DIRECT3D_VERSION >= 0x0500 */ +} D3DLIGHTSTATETYPE; + +#if(DIRECT3D_VERSION < 0x0800) + +typedef enum _D3DRENDERSTATETYPE { + D3DRENDERSTATE_ANTIALIAS = 2, /* D3DANTIALIASMODE */ + D3DRENDERSTATE_TEXTUREPERSPECTIVE = 4, /* TRUE for perspective correction */ + D3DRENDERSTATE_ZENABLE = 7, /* D3DZBUFFERTYPE (or TRUE/FALSE for legacy) */ + D3DRENDERSTATE_FILLMODE = 8, /* D3DFILL_MODE */ + D3DRENDERSTATE_SHADEMODE = 9, /* D3DSHADEMODE */ + D3DRENDERSTATE_LINEPATTERN = 10, /* D3DLINEPATTERN */ + D3DRENDERSTATE_ZWRITEENABLE = 14, /* TRUE to enable z writes */ + D3DRENDERSTATE_ALPHATESTENABLE = 15, /* TRUE to enable alpha tests */ + D3DRENDERSTATE_LASTPIXEL = 16, /* TRUE for last-pixel on lines */ + D3DRENDERSTATE_SRCBLEND = 19, /* D3DBLEND */ + D3DRENDERSTATE_DESTBLEND = 20, /* D3DBLEND */ + D3DRENDERSTATE_CULLMODE = 22, /* D3DCULL */ + D3DRENDERSTATE_ZFUNC = 23, /* D3DCMPFUNC */ + D3DRENDERSTATE_ALPHAREF = 24, /* D3DFIXED */ + D3DRENDERSTATE_ALPHAFUNC = 25, /* D3DCMPFUNC */ + D3DRENDERSTATE_DITHERENABLE = 26, /* TRUE to enable dithering */ +#if(DIRECT3D_VERSION >= 0x0500) + D3DRENDERSTATE_ALPHABLENDENABLE = 27, /* TRUE to enable alpha blending */ +#endif /* DIRECT3D_VERSION >= 0x0500 */ + D3DRENDERSTATE_FOGENABLE = 28, /* TRUE to enable fog blending */ + D3DRENDERSTATE_SPECULARENABLE = 29, /* TRUE to enable specular */ + D3DRENDERSTATE_ZVISIBLE = 30, /* TRUE to enable z checking */ + D3DRENDERSTATE_STIPPLEDALPHA = 33, /* TRUE to enable stippled alpha (RGB device only) */ + D3DRENDERSTATE_FOGCOLOR = 34, /* D3DCOLOR */ + D3DRENDERSTATE_FOGTABLEMODE = 35, /* D3DFOGMODE */ +#if(DIRECT3D_VERSION >= 0x0700) + D3DRENDERSTATE_FOGSTART = 36, /* Fog start (for both vertex and pixel fog) */ + D3DRENDERSTATE_FOGEND = 37, /* Fog end */ + D3DRENDERSTATE_FOGDENSITY = 38, /* Fog density */ +#endif /* DIRECT3D_VERSION >= 0x0700 */ +#if(DIRECT3D_VERSION >= 0x0500) + D3DRENDERSTATE_EDGEANTIALIAS = 40, /* TRUE to enable edge antialiasing */ + D3DRENDERSTATE_COLORKEYENABLE = 41, /* TRUE to enable source colorkeyed textures */ + D3DRENDERSTATE_ZBIAS = 47, /* LONG Z bias */ + D3DRENDERSTATE_RANGEFOGENABLE = 48, /* Enables range-based fog */ +#endif /* DIRECT3D_VERSION >= 0x0500 */ + +#if(DIRECT3D_VERSION >= 0x0600) + D3DRENDERSTATE_STENCILENABLE = 52, /* BOOL enable/disable stenciling */ + D3DRENDERSTATE_STENCILFAIL = 53, /* D3DSTENCILOP to do if stencil test fails */ + D3DRENDERSTATE_STENCILZFAIL = 54, /* D3DSTENCILOP to do if stencil test passes and Z test fails */ + D3DRENDERSTATE_STENCILPASS = 55, /* D3DSTENCILOP to do if both stencil and Z tests pass */ + D3DRENDERSTATE_STENCILFUNC = 56, /* D3DCMPFUNC fn. Stencil Test passes if ((ref & mask) stencilfn (stencil & mask)) is true */ + D3DRENDERSTATE_STENCILREF = 57, /* Reference value used in stencil test */ + D3DRENDERSTATE_STENCILMASK = 58, /* Mask value used in stencil test */ + D3DRENDERSTATE_STENCILWRITEMASK = 59, /* Write mask applied to values written to stencil buffer */ + D3DRENDERSTATE_TEXTUREFACTOR = 60, /* D3DCOLOR used for multi-texture blend */ +#endif /* DIRECT3D_VERSION >= 0x0600 */ + +#if(DIRECT3D_VERSION >= 0x0600) + + /* + * 128 values [128, 255] are reserved for texture coordinate wrap flags. + * These are constructed with the D3DWRAP_U and D3DWRAP_V macros. Using + * a flags word preserves forward compatibility with texture coordinates + * that are >2D. + */ + D3DRENDERSTATE_WRAP0 = 128, /* wrap for 1st texture coord. set */ + D3DRENDERSTATE_WRAP1 = 129, /* wrap for 2nd texture coord. set */ + D3DRENDERSTATE_WRAP2 = 130, /* wrap for 3rd texture coord. set */ + D3DRENDERSTATE_WRAP3 = 131, /* wrap for 4th texture coord. set */ + D3DRENDERSTATE_WRAP4 = 132, /* wrap for 5th texture coord. set */ + D3DRENDERSTATE_WRAP5 = 133, /* wrap for 6th texture coord. set */ + D3DRENDERSTATE_WRAP6 = 134, /* wrap for 7th texture coord. set */ + D3DRENDERSTATE_WRAP7 = 135, /* wrap for 8th texture coord. set */ +#endif /* DIRECT3D_VERSION >= 0x0600 */ +#if(DIRECT3D_VERSION >= 0x0700) + D3DRENDERSTATE_CLIPPING = 136, + D3DRENDERSTATE_LIGHTING = 137, + D3DRENDERSTATE_EXTENTS = 138, + D3DRENDERSTATE_AMBIENT = 139, + D3DRENDERSTATE_FOGVERTEXMODE = 140, + D3DRENDERSTATE_COLORVERTEX = 141, + D3DRENDERSTATE_LOCALVIEWER = 142, + D3DRENDERSTATE_NORMALIZENORMALS = 143, + D3DRENDERSTATE_COLORKEYBLENDENABLE = 144, + D3DRENDERSTATE_DIFFUSEMATERIALSOURCE = 145, + D3DRENDERSTATE_SPECULARMATERIALSOURCE = 146, + D3DRENDERSTATE_AMBIENTMATERIALSOURCE = 147, + D3DRENDERSTATE_EMISSIVEMATERIALSOURCE = 148, + D3DRENDERSTATE_VERTEXBLEND = 151, + D3DRENDERSTATE_CLIPPLANEENABLE = 152, + +#endif /* DIRECT3D_VERSION >= 0x0700 */ + +// +// retired renderstates - not supported for DX7 interfaces +// + D3DRENDERSTATE_TEXTUREHANDLE = 1, /* Texture handle for legacy interfaces (Texture,Texture2) */ + D3DRENDERSTATE_TEXTUREADDRESS = 3, /* D3DTEXTUREADDRESS */ + D3DRENDERSTATE_WRAPU = 5, /* TRUE for wrapping in u */ + D3DRENDERSTATE_WRAPV = 6, /* TRUE for wrapping in v */ + D3DRENDERSTATE_MONOENABLE = 11, /* TRUE to enable mono rasterization */ + D3DRENDERSTATE_ROP2 = 12, /* ROP2 */ + D3DRENDERSTATE_PLANEMASK = 13, /* DWORD physical plane mask */ + D3DRENDERSTATE_TEXTUREMAG = 17, /* D3DTEXTUREFILTER */ + D3DRENDERSTATE_TEXTUREMIN = 18, /* D3DTEXTUREFILTER */ + D3DRENDERSTATE_TEXTUREMAPBLEND = 21, /* D3DTEXTUREBLEND */ + D3DRENDERSTATE_SUBPIXEL = 31, /* TRUE to enable subpixel correction */ + D3DRENDERSTATE_SUBPIXELX = 32, /* TRUE to enable correction in X only */ + D3DRENDERSTATE_STIPPLEENABLE = 39, /* TRUE to enable stippling */ +#if(DIRECT3D_VERSION >= 0x0500) + D3DRENDERSTATE_BORDERCOLOR = 43, /* Border color for texturing w/border */ + D3DRENDERSTATE_TEXTUREADDRESSU = 44, /* Texture addressing mode for U coordinate */ + D3DRENDERSTATE_TEXTUREADDRESSV = 45, /* Texture addressing mode for V coordinate */ + D3DRENDERSTATE_MIPMAPLODBIAS = 46, /* D3DVALUE Mipmap LOD bias */ + D3DRENDERSTATE_ANISOTROPY = 49, /* Max. anisotropy. 1 = no anisotropy */ +#endif /* DIRECT3D_VERSION >= 0x0500 */ + D3DRENDERSTATE_FLUSHBATCH = 50, /* Explicit flush for DP batching (DX5 Only) */ +#if(DIRECT3D_VERSION >= 0x0600) + D3DRENDERSTATE_TRANSLUCENTSORTINDEPENDENT=51, /* BOOL enable sort-independent transparency */ +#endif /* DIRECT3D_VERSION >= 0x0600 */ + D3DRENDERSTATE_STIPPLEPATTERN00 = 64, /* Stipple pattern 01... */ + D3DRENDERSTATE_STIPPLEPATTERN01 = 65, + D3DRENDERSTATE_STIPPLEPATTERN02 = 66, + D3DRENDERSTATE_STIPPLEPATTERN03 = 67, + D3DRENDERSTATE_STIPPLEPATTERN04 = 68, + D3DRENDERSTATE_STIPPLEPATTERN05 = 69, + D3DRENDERSTATE_STIPPLEPATTERN06 = 70, + D3DRENDERSTATE_STIPPLEPATTERN07 = 71, + D3DRENDERSTATE_STIPPLEPATTERN08 = 72, + D3DRENDERSTATE_STIPPLEPATTERN09 = 73, + D3DRENDERSTATE_STIPPLEPATTERN10 = 74, + D3DRENDERSTATE_STIPPLEPATTERN11 = 75, + D3DRENDERSTATE_STIPPLEPATTERN12 = 76, + D3DRENDERSTATE_STIPPLEPATTERN13 = 77, + D3DRENDERSTATE_STIPPLEPATTERN14 = 78, + D3DRENDERSTATE_STIPPLEPATTERN15 = 79, + D3DRENDERSTATE_STIPPLEPATTERN16 = 80, + D3DRENDERSTATE_STIPPLEPATTERN17 = 81, + D3DRENDERSTATE_STIPPLEPATTERN18 = 82, + D3DRENDERSTATE_STIPPLEPATTERN19 = 83, + D3DRENDERSTATE_STIPPLEPATTERN20 = 84, + D3DRENDERSTATE_STIPPLEPATTERN21 = 85, + D3DRENDERSTATE_STIPPLEPATTERN22 = 86, + D3DRENDERSTATE_STIPPLEPATTERN23 = 87, + D3DRENDERSTATE_STIPPLEPATTERN24 = 88, + D3DRENDERSTATE_STIPPLEPATTERN25 = 89, + D3DRENDERSTATE_STIPPLEPATTERN26 = 90, + D3DRENDERSTATE_STIPPLEPATTERN27 = 91, + D3DRENDERSTATE_STIPPLEPATTERN28 = 92, + D3DRENDERSTATE_STIPPLEPATTERN29 = 93, + D3DRENDERSTATE_STIPPLEPATTERN30 = 94, + D3DRENDERSTATE_STIPPLEPATTERN31 = 95, + +// +// retired renderstate names - the values are still used under new naming conventions +// + D3DRENDERSTATE_FOGTABLESTART = 36, /* Fog table start */ + D3DRENDERSTATE_FOGTABLEEND = 37, /* Fog table end */ + D3DRENDERSTATE_FOGTABLEDENSITY = 38, /* Fog table density */ + +#if(DIRECT3D_VERSION >= 0x0500) + D3DRENDERSTATE_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +#endif /* DIRECT3D_VERSION >= 0x0500 */ +} D3DRENDERSTATETYPE; + +#else + +typedef enum _D3DRENDERSTATETYPE D3DRENDERSTATETYPE; + +// +// legacy renderstate names +// +#define D3DRENDERSTATE_TEXTUREPERSPECTIVE (D3DRENDERSTATETYPE)4 +#define D3DRENDERSTATE_ZENABLE (D3DRENDERSTATETYPE)7 +#define D3DRENDERSTATE_FILLMODE (D3DRENDERSTATETYPE)8 +#define D3DRENDERSTATE_SHADEMODE (D3DRENDERSTATETYPE)9 +#define D3DRENDERSTATE_LINEPATTERN (D3DRENDERSTATETYPE)10 +#define D3DRENDERSTATE_ZWRITEENABLE (D3DRENDERSTATETYPE)14 +#define D3DRENDERSTATE_ALPHATESTENABLE (D3DRENDERSTATETYPE)15 +#define D3DRENDERSTATE_LASTPIXEL (D3DRENDERSTATETYPE)16 +#define D3DRENDERSTATE_SRCBLEND (D3DRENDERSTATETYPE)19 +#define D3DRENDERSTATE_DESTBLEND (D3DRENDERSTATETYPE)20 +#define D3DRENDERSTATE_CULLMODE (D3DRENDERSTATETYPE)22 +#define D3DRENDERSTATE_ZFUNC (D3DRENDERSTATETYPE)23 +#define D3DRENDERSTATE_ALPHAREF (D3DRENDERSTATETYPE)24 +#define D3DRENDERSTATE_ALPHAFUNC (D3DRENDERSTATETYPE)25 +#define D3DRENDERSTATE_DITHERENABLE (D3DRENDERSTATETYPE)26 +#define D3DRENDERSTATE_ALPHABLENDENABLE (D3DRENDERSTATETYPE)27 +#define D3DRENDERSTATE_FOGENABLE (D3DRENDERSTATETYPE)28 +#define D3DRENDERSTATE_SPECULARENABLE (D3DRENDERSTATETYPE)29 +#define D3DRENDERSTATE_ZVISIBLE (D3DRENDERSTATETYPE)30 +#define D3DRENDERSTATE_STIPPLEDALPHA (D3DRENDERSTATETYPE)33 +#define D3DRENDERSTATE_FOGCOLOR (D3DRENDERSTATETYPE)34 +#define D3DRENDERSTATE_FOGTABLEMODE (D3DRENDERSTATETYPE)35 +#define D3DRENDERSTATE_FOGSTART (D3DRENDERSTATETYPE)36 +#define D3DRENDERSTATE_FOGEND (D3DRENDERSTATETYPE)37 +#define D3DRENDERSTATE_FOGDENSITY (D3DRENDERSTATETYPE)38 +#define D3DRENDERSTATE_EDGEANTIALIAS (D3DRENDERSTATETYPE)40 +#define D3DRENDERSTATE_ZBIAS (D3DRENDERSTATETYPE)47 +#define D3DRENDERSTATE_RANGEFOGENABLE (D3DRENDERSTATETYPE)48 +#define D3DRENDERSTATE_STENCILENABLE (D3DRENDERSTATETYPE)52 +#define D3DRENDERSTATE_STENCILFAIL (D3DRENDERSTATETYPE)53 +#define D3DRENDERSTATE_STENCILZFAIL (D3DRENDERSTATETYPE)54 +#define D3DRENDERSTATE_STENCILPASS (D3DRENDERSTATETYPE)55 +#define D3DRENDERSTATE_STENCILFUNC (D3DRENDERSTATETYPE)56 +#define D3DRENDERSTATE_STENCILREF (D3DRENDERSTATETYPE)57 +#define D3DRENDERSTATE_STENCILMASK (D3DRENDERSTATETYPE)58 +#define D3DRENDERSTATE_STENCILWRITEMASK (D3DRENDERSTATETYPE)59 +#define D3DRENDERSTATE_TEXTUREFACTOR (D3DRENDERSTATETYPE)60 +#define D3DRENDERSTATE_WRAP0 (D3DRENDERSTATETYPE)128 +#define D3DRENDERSTATE_WRAP1 (D3DRENDERSTATETYPE)129 +#define D3DRENDERSTATE_WRAP2 (D3DRENDERSTATETYPE)130 +#define D3DRENDERSTATE_WRAP3 (D3DRENDERSTATETYPE)131 +#define D3DRENDERSTATE_WRAP4 (D3DRENDERSTATETYPE)132 +#define D3DRENDERSTATE_WRAP5 (D3DRENDERSTATETYPE)133 +#define D3DRENDERSTATE_WRAP6 (D3DRENDERSTATETYPE)134 +#define D3DRENDERSTATE_WRAP7 (D3DRENDERSTATETYPE)135 + +#define D3DRENDERSTATE_CLIPPING (D3DRENDERSTATETYPE)136 +#define D3DRENDERSTATE_LIGHTING (D3DRENDERSTATETYPE)137 +#define D3DRENDERSTATE_EXTENTS (D3DRENDERSTATETYPE)138 +#define D3DRENDERSTATE_AMBIENT (D3DRENDERSTATETYPE)139 +#define D3DRENDERSTATE_FOGVERTEXMODE (D3DRENDERSTATETYPE)140 +#define D3DRENDERSTATE_COLORVERTEX (D3DRENDERSTATETYPE)141 +#define D3DRENDERSTATE_LOCALVIEWER (D3DRENDERSTATETYPE)142 +#define D3DRENDERSTATE_NORMALIZENORMALS (D3DRENDERSTATETYPE)143 +#define D3DRENDERSTATE_COLORKEYBLENDENABLE (D3DRENDERSTATETYPE)144 +#define D3DRENDERSTATE_DIFFUSEMATERIALSOURCE (D3DRENDERSTATETYPE)145 +#define D3DRENDERSTATE_SPECULARMATERIALSOURCE (D3DRENDERSTATETYPE)146 +#define D3DRENDERSTATE_AMBIENTMATERIALSOURCE (D3DRENDERSTATETYPE)147 +#define D3DRENDERSTATE_EMISSIVEMATERIALSOURCE (D3DRENDERSTATETYPE)148 +#define D3DRENDERSTATE_VERTEXBLEND (D3DRENDERSTATETYPE)151 +#define D3DRENDERSTATE_CLIPPLANEENABLE (D3DRENDERSTATETYPE)152 + +// +// retired renderstates - not supported for DX7 interfaces +// +#define D3DRENDERSTATE_TEXTUREHANDLE (D3DRENDERSTATETYPE)1 +#define D3DRENDERSTATE_ANTIALIAS (D3DRENDERSTATETYPE)2 +#define D3DRENDERSTATE_TEXTUREADDRESS (D3DRENDERSTATETYPE)3 +#define D3DRENDERSTATE_WRAPU (D3DRENDERSTATETYPE)5 +#define D3DRENDERSTATE_WRAPV (D3DRENDERSTATETYPE)6 +#define D3DRENDERSTATE_MONOENABLE (D3DRENDERSTATETYPE)11 +#define D3DRENDERSTATE_ROP2 (D3DRENDERSTATETYPE)12 +#define D3DRENDERSTATE_PLANEMASK (D3DRENDERSTATETYPE)13 +#define D3DRENDERSTATE_TEXTUREMAG (D3DRENDERSTATETYPE)17 +#define D3DRENDERSTATE_TEXTUREMIN (D3DRENDERSTATETYPE)18 +#define D3DRENDERSTATE_TEXTUREMAPBLEND (D3DRENDERSTATETYPE)21 +#define D3DRENDERSTATE_SUBPIXEL (D3DRENDERSTATETYPE)31 +#define D3DRENDERSTATE_SUBPIXELX (D3DRENDERSTATETYPE)32 +#define D3DRENDERSTATE_STIPPLEENABLE (D3DRENDERSTATETYPE)39 +#define D3DRENDERSTATE_OLDALPHABLENDENABLE (D3DRENDERSTATETYPE)42 +#define D3DRENDERSTATE_BORDERCOLOR (D3DRENDERSTATETYPE)43 +#define D3DRENDERSTATE_TEXTUREADDRESSU (D3DRENDERSTATETYPE)44 +#define D3DRENDERSTATE_TEXTUREADDRESSV (D3DRENDERSTATETYPE)45 +#define D3DRENDERSTATE_MIPMAPLODBIAS (D3DRENDERSTATETYPE)46 +#define D3DRENDERSTATE_ANISOTROPY (D3DRENDERSTATETYPE)49 +#define D3DRENDERSTATE_FLUSHBATCH (D3DRENDERSTATETYPE)50 +#define D3DRENDERSTATE_TRANSLUCENTSORTINDEPENDENT (D3DRENDERSTATETYPE)51 +#define D3DRENDERSTATE_STIPPLEPATTERN00 (D3DRENDERSTATETYPE)64 +#define D3DRENDERSTATE_STIPPLEPATTERN01 (D3DRENDERSTATETYPE)65 +#define D3DRENDERSTATE_STIPPLEPATTERN02 (D3DRENDERSTATETYPE)66 +#define D3DRENDERSTATE_STIPPLEPATTERN03 (D3DRENDERSTATETYPE)67 +#define D3DRENDERSTATE_STIPPLEPATTERN04 (D3DRENDERSTATETYPE)68 +#define D3DRENDERSTATE_STIPPLEPATTERN05 (D3DRENDERSTATETYPE)69 +#define D3DRENDERSTATE_STIPPLEPATTERN06 (D3DRENDERSTATETYPE)70 +#define D3DRENDERSTATE_STIPPLEPATTERN07 (D3DRENDERSTATETYPE)71 +#define D3DRENDERSTATE_STIPPLEPATTERN08 (D3DRENDERSTATETYPE)72 +#define D3DRENDERSTATE_STIPPLEPATTERN09 (D3DRENDERSTATETYPE)73 +#define D3DRENDERSTATE_STIPPLEPATTERN10 (D3DRENDERSTATETYPE)74 +#define D3DRENDERSTATE_STIPPLEPATTERN11 (D3DRENDERSTATETYPE)75 +#define D3DRENDERSTATE_STIPPLEPATTERN12 (D3DRENDERSTATETYPE)76 +#define D3DRENDERSTATE_STIPPLEPATTERN13 (D3DRENDERSTATETYPE)77 +#define D3DRENDERSTATE_STIPPLEPATTERN14 (D3DRENDERSTATETYPE)78 +#define D3DRENDERSTATE_STIPPLEPATTERN15 (D3DRENDERSTATETYPE)79 +#define D3DRENDERSTATE_STIPPLEPATTERN16 (D3DRENDERSTATETYPE)80 +#define D3DRENDERSTATE_STIPPLEPATTERN17 (D3DRENDERSTATETYPE)81 +#define D3DRENDERSTATE_STIPPLEPATTERN18 (D3DRENDERSTATETYPE)82 +#define D3DRENDERSTATE_STIPPLEPATTERN19 (D3DRENDERSTATETYPE)83 +#define D3DRENDERSTATE_STIPPLEPATTERN20 (D3DRENDERSTATETYPE)84 +#define D3DRENDERSTATE_STIPPLEPATTERN21 (D3DRENDERSTATETYPE)85 +#define D3DRENDERSTATE_STIPPLEPATTERN22 (D3DRENDERSTATETYPE)86 +#define D3DRENDERSTATE_STIPPLEPATTERN23 (D3DRENDERSTATETYPE)87 +#define D3DRENDERSTATE_STIPPLEPATTERN24 (D3DRENDERSTATETYPE)88 +#define D3DRENDERSTATE_STIPPLEPATTERN25 (D3DRENDERSTATETYPE)89 +#define D3DRENDERSTATE_STIPPLEPATTERN26 (D3DRENDERSTATETYPE)90 +#define D3DRENDERSTATE_STIPPLEPATTERN27 (D3DRENDERSTATETYPE)91 +#define D3DRENDERSTATE_STIPPLEPATTERN28 (D3DRENDERSTATETYPE)92 +#define D3DRENDERSTATE_STIPPLEPATTERN29 (D3DRENDERSTATETYPE)93 +#define D3DRENDERSTATE_STIPPLEPATTERN30 (D3DRENDERSTATETYPE)94 +#define D3DRENDERSTATE_STIPPLEPATTERN31 (D3DRENDERSTATETYPE)95 + +// +// retired renderstates - not supported for DX8 interfaces +// +#define D3DRENDERSTATE_COLORKEYENABLE (D3DRENDERSTATETYPE)41 +#define D3DRENDERSTATE_COLORKEYBLENDENABLE (D3DRENDERSTATETYPE)144 + +// +// retired renderstate names - the values are still used under new naming conventions +// +#define D3DRENDERSTATE_BLENDENABLE (D3DRENDERSTATETYPE)27 +#define D3DRENDERSTATE_FOGTABLESTART (D3DRENDERSTATETYPE)36 +#define D3DRENDERSTATE_FOGTABLEEND (D3DRENDERSTATETYPE)37 +#define D3DRENDERSTATE_FOGTABLEDENSITY (D3DRENDERSTATETYPE)38 + +#endif //(DIRECT3D_VERSION < 0x0800) + + +#if(DIRECT3D_VERSION < 0x0800) + +// Values for material source +typedef enum _D3DMATERIALCOLORSOURCE +{ + D3DMCS_MATERIAL = 0, // Color from material is used + D3DMCS_COLOR1 = 1, // Diffuse vertex color is used + D3DMCS_COLOR2 = 2, // Specular vertex color is used + D3DMCS_FORCE_DWORD = 0x7fffffff, // force 32-bit size enum +} D3DMATERIALCOLORSOURCE; + + +#if(DIRECT3D_VERSION >= 0x0500) +// For back-compatibility with legacy compilations +#define D3DRENDERSTATE_BLENDENABLE D3DRENDERSTATE_ALPHABLENDENABLE +#endif /* DIRECT3D_VERSION >= 0x0500 */ + +#if(DIRECT3D_VERSION >= 0x0600) + +// Bias to apply to the texture coordinate set to apply a wrap to. +#define D3DRENDERSTATE_WRAPBIAS 128UL + +/* Flags to construct the WRAP render states */ +#define D3DWRAP_U 0x00000001L +#define D3DWRAP_V 0x00000002L + +#endif /* DIRECT3D_VERSION >= 0x0600 */ + +#if(DIRECT3D_VERSION >= 0x0700) + +/* Flags to construct the WRAP render states for 1D thru 4D texture coordinates */ +#define D3DWRAPCOORD_0 0x00000001L // same as D3DWRAP_U +#define D3DWRAPCOORD_1 0x00000002L // same as D3DWRAP_V +#define D3DWRAPCOORD_2 0x00000004L +#define D3DWRAPCOORD_3 0x00000008L + +#endif /* DIRECT3D_VERSION >= 0x0700 */ + +#endif //(DIRECT3D_VERSION < 0x0800) + +#define D3DRENDERSTATE_STIPPLEPATTERN(y) (D3DRENDERSTATE_STIPPLEPATTERN00 + (y)) + +typedef struct _D3DSTATE { + union { +#if(DIRECT3D_VERSION < 0x0800) + D3DTRANSFORMSTATETYPE dtstTransformStateType; +#endif //(DIRECT3D_VERSION < 0x0800) + D3DLIGHTSTATETYPE dlstLightStateType; + D3DRENDERSTATETYPE drstRenderStateType; + }; + union { + DWORD dwArg[1]; + D3DVALUE dvArg[1]; + }; +} D3DSTATE, *LPD3DSTATE; + + +/* + * Operation used to load matrices + * hDstMat = hSrcMat + */ +typedef struct _D3DMATRIXLOAD { + D3DMATRIXHANDLE hDestMatrix; /* Destination matrix */ + D3DMATRIXHANDLE hSrcMatrix; /* Source matrix */ +} D3DMATRIXLOAD, *LPD3DMATRIXLOAD; + +/* + * Operation used to multiply matrices + * hDstMat = hSrcMat1 * hSrcMat2 + */ +typedef struct _D3DMATRIXMULTIPLY { + D3DMATRIXHANDLE hDestMatrix; /* Destination matrix */ + D3DMATRIXHANDLE hSrcMatrix1; /* First source matrix */ + D3DMATRIXHANDLE hSrcMatrix2; /* Second source matrix */ +} D3DMATRIXMULTIPLY, *LPD3DMATRIXMULTIPLY; + +/* + * Operation used to transform and light vertices. + */ +typedef struct _D3DPROCESSVERTICES { + DWORD dwFlags; /* Do we transform or light or just copy? */ + WORD wStart; /* Index to first vertex in source */ + WORD wDest; /* Index to first vertex in local buffer */ + DWORD dwCount; /* Number of vertices to be processed */ + DWORD dwReserved; /* Must be zero */ +} D3DPROCESSVERTICES, *LPD3DPROCESSVERTICES; + +#define D3DPROCESSVERTICES_TRANSFORMLIGHT 0x00000000L +#define D3DPROCESSVERTICES_TRANSFORM 0x00000001L +#define D3DPROCESSVERTICES_COPY 0x00000002L +#define D3DPROCESSVERTICES_OPMASK 0x00000007L + +#define D3DPROCESSVERTICES_UPDATEEXTENTS 0x00000008L +#define D3DPROCESSVERTICES_NOCOLOR 0x00000010L + + +#if(DIRECT3D_VERSION >= 0x0600) + + +#if(DIRECT3D_VERSION < 0x0800) + +/* + * State enumerants for per-stage texture processing. + */ +typedef enum _D3DTEXTURESTAGESTATETYPE +{ + D3DTSS_COLOROP = 1, /* D3DTEXTUREOP - per-stage blending controls for color channels */ + D3DTSS_COLORARG1 = 2, /* D3DTA_* (texture arg) */ + D3DTSS_COLORARG2 = 3, /* D3DTA_* (texture arg) */ + D3DTSS_ALPHAOP = 4, /* D3DTEXTUREOP - per-stage blending controls for alpha channel */ + D3DTSS_ALPHAARG1 = 5, /* D3DTA_* (texture arg) */ + D3DTSS_ALPHAARG2 = 6, /* D3DTA_* (texture arg) */ + D3DTSS_BUMPENVMAT00 = 7, /* D3DVALUE (bump mapping matrix) */ + D3DTSS_BUMPENVMAT01 = 8, /* D3DVALUE (bump mapping matrix) */ + D3DTSS_BUMPENVMAT10 = 9, /* D3DVALUE (bump mapping matrix) */ + D3DTSS_BUMPENVMAT11 = 10, /* D3DVALUE (bump mapping matrix) */ + D3DTSS_TEXCOORDINDEX = 11, /* identifies which set of texture coordinates index this texture */ + D3DTSS_ADDRESS = 12, /* D3DTEXTUREADDRESS for both coordinates */ + D3DTSS_ADDRESSU = 13, /* D3DTEXTUREADDRESS for U coordinate */ + D3DTSS_ADDRESSV = 14, /* D3DTEXTUREADDRESS for V coordinate */ + D3DTSS_BORDERCOLOR = 15, /* D3DCOLOR */ + D3DTSS_MAGFILTER = 16, /* D3DTEXTUREMAGFILTER filter to use for magnification */ + D3DTSS_MINFILTER = 17, /* D3DTEXTUREMINFILTER filter to use for minification */ + D3DTSS_MIPFILTER = 18, /* D3DTEXTUREMIPFILTER filter to use between mipmaps during minification */ + D3DTSS_MIPMAPLODBIAS = 19, /* D3DVALUE Mipmap LOD bias */ + D3DTSS_MAXMIPLEVEL = 20, /* DWORD 0..(n-1) LOD index of largest map to use (0 == largest) */ + D3DTSS_MAXANISOTROPY = 21, /* DWORD maximum anisotropy */ + D3DTSS_BUMPENVLSCALE = 22, /* D3DVALUE scale for bump map luminance */ + D3DTSS_BUMPENVLOFFSET = 23, /* D3DVALUE offset for bump map luminance */ +#if(DIRECT3D_VERSION >= 0x0700) + D3DTSS_TEXTURETRANSFORMFLAGS = 24, /* D3DTEXTURETRANSFORMFLAGS controls texture transform */ +#endif /* DIRECT3D_VERSION >= 0x0700 */ + D3DTSS_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DTEXTURESTAGESTATETYPE; + +#if(DIRECT3D_VERSION >= 0x0700) +// Values, used with D3DTSS_TEXCOORDINDEX, to specify that the vertex data(position +// and normal in the camera space) should be taken as texture coordinates +// Low 16 bits are used to specify texture coordinate index, to take the WRAP mode from +// +#define D3DTSS_TCI_PASSTHRU 0x00000000 +#define D3DTSS_TCI_CAMERASPACENORMAL 0x00010000 +#define D3DTSS_TCI_CAMERASPACEPOSITION 0x00020000 +#define D3DTSS_TCI_CAMERASPACEREFLECTIONVECTOR 0x00030000 +#endif /* DIRECT3D_VERSION >= 0x0700 */ + +/* + * Enumerations for COLOROP and ALPHAOP texture blending operations set in + * texture processing stage controls in D3DRENDERSTATE. + */ +typedef enum _D3DTEXTUREOP +{ +// Control + D3DTOP_DISABLE = 1, // disables stage + D3DTOP_SELECTARG1 = 2, // the default + D3DTOP_SELECTARG2 = 3, + +// Modulate + D3DTOP_MODULATE = 4, // multiply args together + D3DTOP_MODULATE2X = 5, // multiply and 1 bit + D3DTOP_MODULATE4X = 6, // multiply and 2 bits + +// Add + D3DTOP_ADD = 7, // add arguments together + D3DTOP_ADDSIGNED = 8, // add with -0.5 bias + D3DTOP_ADDSIGNED2X = 9, // as above but left 1 bit + D3DTOP_SUBTRACT = 10, // Arg1 - Arg2, with no saturation + D3DTOP_ADDSMOOTH = 11, // add 2 args, subtract product + // Arg1 + Arg2 - Arg1*Arg2 + // = Arg1 + (1-Arg1)*Arg2 + +// Linear alpha blend: Arg1*(Alpha) + Arg2*(1-Alpha) + D3DTOP_BLENDDIFFUSEALPHA = 12, // iterated alpha + D3DTOP_BLENDTEXTUREALPHA = 13, // texture alpha + D3DTOP_BLENDFACTORALPHA = 14, // alpha from D3DRENDERSTATE_TEXTUREFACTOR + // Linear alpha blend with pre-multiplied arg1 input: Arg1 + Arg2*(1-Alpha) + D3DTOP_BLENDTEXTUREALPHAPM = 15, // texture alpha + D3DTOP_BLENDCURRENTALPHA = 16, // by alpha of current color + +// Specular mapping + D3DTOP_PREMODULATE = 17, // modulate with next texture before use + D3DTOP_MODULATEALPHA_ADDCOLOR = 18, // Arg1.RGB + Arg1.A*Arg2.RGB + // COLOROP only + D3DTOP_MODULATECOLOR_ADDALPHA = 19, // Arg1.RGB*Arg2.RGB + Arg1.A + // COLOROP only + D3DTOP_MODULATEINVALPHA_ADDCOLOR = 20, // (1-Arg1.A)*Arg2.RGB + Arg1.RGB + // COLOROP only + D3DTOP_MODULATEINVCOLOR_ADDALPHA = 21, // (1-Arg1.RGB)*Arg2.RGB + Arg1.A + // COLOROP only + +// Bump mapping + D3DTOP_BUMPENVMAP = 22, // per pixel env map perturbation + D3DTOP_BUMPENVMAPLUMINANCE = 23, // with luminance channel + // This can do either diffuse or specular bump mapping with correct input. + // Performs the function (Arg1.R*Arg2.R + Arg1.G*Arg2.G + Arg1.B*Arg2.B) + // where each component has been scaled and offset to make it signed. + // The result is replicated into all four (including alpha) channels. + // This is a valid COLOROP only. + D3DTOP_DOTPRODUCT3 = 24, + + D3DTOP_FORCE_DWORD = 0x7fffffff, +} D3DTEXTUREOP; + +/* + * Values for COLORARG1,2 and ALPHAARG1,2 texture blending operations + * set in texture processing stage controls in D3DRENDERSTATE. + */ +#define D3DTA_SELECTMASK 0x0000000f // mask for arg selector +#define D3DTA_DIFFUSE 0x00000000 // select diffuse color +#define D3DTA_CURRENT 0x00000001 // select result of previous stage +#define D3DTA_TEXTURE 0x00000002 // select texture color +#define D3DTA_TFACTOR 0x00000003 // select RENDERSTATE_TEXTUREFACTOR +#if(DIRECT3D_VERSION >= 0x0700) +#define D3DTA_SPECULAR 0x00000004 // select specular color +#endif /* DIRECT3D_VERSION >= 0x0700 */ +#define D3DTA_COMPLEMENT 0x00000010 // take 1.0 - x +#define D3DTA_ALPHAREPLICATE 0x00000020 // replicate alpha to color components + +#endif //(DIRECT3D_VERSION < 0x0800) + +/* + * IDirect3DTexture2 State Filter Types + */ +typedef enum _D3DTEXTUREMAGFILTER +{ + D3DTFG_POINT = 1, // nearest + D3DTFG_LINEAR = 2, // linear interpolation + D3DTFG_FLATCUBIC = 3, // cubic + D3DTFG_GAUSSIANCUBIC = 4, // different cubic kernel + D3DTFG_ANISOTROPIC = 5, // +#if(DIRECT3D_VERSION >= 0x0700) +#endif /* DIRECT3D_VERSION >= 0x0700 */ + D3DTFG_FORCE_DWORD = 0x7fffffff, // force 32-bit size enum +} D3DTEXTUREMAGFILTER; + +typedef enum _D3DTEXTUREMINFILTER +{ + D3DTFN_POINT = 1, // nearest + D3DTFN_LINEAR = 2, // linear interpolation + D3DTFN_ANISOTROPIC = 3, // + D3DTFN_FORCE_DWORD = 0x7fffffff, // force 32-bit size enum +} D3DTEXTUREMINFILTER; + +typedef enum _D3DTEXTUREMIPFILTER +{ + D3DTFP_NONE = 1, // mipmapping disabled (use MAG filter) + D3DTFP_POINT = 2, // nearest + D3DTFP_LINEAR = 3, // linear interpolation + D3DTFP_FORCE_DWORD = 0x7fffffff, // force 32-bit size enum +} D3DTEXTUREMIPFILTER; + +#endif /* DIRECT3D_VERSION >= 0x0600 */ + +/* + * Triangle flags + */ + +/* + * Tri strip and fan flags. + * START loads all three vertices + * EVEN and ODD load just v3 with even or odd culling + * START_FLAT contains a count from 0 to 29 that allows the + * whole strip or fan to be culled in one hit. + * e.g. for a quad len = 1 + */ +#define D3DTRIFLAG_START 0x00000000L +#define D3DTRIFLAG_STARTFLAT(len) (len) /* 0 < len < 30 */ +#define D3DTRIFLAG_ODD 0x0000001eL +#define D3DTRIFLAG_EVEN 0x0000001fL + +/* + * Triangle edge flags + * enable edges for wireframe or antialiasing + */ +#define D3DTRIFLAG_EDGEENABLE1 0x00000100L /* v0-v1 edge */ +#define D3DTRIFLAG_EDGEENABLE2 0x00000200L /* v1-v2 edge */ +#define D3DTRIFLAG_EDGEENABLE3 0x00000400L /* v2-v0 edge */ +#define D3DTRIFLAG_EDGEENABLETRIANGLE \ + (D3DTRIFLAG_EDGEENABLE1 | D3DTRIFLAG_EDGEENABLE2 | D3DTRIFLAG_EDGEENABLE3) + +/* + * Primitive structures and related defines. Vertex offsets are to types + * D3DVERTEX, D3DLVERTEX, or D3DTLVERTEX. + */ + +/* + * Triangle list primitive structure + */ +typedef struct _D3DTRIANGLE { + union { + WORD v1; /* Vertex indices */ + WORD wV1; + }; + union { + WORD v2; + WORD wV2; + }; + union { + WORD v3; + WORD wV3; + }; + WORD wFlags; /* Edge (and other) flags */ +} D3DTRIANGLE, *LPD3DTRIANGLE; + +/* + * Line list structure. + * The instruction count defines the number of line segments. + */ +typedef struct _D3DLINE { + union { + WORD v1; /* Vertex indices */ + WORD wV1; + }; + union { + WORD v2; + WORD wV2; + }; +} D3DLINE, *LPD3DLINE; + +/* + * Span structure + * Spans join a list of points with the same y value. + * If the y value changes, a new span is started. + */ +typedef struct _D3DSPAN { + WORD wCount; /* Number of spans */ + WORD wFirst; /* Index to first vertex */ +} D3DSPAN, *LPD3DSPAN; + +/* + * Point structure + */ +typedef struct _D3DPOINT { + WORD wCount; /* number of points */ + WORD wFirst; /* index to first vertex */ +} D3DPOINT, *LPD3DPOINT; + + +/* + * Forward branch structure. + * Mask is logically anded with the driver status mask + * if the result equals 'value', the branch is taken. + */ +typedef struct _D3DBRANCH { + DWORD dwMask; /* Bitmask against D3D status */ + DWORD dwValue; + BOOL bNegate; /* TRUE to negate comparison */ + DWORD dwOffset; /* How far to branch forward (0 for exit)*/ +} D3DBRANCH, *LPD3DBRANCH; + +/* + * Status used for set status instruction. + * The D3D status is initialised on device creation + * and is modified by all execute calls. + */ +typedef struct _D3DSTATUS { + DWORD dwFlags; /* Do we set extents or status */ + DWORD dwStatus; /* D3D status */ + D3DRECT drExtent; +} D3DSTATUS, *LPD3DSTATUS; + +#define D3DSETSTATUS_STATUS 0x00000001L +#define D3DSETSTATUS_EXTENTS 0x00000002L +#define D3DSETSTATUS_ALL (D3DSETSTATUS_STATUS | D3DSETSTATUS_EXTENTS) + +#if(DIRECT3D_VERSION >= 0x0500) +typedef struct _D3DCLIPSTATUS { + DWORD dwFlags; /* Do we set 2d extents, 3D extents or status */ + DWORD dwStatus; /* Clip status */ + float minx, maxx; /* X extents */ + float miny, maxy; /* Y extents */ + float minz, maxz; /* Z extents */ +} D3DCLIPSTATUS, *LPD3DCLIPSTATUS; + +#define D3DCLIPSTATUS_STATUS 0x00000001L +#define D3DCLIPSTATUS_EXTENTS2 0x00000002L +#define D3DCLIPSTATUS_EXTENTS3 0x00000004L + +#endif /* DIRECT3D_VERSION >= 0x0500 */ +/* + * Statistics structure + */ +typedef struct _D3DSTATS { + DWORD dwSize; + DWORD dwTrianglesDrawn; + DWORD dwLinesDrawn; + DWORD dwPointsDrawn; + DWORD dwSpansDrawn; + DWORD dwVerticesProcessed; +} D3DSTATS, *LPD3DSTATS; + +/* + * Execute options. + * When calling using D3DEXECUTE_UNCLIPPED all the primitives + * inside the buffer must be contained within the viewport. + */ +#define D3DEXECUTE_CLIPPED 0x00000001l +#define D3DEXECUTE_UNCLIPPED 0x00000002l + +typedef struct _D3DEXECUTEDATA { + DWORD dwSize; + DWORD dwVertexOffset; + DWORD dwVertexCount; + DWORD dwInstructionOffset; + DWORD dwInstructionLength; + DWORD dwHVertexOffset; + D3DSTATUS dsStatus; /* Status after execute */ +} D3DEXECUTEDATA, *LPD3DEXECUTEDATA; + +/* + * Palette flags. + * This are or'ed with the peFlags in the PALETTEENTRYs passed to DirectDraw. + */ +#define D3DPAL_FREE 0x00 /* Renderer may use this entry freely */ +#define D3DPAL_READONLY 0x40 /* Renderer may not set this entry */ +#define D3DPAL_RESERVED 0x80 /* Renderer may not use this entry */ + + +#if(DIRECT3D_VERSION >= 0x0600) + +typedef struct _D3DVERTEXBUFFERDESC { + DWORD dwSize; + DWORD dwCaps; + DWORD dwFVF; + DWORD dwNumVertices; +} D3DVERTEXBUFFERDESC, *LPD3DVERTEXBUFFERDESC; + +#define D3DVBCAPS_SYSTEMMEMORY 0x00000800l +#define D3DVBCAPS_WRITEONLY 0x00010000l +#define D3DVBCAPS_OPTIMIZED 0x80000000l +#define D3DVBCAPS_DONOTCLIP 0x00000001l + +/* Vertex Operations for ProcessVertices */ +#define D3DVOP_LIGHT (1 << 10) +#define D3DVOP_TRANSFORM (1 << 0) +#define D3DVOP_CLIP (1 << 2) +#define D3DVOP_EXTENTS (1 << 3) + + +#if(DIRECT3D_VERSION < 0x0800) + +/* The maximum number of vertices user can pass to any d3d + drawing function or to create vertex buffer with +*/ +#define D3DMAXNUMVERTICES ((1<<16) - 1) +/* The maximum number of primitives user can pass to any d3d + drawing function. +*/ +#define D3DMAXNUMPRIMITIVES ((1<<16) - 1) + +#if(DIRECT3D_VERSION >= 0x0700) + +/* Bits for dwFlags in ProcessVertices call */ +#define D3DPV_DONOTCOPYDATA (1 << 0) + +#endif /* DIRECT3D_VERSION >= 0x0700 */ + +#endif //(DIRECT3D_VERSION < 0x0800) + +//------------------------------------------------------------------- + +#if(DIRECT3D_VERSION < 0x0800) + +// Flexible vertex format bits +// +#define D3DFVF_RESERVED0 0x001 +#define D3DFVF_POSITION_MASK 0x00E +#define D3DFVF_XYZ 0x002 +#define D3DFVF_XYZRHW 0x004 +#if(DIRECT3D_VERSION >= 0x0700) +#define D3DFVF_XYZB1 0x006 +#define D3DFVF_XYZB2 0x008 +#define D3DFVF_XYZB3 0x00a +#define D3DFVF_XYZB4 0x00c +#define D3DFVF_XYZB5 0x00e + +#endif /* DIRECT3D_VERSION >= 0x0700 */ +#define D3DFVF_NORMAL 0x010 +#define D3DFVF_RESERVED1 0x020 +#define D3DFVF_DIFFUSE 0x040 +#define D3DFVF_SPECULAR 0x080 + +#define D3DFVF_TEXCOUNT_MASK 0xf00 +#define D3DFVF_TEXCOUNT_SHIFT 8 +#define D3DFVF_TEX0 0x000 +#define D3DFVF_TEX1 0x100 +#define D3DFVF_TEX2 0x200 +#define D3DFVF_TEX3 0x300 +#define D3DFVF_TEX4 0x400 +#define D3DFVF_TEX5 0x500 +#define D3DFVF_TEX6 0x600 +#define D3DFVF_TEX7 0x700 +#define D3DFVF_TEX8 0x800 + +#define D3DFVF_RESERVED2 0xf000 // 4 reserved bits + +#else +#define D3DFVF_RESERVED1 0x020 +#endif //(DIRECT3D_VERSION < 0x0800) + +#define D3DFVF_VERTEX ( D3DFVF_XYZ | D3DFVF_NORMAL | D3DFVF_TEX1 ) +#define D3DFVF_LVERTEX ( D3DFVF_XYZ | D3DFVF_RESERVED1 | D3DFVF_DIFFUSE | \ + D3DFVF_SPECULAR | D3DFVF_TEX1 ) +#define D3DFVF_TLVERTEX ( D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | \ + D3DFVF_TEX1 ) + + +typedef struct _D3DDP_PTRSTRIDE +{ + LPVOID lpvData; + DWORD dwStride; +} D3DDP_PTRSTRIDE; + +#define D3DDP_MAXTEXCOORD 8 + +typedef struct _D3DDRAWPRIMITIVESTRIDEDDATA +{ + D3DDP_PTRSTRIDE position; + D3DDP_PTRSTRIDE normal; + D3DDP_PTRSTRIDE diffuse; + D3DDP_PTRSTRIDE specular; + D3DDP_PTRSTRIDE textureCoords[D3DDP_MAXTEXCOORD]; +} D3DDRAWPRIMITIVESTRIDEDDATA, *LPD3DDRAWPRIMITIVESTRIDEDDATA; +//--------------------------------------------------------------------- +// ComputeSphereVisibility return values +// +#define D3DVIS_INSIDE_FRUSTUM 0 +#define D3DVIS_INTERSECT_FRUSTUM 1 +#define D3DVIS_OUTSIDE_FRUSTUM 2 +#define D3DVIS_INSIDE_LEFT 0 +#define D3DVIS_INTERSECT_LEFT (1 << 2) +#define D3DVIS_OUTSIDE_LEFT (2 << 2) +#define D3DVIS_INSIDE_RIGHT 0 +#define D3DVIS_INTERSECT_RIGHT (1 << 4) +#define D3DVIS_OUTSIDE_RIGHT (2 << 4) +#define D3DVIS_INSIDE_TOP 0 +#define D3DVIS_INTERSECT_TOP (1 << 6) +#define D3DVIS_OUTSIDE_TOP (2 << 6) +#define D3DVIS_INSIDE_BOTTOM 0 +#define D3DVIS_INTERSECT_BOTTOM (1 << 8) +#define D3DVIS_OUTSIDE_BOTTOM (2 << 8) +#define D3DVIS_INSIDE_NEAR 0 +#define D3DVIS_INTERSECT_NEAR (1 << 10) +#define D3DVIS_OUTSIDE_NEAR (2 << 10) +#define D3DVIS_INSIDE_FAR 0 +#define D3DVIS_INTERSECT_FAR (1 << 12) +#define D3DVIS_OUTSIDE_FAR (2 << 12) + +#define D3DVIS_MASK_FRUSTUM (3 << 0) +#define D3DVIS_MASK_LEFT (3 << 2) +#define D3DVIS_MASK_RIGHT (3 << 4) +#define D3DVIS_MASK_TOP (3 << 6) +#define D3DVIS_MASK_BOTTOM (3 << 8) +#define D3DVIS_MASK_NEAR (3 << 10) +#define D3DVIS_MASK_FAR (3 << 12) + +#endif /* DIRECT3D_VERSION >= 0x0600 */ + +#if(DIRECT3D_VERSION < 0x0800) + +#if(DIRECT3D_VERSION >= 0x0700) + +// To be used with GetInfo() +#define D3DDEVINFOID_TEXTUREMANAGER 1 +#define D3DDEVINFOID_D3DTEXTUREMANAGER 2 +#define D3DDEVINFOID_TEXTURING 3 + +typedef enum _D3DSTATEBLOCKTYPE +{ + D3DSBT_ALL = 1, // capture all state + D3DSBT_PIXELSTATE = 2, // capture pixel state + D3DSBT_VERTEXSTATE = 3, // capture vertex state + D3DSBT_FORCE_DWORD = 0xffffffff +} D3DSTATEBLOCKTYPE; + +// The D3DVERTEXBLENDFLAGS type is used with D3DRENDERSTATE_VERTEXBLEND state. +// +typedef enum _D3DVERTEXBLENDFLAGS +{ + D3DVBLEND_DISABLE = 0, // Disable vertex blending + D3DVBLEND_1WEIGHT = 1, // blend between 2 matrices + D3DVBLEND_2WEIGHTS = 2, // blend between 3 matrices + D3DVBLEND_3WEIGHTS = 3, // blend between 4 matrices +} D3DVERTEXBLENDFLAGS; + +typedef enum _D3DTEXTURETRANSFORMFLAGS { + D3DTTFF_DISABLE = 0, // texture coordinates are passed directly + D3DTTFF_COUNT1 = 1, // rasterizer should expect 1-D texture coords + D3DTTFF_COUNT2 = 2, // rasterizer should expect 2-D texture coords + D3DTTFF_COUNT3 = 3, // rasterizer should expect 3-D texture coords + D3DTTFF_COUNT4 = 4, // rasterizer should expect 4-D texture coords + D3DTTFF_PROJECTED = 256, // texcoords to be divided by COUNTth element + D3DTTFF_FORCE_DWORD = 0x7fffffff, +} D3DTEXTURETRANSFORMFLAGS; + +// Macros to set texture coordinate format bits in the FVF id + +#define D3DFVF_TEXTUREFORMAT2 0 // Two floating point values +#define D3DFVF_TEXTUREFORMAT1 3 // One floating point value +#define D3DFVF_TEXTUREFORMAT3 1 // Three floating point values +#define D3DFVF_TEXTUREFORMAT4 2 // Four floating point values + +#define D3DFVF_TEXCOORDSIZE3(CoordIndex) (D3DFVF_TEXTUREFORMAT3 << (CoordIndex*2 + 16)) +#define D3DFVF_TEXCOORDSIZE2(CoordIndex) (D3DFVF_TEXTUREFORMAT2) +#define D3DFVF_TEXCOORDSIZE4(CoordIndex) (D3DFVF_TEXTUREFORMAT4 << (CoordIndex*2 + 16)) +#define D3DFVF_TEXCOORDSIZE1(CoordIndex) (D3DFVF_TEXTUREFORMAT1 << (CoordIndex*2 + 16)) + + +#endif /* DIRECT3D_VERSION >= 0x0700 */ + +#else +// +// legacy vertex blend names +// +typedef enum _D3DVERTEXBLENDFLAGS D3DVERTEXBLENDFLAGS; +#define D3DVBLEND_DISABLE (D3DVERTEXBLENDFLAGS)0 +#define D3DVBLEND_1WEIGHT (D3DVERTEXBLENDFLAGS)1 +#define D3DVBLEND_2WEIGHTS (D3DVERTEXBLENDFLAGS)2 +#define D3DVBLEND_3WEIGHTS (D3DVERTEXBLENDFLAGS)3 + +#endif //(DIRECT3D_VERSION < 0x0800) + +#pragma pack() +#pragma warning(default:4201) + +#endif /* _D3DTYPES_H_ */ + diff --git a/Include/dxwnd.h b/Include/dxwnd.h index a2d3fdb..4482ee8 100644 --- a/Include/dxwnd.h +++ b/Include/dxwnd.h @@ -102,6 +102,7 @@ #define BUFFEREDIOFIX 0x00100000 // fix buffered IO incompatibilities between pre-Win98 and post-WinNT #define FILTERMESSAGES 0x00200000 // ignore offending messages that are typical of a window and are hot handled by a fullscreeen app #define PEEKALLMESSAGES 0x00400000 // force Peek-ing all sort of messages to avoid Win7 message queue saturation that leads to program halt +#define SURFACEWARN 0x00800000 // warn when a unclassified surface capability is met (debug only!) // logging Tflags DWORD: #define OUTTRACE 0x00000001 // enables tracing to dxwnd.log in general diff --git a/build/dxwnd.3.ini b/build/dxwnd.3.ini new file mode 100644 index 0000000..00c9d6c --- /dev/null +++ b/build/dxwnd.3.ini @@ -0,0 +1,167 @@ +[window] +posx=1452 +posy=365 +sizx=320 +sizy=514 +[target] +title0=Rayman 2 Demo +path0=D:\Games\Rayman2Demo\Rayman2Demo.exe +module0= +opengllib0= +ver0=1 +coord0=0 +flag0=402653217 +flagg0=1210056704 +flagh0=2097172 +flagi0=0 +tflag0=64 +initx0=0 +inity0=0 +minx0=0 +miny0=0 +maxx0=0 +maxy0=0 +posx0=50 +posy0=50 +sizx0=800 +sizy0=600 +maxfps0=0 +initts0=0 +title1=Mirror's Edge +path1=D:\Games\Mirror's Edge\Binaries\MirrorsEdge.exe +module1= +opengllib1= +ver1=0 +coord1=0 +flag1=-2013265882 +flagg1=1207959552 +flagh1=2097172 +flagi1=0 +tflag1=5 +initx1=0 +inity1=0 +minx1=0 +miny1=0 +maxx1=0 +maxy1=0 +posx1=50 +posy1=50 +sizx1=800 +sizy1=600 +maxfps1=0 +initts1=6 +title2=LastHalfWin.exe +path2=D:\Games\Last Half Of Darkness\LastHalfWin.exe +module2= +opengllib2= +ver2=1 +coord2=0 +flag2=134217760 +flagg2=1207959552 +flagh2=4 +flagi2=0 +tflag2=512 +initx2=0 +inity2=0 +minx2=0 +miny2=0 +maxx2=0 +maxy2=0 +posx2=50 +posy2=50 +sizx2=800 +sizy2=600 +maxfps2=0 +initts2=0 +title3=DOOM95.EXE +path3=D:\Games\Doom95i\DOOM95.EXE +module3= +opengllib3= +ver3=0 +coord3=0 +flag3=134217762 +flagg3=1207959552 +flagh3=20 +flagi3=0 +tflag3=512 +initx3=0 +inity3=0 +minx3=0 +miny3=0 +maxx3=0 +maxy3=0 +posx3=50 +posy3=50 +sizx3=800 +sizy3=600 +maxfps3=0 +initts3=0 +title4=CNC3.exe +path4=D:\Games\Command & Conquer 3\CNC3.exe +module4= +opengllib4= +ver4=9 +coord4=0 +flag4=134217762 +flagg4=1207959552 +flagh4=20 +flagi4=0 +tflag4=512 +initx4=0 +inity4=0 +minx4=0 +miny4=0 +maxx4=0 +maxy4=0 +posx4=50 +posy4=50 +sizx4=800 +sizy4=600 +maxfps4=0 +initts4=0 +title5=Div.exe +path5=D:\Games\Beyond Divinity\Div.exe +module5= +opengllib5= +ver5=0 +coord5=0 +flag5=134217762 +flagg5=1207959552 +flagh5=20 +flagi5=0 +tflag5=512 +initx5=0 +inity5=0 +minx5=0 +miny5=0 +maxx5=0 +maxy5=0 +posx5=50 +posy5=50 +sizx5=800 +sizy5=600 +maxfps5=0 +initts5=0 +title6=martian gothic.exe +path6=D:\Games\Martian Gothic\martian gothic.exe +module6= +opengllib6= +ver6=7 +coord6=0 +flag6=201326626 +flagg6=1208090624 +flagh6=276 +flagi6=0 +tflag6=263 +initx6=0 +inity6=0 +minx6=0 +miny6=0 +maxx6=0 +maxy6=0 +posx6=50 +posy6=50 +sizx6=800 +sizy6=600 +maxfps6=0 +initts6=0 diff --git a/build/dxwnd.4.ini b/build/dxwnd.4.ini new file mode 100644 index 0000000..3ac8a3b --- /dev/null +++ b/build/dxwnd.4.ini @@ -0,0 +1,2214 @@ +[target] +title0=101 Airborne Invasion +path0=D:\Games\101air\101.exe +module0= +opengllib0= +ver0=0 +coord0=0 +flag0=134217762 +flagg0=134217728 +flagh0=20 +flagi0=0 +tflag0=0 +initx0=0 +inity0=0 +minx0=0 +miny0=0 +maxx0=0 +maxy0=0 +posx0=50 +posy0=50 +sizx0=800 +sizy0=600 +maxfps0=0 +initts0=0 +title1=688I Hunter Killer +path1=D:\Games\688\688I_HK.EXE +module1= +opengllib1= +ver1=0 +coord1=1 +flag1=1209532962 +flagg1=135266304 +flagh1=20 +flagi1=0 +tflag1=0 +initx1=0 +inity1=0 +minx1=0 +miny1=0 +maxx1=0 +maxy1=0 +posx1=50 +posy1=50 +sizx1=800 +sizy1=600 +maxfps1=0 +initts1=0 +title2=A10 Cuba +path2=D:\Games\A10\A10Cuba.exe +module2= +opengllib2= +ver2=0 +coord2=0 +flag2=134217762 +flagg2=1207959552 +flagh2=20 +flagi2=0 +tflag2=0 +initx2=0 +inity2=0 +minx2=0 +miny2=0 +maxx2=0 +maxy2=0 +posx2=50 +posy2=50 +sizx2=800 +sizy2=600 +maxfps2=0 +initts2=0 +title3=Abomination the Nemesis Project +path3=D:\Games\Abomination\Abomb.exe +module3= +opengllib3= +ver3=0 +coord3=0 +flag3=134217762 +flagg3=1207959552 +flagh3=20 +flagi3=0 +tflag3=66 +initx3=0 +inity3=0 +minx3=0 +miny3=0 +maxx3=0 +maxy3=0 +posx3=50 +posy3=50 +sizx3=800 +sizy3=600 +maxfps3=0 +initts3=0 +title4=ACabal95.exe +path4=D:\Games\Alien_cabal\ACabal95.exe +module4= +opengllib4= +ver4=0 +coord4=0 +flag4=671088674 +flagg4=1209008128 +flagh4=20 +flagi4=0 +tflag4=258 +initx4=0 +inity4=0 +minx4=0 +miny4=0 +maxx4=0 +maxy4=0 +posx4=50 +posy4=50 +sizx4=800 +sizy4=600 +maxfps4=0 +initts4=0 +title5=Actua Soccer 3 +path5=D:\Games\ActuaSoccer3\Soccer3.exe +module5= +opengllib5= +ver5=0 +coord5=0 +flag5=671088674 +flagg5=134217728 +flagh5=20 +flagi5=0 +tflag5=67 +initx5=0 +inity5=0 +minx5=0 +miny5=0 +maxx5=0 +maxy5=0 +posx5=50 +posy5=50 +sizx5=800 +sizy5=600 +maxfps5=0 +initts5=0 +title6=Akuma Demon Spawn - Lamentation Sword +path6=D:\Games\Akuma Demon Spawn - Lamentation Sword (1999)\Akuma\Akuma.EXE +module6= +opengllib6= +ver6=0 +coord6=0 +flag6=134217762 +flagg6=1207959554 +flagh6=20 +flagi6=0 +tflag6=0 +initx6=0 +inity6=0 +minx6=0 +miny6=0 +maxx6=0 +maxy6=0 +posx6=50 +posy6=50 +sizx6=800 +sizy6=600 +maxfps6=0 +initts6=0 +title7=Ancient Conquest +path7=D:\Games\Ancient Conquest\ANCIENT.EXE +module7= +opengllib7= +ver7=0 +coord7=0 +flag7=671088674 +flagg7=1207959552 +flagh7=20 +flagi7=0 +tflag7=338 +initx7=0 +inity7=0 +minx7=0 +miny7=0 +maxx7=0 +maxy7=0 +posx7=50 +posy7=50 +sizx7=800 +sizy7=600 +maxfps7=0 +initts7=0 +title8=Army Men RTS +path8=D:\Games\Army Men RTS\amrts.exe +module8= +opengllib8= +ver8=0 +coord8=0 +flag8=134217762 +flagg8=1207959552 +flagh8=20 +flagi8=0 +tflag8=0 +initx8=0 +inity8=0 +minx8=0 +miny8=0 +maxx8=0 +maxy8=0 +posx8=50 +posy8=50 +sizx8=800 +sizy8=600 +maxfps8=0 +initts8=0 +title9=Balls of Steel +path9=D:\Games\Balls of Steel\bos.exe +module9=duke.ddp mutation.ddp +opengllib9= +ver9=0 +coord9=0 +flag9=167772192 +flagg9=202375169 +flagh9=20 +flagi9=0 +tflag9=262 +initx9=0 +inity9=0 +minx9=0 +miny9=0 +maxx9=0 +maxy9=0 +posx9=50 +posy9=50 +sizx9=800 +sizy9=600 +maxfps9=0 +initts9=0 +title10=Barrage +path10=D:\Games\Barrage\SRC\BARRAGE.EXE +module10= +opengllib10= +ver10=0 +coord10=0 +flag10=142606368 +flagg10=134217728 +flagh10=8212 +flagi10=0 +tflag10=6 +initx10=0 +inity10=0 +minx10=0 +miny10=0 +maxx10=0 +maxy10=0 +posx10=50 +posy10=50 +sizx10=800 +sizy10=600 +maxfps10=0 +initts10=0 +title11=Beavis & ButtHead do U. +path11=D:\Games\B_b\BEAVIS.EXE +module11= +opengllib11= +ver11=0 +coord11=0 +flag11=134217762 +flagg11=1207959552 +flagh11=20 +flagi11=0 +tflag11=3 +initx11=0 +inity11=0 +minx11=0 +miny11=0 +maxx11=0 +maxy11=0 +posx11=50 +posy11=50 +sizx11=800 +sizy11=600 +maxfps11=0 +initts11=0 +title12=Beyond Divinity +path12=D:\Games\Beyond Divinity\Div.exe +module12= +opengllib12= +ver12=0 +coord12=0 +flag12=134217762 +flagg12=1207959552 +flagh12=20 +flagi12=0 +tflag12=0 +initx12=0 +inity12=0 +minx12=0 +miny12=0 +maxx12=0 +maxy12=0 +posx12=50 +posy12=50 +sizx12=800 +sizy12=600 +maxfps12=0 +initts12=0 +title13=Black & White +path13=D:\Games\Black & White\runblack.exe +module13= +opengllib13= +ver13=0 +coord13=0 +flag13=679477280 +flagg13=1207959552 +flagh13=20 +flagi13=0 +tflag13=3 +initx13=0 +inity13=0 +minx13=0 +miny13=0 +maxx13=0 +maxy13=0 +posx13=50 +posy13=50 +sizx13=800 +sizy13=600 +maxfps13=0 +initts13=0 +title14=Black & White 2 Demo +path14=D:\Games\Black & White 2 Demo\BW2Demo.exe +module14= +opengllib14= +ver14=0 +coord14=0 +flag14=134217762 +flagg14=1208090624 +flagh14=20 +flagi14=0 +tflag14=1 +initx14=0 +inity14=0 +minx14=0 +miny14=0 +maxx14=0 +maxy14=0 +posx14=50 +posy14=50 +sizx14=800 +sizy14=600 +maxfps14=0 +initts14=0 +title15=Carnivores +path15=D:\Games\Carnivores\HUNTSOFT.EXE +module15= +opengllib15= +ver15=0 +coord15=1 +flag15=939524130 +flagg15=135266320 +flagh15=20 +flagi15=0 +tflag15=66 +initx15=0 +inity15=0 +minx15=0 +miny15=0 +maxx15=0 +maxy15=0 +posx15=50 +posy15=50 +sizx15=800 +sizy15=600 +maxfps15=0 +initts15=0 +title16=Cave Story (ITA) +path16=D:\Games\Cave Story\Doukutsu.exe +module16= +opengllib16= +ver16=0 +coord16=0 +flag16=134221858 +flagg16=1207959552 +flagh16=32790 +flagi16=0 +tflag16=2 +initx16=0 +inity16=0 +minx16=0 +miny16=0 +maxx16=0 +maxy16=0 +posx16=50 +posy16=50 +sizx16=800 +sizy16=600 +maxfps16=0 +initts16=0 +title17=Chariots of War +path17=D:\Games\Chariots of War\CoW.exe +module17= +opengllib17= +ver17=0 +coord17=0 +flag17=134217762 +flagg17=1207959552 +flagh17=20 +flagi17=0 +tflag17=0 +initx17=0 +inity17=0 +minx17=0 +miny17=0 +maxx17=0 +maxy17=0 +posx17=50 +posy17=50 +sizx17=800 +sizy17=600 +maxfps17=0 +initts17=0 +title18=Command & Conquer 3 +path18=D:\Games\Command & Conquer 3\CNC3.exe +module18= +opengllib18= +ver18=0 +coord18=0 +flag18=134217762 +flagg18=1207959552 +flagh18=20 +flagi18=0 +tflag18=0 +initx18=0 +inity18=0 +minx18=0 +miny18=0 +maxx18=0 +maxy18=0 +posx18=50 +posy18=50 +sizx18=800 +sizy18=600 +maxfps18=0 +initts18=0 +title19=Commandos II +path19=D:\Games\Commandos II\comm2.exe +module19= +opengllib19= +ver19=0 +coord19=0 +flag19=134217762 +flagg19=134217728 +flagh19=20 +flagi19=0 +tflag19=64 +initx19=0 +inity19=0 +minx19=0 +miny19=0 +maxx19=0 +maxy19=0 +posx19=50 +posy19=50 +sizx19=800 +sizy19=600 +maxfps19=0 +initts19=0 +title20=Crazy Frog Racer +path20=D:\Games\CrazyFrog\CRAZY.EXE +module20= +opengllib20= +ver20=8 +coord20=0 +flag20=134217762 +flagg20=134217729 +flagh20=20 +flagi20=0 +tflag20=64 +initx20=0 +inity20=0 +minx20=0 +miny20=0 +maxx20=0 +maxy20=0 +posx20=50 +posy20=50 +sizx20=800 +sizy20=600 +maxfps20=0 +initts20=0 +title21=Crazy Taxy +path21=D:\Games\Crazy_Taxi\Crazy Taxi PC Version\crazy_taxi_pc.exe +module21= +opengllib21= +ver21=0 +coord21=0 +flag21=671219744 +flagg21=134217728 +flagh21=20 +flagi21=0 +tflag21=66 +initx21=0 +inity21=0 +minx21=0 +miny21=0 +maxx21=0 +maxy21=0 +posx21=50 +posy21=50 +sizx21=800 +sizy21=600 +maxfps21=0 +initts21=0 +title22=Dark Angael +path22=D:\Games\Dark Angael\GAME.EXE +module22= +opengllib22= +ver22=0 +coord22=0 +flag22=134217762 +flagg22=134217728 +flagh22=20 +flagi22=0 +tflag22=0 +initx22=0 +inity22=0 +minx22=0 +miny22=0 +maxx22=0 +maxy22=0 +posx22=50 +posy22=50 +sizx22=800 +sizy22=600 +maxfps22=0 +initts22=0 +title23=Dark Colony +path23=D:\Games\Dark Colony\DCOLONY\DC.EXE +module23= +opengllib23= +ver23=0 +coord23=0 +flag23=134217762 +flagg23=135266304 +flagh23=20 +flagi23=0 +tflag23=2 +initx23=0 +inity23=0 +minx23=0 +miny23=0 +maxx23=0 +maxy23=0 +posx23=50 +posy23=50 +sizx23=800 +sizy23=600 +maxfps23=0 +initts23=0 +title24=Dark Judgement +path24=D:\Games\Dark Judgement\Dark Judgement.EXE +module24= +opengllib24= +ver24=0 +coord24=0 +flag24=134217826 +flagg24=134217728 +flagh24=20 +flagi24=0 +tflag24=2 +initx24=0 +inity24=0 +minx24=0 +miny24=0 +maxx24=0 +maxy24=0 +posx24=50 +posy24=50 +sizx24=800 +sizy24=600 +maxfps24=0 +initts24=0 +title25=Dark Vengeance +path25=D:\Games\dark_vengeance\dv.exe +module25= +opengllib25= +ver25=0 +coord25=0 +flag25=142606386 +flagg25=134217728 +flagh25=6299668 +flagi25=0 +tflag25=258 +initx25=0 +inity25=0 +minx25=0 +miny25=0 +maxx25=800 +maxy25=600 +posx25=50 +posy25=50 +sizx25=800 +sizy25=600 +maxfps25=0 +initts25=0 +title26=Descent 3 +path26=D:\Games\Descent_3\Descent 3.exe +module26= +opengllib26= +ver26=0 +coord26=0 +flag26=134217760 +flagg26=134348801 +flagh26=4 +flagi26=0 +tflag26=0 +initx26=0 +inity26=0 +minx26=0 +miny26=0 +maxx26=0 +maxy26=0 +posx26=50 +posy26=50 +sizx26=800 +sizy26=600 +maxfps26=0 +initts26=0 +title27=Descent 3 main +path27=D:\Games\Descent_3\main.exe +module27= +opengllib27= +ver27=0 +coord27=0 +flag27=771891234 +flagg27=-1946025984 +flagh27=8212 +flagi27=0 +tflag27=2 +initx27=0 +inity27=0 +minx27=0 +miny27=0 +maxx27=0 +maxy27=0 +posx27=50 +posy27=50 +sizx27=800 +sizy27=600 +maxfps27=0 +initts27=0 +title28=Dethkarz.exe +path28=D:\Games\DethKarz\Dethkarz.exe +module28= +opengllib28= +ver28=0 +coord28=0 +flag28=671088672 +flagg28=134217728 +flagh28=276 +flagi28=0 +tflag28=258 +initx28=0 +inity28=0 +minx28=0 +miny28=0 +maxx28=0 +maxy28=0 +posx28=50 +posy28=50 +sizx28=800 +sizy28=600 +maxfps28=0 +initts28=0 +title29=Diablo +path29=D:\Games\Diablo\Diablo.exe +module29= +opengllib29= +ver29=0 +coord29=1 +flag29=134217762 +flagg29=134217728 +flagh29=20 +flagi29=0 +tflag29=322 +initx29=0 +inity29=0 +minx29=0 +miny29=0 +maxx29=0 +maxy29=0 +posx29=50 +posy29=50 +sizx29=0 +sizy29=0 +maxfps29=0 +initts29=0 +title30=Doom 3 +path30=D:\Games\Doom 3\Doom3.exe +module30= +opengllib30= +ver30=0 +coord30=0 +flag30=134217762 +flagg30=1207959552 +flagh30=20 +flagi30=0 +tflag30=0 +initx30=0 +inity30=0 +minx30=0 +miny30=0 +maxx30=0 +maxy30=0 +posx30=50 +posy30=50 +sizx30=800 +sizy30=600 +maxfps30=0 +initts30=0 +title31=Duckman +path31=D:\Games\duckman\DUCKMAN.EXE +module31= +opengllib31= +ver31=0 +coord31=0 +flag31=402653218 +flagg31=134217744 +flagh31=1049620 +flagi31=0 +tflag31=2 +initx31=0 +inity31=0 +minx31=0 +miny31=0 +maxx31=0 +maxy31=0 +posx31=50 +posy31=50 +sizx31=800 +sizy31=600 +maxfps31=0 +initts31=0 +title32=Dungeon Keeper 2 +path32=D:\Games\Dungeon Keeper 2\DKII.exe +module32= +opengllib32= +ver32=0 +coord32=0 +flag32=134217762 +flagg32=1241513984 +flagh32=20 +flagi32=0 +tflag32=3 +initx32=0 +inity32=0 +minx32=0 +miny32=0 +maxx32=0 +maxy32=0 +posx32=50 +posy32=50 +sizx32=800 +sizy32=600 +maxfps32=0 +initts32=0 +title33=Dweep +path33=D:\Games\dweep\Dweep.exe +module33= +opengllib33= +ver33=0 +coord33=0 +flag33=134234146 +flagg33=134283264 +flagh33=1048596 +flagi33=0 +tflag33=0 +initx33=0 +inity33=0 +minx33=0 +miny33=0 +maxx33=0 +maxy33=0 +posx33=50 +posy33=50 +sizx33=800 +sizy33=600 +maxfps33=0 +initts33=2 +title34=Dylan Dog Horror Luna Park +path34=D:\Games\Dylan Dog\hlp.exe +module34= +opengllib34= +ver34=1 +coord34=0 +flag34=134217762 +flagg34=135266304 +flagh34=1048596 +flagi34=0 +tflag34=0 +initx34=0 +inity34=0 +minx34=0 +miny34=0 +maxx34=0 +maxy34=0 +posx34=50 +posy34=50 +sizx34=0 +sizy34=0 +maxfps34=0 +initts34=0 +title35=Eliminator +path35=D:\Games\eliminat\Eliminator.exe +module35= +opengllib35= +ver35=1 +coord35=0 +flag35=134217762 +flagg35=134217728 +flagh35=1044 +flagi35=0 +tflag35=2 +initx35=0 +inity35=0 +minx35=0 +miny35=0 +maxx35=0 +maxy35=0 +posx35=800 +posy35=600 +sizx35=400 +sizy35=300 +maxfps35=0 +initts35=0 +title36=EMERGY.EXE +path36=D:\Games\Emergency\EMERGY.EXE +module36= +opengllib36= +ver36=0 +coord36=0 +flag36=134283298 +flagg36=134217728 +flagh36=20 +flagi36=0 +tflag36=0 +initx36=0 +inity36=0 +minx36=0 +miny36=0 +maxx36=0 +maxy36=0 +posx36=50 +posy36=50 +sizx36=800 +sizy36=600 +maxfps36=0 +initts36=0 +title37=EMPIRES.EXE +path37=D:\Games\Age of Empires\EMPIRES.EXE +module37= +opengllib37= +ver37=0 +coord37=0 +flag37=134217762 +flagg37=134217728 +flagh37=1048596 +flagi37=0 +tflag37=64 +initx37=0 +inity37=0 +minx37=0 +miny37=0 +maxx37=0 +maxy37=0 +posx37=50 +posy37=50 +sizx37=800 +sizy37=600 +maxfps37=0 +initts37=0 +title38=EPIC40K.EXE +path38=D:\Games\war_hammer_final_liberation\EPIC40K.EXE +module38= +opengllib38= +ver38=0 +coord38=0 +flag38=-1476263902 +flagg38=135266304 +flagh38=2097172 +flagi38=0 +tflag38=0 +initx38=0 +inity38=0 +minx38=0 +miny38=0 +maxx38=0 +maxy38=0 +posx38=50 +posy38=50 +sizx38=800 +sizy38=600 +maxfps38=0 +initts38=0 +title39=Evany.exe +path39=D:\Games\Evany La chiave per mondi sconosciuti\Evany.exe +module39= +opengllib39= +ver39=0 +coord39=0 +flag39=738197538 +flagg39=1207959552 +flagh39=20 +flagi39=0 +tflag39=274 +initx39=0 +inity39=0 +minx39=0 +miny39=0 +maxx39=0 +maxy39=0 +posx39=50 +posy39=50 +sizx39=800 +sizy39=600 +maxfps39=0 +initts39=0 +title40=Evil Dead +path40=D:\Games\Evil Dead\EvilDead.exe +module40= +opengllib40= +ver40=0 +coord40=0 +flag40=-2013265888 +flagg40=1207959552 +flagh40=4 +flagi40=0 +tflag40=0 +initx40=0 +inity40=0 +minx40=0 +miny40=0 +maxx40=0 +maxy40=0 +posx40=50 +posy40=50 +sizx40=800 +sizy40=600 +maxfps40=0 +initts40=0 +title41=Fable - The Lost Chapters +path41=D:\Games\Fable - The Lost Chapters\Fable.exe +module41= +opengllib41= +ver41=9 +coord41=1 +flag41=134217760 +flagg41=201457672 +flagh41=20 +flagi41=0 +tflag41=258 +initx41=0 +inity41=0 +minx41=0 +miny41=0 +maxx41=0 +maxy41=0 +posx41=50 +posy41=50 +sizx41=800 +sizy41=600 +maxfps41=0 +initts41=0 +title42=Fallout +path42=D:\Games\Fallout\FALLOUTW.EXE +module42= +opengllib42= +ver42=1 +coord42=3 +flag42=134217762 +flagg42=134217728 +flagh42=1048596 +flagi42=0 +tflag42=66 +initx42=0 +inity42=0 +minx42=0 +miny42=0 +maxx42=0 +maxy42=0 +posx42=50 +posy42=50 +sizx42=800 +sizy42=600 +maxfps42=0 +initts42=0 +title43=Fighting Forces +path43=D:\Games\Fighting Forces\FFORCE.EXE +module43= +opengllib43= +ver43=0 +coord43=0 +flag43=134217762 +flagg43=671088640 +flagh43=3092 +flagi43=0 +tflag43=258 +initx43=0 +inity43=0 +minx43=0 +miny43=0 +maxx43=0 +maxy43=0 +posx43=50 +posy43=50 +sizx43=800 +sizy43=600 +maxfps43=0 +initts43=0 +title44=Final Fighter +path44=D:\Games\Final Fighter\FinalFighter.exe +module44= +opengllib44= +ver44=0 +coord44=0 +flag44=939524128 +flagg44=135266305 +flagh44=4 +flagi44=0 +tflag44=512 +initx44=0 +inity44=0 +minx44=0 +miny44=0 +maxx44=0 +maxy44=0 +posx44=50 +posy44=50 +sizx44=800 +sizy44=600 +maxfps44=0 +initts44=0 +title45=Final Odyssey +path45=D:\Games\Final odyssey\FinalOdy.exe +module45= +opengllib45= +ver45=0 +coord45=0 +flag45=134217760 +flagg45=134217728 +flagh45=4 +flagi45=0 +tflag45=64 +initx45=0 +inity45=0 +minx45=0 +miny45=0 +maxx45=0 +maxy45=0 +posx45=50 +posy45=50 +sizx45=800 +sizy45=600 +maxfps45=0 +initts45=0 +title46=Forsaken HW +path46=D:\Games\Forsaken\ForsakenHW.exe +module46= +opengllib46= +ver46=0 +coord46=0 +flag46=134217760 +flagg46=1207959552 +flagh46=20 +flagi46=0 +tflag46=0 +initx46=0 +inity46=0 +minx46=0 +miny46=0 +maxx46=0 +maxy46=0 +posx46=50 +posy46=50 +sizx46=800 +sizy46=600 +maxfps46=0 +initts46=0 +title47=Forsaken SW +path47=D:\Games\Forsaken\ForsakenSW.exe +module47= +opengllib47= +ver47=0 +coord47=0 +flag47=134217760 +flagg47=1207959552 +flagh47=65556 +flagi47=0 +tflag47=258 +initx47=0 +inity47=0 +minx47=0 +miny47=0 +maxx47=0 +maxy47=0 +posx47=50 +posy47=50 +sizx47=800 +sizy47=600 +maxfps47=0 +initts47=0 +title48=Fuel +path48=D:\Games\Codemasters\FUEL\FUEL.exe +module48= +opengllib48= +ver48=0 +coord48=0 +flag48=134217762 +flagg48=1207959552 +flagh48=20 +flagi48=0 +tflag48=0 +initx48=0 +inity48=0 +minx48=0 +miny48=0 +maxx48=0 +maxy48=0 +posx48=50 +posy48=50 +sizx48=800 +sizy48=600 +maxfps48=0 +initts48=0 +title49=Gangsters 2 +path49=D:\Games\Gangsters 2\Gangsters2.exe +module49= +opengllib49= +ver49=0 +coord49=0 +flag49=134217762 +flagg49=134217728 +flagh49=20 +flagi49=0 +tflag49=2 +initx49=0 +inity49=0 +minx49=0 +miny49=0 +maxx49=0 +maxy49=0 +posx49=50 +posy49=50 +sizx49=800 +sizy49=600 +maxfps49=0 +initts49=0 +title50=GeneRally +path50=D:\Games\generally105\GeneRally.exe +module50= +opengllib50= +ver50=7 +coord50=0 +flag50=134234146 +flagg50=135266305 +flagh50=20 +flagi50=0 +tflag50=0 +initx50=0 +inity50=0 +minx50=0 +miny50=0 +maxx50=0 +maxy50=0 +posx50=50 +posy50=50 +sizx50=800 +sizy50=600 +maxfps50=0 +initts50=0 +title51=Gex +path51=D:\Games\gex\GEX.EXE +module51= +opengllib51= +ver51=0 +coord51=0 +flag51=134217763 +flagg51=134217728 +flagh51=20 +flagi51=0 +tflag51=66 +initx51=0 +inity51=0 +minx51=0 +miny51=0 +maxx51=0 +maxy51=0 +posx51=50 +posy51=50 +sizx51=800 +sizy51=600 +maxfps51=0 +initts51=0 +title52=G-Nome +path52=D:\Games\G-Nome\G-NOME.EXE +module52= +opengllib52= +ver52=0 +coord52=0 +flag52=714084386 +flagg52=201326592 +flagh52=33300 +flagi52=0 +tflag52=0 +initx52=0 +inity52=0 +minx52=0 +miny52=0 +maxx52=0 +maxy52=0 +posx52=250 +posy52=250 +sizx52=800 +sizy52=600 +maxfps52=0 +initts52=0 +title53=gpl.exe +path53=D:\Games\Grand Prix Legends\gpl\gpl.exe +module53= +opengllib53= +ver53=0 +coord53=0 +flag53=-1467875294 +flagg53=135266304 +flagh53=20 +flagi53=0 +tflag53=322 +initx53=0 +inity53=0 +minx53=0 +miny53=0 +maxx53=0 +maxy53=0 +posx53=50 +posy53=50 +sizx53=800 +sizy53=600 +maxfps53=0 +initts53=0 +title54=Hard Truck - Road to Victory +path54=C:\Hard Truck\HTruck.exe +module54= +opengllib54= +ver54=0 +coord54=0 +flag54=134217760 +flagg54=134217728 +flagh54=2068 +flagi54=0 +tflag54=0 +initx54=0 +inity54=0 +minx54=0 +miny54=0 +maxx54=0 +maxy54=0 +posx54=50 +posy54=50 +sizx54=800 +sizy54=600 +maxfps54=0 +initts54=0 +title55=Hellcopter +path55=D:\Games\Hellcopter\HCopter.exe +module55= +opengllib55= +ver55=0 +coord55=0 +flag55=134217762 +flagg55=134217728 +flagh55=1044 +flagi55=0 +tflag55=258 +initx55=0 +inity55=0 +minx55=0 +miny55=0 +maxx55=0 +maxy55=0 +posx55=50 +posy55=50 +sizx55=800 +sizy55=600 +maxfps55=0 +initts55=0 +title56=Heroes of Might & Magic 2 Gold +path56=D:\Games\heroes2gold\HEROES2W.EXE +module56= +opengllib56= +ver56=0 +coord56=0 +flag56=134217730 +flagg56=143654912 +flagh56=20 +flagi56=0 +tflag56=770 +initx56=0 +inity56=0 +minx56=0 +miny56=0 +maxx56=0 +maxy56=0 +posx56=50 +posy56=50 +sizx56=800 +sizy56=600 +maxfps56=0 +initts56=0 +title57=Heroes of Might and Magic 3 CD +path57=D:\Games\Heroes of Might & Magic III\HEROES3.EXE +module57= +opengllib57= +ver57=0 +coord57=0 +flag57=134217762 +flagg57=1207959552 +flagh57=20 +flagi57=0 +tflag57=0 +initx57=0 +inity57=0 +minx57=0 +miny57=0 +maxx57=0 +maxy57=0 +posx57=50 +posy57=50 +sizx57=800 +sizy57=600 +maxfps57=0 +initts57=0 +title58=Heroes of Might and Magic 3 Complete +path58=D:\Games\Heroes of Might and Magic 3 Complete\Heroes3.exe +module58= +opengllib58= +ver58=0 +coord58=0 +flag58=134217762 +flagg58=1207959552 +flagh58=20 +flagi58=0 +tflag58=3 +initx58=0 +inity58=0 +minx58=0 +miny58=0 +maxx58=0 +maxy58=0 +posx58=50 +posy58=50 +sizx58=800 +sizy58=600 +maxfps58=0 +initts58=0 +title59=Heroes of Might and Magic 4 Complete +path59=D:\Games\Heroes of Might and Magic 4 Complete\heroes4.exe +module59= +opengllib59= +ver59=0 +coord59=2 +flag59=134283298 +flagg59=1207959552 +flagh59=65558 +flagi59=0 +tflag59=274 +initx59=0 +inity59=0 +minx59=0 +miny59=0 +maxx59=0 +maxy59=0 +posx59=50 +posy59=50 +sizx59=800 +sizy59=600 +maxfps59=0 +initts59=0 +title60=Heroes of Might and Magic IV +path60=D:\Games\Heroes of Might and Magic IV\heroes4i.exe +module60= +opengllib60= +ver60=0 +coord60=1 +flag60=134283298 +flagg60=1211121728 +flagh60=65556 +flagi60=0 +tflag60=3 +initx60=0 +inity60=0 +minx60=0 +miny60=0 +maxx60=0 +maxy60=0 +posx60=50 +posy60=50 +sizx60=1200 +sizy60=900 +maxfps60=0 +initts60=0 +title61=HoI2.exe +path61=D:\Games\HoI2 Doomsday\HoI2.exe +module61= +opengllib61= +ver61=0 +coord61=0 +flag61=150994976 +flagg61=134217728 +flagh61=20 +flagi61=0 +tflag61=258 +initx61=0 +inity61=0 +minx61=0 +miny61=0 +maxx61=0 +maxy61=0 +posx61=50 +posy61=50 +sizx61=800 +sizy61=600 +maxfps61=0 +initts61=0 +title62=Hooligans Storm over Europe +path62=D:\Games\Hooligans\Hooligans.exe +module62= +opengllib62= +ver62=0 +coord62=0 +flag62=134742048 +flagg62=202375168 +flagh62=20 +flagi62=0 +tflag62=258 +initx62=0 +inity62=0 +minx62=0 +miny62=0 +maxx62=0 +maxy62=0 +posx62=50 +posy62=50 +sizx62=800 +sizy62=600 +maxfps62=0 +initts62=0 +title63=Imperialism +path63=D:\Games\Imperialism\Imperialism.exe +module63= +opengllib63= +ver63=0 +coord63=0 +flag63=679485474 +flagg63=134217728 +flagh63=32788 +flagi63=0 +tflag63=2 +initx63=0 +inity63=0 +minx63=0 +miny63=0 +maxx63=0 +maxy63=0 +posx63=50 +posy63=50 +sizx63=1200 +sizy63=900 +maxfps63=0 +initts63=0 +title64=Imperialism II +path64=D:\Games\imperialism_2\imperialism II.exe +module64= +opengllib64= +ver64=0 +coord64=0 +flag64=671096866 +flagg64=470810688 +flagh64=20 +flagi64=0 +tflag64=66 +initx64=0 +inity64=0 +minx64=0 +miny64=0 +maxx64=0 +maxy64=0 +posx64=50 +posy64=50 +sizx64=800 +sizy64=600 +maxfps64=0 +initts64=0 +title65=Kohan II Kings of War +path65=D:\Games\Kohan II Kings of War\k2.exe +module65= +opengllib65= +ver65=0 +coord65=0 +flag65=134217762 +flagg65=1207959552 +flagh65=20 +flagi65=0 +tflag65=0 +initx65=0 +inity65=0 +minx65=0 +miny65=0 +maxx65=0 +maxy65=0 +posx65=50 +posy65=50 +sizx65=800 +sizy65=600 +maxfps65=0 +initts65=0 +title66=Martian Gothic Unification +path66=D:\Games\Martian Gothic\martian gothic.exe +module66= +opengllib66= +ver66=0 +coord66=0 +flag66=402653217 +flagg66=134217728 +flagh66=20 +flagi66=0 +tflag66=3 +initx66=0 +inity66=0 +minx66=0 +miny66=0 +maxx66=0 +maxy66=0 +posx66=50 +posy66=100 +sizx66=400 +sizy66=300 +maxfps66=0 +initts66=0 +title67=Mechwarrior 3 +path67=D:\Games\Mechwarrior 3 (full)\Mech3.exe +module67= +opengllib67= +ver67=0 +coord67=0 +flag67=671096866 +flagg67=-2012086272 +flagh67=20 +flagi67=0 +tflag67=258 +initx67=0 +inity67=0 +minx67=0 +miny67=0 +maxx67=0 +maxy67=0 +posx67=50 +posy67=50 +sizx67=800 +sizy67=600 +maxfps67=0 +initts67=0 +title68=Messiah GOG +path68=D:\Games\Messiah (GOG)\MessiahD3D.exe +module68= +opengllib68= +ver68=7 +coord68=0 +flag68=947912738 +flagg68=1207959552 +flagh68=20 +flagi68=0 +tflag68=3 +initx68=0 +inity68=0 +minx68=0 +miny68=0 +maxx68=0 +maxy68=0 +posx68=50 +posy68=50 +sizx68=800 +sizy68=600 +maxfps68=0 +initts68=0 +title69=Nightmare Ned +path69=D:\Games\Ned\NITENED.EXE +module69= +opengllib69= +ver69=0 +coord69=0 +flag69=134217762 +flagg69=134217728 +flagh69=1048596 +flagi69=0 +tflag69=2 +initx69=0 +inity69=0 +minx69=0 +miny69=0 +maxx69=0 +maxy69=0 +posx69=50 +posy69=50 +sizx69=800 +sizy69=600 +maxfps69=0 +initts69=0 +title70=Premier Manager 98 +path70=D:\Games\Premier Manager 98\MANAGER.EXE +module70= +opengllib70= +ver70=1 +coord70=0 +flag70=671088674 +flagg70=1207959552 +flagh70=20 +flagi70=0 +tflag70=0 +initx70=0 +inity70=0 +minx70=0 +miny70=0 +maxx70=0 +maxy70=0 +posx70=50 +posy70=50 +sizx70=800 +sizy70=600 +maxfps70=0 +initts70=0 +title71=Raiden II +path71=D:\Games\raiden2\RAIDENII.EXE +module71= +opengllib71= +ver71=0 +coord71=1 +flag71=134217762 +flagg71=134217728 +flagh71=20 +flagi71=0 +tflag71=0 +initx71=0 +inity71=0 +minx71=0 +miny71=0 +maxx71=0 +maxy71=0 +posx71=50 +posy71=50 +sizx71=800 +sizy71=600 +maxfps71=0 +initts71=0 +title72=Rapanui +path72=D:\Games\Rapanui\Rapanui.exe +module72= +opengllib72= +ver72=0 +coord72=0 +flag72=134217762 +flagg72=134217728 +flagh72=20 +flagi72=0 +tflag72=0 +initx72=0 +inity72=0 +minx72=0 +miny72=0 +maxx72=0 +maxy72=0 +posx72=50 +posy72=50 +sizx72=800 +sizy72=600 +maxfps72=0 +initts72=0 +title73=Rayman 2 (GOG) +path73=D:\Games\GOG.com\Rayman 2\Rayman2.exe +module73= +opengllib73= +ver73=1 +coord73=0 +flag73=134217762 +flagg73=1208025088 +flagh73=20 +flagi73=0 +tflag73=274 +initx73=0 +inity73=0 +minx73=0 +miny73=0 +maxx73=0 +maxy73=0 +posx73=50 +posy73=50 +sizx73=800 +sizy73=600 +maxfps73=0 +initts73=8 +title74=Rayman2.exe +path74=C:\Program Files\GOG.com\Rayman 2\Rayman2.exe +module74= +opengllib74= +ver74=1 +coord74=0 +flag74=134217763 +flagg74=1208029184 +flagh74=2097172 +flagi74=0 +tflag74=18 +initx74=0 +inity74=0 +minx74=0 +miny74=0 +maxx74=0 +maxy74=0 +posx74=50 +posy74=50 +sizx74=800 +sizy74=600 +maxfps74=50 +initts74=8 +title75=Rayman2Demo.exe +path75=D:\Games\Rayman2Demo\Rayman2Demo.exe +module75= +opengllib75= +ver75=1 +coord75=0 +flag75=134217760 +flagg75=1207959552 +flagh75=20 +flagi75=0 +tflag75=0 +initx75=0 +inity75=0 +minx75=0 +miny75=0 +maxx75=0 +maxy75=0 +posx75=50 +posy75=50 +sizx75=800 +sizy75=600 +maxfps75=0 +initts75=0 +title76=Silent Hunter II (shell) +path76=D:\Games\Silent Hunter II\Shell\Shell.exe +module76= +opengllib76= +ver76=0 +coord76=0 +flag76=402653221 +flagg76=135266304 +flagh76=20 +flagi76=0 +tflag76=2 +initx76=0 +inity76=0 +minx76=0 +miny76=0 +maxx76=800 +maxy76=600 +posx76=50 +posy76=50 +sizx76=800 +sizy76=600 +maxfps76=0 +initts76=0 +title77=Silent Hunter II (sim) +path77=D:\Games\Silent Hunter II\Sim\Sim.exe +module77= +opengllib77= +ver77=0 +coord77=0 +flag77=134217780 +flagg77=134217728 +flagh77=20 +flagi77=0 +tflag77=0 +initx77=400 +inity77=300 +minx77=0 +miny77=0 +maxx77=800 +maxy77=600 +posx77=50 +posy77=50 +sizx77=800 +sizy77=600 +maxfps77=0 +initts77=0 +title78=Space Hack +path78=D:\Games\Space Hack\main.exe +module78= +opengllib78= +ver78=0 +coord78=0 +flag78=671105058 +flagg78=134217728 +flagh78=20 +flagi78=0 +tflag78=258 +initx78=0 +inity78=0 +minx78=0 +miny78=0 +maxx78=0 +maxy78=0 +posx78=50 +posy78=50 +sizx78=800 +sizy78=600 +maxfps78=0 +initts78=0 +title79=Tachyon The Fringe +path79=D:\Games\TachyonTheFringe\space.exe +module79= +opengllib79= +ver79=0 +coord79=0 +flag79=134234148 +flagg79=134217728 +flagh79=20 +flagi79=0 +tflag79=258 +initx79=0 +inity79=0 +minx79=0 +miny79=0 +maxx79=0 +maxy79=0 +posx79=50 +posy79=50 +sizx79=800 +sizy79=600 +maxfps79=0 +initts79=0 +title80=Tanktics +path80=D:\Games\Tanktics\tanktics.exe +module80= +opengllib80= +ver80=0 +coord80=0 +flag80=671088674 +flagg80=134217728 +flagh80=20 +flagi80=0 +tflag80=258 +initx80=0 +inity80=0 +minx80=0 +miny80=0 +maxx80=0 +maxy80=0 +posx80=50 +posy80=50 +sizx80=800 +sizy80=600 +maxfps80=0 +initts80=0 +title81=TD5_D3D.exe +path81=D:\Games\Test Drive 5\TD5_D3D.exe +module81= +opengllib81= +ver81=0 +coord81=0 +flag81=134217760 +flagg81=1207959552 +flagh81=20 +flagi81=0 +tflag81=64 +initx81=0 +inity81=0 +minx81=0 +miny81=0 +maxx81=0 +maxy81=0 +posx81=50 +posy81=50 +sizx81=800 +sizy81=600 +maxfps81=0 +initts81=0 +title82=The Sims +path82=D:\Games\sims\Sims.exe +module82= +opengllib82= +ver82=0 +coord82=0 +flag82=671096866 +flagg82=134217728 +flagh82=20 +flagi82=0 +tflag82=66 +initx82=0 +inity82=0 +minx82=0 +miny82=0 +maxx82=0 +maxy82=0 +posx82=50 +posy82=50 +sizx82=800 +sizy82=600 +maxfps82=0 +initts82=0 +title83=Tomb Raider - The Last Revelation +path83=D:\Games\Tomb Raider - The Last Revelation\tomb4.exe +module83= +opengllib83= +ver83=0 +coord83=0 +flag83=134217826 +flagg83=134217728 +flagh83=20 +flagi83=0 +tflag83=2 +initx83=0 +inity83=0 +minx83=0 +miny83=0 +maxx83=0 +maxy83=0 +posx83=50 +posy83=50 +sizx83=800 +sizy83=600 +maxfps83=0 +initts83=0 +title84=TOMB2.EXE +path84=D:\Games\Tomb Raider 2\TOMB2.EXE +module84= +opengllib84= +ver84=0 +coord84=0 +flag84=134217760 +flagg84=201326592 +flagh84=2068 +flagi84=0 +tflag84=0 +initx84=0 +inity84=0 +minx84=0 +miny84=0 +maxx84=0 +maxy84=0 +posx84=50 +posy84=50 +sizx84=800 +sizy84=600 +maxfps84=0 +initts84=0 +title85=Vangers one of the Road +path85=D:\Games\Vangers\road.exe +module85= +opengllib85= +ver85=1 +coord85=0 +flag85=406847650 +flagg85=671088640 +flagh85=262164 +flagi85=0 +tflag85=258 +initx85=0 +inity85=0 +minx85=0 +miny85=0 +maxx85=0 +maxy85=0 +posx85=50 +posy85=50 +sizx85=800 +sizy85=600 +maxfps85=0 +initts85=0 +title86=wa.exe +path86=D:\Games\worms_arma\Worms_2_Armageddon\wa.exe +module86= +opengllib86= +ver86=0 +coord86=0 +flag86=713031712 +flagg86=142606336 +flagh86=20 +flagi86=0 +tflag86=2 +initx86=0 +inity86=0 +minx86=0 +miny86=0 +maxx86=0 +maxy86=0 +posx86=50 +posy86=50 +sizx86=800 +sizy86=600 +maxfps86=0 +initts86=0 +title87=Wargames +path87=D:\Games\WarGames\wargames.exe +module87= +opengllib87= +ver87=0 +coord87=0 +flag87=134217762 +flagg87=1207959552 +flagh87=20 +flagi87=0 +tflag87=67 +initx87=0 +inity87=0 +minx87=0 +miny87=0 +maxx87=0 +maxy87=0 +posx87=50 +posy87=50 +sizx87=800 +sizy87=600 +maxfps87=0 +initts87=0 +title88=Warlords 3 +path88=D:\Games\Warlords3\Darklord.exe +module88= +opengllib88= +ver88=0 +coord88=0 +flag88=-2013249502 +flagg88=135266304 +flagh88=20 +flagi88=0 +tflag88=2 +initx88=0 +inity88=0 +minx88=0 +miny88=0 +maxx88=0 +maxy88=0 +posx88=50 +posy88=50 +sizx88=800 +sizy88=600 +maxfps88=0 +initts88=0 +title89=Western Front +path89=D:\Games\Western Front\wf.exe +module89= +opengllib89= +ver89=0 +coord89=0 +flag89=679477282 +flagg89=135266304 +flagh89=16404 +flagi89=0 +tflag89=0 +initx89=0 +inity89=0 +minx89=0 +miny89=0 +maxx89=0 +maxy89=0 +posx89=50 +posy89=50 +sizx89=800 +sizy89=600 +maxfps89=0 +initts89=0 +title90=dw.exe +path90=D:\Games\Devil.Whiskey\dw.exe +module90= +opengllib90= +ver90=7 +coord90=0 +flag90=671088674 +flagg90=1208090624 +flagh90=5 +flagi90=0 +tflag90=64 +initx90=0 +inity90=0 +minx90=0 +miny90=0 +maxx90=0 +maxy90=0 +posx90=50 +posy90=50 +sizx90=800 +sizy90=600 +maxfps90=0 +initts90=0 +title91=Dungeon Lords MMXII +path91=D:\Games\Dungeon Lords MMXII\dlords2012.exe +module91= +opengllib91= +ver91=0 +coord91=2 +flag91=-2013265886 +flagg91=1207959552 +flagh91=20 +flagi91=0 +tflag91=0 +initx91=0 +inity91=0 +minx91=0 +miny91=0 +maxx91=0 +maxy91=0 +posx91=50 +posy91=50 +sizx91=800 +sizy91=600 +maxfps91=0 +initts91=0 +title92=Bunnies must die +path92=D:\Games\Bunnies must die\bmd.exe +module92= +opengllib92= +ver92=7 +coord92=0 +flag92=671088674 +flagg92=1209008128 +flagh92=4 +flagi92=0 +tflag92=3 +initx92=0 +inity92=0 +minx92=0 +miny92=0 +maxx92=0 +maxy92=0 +posx92=50 +posy92=50 +sizx92=800 +sizy92=600 +maxfps92=0 +initts92=0 +title93=Magic & Mayhem +path93=D:\Games\Magic_&_Mayhem\Chaos.exe +module93= +opengllib93= +ver93=0 +coord93=0 +flag93=138412066 +flagg93=1275068416 +flagh93=8388628 +flagi93=0 +tflag93=259 +initx93=0 +inity93=0 +minx93=0 +miny93=0 +maxx93=0 +maxy93=0 +posx93=50 +posy93=50 +sizx93=800 +sizy93=600 +maxfps93=0 +initts93=0 +title94=Submarine Titans Demo +path94=D:\Games\Submarine Titans Demo\st.exe +module94= +opengllib94= +ver94=0 +coord94=0 +flag94=675282978 +flagg94=1207959552 +flagh94=20 +flagi94=0 +tflag94=3 +initx94=0 +inity94=0 +minx94=0 +miny94=0 +maxx94=0 +maxy94=0 +posx94=50 +posy94=50 +sizx94=800 +sizy94=600 +maxfps94=0 +initts94=0 +title95=Fate +path95=D:\Games\Fate\Fate.exe +module95= +opengllib95= +ver95=0 +coord95=2 +flag95=134217762 +flagg95=1207959552 +flagh95=20 +flagi95=0 +tflag95=64 +initx95=0 +inity95=0 +minx95=0 +miny95=0 +maxx95=0 +maxy95=0 +posx95=50 +posy95=50 +sizx95=800 +sizy95=600 +maxfps95=0 +initts95=0 +[window] +posx=1210 +posy=149 +sizx=360 +sizy=420 diff --git a/build/dxwnd.dll b/build/dxwnd.dll index dc4571c..9f7cbd0 100644 --- a/build/dxwnd.dll +++ b/build/dxwnd.dll @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:87bb2172d84948aba5cd6af6e3b810430441b3935584ea3d46b3ef4c0bf1f8ed -size 407552 +oid sha256:0c14a21ce803c1f48696c754cbdb5368e40439fab6b64b9af7188331c159cba9 +size 414720 diff --git a/build/dxwnd.exe b/build/dxwnd.exe index 876a9db..c3cbae6 100644 --- a/build/dxwnd.exe +++ b/build/dxwnd.exe @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:6228efb8d349dfee02f1fc5b997651e2bb36d01120398c7743ab495286852aeb -size 525312 +oid sha256:12cba4b1f36d3b9f0ed76b365035ee75fb22df7f464e0f05f05339a829c9586c +size 526336 diff --git a/build/readme-relnotes.txt b/build/readme-relnotes.txt index 6588311..c74180a 100644 --- a/build/readme-relnotes.txt +++ b/build/readme-relnotes.txt @@ -267,4 +267,8 @@ hook trace is now activated from a separate log flag to reduce debug log size added "Peek all messages in queue" to avoid queue saturation and automatic task kill in Win7 (thank to P K help) fixed message handling in the case messages are passed to a routine handle +v2.02.37 +code reorganization +GUI: +removed useless flags and moved debug options in a hidden tab diff --git a/dll/ddraw.cpp b/dll/ddraw.cpp index ab10273..a3b8bf2 100644 --- a/dll/ddraw.cpp +++ b/dll/ddraw.cpp @@ -98,15 +98,20 @@ HRESULT WINAPI extReleaseP(LPDIRECTDRAWPALETTE); // STDMETHOD(Initialize)(THIS_ LPDIRECTDRAW, DWORD, LPPALETTEENTRY) PURE; HRESULT WINAPI extSetEntries(LPDIRECTDRAWPALETTE, DWORD, DWORD, DWORD, LPPALETTEENTRY); +// GammaRamp +HRESULT WINAPI extDDSetGammaRamp(LPDIRECTDRAWSURFACE, DWORD, LPDDGAMMARAMP); +HRESULT WINAPI extDDGetGammaRamp(LPDIRECTDRAWSURFACE, DWORD, LPDDGAMMARAMP); + + HDC WINAPI extGDIGetDC(HWND); HDC WINAPI extGDIGetWindowDC(HWND); int WINAPI extGDIReleaseDC(HWND, HDC); /* DirectDraw APIs */ -DirectDrawCreate_Type pDirectDrawCreate; -DirectDrawCreateEx_Type pDirectDrawCreateEx; -DirectDrawEnumerate_Type pDirectDrawEnumerate; -DirectDrawEnumerateEx_Type pDirectDrawEnumerateEx; +DirectDrawCreate_Type pDirectDrawCreate = NULL; +DirectDrawCreateEx_Type pDirectDrawCreateEx = NULL; +DirectDrawEnumerate_Type pDirectDrawEnumerate = NULL; +DirectDrawEnumerateEx_Type pDirectDrawEnumerateEx = NULL; /* DirectDraw hook pointers */ QueryInterface_Type pQueryInterfaceD; @@ -213,11 +218,19 @@ GetEntries_Type pGetEntries; // STDMETHOD(Initialize)(THIS_ LPDIRECTDRAW, DWORD, LPPALETTEENTRY) PURE; SetEntries_Type pSetEntries; +// GammaRamp +GammaRamp_Type pDDGetGammaRamp; +GammaRamp_Type pDDSetGammaRamp; + +// ddraw global variables, constants & so on + #define MAXBACKBUFFERS 4 -LPDIRECTDRAWSURFACE lpDDSEmu_Prim=NULL, lpDDSEmu_Back=NULL; +LPDIRECTDRAWSURFACE lpDDSEmu_Prim=NULL; +LPDIRECTDRAWSURFACE lpDDSEmu_Back=NULL; LPDIRECTDRAWSURFACE lpDDSBack=NULL; LPDIRECTDRAWSURFACE lpDDZBuffer=NULL; +LPDIRECTDRAWSURFACE lpDDTexture=NULL; // v2.1.87: lpPrimaryDD is the DIRECTDRAW object to which the primary surface and all // the service objects (emulated backbuffer, emulater primary, ....) are attached. LPDIRECTDRAW lpPrimaryDD=NULL; @@ -225,6 +238,12 @@ LPDIRECTDRAW lpBackBufferDD=NULL; int iBakBufferVersion; LPDIRECTDRAWCLIPPER lpDDC=NULL; LPDIRECTDRAWPALETTE lpDDP=NULL; + +// v2.02.37: globals to store requested main surface capabilities +DDSURFACEDESC2 DDSD_Prim; +DDSURFACEDESC2 DDSD_Back; +DDSURFACEDESC2 DDSD_ZBuffer; + DWORD PaletteEntries[256]; DWORD *Palette16BPP = NULL; void *EmuScreenBuffer = NULL; // to implement pitch bug fix @@ -268,13 +287,27 @@ static void RefProbe(INTERFACE *obj, char *op, int line) OutTrace("### COM obj=%x op=%s refcount=%d at %d ###\n", obj, op, (*pReleaseS)((LPDIRECTDRAWSURFACE)obj), line); } -//#define REFPROVE_TEST // comment out to eliminate -#ifdef REFPROVE_TEST +static void Stopper(char *s, int line) +{ + char sMsg[81]; + sprintf(sMsg,"break: \"%s\"", s); + MessageBox(0, sMsg, "break", MB_OK | MB_ICONEXCLAMATION); +} + +//#define REFPROBE_TEST // comment out to eliminate +#ifdef REFPROBE_TEST #define REFPROBE(obj, op) RefProbe((INTERFACE *)(obj), op, __LINE__) #else #define REFPROBE(obj, op) #endif +#define STOPPER_TEST // comment out to eliminate +#ifdef STOPPER_TEST +#define STOPPER(s) Stopper(s, __LINE__) +#else +#define STOPPER(s) +#endif + static char *sFourCC(DWORD fcc) { static char sRet[5]; @@ -290,6 +323,66 @@ static char *sFourCC(DWORD fcc) return sRet; } +static char *DumpPixelFormat(LPDDSURFACEDESC2 lpddsd) +{ + static char sBuf[512]; + char sItem[256]; + DWORD flags=lpddsd->ddpfPixelFormat.dwFlags; + sprintf(sBuf, " PixelFormat size=%d flags=%x(%s) BPP=%d", + lpddsd->dwSize, flags, ExplainPixelFormatFlags(flags), lpddsd->ddpfPixelFormat.dwRGBBitCount); + if (flags & DDPF_RGB) { + sprintf(sItem, " RGBA=(%x,%x,%x,%x)", + lpddsd->ddpfPixelFormat.dwRBitMask, + lpddsd->ddpfPixelFormat.dwGBitMask, + lpddsd->ddpfPixelFormat.dwBBitMask, + lpddsd->ddpfPixelFormat.dwRGBAlphaBitMask); + strcat(sBuf, sItem); + } + if (flags & DDPF_YUV) { + sprintf(sItem, " YUVA=(%x,%x,%x,%x)", + lpddsd->ddpfPixelFormat.dwYBitMask, + lpddsd->ddpfPixelFormat.dwUBitMask, + lpddsd->ddpfPixelFormat.dwVBitMask, + lpddsd->ddpfPixelFormat.dwYUVAlphaBitMask); + strcat(sBuf, sItem); + } + if (flags & DDPF_ZBUFFER) { + sprintf(sItem, " SdZSbL=(%x,%x,%x,%x)", + lpddsd->ddpfPixelFormat.dwStencilBitDepth, + lpddsd->ddpfPixelFormat.dwZBitMask, + lpddsd->ddpfPixelFormat.dwStencilBitMask, + lpddsd->ddpfPixelFormat.dwLuminanceAlphaBitMask); + strcat(sBuf, sItem); + } + if (flags & DDPF_ALPHA) { + sprintf(sItem, " LBdBlZ=(%x,%x,%x,%x)", + lpddsd->ddpfPixelFormat.dwLuminanceBitMask, + lpddsd->ddpfPixelFormat.dwBumpDvBitMask, + lpddsd->ddpfPixelFormat.dwBumpLuminanceBitMask, + lpddsd->ddpfPixelFormat.dwRGBZBitMask); + strcat(sBuf, sItem); + } + if (flags & DDPF_LUMINANCE) { + sprintf(sItem, " BMbMF=(%x,%x,%x,%x)", + lpddsd->ddpfPixelFormat.dwBumpDuBitMask, + lpddsd->ddpfPixelFormat.MultiSampleCaps.wBltMSTypes, + lpddsd->ddpfPixelFormat.MultiSampleCaps.wFlipMSTypes, + lpddsd->ddpfPixelFormat.dwYUVZBitMask); + strcat(sBuf, sItem); + } + if (flags & DDPF_BUMPDUDV) { + sprintf(sItem, " O=(%x)", + lpddsd->ddpfPixelFormat.dwOperations); + strcat(sBuf, sItem); + } + if (flags & DDPF_FOURCC) { + sprintf(sItem, " FourCC=%x(%s)", + lpddsd->ddpfPixelFormat.dwFourCC, sFourCC(lpddsd->ddpfPixelFormat.dwFourCC)); + strcat(sBuf, sItem); + } + return sBuf; +} + static void LogSurfaceAttributes(LPDDSURFACEDESC lpddsd, char *label, int line) { OutTraceD("SurfaceDesc: %s Flags=%x(%s)", @@ -311,42 +404,16 @@ static void LogSurfaceAttributes(LPDDSURFACEDESC lpddsd, char *label, int line) if (lpddsd->dwFlags & DDSD_CKDESTOVERLAY ) OutTraceD(" CKDestOverlay=(%x,%x)", lpddsd->ddckCKDestOverlay.dwColorSpaceLowValue, lpddsd->ddckCKDestOverlay.dwColorSpaceHighValue); if (lpddsd->dwFlags & DDSD_CKSRCBLT ) OutTraceD(" CKSrcBlt=(%x,%x)", lpddsd->ddckCKSrcBlt.dwColorSpaceLowValue, lpddsd->ddckCKSrcBlt.dwColorSpaceHighValue); if (lpddsd->dwFlags & DDSD_CKSRCOVERLAY ) OutTraceD(" CKSrcOverlay=(%x,%x)", lpddsd->ddckCKSrcOverlay.dwColorSpaceLowValue, lpddsd->ddckCKSrcOverlay.dwColorSpaceHighValue); - if (lpddsd->dwFlags & DDSD_PIXELFORMAT ){ - DWORD flags=lpddsd->ddpfPixelFormat.dwFlags; - OutTraceD(" PixelFormat flags=%x(%s) BPP=%d", flags, ExplainPixelFormatFlags(flags), lpddsd->ddpfPixelFormat.dwRGBBitCount); - if (flags & DDPF_RGB) OutTraceD(" RGBA=(%x,%x,%x,%x)", - lpddsd->ddpfPixelFormat.dwRBitMask, - lpddsd->ddpfPixelFormat.dwGBitMask, - lpddsd->ddpfPixelFormat.dwBBitMask, - lpddsd->ddpfPixelFormat.dwRGBAlphaBitMask); - if (flags & DDPF_YUV) OutTraceD(" YUVA=(%x,%x,%x,%x)", - lpddsd->ddpfPixelFormat.dwYBitMask, - lpddsd->ddpfPixelFormat.dwUBitMask, - lpddsd->ddpfPixelFormat.dwVBitMask, - lpddsd->ddpfPixelFormat.dwYUVAlphaBitMask); - if (flags & DDPF_ZBUFFER) OutTraceD(" SdZSbL=(%x,%x,%x,%x)", - lpddsd->ddpfPixelFormat.dwStencilBitDepth, - lpddsd->ddpfPixelFormat.dwZBitMask, - lpddsd->ddpfPixelFormat.dwStencilBitMask, - lpddsd->ddpfPixelFormat.dwLuminanceAlphaBitMask); - if (flags & DDPF_ALPHA) OutTraceD(" LBdBlZ=(%x,%x,%x,%x)", - lpddsd->ddpfPixelFormat.dwLuminanceBitMask, - lpddsd->ddpfPixelFormat.dwBumpDvBitMask, - lpddsd->ddpfPixelFormat.dwBumpLuminanceBitMask, - lpddsd->ddpfPixelFormat.dwRGBZBitMask); - if (flags & DDPF_LUMINANCE) OutTraceD(" BMbMF=(%x,%x,%x,%x)", - lpddsd->ddpfPixelFormat.dwBumpDuBitMask, - lpddsd->ddpfPixelFormat.MultiSampleCaps.wBltMSTypes, - lpddsd->ddpfPixelFormat.MultiSampleCaps.wFlipMSTypes, - lpddsd->ddpfPixelFormat.dwYUVZBitMask); - if (flags & DDPF_BUMPDUDV) OutTraceD(" O=(%x)", - lpddsd->ddpfPixelFormat.dwOperations); - if (flags & DDPF_FOURCC) OutTraceD(" FourCC=%x(%s)", lpddsd->ddpfPixelFormat.dwFourCC, sFourCC(lpddsd->ddpfPixelFormat.dwFourCC)); - } + if (lpddsd->dwFlags & DDSD_PIXELFORMAT ) OutTraceD("%s", DumpPixelFormat((LPDDSURFACEDESC2)lpddsd)); if (lpddsd->dwFlags & DDSD_LPSURFACE) OutTraceD(" Surface=%x", lpddsd->lpSurface); OutTraceD("\n"); } +static void DumpPixFmt(LPDDSURFACEDESC2 lpdds) +{ + OutTraceD("PixelFormat: lpddsd=%x %s\n", DumpPixelFormat(lpdds)); +} + static void DumpSurfaceAttributes(LPDDSURFACEDESC lpddsd, char *label, int line) { if(!IsDebug) return; @@ -374,118 +441,13 @@ static void DescribeSurface(LPDIRECTDRAWSURFACE lpdds, int dxversion, char *labe } if(res)return; OutTrace("Surface %s: ddsd=%x dxversion=%d ", label, lpdds, dxversion); - DumpSurfaceAttributes((LPDDSURFACEDESC)&ddsd, label, line); -} - -#define CAPSHASHSIZE 113 - -typedef struct { - LPDIRECTDRAWSURFACE lpdds; - DWORD Flags; - DWORD Caps; - DDPIXELFORMAT PixelFormat; -} CapsHash_Type; -static CapsHash_Type *CapsHash=NULL; - -static void PushCaps(LPDDSURFACEDESC2 lpddsd, LPDIRECTDRAWSURFACE lpdds) -{ - static BOOL DoFirst = TRUE; - int i; - if (DoFirst) { // initialize - CapsHash=(CapsHash_Type *)malloc(CAPSHASHSIZE * sizeof(CapsHash_Type)); - memset(CapsHash, 0, CAPSHASHSIZE * sizeof(CapsHash_Type)); - DoFirst = FALSE; - } - if(IsDebug){ - OutTrace("PushCaps: lpdds=%x dwFlags=%x dwCaps=%x", lpdds, lpddsd->dwFlags, lpddsd->ddsCaps.dwCaps); - if (lpddsd->dwFlags & DDSD_PIXELFORMAT) OutTrace(" PF.dwFlags=%x PF.dwFourCC=%x PF.dwRGBBitCount=%x RGBA=(%x,%x,%x,%x)", - lpddsd->ddpfPixelFormat.dwFlags, lpddsd->ddpfPixelFormat.dwFourCC, lpddsd->ddpfPixelFormat.dwRGBBitCount, - lpddsd->ddpfPixelFormat.dwRBitMask, lpddsd->ddpfPixelFormat.dwGBitMask, lpddsd->ddpfPixelFormat.dwBBitMask, lpddsd->ddpfPixelFormat.dwRGBAlphaBitMask); - OutTrace("\n"); - } - i = ((DWORD)lpdds >> 3) % CAPSHASHSIZE; - if(CapsHash[i].lpdds && (CapsHash[i].lpdds != lpdds)) { - char sMsg[80]; - sprintf(sMsg, "PushCaps CONFLICT %x:%x\n", lpdds, CapsHash[i].lpdds); - OutTraceE(sMsg); - if (IsAssertEnabled) MessageBox(0, sMsg, "PushCaps", MB_OK | MB_ICONEXCLAMATION); - return; - } - CapsHash[i].lpdds = lpdds; - CapsHash[i].Flags = lpddsd->dwFlags; - CapsHash[i].Caps = lpddsd->ddsCaps.dwCaps; - memcpy((void *)&CapsHash[i].PixelFormat, &lpddsd->ddpfPixelFormat, sizeof(DDPIXELFORMAT)); - //CapsHash[i].PixelFormat.dwFlags = lpddsd->ddpfPixelFormat.dwFlags; -} - -static int PopCaps(LPDDSURFACEDESC2 lpddsd, LPDIRECTDRAWSURFACE lpdds) -{ - UINT i; - if(!CapsHash) return FALSE; // not initialized yet! - - i = ((DWORD)lpdds >> 3) % CAPSHASHSIZE; - if(lpdds != CapsHash[i].lpdds){ - char sMsg[80]; - sprintf(sMsg, "PopCaps MISMATCH %x:%x\n", lpdds, CapsHash[i].lpdds); - OutTraceE(sMsg); - if (IsAssertEnabled) MessageBox(0, sMsg, "PopCaps", MB_OK | MB_ICONEXCLAMATION); - return FALSE; - } - if (lpddsd->dwSize > (DWORD)&((LPDDSURFACEDESC2)NULL)->dwFlags) lpddsd->dwFlags = CapsHash[i].Flags; - if (lpddsd->dwSize > (DWORD)&((LPDDSURFACEDESC2)NULL)->ddsCaps.dwCaps) lpddsd->ddsCaps.dwCaps = CapsHash[i].Caps; - if ((lpddsd->dwFlags & DDSD_PIXELFORMAT) && (lpddsd->dwSize > (DWORD)&((LPDDSURFACEDESC2)NULL)->ddpfPixelFormat)) - memcpy(&(lpddsd->ddpfPixelFormat), (void *)&CapsHash[i].PixelFormat, sizeof(DDPIXELFORMAT)); - - if(IsDebug){ - OutTrace("PopCaps: lpdds=%x dwFlags=%x dwCaps=%x", lpdds, lpddsd->dwFlags, lpddsd->ddsCaps.dwCaps); - if (lpddsd->dwFlags & DDSD_PIXELFORMAT) OutTrace(" PF.dwFlags=%x PF.dwFourCC=%x PF.dwRGBBitCount=%x RGBA=(%x,%x,%x,%x)", - lpddsd->ddpfPixelFormat.dwFlags, lpddsd->ddpfPixelFormat.dwFourCC, lpddsd->ddpfPixelFormat.dwRGBBitCount, - lpddsd->ddpfPixelFormat.dwRBitMask, lpddsd->ddpfPixelFormat.dwGBitMask, lpddsd->ddpfPixelFormat.dwBBitMask, lpddsd->ddpfPixelFormat.dwRGBAlphaBitMask); - OutTrace("\n"); - } - return TRUE; + LogSurfaceAttributes((LPDDSURFACEDESC)&ddsd, label, line); } /* ------------------------------------------------------------------------------ */ -// auxiliary (static) functions for HDC service surfaces stack +// auxiliary (static) functions for palette handling /* ------------------------------------------------------------------------------ */ -typedef struct { - LPDIRECTDRAWSURFACE lpdds; - HDC hdc; -} DCStackEntry_Type; - -DCStackEntry_Type DCStack[22]; - -static void InitDCStack() -{ - int i; - for(i=0; i<22; i++) { - DCStack[i].hdc=NULL; - DCStack[i].lpdds=NULL; - } -} - -static void PushDC(LPDIRECTDRAWSURFACE lpdds, HDC hdc) -{ - int i; - for(i=0; DCStack[i].hdc; i++); - if(i<20){ - DCStack[i].lpdds=lpdds; - DCStack[i].hdc=hdc; - } -} - -static LPDIRECTDRAWSURFACE PopDC(HDC hdc) -{ - int i; - LPDIRECTDRAWSURFACE ret; - for(i=0; DCStack[i].hdc && (DCStack[i].hdc!=hdc); i++); - ret=DCStack[i].lpdds; - for(; DCStack[i].hdc; i++) DCStack[i].hdc=NULL; - return ret; -} - BOOL isPaletteUpdated; void mySetPalette(int dwstart, int dwcount, LPPALETTEENTRY lpentries) @@ -658,7 +620,6 @@ void InitScreenParameters() //if(dxw.dwFlags2 & INIT8BPP) dxw.VirtualPixelFormat.dwRGBBitCount = 8; OutTraceD("InitScreenParameters: RGBBitCount=%d\n", CurrDevMode.dmBitsPerPel); SetBltTransformations(); - InitDCStack(); return; } @@ -713,9 +674,6 @@ int HookDirectDraw(HMODULE module, int version) HINSTANCE hinst; void *tmp; const GUID dd7 = {0x15e65ec0,0x3b9c,0x11d2,0xb9,0x2f,0x00,0x60,0x97,0x97,0xea,0x5b}; - //static BOOL DoOnce = FALSE; - //if(DoOnce) return 0; - //DoOnce=TRUE; if(dxw.dwFlags2 & SETCOMPATIBILITY){ typedef HRESULT (WINAPI *SetAppCompatData_Type)(DWORD, DWORD); @@ -898,19 +856,6 @@ int lpddHookedVersion(LPDIRECTDRAW lpdd) /* ------------------------------------------------------------------ */ -static void DumpPixFmt(LPDDSURFACEDESC2 lpdds) -{ - OutTraceD("PixFmt: Size=%x Flags=%x(%s) FourCC=%x RGBBitCount=%d RGBA BitMask=(%x,%x,%x,%x)\n", - lpdds->ddpfPixelFormat.dwSize, - lpdds->ddpfPixelFormat.dwFlags, ExplainPixelFormatFlags(lpdds->ddpfPixelFormat.dwFlags), - lpdds->ddpfPixelFormat.dwFourCC, - lpdds->ddpfPixelFormat.dwRGBBitCount, - lpdds->ddpfPixelFormat.dwRBitMask, - lpdds->ddpfPixelFormat.dwGBitMask, - lpdds->ddpfPixelFormat.dwBBitMask, - lpdds->ddpfPixelFormat.dwRGBAlphaBitMask); -} - static char *SetPixFmt(LPDDSURFACEDESC2 lpdd) { char *pfstr; @@ -966,6 +911,24 @@ static char *SetPixFmt(LPDDSURFACEDESC2 lpdd) return pfstr; } +static void RenewClipper(LPDIRECTDRAW lpdd, LPDIRECTDRAWSURFACE lpdds) +{ + HRESULT res; + + return; + + if (lpDDC) lpDDC->Release(); + res=lpdd->CreateClipper(0, &lpDDC, NULL); + if(res) OutTraceE("CreateSurface: CreateClipper ERROR: lpdd=%x res=%x(%s) at %d\n", lpdd, res, ExplainDDError(res), __LINE__); + //HookDDClipper(&lpDDC); + res=lpDDC->SetHWnd(0, dxw.GethWnd()); + if(res) OutTraceE("CreateSurface: SetHWnd ERROR: hWnd=%x res=%x(%s) at %d\n", dxw.GethWnd(), res, ExplainDDError(res), __LINE__); + res=lpdds->SetClipper(lpDDC); + //res=(*pSetClipper)(lpdds, lpDDC); + if(res) OutTraceE("CreateSurface: SetClipper ERROR: lpdds=%x res=%x(%s) at %d\n", lpdds, res, ExplainDDError(res), __LINE__); + return; +} + /* ------------------------------------------------------------------ */ // hook query functions that determines the object versioning .... /* ------------------------------------------------------------------ */ @@ -1278,8 +1241,12 @@ static void HookDDSurfaceGeneric(LPDIRECTDRAWSURFACE *lplpdds, int dxversion) OutTraceD("Hooking surface as generic dds=%x dxversion=%d thread_id=%x\n", *lplpdds, dxversion, GetCurrentThreadId()); + // IDirectDrawSurface::QueryInterface + SetHook((void *)(**(DWORD **)lplpdds), extQueryInterfaceS, (void **)&pQueryInterfaceS, "QueryInterface(S)"); // IDirectDrawSurface::Release SetHook((void *)(**(DWORD **)lplpdds + 8), extReleaseS, (void **)&pReleaseS, "Release(S)"); + // IDirectDrawSurface::AddAttachedSurface + SetHook((void *)(**(DWORD **)lplpdds + 12), extAddAttachedSurface, (void **)&pAddAttachedSurface, "AddAttachedSurface(S)"); // IDirectDrawSurface::Flip SetHook((void *)(**(DWORD **)lplpdds + 44), extFlip, (void **)&pFlip, "Flip(S)"); // IDirectDrawSurface::Blt @@ -1357,12 +1324,8 @@ static void HookDDSurfaceGeneric(LPDIRECTDRAWSURFACE *lplpdds, int dxversion) // just proxed .... - // IDirectDrawSurface::QueryInterface - SetHook((void *)(**(DWORD **)lplpdds), extQueryInterfaceS, (void **)&pQueryInterfaceS, "QueryInterface(S)"); // IDirectDrawSurface::AddRef SetHook((void *)(**(DWORD **)lplpdds + 4), extAddRefSProxy, (void **)&pAddRefS, "AddRef(S)"); - // IDirectDrawSurface::AddAttachedSurface - SetHook((void *)(**(DWORD **)lplpdds + 12), extAddAttachedSurface, (void **)&pAddAttachedSurface, "AddAttachedSurface(S)"); // IDirectDrawSurface::AddOverlayDirtyRect SetHook((void *)(**(DWORD **)lplpdds + 16), extAddOverlayDirtyRectProxy, (void **)&pAddOverlayDirtyRect, "AddOverlayDirtyRect(S)"); // IDirectDrawSurface::BltBatch @@ -1400,24 +1363,6 @@ static void HookDDSurfaceGeneric(LPDIRECTDRAWSURFACE *lplpdds, int dxversion) SetHook((void *)(**(DWORD **)lplpdds + 140), extUpdateOverlayZOrderProxy, (void **)&pUpdateOverlayZOrder, "UpdateOverlayZOrder(S)"); } -static void RenewClipper(LPDIRECTDRAW lpdd, LPDIRECTDRAWSURFACE lpdds) -{ - HRESULT res; - - return; - - if (lpDDC) lpDDC->Release(); - res=lpdd->CreateClipper(0, &lpDDC, NULL); - if(res) OutTraceE("CreateSurface: CreateClipper ERROR: lpdd=%x res=%x(%s) at %d\n", lpdd, res, ExplainDDError(res), __LINE__); - //HookDDClipper(&lpDDC); - res=lpDDC->SetHWnd(0, dxw.GethWnd()); - if(res) OutTraceE("CreateSurface: SetHWnd ERROR: hWnd=%x res=%x(%s) at %d\n", dxw.GethWnd(), res, ExplainDDError(res), __LINE__); - res=lpdds->SetClipper(lpDDC); - //res=(*pSetClipper)(lpdds, lpDDC); - if(res) OutTraceE("CreateSurface: SetClipper ERROR: lpdds=%x res=%x(%s) at %d\n", lpdds, res, ExplainDDError(res), __LINE__); - return; -} - /* ------------------------------------------------------------------------------ */ // directdraw method hooks /* ------------------------------------------------------------------------------ */ @@ -1592,14 +1537,16 @@ HRESULT WINAPI extQueryInterfaceD(void *lpdd, REFIID riid, LPVOID *obp) { HRESULT res; unsigned int dwLocalDDVersion; + unsigned int dwLocalD3DVersion; res = (*pQueryInterfaceD)(lpdd, riid, obp); - OutTraceD("QueryInterface(D): lpdd=%x REFIID=%x obp=%x ret=%x at %d\n", - lpdd, riid.Data1, *obp, res, __LINE__); + OutTraceD("QueryInterface(D): lpdd=%x REFIID=%x(%s) obp=%x ret=%x at %d\n", + lpdd, riid.Data1, ExplainGUID((GUID *)&riid), *obp, res, __LINE__); if(res) return res; dwLocalDDVersion=0; + dwLocalD3DVersion=0; switch(riid.Data1){ case 0x6C14DB80: //DirectDraw1 dwLocalDDVersion = 1; @@ -1607,18 +1554,31 @@ HRESULT WINAPI extQueryInterfaceD(void *lpdd, REFIID riid, LPVOID *obp) case 0xB3A6F3E0: //DirectDraw2 dwLocalDDVersion = 2; break; - case 0x9c59509a: //DirectDraw4 + case 0x9c59509a: //DirectDraw4 dwLocalDDVersion = 4; break; case 0x15e65ec0: //DirectDraw7 dwLocalDDVersion = 7; break; + case 0x3BBA0080: //Direct3D + dwLocalD3DVersion = 1; + break; + case 0x6aae1ec1: //Direct3D2 + dwLocalD3DVersion = 5; + break; + case 0xbb223240: //Direct3D3 + dwLocalD3DVersion = 6; + break; + case 0xf5049e77: //Direct3D7 + dwLocalD3DVersion = 7; + break; } - if (! *obp) { OutTraceD("QueryInterface(D): Interface for DX version %d not found\n", dwLocalDDVersion); return(0); } + if(dwLocalDDVersion) OutTraceD("QueryInterface(D): Got interface for DX version %d\n", dwLocalDDVersion); + if(dwLocalD3DVersion) OutTraceD("QueryInterface(D): Got interface for D3D version %d\n", dwLocalD3DVersion); if (dwLocalDDVersion > dxw.dwMaxDDVersion) { *obp = NULL; @@ -1635,7 +1595,16 @@ HRESULT WINAPI extQueryInterfaceD(void *lpdd, REFIID riid, LPVOID *obp) case 7: dxw.dwDDVersion=dwLocalDDVersion; HookDDSession((LPDIRECTDRAW *)obp, dxw.dwDDVersion); + break; + } + extern void HookDirect3DSession(LPDIRECTDRAW *, int); + switch (dwLocalD3DVersion){ + case 1: + case 5: + case 6: + case 7: + HookDirect3DSession((LPDIRECTDRAW *)obp, dwLocalD3DVersion); break; } @@ -1652,9 +1621,16 @@ HRESULT WINAPI extQueryInterfaceS(void *lpdds, REFIID riid, LPVOID *obp) { HRESULT res; BOOL IsPrim; + BOOL IsBack; + BOOL IsGammaRamp; unsigned int dwLocalDDVersion; + OutTraceD("QueryInterface(S): lpdds=%x REFIID=%x(%s) obp=%x\n", + lpdds, riid.Data1, ExplainGUID((GUID *)&riid), *obp); + IsPrim=dxw.IsAPrimarySurface((LPDIRECTDRAWSURFACE)lpdds); + IsBack=dxw.IsABackBufferSurface((LPDIRECTDRAWSURFACE)lpdds); + IsGammaRamp=FALSE; dwLocalDDVersion=0; switch(riid.Data1){ @@ -1682,7 +1658,14 @@ HRESULT WINAPI extQueryInterfaceS(void *lpdds, REFIID riid, LPVOID *obp) return DDERR_GENERIC; } break; - } + case 0x4B9F0EE0: + OutTraceD("QueryInterface: IID_IDirectDrawColorControl\n"); + break; + case 0x69C11C3E: + OutTraceD("QueryInterface: IID_IDirectDrawGammaControl\n"); + IsGammaRamp=TRUE; + break; + } if (dwLocalDDVersion > dxw.dwMaxDDVersion) { *obp = NULL; @@ -1715,31 +1698,36 @@ HRESULT WINAPI extQueryInterfaceS(void *lpdds, REFIID riid, LPVOID *obp) case 3: case 4: case 7: - dxw.dwDDVersion=dwLocalDDVersion; - if(IsPrim){ OutTraceD("QueryInterface(S): primary=%x new=%x\n", lpdds, *obp); dxw.MarkPrimarySurface((LPDIRECTDRAWSURFACE)*obp); HookDDSurfacePrim((LPDIRECTDRAWSURFACE *)obp, dxw.dwDDVersion); } else{ - dxw.UnmarkPrimarySurface((LPDIRECTDRAWSURFACE)*obp); - // v2.02.13: seems that hooking inconditionally gives troubles. What is the proper hook condition? - // maybe when in emulation mode? - //ASSERT TO BE FINISHED - if(dxw.dwFlags1 & EMULATESURFACE) HookDDSurfaceGeneric((LPDIRECTDRAWSURFACE *)obp, dxw.dwDDVersion); + if(IsBack) dxw.MarkBackBufferSurface((LPDIRECTDRAWSURFACE)*obp); + else dxw.MarkRegularSurface((LPDIRECTDRAWSURFACE)*obp); + // v2.02.13: seems that hooking inconditionally gives troubles. What is the proper safe hook condition? + HookDDSurfaceGeneric((LPDIRECTDRAWSURFACE *)obp, dxw.dwDDVersion); } - break; } - if (dxw.dwFlags3 & SAVECAPS) { - DDSURFACEDESC2 ddsd; - if (PopCaps(&ddsd, (LPDIRECTDRAWSURFACE)lpdds)) PushCaps(&ddsd, (LPDIRECTDRAWSURFACE)*obp); + if(IsGammaRamp){ + // IDirectDrawGammaControl::GetGammaRamp + SetHook((void *)(**(DWORD **)obp + 12), extDDGetGammaRamp, (void **)&pDDGetGammaRamp, "GetGammaRamp(G)"); + // IDirectDrawGammaControl::SetGammaRamp + SetHook((void *)(**(DWORD **)obp + 16), extDDSetGammaRamp, (void **)&pDDSetGammaRamp, "SetGammaRamp(G)"); } - if(lpdds == lpDDSBack) lpDDSBack = (LPDIRECTDRAWSURFACE)*obp; + if((lpdds == lpDDSBack) && dwLocalDDVersion) { + // assume that you always use the newer interface version, if available. + if(dwLocalDDVersion > (UINT)iBakBufferVersion){ + OutTrace("QueryInterface(S): switching backbuffer %x -> %x\n", lpDDSBack, *obp); + lpDDSBack = (LPDIRECTDRAWSURFACE)*obp; + iBakBufferVersion = dwLocalDDVersion; + } + } return 0; } @@ -1921,49 +1909,51 @@ HRESULT WINAPI extSetCooperativeLevel(void *lpdd, HWND hwnd, DWORD dwflags) return res; } -static char *FixSurfaceCaps(LPDDSURFACEDESC2 lpddsd) +#define FIX_FLAGSMASK (DDSD_CAPS|DDSD_HEIGHT|DDSD_WIDTH|DDSD_PITCH|DDSD_PIXELFORMAT|DDSD_ZBUFFERBITDEPTH) +//#define FIXCAPS_ANALITICAL + +static void FixSurfaceCaps(LPDDSURFACEDESC2 lpddsd, int dxversion) { - // OutTrace("FixSurfaceCaps DEBUG: flags=%x(%s) caps=%x(%s)\n", - // lpddsd->dwFlags, ExplainFlags(lpddsd->dwFlags), lpddsd->ddsCaps.dwCaps, ExplainDDSCaps(lpddsd->ddsCaps.dwCaps)); - // experimental part: - switch (lpddsd->dwFlags){ - case DDSD_CAPS|DDSD_HEIGHT|DDSD_WIDTH|DDSD_PITCH: + // To do: fix Dungeon Keeper II + + // rules of thumb: + // 1) always get rid of DDSCAPS_VIDEOMEMORY caps + // 2) always add DDSCAPS_SYSTEMMEMORY caps + // 3) DDSCAPS_SYSTEMMEMORY is supported from dxversion 4 + // 4) if DDSD_CAPS is not set, ignore caps + // 5) ignore DDSD_CKSRCBLT, .... + // 6) setting a different pixel format in memory requires DDSCAPS_OFFSCREENPLAIN capability + + if(!(lpddsd->dwFlags & DDSD_CAPS)) lpddsd->ddsCaps.dwCaps = 0; + + OutTraceD("FixSurfaceCaps: Flags=%x(%s) Caps=%x(%s)\n", + lpddsd->dwFlags, ExplainFlags(lpddsd->dwFlags), lpddsd->ddsCaps.dwCaps, ExplainDDSCaps(lpddsd->ddsCaps.dwCaps)); + +#ifdef FIXCAPS_ANALITICAL + switch (lpddsd->dwFlags & FIX_FLAGSMASK){ + case DDSD_CAPS|DDSD_WIDTH|DDSD_HEIGHT|DDSD_ZBUFFERBITDEPTH: switch (lpddsd->ddsCaps.dwCaps){ - case DDSCAPS_OFFSCREENPLAIN|DDSCAPS_SYSTEMMEMORY: - // Airline Tycoon Evolution - OutTrace("FixSurfaceCaps: no PixelFormat\n"); - return "null"; - break; - //case DDSCAPS_OFFSCREENPLAIN|DDSCAPS_SYSTEMMEMORY|DDSCAPS_3DDEVICE: - // OutTrace("FixSurfaceCaps: ??? (Dungeon Keeper D3D)\n"); - // //return SetPixFmt(lpddsd); - // return "null"; - // break; - default: + case DDSCAPS_VIDEOMEMORY|DDSCAPS_ZBUFFER: + // Dungeon Keeper II + return; break; } break; - case DDSD_CAPS|DDSD_WIDTH|DDSD_HEIGHT|DDSD_PIXELFORMAT: + case DDSD_CAPS|DDSD_WIDTH: switch (lpddsd->ddsCaps.dwCaps){ - case DDSCAPS_OFFSCREENPLAIN: - // Submarine titans (8BPP) - OutTrace("FixSurfaceCaps: SystemMemory OffScreen PixelFormat (1)\n"); - //lpddsd->ddsCaps.dwCaps &= ~DDSCAPS_VIDEOMEMORY; - lpddsd->ddsCaps.dwCaps = (DDSCAPS_SYSTEMMEMORY|DDSCAPS_OFFSCREENPLAIN); - return SetPixFmt(lpddsd); + case DDSCAPS_SYSTEMMEMORY: + return; break; - case DDSCAPS_OFFSCREENPLAIN|DDSCAPS_SYSTEMMEMORY: - // Duckman - OutTrace("FixSurfaceCaps: SystemMemory OffScreen PixelFormat (2)\n"); - //lpddsd->ddsCaps.dwCaps &= ~DDSCAPS_VIDEOMEMORY; - //lpddsd->ddsCaps.dwCaps |= (DDSCAPS_SYSTEMMEMORY|DDSCAPS_OFFSCREENPLAIN); - return SetPixFmt(lpddsd); + case DDSCAPS_VIDEOMEMORY: + return; break; - case DDSCAPS_SYSTEMMEMORY|DDSCAPS_ZBUFFER: - // the Sims - OutTrace("FixSurfaceCaps: SystemMemory ZBuffer for the Sims\n"); - //lpddsd->ddsCaps.dwCaps = (DDSCAPS_SYSTEMMEMORY|DDSCAPS_ZBUFFER); identical ... - return "ZBUFFER"; + case DDSCAPS_SYSTEMMEMORY|DDSCAPS_RESERVED2: + // Martian Gothic + return; + break; + case DDSCAPS_VIDEOMEMORY|DDSCAPS_RESERVED2: + // Martian Gothic + return; break; } break; @@ -1971,62 +1961,182 @@ static char *FixSurfaceCaps(LPDDSURFACEDESC2 lpddsd) switch (lpddsd->ddsCaps.dwCaps){ case DDSCAPS_BACKBUFFER|DDSCAPS_SYSTEMMEMORY: // Vangers - OutTrace("FixSurfaceCaps: backbuffer\n"); lpddsd->ddsCaps.dwCaps = DDSCAPS_SYSTEMMEMORY; - return("backbuf"); + return; + break; + case DDSCAPS_OFFSCREENPLAIN|DDSCAPS_3DDEVICE|DDSCAPS_VIDEOMEMORY: + // Bunnies must die + lpddsd->ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN|DDSCAPS_3DDEVICE|DDSCAPS_SYSTEMMEMORY; // NOT WORKING + return; break; case DDSCAPS_OFFSCREENPLAIN|DDSCAPS_VIDEOMEMORY: - // Alien Nations - OutTrace("FixSurfaceCaps: Alien Nations (1)\n"); + // Alien Nations, Heroes of Might & Magic IV --- troublesome!!!! + //lpddsd->dwFlags = 0; + //lpddsd->ddsCaps.dwCaps = (DDSCAPS_OFFSCREENPLAIN|DDSCAPS_SYSTEMMEMORY); + lpddsd->ddsCaps.dwCaps = 0; + return; + break; + case DDSCAPS_OFFSCREENPLAIN|DDSCAPS_SYSTEMMEMORY: + // Cave Story, HoMM3 lpddsd->dwFlags |= DDSD_PIXELFORMAT; - lpddsd->ddsCaps.dwCaps &= ~DDSCAPS_VIDEOMEMORY; - return SetPixFmt(lpddsd); + SetPixFmt(lpddsd); + return; + break; + case DDSCAPS_SYSTEMMEMORY: + // Magic & Mayhem + lpddsd->dwFlags |= DDSD_PIXELFORMAT; + lpddsd->ddsCaps.dwCaps = DDSCAPS_SYSTEMMEMORY|DDSCAPS_OFFSCREENPLAIN; + SetPixFmt(lpddsd); + return; + break; + case DDSCAPS_OFFSCREENPLAIN: + // Cave Story, Magic & Mayhem + lpddsd->dwFlags |= DDSD_PIXELFORMAT; + lpddsd->ddsCaps.dwCaps = DDSCAPS_SYSTEMMEMORY|DDSCAPS_OFFSCREENPLAIN; + SetPixFmt(lpddsd); + return; break; case DDSCAPS_OFFSCREENPLAIN|DDSCAPS_3DDEVICE: // Nightmare Ned - OutTrace("FixSurfaceCaps: Nightmare Ned\n"); lpddsd->dwFlags |= DDSD_PIXELFORMAT; - lpddsd->ddsCaps.dwCaps &= ~DDSCAPS_VIDEOMEMORY; - return SetPixFmt(lpddsd); + SetPixFmt(lpddsd); + return; + break; + case DDSCAPS_SYSTEMMEMORY|DDSCAPS_3DDEVICE: + // Actua Soccer 3 + lpddsd->dwFlags |= DDSD_PIXELFORMAT; + SetPixFmt(lpddsd); + return; + break; + case DDSCAPS_VIDEOMEMORY|DDSCAPS_3DDEVICE: + // Actua Soccer 3 + lpddsd->dwFlags |= DDSD_PIXELFORMAT; + lpddsd->ddsCaps.dwCaps = DDSCAPS_SYSTEMMEMORY|DDSCAPS_3DDEVICE; + SetPixFmt(lpddsd); + return; break; case DDSCAPS_OFFSCREENPLAIN|DDSCAPS_3DDEVICE|DDSCAPS_SYSTEMMEMORY: - // Nightmare Ned - OutTrace("FixSurfaceCaps: The Sims\n"); + // Nightmare Ned, The Sims ??? lpddsd->dwFlags |= DDSD_PIXELFORMAT; - lpddsd->ddsCaps.dwCaps &= ~DDSCAPS_VIDEOMEMORY; - return SetPixFmt(lpddsd); - break; - default: + SetPixFmt(lpddsd); + return; break; } break; - default: + case DDSD_CAPS|DDSD_HEIGHT|DDSD_WIDTH|DDSD_PITCH: + switch (lpddsd->ddsCaps.dwCaps){ + case DDSCAPS_OFFSCREENPLAIN|DDSCAPS_SYSTEMMEMORY: + // Airline Tycoon Evolution + return; + break; + //case DDSCAPS_OFFSCREENPLAIN|DDSCAPS_SYSTEMMEMORY|DDSCAPS_3DDEVICE: + // OutTrace("FixSurfaceCaps: ??? (Dungeon Keeper D3D)\n"); + // break; + } break; + case DDSD_CAPS|DDSD_WIDTH|DDSD_HEIGHT|DDSD_PIXELFORMAT: + switch (lpddsd->ddsCaps.dwCaps){ + case DDSCAPS_OFFSCREENPLAIN: + // Submarine titans (8BPP) + lpddsd->ddsCaps.dwCaps = (DDSCAPS_SYSTEMMEMORY|DDSCAPS_OFFSCREENPLAIN); + SetPixFmt(lpddsd); + return; + break; + case DDSCAPS_OFFSCREENPLAIN|DDSCAPS_SYSTEMMEMORY: + // Duckman, HoM&M4 + return; + break; + case DDSCAPS_SYSTEMMEMORY|DDSCAPS_ZBUFFER: + // the Sims + return; + break; + case DDSCAPS_SYSTEMMEMORY|DDSCAPS_TEXTURE: + // Wargames Direct3D hw acceleration + return; + break; + case DDSCAPS_VIDEOMEMORY|DDSCAPS_ZBUFFER: + // Martian Gothic + lpddsd->ddsCaps.dwCaps = (DDSCAPS_SYSTEMMEMORY|DDSCAPS_ZBUFFER); // working ???? + return; + break; + case DDSCAPS_VIDEOMEMORY|DDSCAPS_LOCALVIDMEM|DDSCAPS_ZBUFFER: + // Rayman 2 + lpddsd->ddsCaps.dwCaps = (DDSCAPS_SYSTEMMEMORY|DDSCAPS_ZBUFFER); // working ???? + return; + break; + case DDSCAPS_OFFSCREENPLAIN|DDSCAPS_SYSTEMMEMORY|DDSCAPS_3DDEVICE: + // Premier Manager 98 + SetPixFmt(lpddsd); + return; + break; + case DDSCAPS_OVERLAY|DDSCAPS_VIDEOMEMORY: // NOT WORKING + // Bunnies must die (not the horny ones!) + lpddsd->ddsCaps.dwCaps = DDSCAPS_OVERLAY|DDSCAPS_SYSTEMMEMORY; + return; + break; + } + break; + case DDSD_CAPS|DDSD_WIDTH|DDSD_HEIGHT|DDSD_PITCH|DDSD_PIXELFORMAT: + switch (lpddsd->ddsCaps.dwCaps){ + case DDSCAPS_SYSTEMMEMORY: + // Wargames + lpddsd->ddsCaps.dwCaps = (DDSCAPS_SYSTEMMEMORY|DDSCAPS_OFFSCREENPLAIN); + SetPixFmt(lpddsd); + //lpddsd->dwFlags = DDSD_CAPS|DDSD_WIDTH|DDSD_HEIGHT|DDSD_PITCH; // turn DDSD_PIXELFORMAT off + return; + break; + case DDSCAPS_OFFSCREENPLAIN|DDSCAPS_VIDEOMEMORY: + // A10 Cuba + lpddsd->ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN|DDSCAPS_SYSTEMMEMORY; // DDSCAPS_OFFSCREENPLAIN|DDSCAPS_VIDEOMEMORY working as well... + return; + break; + } + break; + } - if(((lpddsd->dwFlags & (DDSD_CAPS|DDSD_WIDTH|DDSD_HEIGHT|DDSD_PIXELFORMAT)) == (DDSD_CAPS|DDSD_WIDTH|DDSD_HEIGHT|DDSD_PIXELFORMAT)) && - (lpddsd->ddsCaps.dwCaps & DDSCAPS_ZBUFFER)){ - OutTraceB("FixSurfaceCaps: Experimental pixelformat for ZBUFFER case\n"); - lpddsd->ddsCaps.dwCaps &= ~(DDSCAPS_VIDEOMEMORY|DDSCAPS_LOCALVIDMEM); // Evany - lpddsd->ddsCaps.dwCaps |= DDSCAPS_SYSTEMMEMORY; - return "ZBUFFER"; + if(dxw.dwFlags3 & SURFACEWARN){ + char sMsg[512]; + sprintf(sMsg, "Flags=%x(%s) Caps=%x(%s)", lpddsd->dwFlags, ExplainFlags(lpddsd->dwFlags), lpddsd->ddsCaps.dwCaps, ExplainDDSCaps(lpddsd->ddsCaps.dwCaps)); + MessageBox(0, sMsg, "FixSurfaceCaps unmanaged setting", MB_OK | MB_ICONEXCLAMATION); } - if(((lpddsd->dwFlags & DDSD_WIDTH) && !(lpddsd->dwFlags & DDSD_HEIGHT)) || - (lpddsd->dwFlags & DDSD_ZBUFFERBITDEPTH) || - ((lpddsd->dwFlags & DDSD_PIXELFORMAT) && !(lpddsd->dwFlags & DDSD_PITCH) && !(lpddsd->ddsCaps.dwCaps & DDSCAPS_3DDEVICE)) || // fix good for "Wargames" - ((lpddsd->dwFlags & DDSD_CAPS) && (lpddsd->ddsCaps.dwCaps & DDSCAPS_3DDEVICE) && !(lpddsd->dwFlags & DDSD_PIXELFORMAT)) // fix good for Premier Manager 98 - ){ - OutTraceB("FixSurfaceCaps: suppress DDSD_PIXELFORMAT case\n"); - // don't alter pixel format - lpddsd->dwFlags &= ~DDSD_PIXELFORMAT; // Wargames, Warhammer Dark Omen - return "(none)"; +#endif + + if((lpddsd->dwFlags & (DDSD_WIDTH|DDSD_HEIGHT)) == DDSD_WIDTH) { // buffer surface - no changes + return; } - // adjust pixel format + if((lpddsd->dwFlags & DDSD_CAPS) && (lpddsd->ddsCaps.dwCaps & DDSCAPS_ZBUFFER)) { // z-buffer surface - set to memory + lpddsd->ddsCaps.dwCaps = (DDSCAPS_SYSTEMMEMORY|DDSCAPS_ZBUFFER); + return; + } + if((lpddsd->dwFlags & DDSD_CAPS) && (lpddsd->ddsCaps.dwCaps & DDSCAPS_3DDEVICE)) { // 3DDEVICE: enforce PIXELFORMAT on MEMORY + lpddsd->dwFlags |= DDSD_PIXELFORMAT; + lpddsd->ddsCaps.dwCaps = (DDSCAPS_OFFSCREENPLAIN|DDSCAPS_SYSTEMMEMORY|DDSCAPS_3DDEVICE); + SetPixFmt(lpddsd); + return; + } + if(lpddsd->dwFlags & DDSD_ZBUFFERBITDEPTH){ + lpddsd->dwFlags &= ~DDSD_PIXELFORMAT; + } + // HoM&M3/4 fix.... + if(((lpddsd->dwFlags & (DDSD_CAPS|DDSD_WIDTH|DDSD_HEIGHT)) == (DDSD_CAPS|DDSD_HEIGHT|DDSD_WIDTH)) && + (lpddsd->ddsCaps.dwCaps == (DDSCAPS_OFFSCREENPLAIN|DDSCAPS_VIDEOMEMORY))){ + lpddsd->ddsCaps.dwCaps = 0; + return; + } + // HoM&M3/4 fix.... don't alter pixel format set to OFFSCREENPLAIN+SYSTEMMEMORY surface + if(((lpddsd->dwFlags & (DDSD_CAPS|DDSD_WIDTH|DDSD_HEIGHT|DDSD_PIXELFORMAT)) == (DDSD_CAPS|DDSD_WIDTH|DDSD_HEIGHT|DDSD_PIXELFORMAT)) && + (lpddsd->ddsCaps.dwCaps == (DDSCAPS_OFFSCREENPLAIN|DDSCAPS_SYSTEMMEMORY))){ + return; + } + + // default case: adjust pixel format OutTraceB("FixSurfaceCaps: suppress DDSCAPS_VIDEOMEMORY case\n"); lpddsd->dwFlags |= (DDSD_CAPS|DDSD_PIXELFORMAT); lpddsd->ddsCaps.dwCaps &= ~DDSCAPS_VIDEOMEMORY; lpddsd->ddsCaps.dwCaps |= (DDSCAPS_SYSTEMMEMORY|DDSCAPS_OFFSCREENPLAIN); - return SetPixFmt(lpddsd); + SetPixFmt(lpddsd); + return; } static void ClearSurfaceDesc(void *ddsd, int dxversion) @@ -2043,18 +2153,6 @@ static HRESULT BuildPrimaryEmu(LPDIRECTDRAW lpdd, CreateSurface_Type pCreateSurf HRESULT res; // emulated primary surface -#if 0 - ClearSurfaceDesc((void *)&ddsd, dxversion); - ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_PIXELFORMAT; - ddsd.ddsCaps.dwCaps = DDSCAPS_SYSTEMMEMORY | DDSCAPS_OFFSCREENPLAIN; - if (lpddsd->dwFlags & DDSD_CKDESTBLT) ddsd.dwFlags|=DDSD_CKDESTBLT; - if (lpddsd->dwFlags & DDSD_CKDESTOVERLAY) ddsd.dwFlags|=DDSD_CKDESTOVERLAY; - if (lpddsd->dwFlags & DDSD_CKSRCBLT) ddsd.dwFlags|=DDSD_CKSRCBLT; - if (lpddsd->dwFlags & DDSD_CKSRCOVERLAY) ddsd.dwFlags|=DDSD_CKSRCOVERLAY; - ddsd.dwWidth = dxw.GetScreenWidth(); - ddsd.dwHeight = dxw.GetScreenHeight(); - SetPixFmt((LPDDSURFACEDESC2)&ddsd); -#else memcpy((void *)&ddsd, lpddsd, lpddsd->dwSize); ddsd.dwFlags &= ~(DDSD_BACKBUFFERCOUNT|DDSD_REFRESHRATE); ddsd.dwFlags |= (DDSD_CAPS|DDSD_WIDTH|DDSD_HEIGHT|DDSD_PIXELFORMAT); @@ -2064,7 +2162,6 @@ static HRESULT BuildPrimaryEmu(LPDIRECTDRAW lpdd, CreateSurface_Type pCreateSurf ddsd.dwWidth = dxw.GetScreenWidth(); ddsd.dwHeight = dxw.GetScreenHeight(); SetPixFmt((LPDDSURFACEDESC2)&ddsd); -#endif // create Primary surface DumpSurfaceAttributes((LPDDSURFACEDESC)&ddsd, "[Primary]" , __LINE__); @@ -2087,7 +2184,6 @@ static HRESULT BuildPrimaryEmu(LPDIRECTDRAW lpdd, CreateSurface_Type pCreateSurf OutTraceD("CreateSurface: created PRIMARY DDSPrim=%x\n", *lplpdds); if(IsDebug) DescribeSurface(*lplpdds, dxversion, "DDSPrim", __LINE__); - dxw.MarkPrimarySurface(*lplpdds); HookDDSurfacePrim(lplpdds, dxversion); if(lpDDSEmu_Prim==NULL){ @@ -2111,7 +2207,7 @@ static HRESULT BuildPrimaryEmu(LPDIRECTDRAW lpdd, CreateSurface_Type pCreateSurf OutTraceD("CreateSurface: created new DDSEmu_Prim=%x\n",lpDDSEmu_Prim); if(IsDebug) DescribeSurface(lpDDSEmu_Prim, dxversion, "DDSEmu_Prim", __LINE__); InitDSScreenParameters(lpDDSEmu_Prim); - dxw.UnmarkPrimarySurface(lpDDSEmu_Prim); + dxw.MarkRegularSurface(lpDDSEmu_Prim); // can't hook lpDDSEmu_Prim as generic, since the Flip method is unimplemented for a PRIMARY surface! // better avoid it or hook just useful methods. //if (dxw.dwTFlags & OUTPROXYTRACE) HookDDSurfaceGeneric(&lpDDSEmu_Prim, dxw.dwDDVersion); @@ -2133,7 +2229,7 @@ static HRESULT BuildPrimaryEmu(LPDIRECTDRAW lpdd, CreateSurface_Type pCreateSurf } OutTraceD("CreateSurface: created new DDSEmu_Back=%x\n", lpDDSEmu_Back); if(IsDebug) DescribeSurface(lpDDSEmu_Back, dxversion, "DDSEmu_Back", __LINE__); - dxw.UnmarkPrimarySurface(lpDDSEmu_Back); + dxw.MarkRegularSurface(lpDDSEmu_Back); if (dxw.dwTFlags & OUTPROXYTRACE) HookDDSurfaceGeneric(&lpDDSEmu_Back, dxversion); } @@ -2174,7 +2270,7 @@ static HRESULT BuildPrimaryDir(LPDIRECTDRAW lpdd, CreateSurface_Type pCreateSurf if(dxw.dwFlags1 & EMULATEBUFFER){ lpDDSEmu_Prim = *lplpdds; - dxw.UnmarkPrimarySurface(lpDDSEmu_Prim); + dxw.MarkRegularSurface(lpDDSEmu_Prim); RenewClipper(lpdd, lpDDSEmu_Prim); ddsd.dwFlags = DDSD_WIDTH | DDSD_HEIGHT | DDSD_CAPS; @@ -2193,7 +2289,6 @@ static HRESULT BuildPrimaryDir(LPDIRECTDRAW lpdd, CreateSurface_Type pCreateSurf if(IsDebug) DescribeSurface(*lplpdds, dxversion, "DDSPrim(2)", __LINE__); } - dxw.MarkPrimarySurface(*lplpdds); HookDDSurfacePrim(lplpdds, dxversion); if(dxw.dwFlags1 & CLIPCURSOR) dxw.SetClipCursor(); @@ -2206,14 +2301,6 @@ static HRESULT BuildBackBufferEmu(LPDIRECTDRAW lpdd, CreateSurface_Type pCreateS HRESULT res; // create BackBuffer surface -#if 0 - ClearSurfaceDesc((void *)&ddsd, dxversion); - ddsd.dwFlags = DDSD_CAPS|DDSD_PIXELFORMAT|DDSD_HEIGHT|DDSD_WIDTH; - ddsd.ddsCaps.dwCaps=DDSCAPS_SYSTEMMEMORY | DDSCAPS_OFFSCREENPLAIN; - ddsd.dwWidth = dxw.GetScreenWidth(); - ddsd.dwHeight = dxw.GetScreenHeight(); - SetPixFmt(&ddsd); -#else memcpy(&ddsd, lpddsd, lpddsd->dwSize); ddsd.dwFlags &= ~(DDSD_WIDTH|DDSD_HEIGHT|DDSD_BACKBUFFERCOUNT|DDSD_REFRESHRATE); ddsd.dwFlags |= (DDSD_CAPS|DDSD_HEIGHT|DDSD_WIDTH|DDSD_PIXELFORMAT); @@ -2223,7 +2310,6 @@ static HRESULT BuildBackBufferEmu(LPDIRECTDRAW lpdd, CreateSurface_Type pCreateS ddsd.dwWidth = dxw.GetScreenWidth(); ddsd.dwHeight = dxw.GetScreenHeight(); SetPixFmt(&ddsd); -#endif DumpSurfaceAttributes((LPDDSURFACEDESC)&ddsd, "[Backbuf]" , __LINE__); res=(*pCreateSurface)(lpdd, &ddsd, lplpdds, 0); @@ -2232,13 +2318,9 @@ static HRESULT BuildBackBufferEmu(LPDIRECTDRAW lpdd, CreateSurface_Type pCreateS if(res==DDERR_INVALIDPIXELFORMAT) DumpPixFmt(&ddsd); return res; } - if (dxw.dwFlags3 & SAVECAPS) { - ddsd.ddsCaps.dwCaps=DDSCAPS_VIDEOMEMORY; - PushCaps(&ddsd, *lplpdds); - } + OutTraceD("CreateSurface: created BACK DDSBack=%x\n", *lplpdds); if(IsDebug) DescribeSurface(*lplpdds, dxversion, "DDSBack", __LINE__); - dxw.UnmarkPrimarySurface(*lplpdds); HookDDSurfaceGeneric(lplpdds, dxversion); // added !!! lpBackBufferDD = lpdd; // v2.02.31 iBakBufferVersion=dxversion; // v2.02.31 @@ -2287,13 +2369,9 @@ static HRESULT BuildBackBufferDir(LPDIRECTDRAW lpdd, CreateSurface_Type pCreateS return res; } } - if (dxw.dwFlags3 & SAVECAPS) { - ddsd.ddsCaps.dwCaps=DDSCAPS_VIDEOMEMORY; - PushCaps(&ddsd, *lplpdds); - } + OutTraceD("CreateSurface: created BACK DDSBack=%x\n", *lplpdds); if(IsDebug) DescribeSurface(*lplpdds, dxversion, "DDSBack", __LINE__); - dxw.UnmarkPrimarySurface(*lplpdds); HookDDSurfaceGeneric(lplpdds, dxversion); // added !!! lpBackBufferDD = lpdd; // v2.02.31 iBakBufferVersion=dxversion; // v2.02.31 @@ -2307,16 +2385,7 @@ static HRESULT BuildGenericEmu(LPDIRECTDRAW lpdd, CreateSurface_Type pCreateSurf HRESULT res; memcpy(&ddsd, lpddsd, lpddsd->dwSize); // Copy over .... - if(ddsd.dwFlags & DDSD_CAPS){ - ddsd.ddsCaps.dwCaps &= ~DDSCAPS_VIDEOMEMORY; - } - else{ - ddsd.dwFlags |= DDSD_CAPS; - ddsd.ddsCaps.dwCaps = 0; - } - ddsd.ddsCaps.dwCaps |= DDSCAPS_SYSTEMMEMORY; - //if (dxversion >= 4) ddsd.ddsCaps.dwCaps |= DDSCAPS_OFFSCREENPLAIN; - FixSurfaceCaps(&ddsd); + FixSurfaceCaps(&ddsd, dxversion); DumpSurfaceAttributes((LPDDSURFACEDESC)&ddsd, "[Emu Generic]" , __LINE__); res=(*pCreateSurface)(lpdd, &ddsd, lplpdds, pu); @@ -2325,12 +2394,12 @@ static HRESULT BuildGenericEmu(LPDIRECTDRAW lpdd, CreateSurface_Type pCreateSurf return res; } + if(ddsd.ddsCaps.dwCaps & DDSCAPS_ZBUFFER) lpDDZBuffer=*lplpdds; + OutTraceD("CreateSurface: created Emu_Generic dds=%x\n", *lplpdds); if(IsDebug) DescribeSurface(*lplpdds, dxversion, "DDSEmu_Generic", __LINE__); // diagnostic hooks .... HookDDSurfaceGeneric(lplpdds, dxversion); - // unmark this as possible primary - dxw.UnmarkPrimarySurface(*lplpdds); return DD_OK; } @@ -2358,7 +2427,6 @@ static HRESULT BuildGenericDir(LPDIRECTDRAW lpdd, CreateSurface_Type pCreateSurf // hooks .... HookDDSurfaceGeneric(lplpdds, dxversion); - dxw.UnmarkPrimarySurface(*lplpdds); OutTraceD("CreateSurface: created lpdds=%x type=Generic ret=%x\n", *lplpdds, res); if(IsDebug) DescribeSurface(lpDDSBack, dxversion, "Generic", __LINE__); @@ -2370,7 +2438,7 @@ static HRESULT WINAPI extCreateSurface(int dxversion, CreateSurface_Type pCreate LPDIRECTDRAWSURFACE *lplpdds, void *pu) { HRESULT res; - DDSURFACEDESC2 ddsd, SavedDDSD; + DDSURFACEDESC2 ddsd; LPDIRECTDRAWSURFACE lpDDSPrim; DWORD CurFlags; int TargetSize; @@ -2413,8 +2481,6 @@ static HRESULT WINAPI extCreateSurface(int dxversion, CreateSurface_Type pCreate lpddsd->dwFlags++; } - if (dxw.dwFlags3 & SAVECAPS) SavedDDSD=*lpddsd; - memcpy(&ddsd, lpddsd, lpddsd->dwSize); // Copy // creation of the primary surface.... @@ -2424,9 +2490,7 @@ static HRESULT WINAPI extCreateSurface(int dxversion, CreateSurface_Type pCreate GetHookInfo()->ColorDepth=(short)dxw.VirtualPixelFormat.dwRGBBitCount; GetHookInfo()->DXVersion=dxversion; lpPrimaryDD = lpdd; // v2.1.87 - - dxw.dwPrimarySurfaceCaps = ddsd.ddsCaps.dwCaps; - dxw.dwBackBufferCount = (ddsd.dwFlags & DDSD_BACKBUFFERCOUNT) ? ddsd.dwBackBufferCount : 0; + memcpy(&DDSD_Prim, lpddsd, sizeof(DDSD_Prim)); // v2.02.37 // beware of the different behaviour between older and newer directdraw releases... if(dxversion >= 4){ @@ -2455,7 +2519,6 @@ static HRESULT WINAPI extCreateSurface(int dxversion, CreateSurface_Type pCreate OutTraceD(sMsg); if (IsAssertEnabled) MessageBox(0, sMsg, "CreateSurface", MB_OK | MB_ICONEXCLAMATION); // recover ... - dxw.dwBackBufferCount =MAXBACKBUFFERS; BBCount = MAXBACKBUFFERS; } @@ -2464,11 +2527,13 @@ static HRESULT WINAPI extCreateSurface(int dxversion, CreateSurface_Type pCreate res=BuildPrimary(lpdd, pCreateSurface, lpddsd, dxversion, lplpdds, NULL); if(res) return res; lpDDSPrim = *lplpdds; + dxw.MarkPrimarySurface(lpDDSPrim); if (BBCount){ // build emulated backbuffer surface res=BuildBackBuffer(lpdd, pCreateSurface, lpddsd, dxversion, &lpDDSBack, NULL); if(res) return res; + dxw.MarkBackBufferSurface(lpDDSBack); // V2.1.85/V2.2.34: tricky !!!! // When a real backbuffer is created, it has a reference to its frontbuffer. @@ -2498,20 +2563,20 @@ static HRESULT WINAPI extCreateSurface(int dxversion, CreateSurface_Type pCreate if (lpDDSBack) { OutTraceD("CreateSurface: returning current DDSBack=%x\n", lpDDSBack); *lplpdds = lpDDSBack; - REFPROBE(*lplpdds, "CREATED"); + REFPROBE(lpDDSBack, "CREATED"); return DD_OK; } res=BuildBackBuffer(lpdd, pCreateSurface, lpddsd, dxversion, lplpdds, NULL); lpDDSBack = *lplpdds; + dxw.MarkBackBufferSurface(lpDDSBack); REFPROBE(*lplpdds, "CREATED"); return res; } // if nothing else, it's a generic surface res=BuildGeneric(lpdd, pCreateSurface, lpddsd, dxversion, lplpdds, pu); - - if (dxw.dwFlags3 & SAVECAPS) PushCaps(&SavedDDSD, *lplpdds); + if(!res) dxw.MarkRegularSurface(*lplpdds); REFPROBE(*lplpdds, "CREATED"); return res; @@ -2544,10 +2609,12 @@ HRESULT WINAPI extGetAttachedSurface(int dxversion, GetAttachedSurface_Type pGet { HRESULT res; BOOL IsPrim; + BOOL IsBack; IsPrim=dxw.IsAPrimarySurface(lpdds); + IsBack=dxw.IsABackBufferSurface(lpdds); OutTraceD("GetAttachedSurface(%d): lpdds=%x%s caps=%x(%s)\n", - dxversion, lpdds, (IsPrim?"(PRIM)":""), lpddsc->dwCaps, ExplainDDSCaps(lpddsc->dwCaps)); + dxversion, lpdds, (IsPrim?"(PRIM)":(IsBack ? "(BACK)":"")), lpddsc->dwCaps, ExplainDDSCaps(lpddsc->dwCaps)); #if 0 if(0 && (lpddsc->dwCaps & DDSCAPS_MIPMAP)){ @@ -2565,16 +2632,16 @@ HRESULT WINAPI extGetAttachedSurface(int dxversion, GetAttachedSurface_Type pGet // beware: "Snowboard Racer" fails if you return an attached surface anyhow! There, // the primary surface was created with back buffer count == 1. - if ((lpdds == lpDDSBack) && (dxw.dwBackBufferCount > 1)){ - *lplpddas = lpDDSBack; - OutTraceD("GetAttachedSurface(%d): DOUBLEBUFFER attached=%x\n", dxversion, *lplpddas); + // this is yet to be proven utility..... + if (IsBack && (lpddsc->dwCaps & DDSCAPS_ZBUFFER) && lpDDZBuffer){ + *lplpddas = lpDDZBuffer; + OutTraceD("GetAttachedSurface(%d): emulating ZBUFFER attach on BACKBUFFER lpddsadd=%x\n", dxversion, *lplpddas); return 0; } - // this is yet to be proven utility..... - if ((lpdds == lpDDSBack) && (lpddsc->dwCaps & DDSCAPS_ZBUFFER) && lpDDZBuffer){ - *lplpddas = lpDDZBuffer; - OutTraceD("GetAttachedSurface(%d): emulating ZBUFFER attach on BACKBUFFER lpddsadd=%x\n", dxversion, *lplpddas); + if (IsBack && (DDSD_Prim.dwBackBufferCount > 1)){ + *lplpddas = lpDDSBack; + OutTraceD("GetAttachedSurface(%d): DOUBLEBUFFER attached=%x\n", dxversion, *lplpddas); return 0; } @@ -2687,23 +2754,40 @@ HRESULT WINAPI sBlt(char *api, LPDIRECTDRAWSURFACE lpdds, LPRECT lpdestrect, // log if(IsTraceD){ - OutTrace("%s: dest=%x%s src=%x%s dwFlags=%x(%s)", + char sLog[256]; + char sInfo[128]; + sprintf(sLog, "%s: dest=%x%s src=%x%s dwFlags=%x(%s)", api, lpdds, (ToPrim ? "(PRIM)":""), lpddssrc, (FromPrim ? "(PRIM)":""), dwflags, ExplainBltFlags(dwflags)); if (lpdestrect) - OutTrace(" destrect=(%d,%d)-(%d,%d)", lpdestrect->left, lpdestrect->top, lpdestrect->right, lpdestrect->bottom); + sprintf(sInfo, " destrect=(%d,%d)-(%d,%d)", lpdestrect->left, lpdestrect->top, lpdestrect->right, lpdestrect->bottom); else - OutTrace(" destrect=(NULL)"); + sprintf(sInfo, " destrect=(NULL)"); + strcat(sLog, sInfo); if (lpsrcrect) - OutTrace(" srcrect=(%d,%d)-(%d,%d)", lpsrcrect->left, lpsrcrect->top, lpsrcrect->right, lpsrcrect->bottom); + sprintf(sInfo, " srcrect=(%d,%d)-(%d,%d)", lpsrcrect->left, lpsrcrect->top, lpsrcrect->right, lpsrcrect->bottom); else - OutTrace(" srcrect=(NULL)"); - //if (lpddbltfx) - // OutTrace(" ddbltfx.(destcolor=%x srccolor=%x fillcolor=%x filldepth=%x)", - // lpddbltfx->ddckDestColorkey, - // lpddbltfx->ddckSrcColorkey, - // lpddbltfx->dwFillColor, - // lpddbltfx->dwFillDepth); - OutTrace("\n"); + sprintf(sInfo, " srcrect=(NULL)"); + strcat(sLog, sInfo); + if(lpddbltfx){ + if (dwflags & DDBLT_COLORFILL){ + sprintf(sInfo, " ddbltfx.FillColor=%x", lpddbltfx->dwFillColor); + strcat(sLog, sInfo); + } + if (dwflags & DDBLT_KEYDESTOVERRIDE){ + sprintf(sInfo, " ddbltfx.DestColorkey=%x", lpddbltfx->ddckDestColorkey); + strcat(sLog, sInfo); + } + if (dwflags & DDBLT_KEYSRCOVERRIDE){ + sprintf(sInfo, " ddbltfx.SrcColorkey=%x", lpddbltfx->ddckSrcColorkey); + strcat(sLog, sInfo); + } + if (dwflags & DDBLT_ROP){ + sprintf(sInfo, " ddbltfx.ROP=%x", lpddbltfx->dwROP); + strcat(sLog, sInfo); + } + } + strcat(sLog,"\n"); + OutTrace(sLog); } #ifdef ONEPIXELFIX @@ -2720,41 +2804,13 @@ HRESULT WINAPI sBlt(char *api, LPDIRECTDRAWSURFACE lpdds, LPRECT lpdestrect, #define FIXBIGGERRECT 1 #if FIXBIGGERRECT if(ToPrim && lpdestrect){ + if((DWORD)lpdestrect->top < 0) lpdestrect->top = 0; + if((DWORD)lpdestrect->left < 0) lpdestrect->left = 0; if((DWORD)lpdestrect->bottom > dxw.GetScreenHeight()) lpdestrect->bottom = dxw.GetScreenHeight(); if((DWORD)lpdestrect->right > dxw.GetScreenWidth()) lpdestrect->right = dxw.GetScreenWidth(); } #endif - if((dxw.dwFlags1 & EMULATESURFACE) && (dwflags==DDBLT_COLORFILL)){ - OutTraceD("Debug: dwFillDepth=%d, EmuBPP=%d, dwFillColor=%x\n", - lpddbltfx->dwFillDepth, dxw.VirtualPixelFormat.dwRGBBitCount, lpddbltfx->dwFillColor); - //lpddbltfx->dwFillDepth=VirtualScr.dwRGBBitCount; - } - - if(IsDebug){ - if(dwflags & DDBLT_COLORFILL){ - OutTrace("DEBUG: ColorFill=%x depth=%d\n", lpddbltfx->dwFillColor, lpddbltfx->dwFillDepth); - } - if(dwflags & DDBLT_KEYSRC){ - DDCOLORKEY ColorKey; - (*pGetColorKey)(lpddssrc, DDCKEY_SRCBLT, &ColorKey); - OutTrace("DEBUG: KeySrc=%x\n", ColorKey.dwColorSpaceHighValue); - } - if(dwflags & DDBLT_KEYDEST){ - DDCOLORKEY ColorKey; - (*pGetColorKey)(lpddssrc, DDCKEY_DESTBLT, &ColorKey); - OutTrace("DEBUG: KeyDest=%x\n", ColorKey.dwColorSpaceHighValue); - } - if(dwflags & DDBLT_KEYSRCOVERRIDE){ - OutTrace("DEBUG: SrcColorkey=%x\n", lpddbltfx->ddckSrcColorkey.dwColorSpaceHighValue); - OutTrace("DEBUG: KeySrcAlpha=%x depth=%d\n", lpddbltfx->dwAlphaSrcConst, lpddbltfx->dwAlphaSrcConstBitDepth); - } - if(dwflags & DDBLT_KEYDESTOVERRIDE){ - OutTrace("DEBUG: DestColorkey=%x\n", lpddbltfx->ddckDestColorkey.dwColorSpaceHighValue); - OutTrace("DEBUG: KeyDestAlpha=%x depth=%d\n", lpddbltfx->dwAlphaDestConst, lpddbltfx->dwAlphaDestConstBitDepth); - } - } - // blit to non primary surface if(!ToPrim){ @@ -2787,8 +2843,11 @@ HRESULT WINAPI sBlt(char *api, LPDIRECTDRAWSURFACE lpdds, LPRECT lpdestrect, switch(res){ case DDERR_UNSUPPORTED: if (dxw.dwFlags1 & EMULATESURFACE){ + RECT targetrect; if (IsDebug) BlitTrace("UNSUPP", lpsrcrect ? &srcrect : NULL, lpdestrect, __LINE__); - res=(*pBlt)(lpDDSEmu_Prim, lpdestrect, lpddssrc, lpsrcrect ? &srcrect : NULL, dwflags, lpddbltfx); + targetrect=*lpdestrect; + dxw.MapWindowRect(&targetrect); + res=(*pBlt)(lpDDSEmu_Prim, &targetrect, lpddssrc, lpsrcrect ? &srcrect : NULL, dwflags, lpddbltfx); } break; case DDERR_SURFACEBUSY: @@ -2801,6 +2860,8 @@ HRESULT WINAPI sBlt(char *api, LPDIRECTDRAWSURFACE lpdds, LPRECT lpdestrect, break; } if (res) BlitError(res, &srcrect, lpdestrect, __LINE__); + DescribeSurface(lpdds, 0, "[DST]" , __LINE__); + if (lpddssrc) DescribeSurface(lpddssrc, 0, "[SRC]" , __LINE__); // lpddssrc could be NULL!!! if(dxw.dwFlags1 & SUPPRESSDXERRORS) res=0; return res; } @@ -2866,6 +2927,8 @@ HRESULT WINAPI sBlt(char *api, LPDIRECTDRAWSURFACE lpdds, LPRECT lpdestrect, if (res) { BlitError(res, lpsrcrect, &emurect, __LINE__); + DescribeSurface(lpdds, 0, "[DST]" , __LINE__); + if (lpddssrc) DescribeSurface(lpddssrc, 0, "[SRC]" , __LINE__); // lpddssrc could be NULL!!! /* Dungeon Keeper II intro movies bug .... it seems that you can't blit from compressed or different surfaces in memory, @@ -2953,8 +3016,6 @@ HRESULT WINAPI extFlip(LPDIRECTDRAWSURFACE lpdds, LPDIRECTDRAWSURFACE lpddssrc, //ddsc.dwCaps=DDSCAPS_OFFSCREENPLAIN+DDSCAPS_SYSTEMMEMORY; ddsc.dwCaps=sd.ddsCaps.dwCaps; - //res=lpdds->GetAttachedSurface(0,&lpddsAttached); - //res=(*pGetAttachedSurface)(lpdds, &ddsc, &lpddsAttached); res=lpdds->GetAttachedSurface(&ddsc, &lpddsAttached); if(res){ OutTraceE("Flip: GetAttachedSurface ERROR %x(%s) at %d\n", res, ExplainDDError(res), __LINE__); @@ -3046,6 +3107,10 @@ HRESULT WINAPI extBltFast(LPDIRECTDRAWSURFACE lpdds, DWORD dwx, DWORD dwy, if(dwtrans & DDBLTFAST_DESTCOLORKEY) flags |= DDBLT_KEYDEST; if(dwtrans & DDBLTFAST_SRCCOLORKEY) flags |= DDBLT_KEYSRC; + if ((dxw.dwFlags2 & FULLRECTBLT) && ToPrim){ + return sBlt("BltFast", lpdds, NULL, lpddssrc, lpsrcrect, flags, 0, FALSE); + } + destrect.left = dwx; destrect.top = dwy; if(lpsrcrect){ @@ -3058,6 +3123,7 @@ HRESULT WINAPI extBltFast(LPDIRECTDRAWSURFACE lpdds, DWORD dwx, DWORD dwy, } else{ // does it EVER goes through here? NULL is not a valid rect value for BltFast call.... + // yes, forced in FULLRECTBLT mode! ddsd.dwSize=Set_dwSize_From_Surface(lpddssrc); ddsd.dwFlags = DDSD_WIDTH | DDSD_HEIGHT; ret=lpddssrc->GetSurfaceDesc((LPDDSURFACEDESC)&ddsd); @@ -3122,7 +3188,7 @@ HRESULT WINAPI extWaitForVerticalBlank(LPDIRECTDRAW lpdd, DWORD dwflags, HANDLE return 0; } -// extGetPalette: To revise completely. Un-hooked right now, to make things working. +// extGetPalette: To revise completely. HRESULT WINAPI extGetPalette(LPDIRECTDRAWSURFACE lpdds, LPDIRECTDRAWPALETTE *lplpddp) { @@ -3245,6 +3311,7 @@ HRESULT WINAPI extLock(LPDIRECTDRAWSURFACE lpdds, LPRECT lprect, LPDIRECTDRAWSUR BOOL IsPrim; IsPrim=dxw.IsAPrimarySurface(lpdds); + CleanRect(&lprect, __LINE__); if(IsTraceD){ OutTrace("Lock: lpdds=%x%s flags=%x(%s) lpdds2=%x", @@ -3502,6 +3569,7 @@ HRESULT WINAPI extFlipToGDISurface(LPDIRECTDRAW lpdd) //HRESULT res; OutTraceD("FlipToGDISurface: lpdd=%x\n", lpdd); + STOPPER("FlipToGDISurface"); // to revise: so far, it seems the best thing to do is NOTHING, just return 0. //res=(*pFlipToGDISurface)(lpdd); //if (res) OutTraceE("FlipToGDISurface: ERROR res=%x(%s), skipping\n", res, ExplainDDError(res)); @@ -3737,39 +3805,18 @@ HRESULT WINAPI extReleaseS(LPDIRECTDRAWSURFACE lpdds) { HRESULT res; BOOL IsPrim; - BOOL IsClosed; - OutTraceD("Release(S): DEBUG - lpdds=%x\n", lpdds); - REFPROBE(lpdds, "RELEASE"); + BOOL IsBack; IsPrim=dxw.IsAPrimarySurface(lpdds); + IsBack=dxw.IsABackBufferSurface(lpdds); + REFPROBE(lpdds, "RELEASE"); - // handling of service closed surfaces - IsClosed=0; - __try{ - HRESULT dw=(DWORD)(*pReleaseS); - if ((dw & 0xF0000000) == 0xF0000000) IsClosed=1; - if ((*(DWORD *)lpdds & 0xF0000000) == 0xF0000000) IsClosed=1; - if(IsClosed) OutTraceE("Release(S): ASSERT got closed surface lpdds=%x\n", lpdds); - } - __except (EXCEPTION_EXECUTE_HANDLER){ - OutTraceE("Exception at %d\n",__LINE__); - IsClosed=1; - }; - - res = IsClosed ? 0 :(*pReleaseS)(lpdds); + res = (*pReleaseS)(lpdds); - OutTraceD("Release(S): lpdds=%x%s refcount=%d\n", lpdds, IsPrim?"(PRIM)":"", res); + OutTraceD("Release(S): lpdds=%x%s refcount=%d\n", lpdds, IsPrim?"(PRIM)":(IsBack?"(BACK)":""), res); if (res==0) { // common precondition // when releasing primary surface, erase clipping region if(IsPrim && (dxw.dwFlags1 & CLIPCURSOR)) dxw.EraseClipCursor(); - // if primary, clean primay surface list - if(IsPrim) dxw.UnmarkPrimarySurface(lpdds); - // service surfaces cleanup - if(lpdds==lpDDSBack) { - //OutTraceD("Release(S): NOT Clearing lpDDSBack pointer\n"); - OutTraceD("Release(S): Clearing lpDDSBack pointer\n"); - lpDDSBack=NULL; - } if (dxw.dwFlags1 & EMULATESURFACE) { if(lpdds==lpDDSEmu_Prim) { OutTraceD("Release(S): Clearing lpDDSEmu_Prim pointer\n"); @@ -3940,8 +3987,10 @@ HRESULT WINAPI cbDump(LPDDSURFACEDESC lpDDSurfaceDesc, LPVOID lpContext) HRESULT WINAPI extGetCapsS(int dxInterface, GetCapsS_Type pGetCapsS, LPDIRECTDRAWSURFACE lpdds, LPDDSCAPS caps) { HRESULT res; - BOOL IsPrim; + BOOL IsPrim, IsBack, IsFixed; IsPrim=dxw.IsAPrimarySurface(lpdds); + IsBack=dxw.IsABackBufferSurface(lpdds); + IsFixed=FALSE; OutTraceD("GetCaps(S%d): lpdds=%x%s, lpcaps=%x\n", dxInterface, lpdds, IsPrim?"(PRIM)":"", caps); res=(*pGetCapsS)(lpdds, caps); if(res) @@ -3949,23 +3998,29 @@ HRESULT WINAPI extGetCapsS(int dxInterface, GetCapsS_Type pGetCapsS, LPDIRECTDRA else OutTraceD("GetCaps(S%d): lpdds=%x caps=%x(%s)\n", dxInterface, lpdds, caps->dwCaps, ExplainDDSCaps(caps->dwCaps)); - if (!(dxw.dwFlags1 & EMULATESURFACE)) return res; - - // note: C&C95 Gold Edition includes a check for the primary surface NOT having - // DDSCAPS_SYSTEMMEMORY bit set - - if(IsPrim) caps->dwCaps |= dxw.dwPrimarySurfaceCaps; - // v2.1.83: add FLIP capability (Funtraks a.k.a. Ignition) - // v2.2.26: add VIDEOMEMORY|LOCALVIDMEM capability (Alien Cabal 95 - partial fix) - if(dxw.dwFlags1 & EMULATESURFACE) { - //if ((lpdds == lpDDSBack) || (caps->dwCaps & DDSCAPS_ZBUFFER)) { - if (lpdds == lpDDSBack) { //v2.02.32: fix - a ZBUFFER can be in SYSTEMMEMORY !! - caps->dwCaps |= DDSCAPS_FLIP|DDSCAPS_VIDEOMEMORY|DDSCAPS_LOCALVIDMEM; - caps->dwCaps &= ~DDSCAPS_SYSTEMMEMORY; + if (IsPrim) { + OutTraceD("GetCaps(S%d): fixing PRIMARY surface\n", dxInterface); + IsFixed=TRUE; + caps->dwCaps |= DDSD_Prim.ddsCaps.dwCaps; + caps->dwCaps |= DDSCAPS_PRIMARYSURFACE|DDSCAPS_FLIP|DDSCAPS_FRONTBUFFER|DDSCAPS_VIDEOMEMORY|DDSCAPS_VISIBLE; // primary surfaces must be this way + caps->dwCaps &= ~(DDSCAPS_SYSTEMMEMORY|DDSCAPS_OFFSCREENPLAIN); // primary surfaces can't be this way } + + if (IsBack) { + OutTraceD("GetCaps(S%d): fixing BACKBUFFER surface\n", dxInterface); + IsFixed=TRUE; + caps->dwCaps |= (DDSCAPS_BACKBUFFER|DDSCAPS_VIDEOMEMORY|DDSCAPS_LOCALVIDMEM); // you never know.... + caps->dwCaps &= ~(DDSCAPS_SYSTEMMEMORY|DDSCAPS_OFFSCREENPLAIN); // backbuffer surfaces can't be this way } - OutTraceD("GetCaps(S%d): lpdds=%x FIXED caps=%x(%s)\n", dxInterface, lpdds, caps->dwCaps, ExplainDDSCaps(caps->dwCaps)); + if ((caps->dwCaps & DDSCAPS_ZBUFFER) || (lpdds == lpDDZBuffer)){ + OutTraceD("GetCaps(S%d): fixing ZBUFFER surface\n", dxInterface); + IsFixed=TRUE; + caps->dwCaps |= (DDSCAPS_ZBUFFER|DDSCAPS_VIDEOMEMORY|DDSCAPS_LOCALVIDMEM); + caps->dwCaps &= ~DDSCAPS_SYSTEMMEMORY; // zbuffer surfaces can't be this way (beware: it can be OFFSCREENPLAIN!) + } + + if(IsFixed) OutTraceD("GetCaps(S%d): lpdds=%x FIXED caps=%x(%s)\n", dxInterface, lpdds, caps->dwCaps, ExplainDDSCaps(caps->dwCaps)); return res; } @@ -3994,24 +4049,11 @@ ULONG WINAPI extReleaseD(LPDIRECTDRAW lpdd) { ULONG ref; int dxversion; - BOOL IsClosed; dxversion=lpddHookedVersion(lpdd); // must be called BEFORE releasing the session!! OutTraceD("Release(D): lpdd=%x dxversion=%d\n", lpdd, dxversion); - IsClosed=0; - __try{ - HRESULT dw=(DWORD)(*pReleaseD); - if ((dw & 0xF0000000) == 0xF0000000) IsClosed=1; - if ((*(DWORD *)lpdd & 0xF0000000) == 0xF0000000) IsClosed=1; - if(IsClosed) OutTraceE("Release(D): ASSERT got closed session lpdd=%x\n", lpdd); - } - __except (EXCEPTION_EXECUTE_HANDLER){ - OutTraceE("Exception at %d\n",__LINE__); - IsClosed=1; - }; - - ref=IsClosed?0:(*pReleaseD)(lpdd); + ref=(*pReleaseD)(lpdd); if (lpdd == lpPrimaryDD) { // v2.1.87: fix for Dungeon Keeper II OutTraceD("Release(D): service lpdd=%x version=%d\n", lpdd, dxversion); @@ -4051,18 +4093,8 @@ HRESULT WINAPI extCreateClipper(LPDIRECTDRAW lpdd, DWORD dwflags, HRESULT WINAPI extReleaseC(LPDIRECTDRAWCLIPPER lpddClip) { ULONG ref; - BOOL IsClosed; - // handling of service closed clipper - IsClosed=0; - __try{DWORD dw=(DWORD)(*pReleaseC);} - __except (EXCEPTION_EXECUTE_HANDLER){ - OutTraceD("Exception at %d\n",__LINE__); - IsClosed=1; - }; - - // avoid crashing.... - ref= IsClosed ? 0 : (*pReleaseC)(lpddClip); + ref = (*pReleaseC)(lpddClip); OutTraceD("Release(C): PROXED lpddClip=%x ref=%x\n", lpddClip, ref); if (lpddClip==lpDDC && ref==0) { @@ -4075,8 +4107,9 @@ HRESULT WINAPI extReleaseC(LPDIRECTDRAWCLIPPER lpddClip) HRESULT WINAPI extGetSurfaceDesc(GetSurfaceDesc_Type pGetSurfaceDesc, LPDIRECTDRAWSURFACE lpdds, LPDDSURFACEDESC lpddsd) { HRESULT res; - BOOL IsPrim, IsFixed; + BOOL IsPrim, IsBack, IsFixed; IsPrim=dxw.IsAPrimarySurface(lpdds); + IsBack=dxw.IsABackBufferSurface(lpdds); IsFixed=FALSE; if (!pGetSurfaceDesc) { @@ -4086,7 +4119,7 @@ HRESULT WINAPI extGetSurfaceDesc(GetSurfaceDesc_Type pGetSurfaceDesc, LPDIRECTDR res=(*pGetSurfaceDesc)(lpdds, lpddsd); OutTraceD("GetSurfaceDesc: %slpdds=%x%s res=%x(%s)\n", - res?"ERROR ":"", lpdds, IsPrim?"(PRIM)":"", res, ExplainDDError(res)); + res?"ERROR ":"", lpdds, IsPrim?"(PRIM)":(IsBack?"(BACK)":""), res, ExplainDDError(res)); if(res) { OutTraceE("GetSurfaceDesc: ERROR err=%d(%s) at %d\n", res, ExplainDDError(res), __LINE__); return res; @@ -4095,37 +4128,33 @@ HRESULT WINAPI extGetSurfaceDesc(GetSurfaceDesc_Type pGetSurfaceDesc, LPDIRECTDR LogSurfaceAttributes(lpddsd, "GetSurfaceDesc", __LINE__); if (IsPrim) { + OutTraceD("GetSurfaceDesc: fixing PRIMARY surface\n"); IsFixed=TRUE; - // expose original caps - if (dxw.dwFlags1 & EMULATESURFACE) { - lpddsd->ddpfPixelFormat = dxw.VirtualPixelFormat; - } - //lpddsd->ddsCaps.dwCaps=dxw.dwPrimarySurfaceCaps; - // V2.1.84: better .OR. the capabilities (you don't ask but get for DDSCAPS_VISIBLE...) - lpddsd->ddsCaps.dwCaps |= dxw.dwPrimarySurfaceCaps; - lpddsd->ddsCaps.dwCaps |= DDSCAPS_PRIMARYSURFACE|DDSCAPS_FLIP|DDSCAPS_FRONTBUFFER; // you never know.... - lpddsd->dwBackBufferCount=dxw.dwBackBufferCount; + if (dxw.dwFlags1 & EMULATESURFACE) lpddsd->ddpfPixelFormat = dxw.VirtualPixelFormat; + lpddsd->ddsCaps.dwCaps |= DDSD_Prim.ddsCaps.dwCaps; + lpddsd->ddsCaps.dwCaps |= (DDSCAPS_PRIMARYSURFACE|DDSCAPS_FLIP|DDSCAPS_FRONTBUFFER|DDSCAPS_VIDEOMEMORY|DDSCAPS_VISIBLE); // primary surfaces must be this way + lpddsd->ddsCaps.dwCaps &= ~(DDSCAPS_SYSTEMMEMORY|DDSCAPS_OFFSCREENPLAIN); // primary surfaces can't be this way + lpddsd->dwBackBufferCount=DDSD_Prim.dwBackBufferCount; lpddsd->dwHeight=dxw.GetScreenHeight(); lpddsd->dwWidth=dxw.GetScreenWidth(); } - if((dxw.dwFlags1 & EMULATESURFACE) && - (dxw.dwFlags1 & SWITCHVIDEOMEMORY) && - (lpddsd->ddsCaps.dwCaps & DDSCAPS_SYSTEMMEMORY)){ + if (IsBack) { + OutTraceD("GetSurfaceDesc: fixing BACKBUFFER surface\n"); IsFixed=TRUE; - lpddsd->ddsCaps.dwCaps &= ~DDSCAPS_SYSTEMMEMORY; - lpddsd->ddsCaps.dwCaps |= DDSCAPS_VIDEOMEMORY; + lpddsd->ddsCaps.dwCaps |= (DDSCAPS_BACKBUFFER|DDSCAPS_VIDEOMEMORY|DDSCAPS_LOCALVIDMEM); // you never know.... + lpddsd->ddsCaps.dwCaps &= ~(DDSCAPS_SYSTEMMEMORY|DDSCAPS_OFFSCREENPLAIN); // primary surfaces can't be this way } - if (dxw.dwFlags3 & SAVECAPS) { - if (PopCaps((LPDDSURFACEDESC2)lpddsd, lpdds)) IsFixed=TRUE; - if (lpddsd->ddsCaps.dwCaps & DDSCAPS_VIDEOMEMORY) lpddsd->ddsCaps.dwCaps |= DDSCAPS_LOCALVIDMEM; + if (lpddsd->ddsCaps.dwCaps & DDSCAPS_ZBUFFER) { + OutTraceD("GetSurfaceDesc: fixing ZBUFFER surface\n"); + IsFixed=TRUE; + lpddsd->ddsCaps.dwCaps |= (DDSCAPS_ZBUFFER|DDSCAPS_VIDEOMEMORY|DDSCAPS_LOCALVIDMEM); + //lpddsd->ddsCaps.dwCaps |= (DDSCAPS_ZBUFFER|DDSCAPS_VIDEOMEMORY); + lpddsd->ddsCaps.dwCaps &= ~DDSCAPS_SYSTEMMEMORY; // zbuffer surfaces can't be this way } - //if(dxw.dwFlags1 & EMULATESURFACE) lpddsd->ddsCaps.dwCaps |= DDSCAPS_3DDEVICE; - if(dxw.dwFlags1 & EMULATESURFACE) lpddsd->ddsCaps.dwCaps |= DDSCAPS_3DDEVICE|DDSCAPS_VIDEOMEMORY|DDSCAPS_LOCALVIDMEM; - - if(IsFixed) DumpSurfaceAttributes(lpddsd, "GetSurfaceDesc [FIXED]", __LINE__); + if(IsFixed) LogSurfaceAttributes(lpddsd, "GetSurfaceDesc [FIXED]", __LINE__); return DD_OK; } @@ -4138,6 +4167,7 @@ HRESULT WINAPI extGetSurfaceDesc1(LPDIRECTDRAWSURFACE lpdds, LPDDSURFACEDESC lpd switch(lpddsd->dwSize){ case sizeof(DDSURFACEDESC): if (pGetSurfaceDesc1) return extGetSurfaceDesc(pGetSurfaceDesc1, lpdds, lpddsd); + /**/ if (pGetSurfaceDesc4) return extGetSurfaceDesc((GetSurfaceDesc_Type)pGetSurfaceDesc4, (LPDIRECTDRAWSURFACE)lpdds, (LPDDSURFACEDESC)lpddsd); break; case sizeof(DDSURFACEDESC2): if (pGetSurfaceDesc4) return extGetSurfaceDesc((GetSurfaceDesc_Type)pGetSurfaceDesc4, (LPDIRECTDRAWSURFACE)lpdds, (LPDDSURFACEDESC)lpddsd); @@ -4173,31 +4203,10 @@ HRESULT WINAPI extGetSurfaceDesc2(LPDIRECTDRAWSURFACE2 lpdds, LPDDSURFACEDESC2 l HRESULT WINAPI extReleaseP(LPDIRECTDRAWPALETTE lpddPalette) { - // v2.1.26: Release Palette FIX: - // Uprising 2 crashed trying to use palette functions after having fully released the - // current palette (ref=0!) causing a game crash. The fix pretends that the palette - // was released when attempting the operation to the last object reference (LastRefCount==1) - // returning a ref 0 without actually releasing the object. - //v2.02.08: Better fix: to avoid the problem, just remember to NULL-ify the global main - // palette pointer lpDDP - //v2.02.13: still problems in Virtua Fighter 2 in emu mode. Added try catch protection. ULONG ref; - BOOL IsClosed; - - // handling of service closed surfaces - IsClosed=0; - __try{ - HRESULT dw=(DWORD)(*pReleaseP); - if ((dw & 0xF0000000) == 0xF0000000) IsClosed=1; - if ((*(DWORD*)lpddPalette & 0xF0000000) == 0xF0000000) IsClosed=1; - if(IsClosed) OutTraceE("Release(P): ASSERT got closed palette lpddPalette=%x\n", lpddPalette); - } - __except (EXCEPTION_EXECUTE_HANDLER){ - OutTraceE("Exception at %d\n",__LINE__); - IsClosed=1; - }; - ref=IsClosed ? 0 :(*pReleaseP)(lpddPalette); + ref = (*pReleaseP)(lpddPalette); + OutTraceD("Release(P): lpddPalette=%x ref=%x\n", lpddPalette, ref); if(lpddPalette==lpDDP && ref==0){ OutTraceD("Release(P): clearing lpDDP=%x->NULL\n", lpDDP); @@ -4265,3 +4274,23 @@ HRESULT WINAPI extDirectDrawEnumerateEx(LPDDENUMCALLBACKEX lpCallback, LPVOID lp if(ret) OutTraceP("DirectDrawEnumerateEx: ERROR res=%x(%s)\n", ret, ExplainDDError(ret)); return ret; } + +HRESULT WINAPI extDDGetGammaRamp(LPDIRECTDRAWSURFACE lpdds, DWORD dwFlags, LPDDGAMMARAMP lpgr) +{ + HRESULT ret; + OutTraceD("GetGammaRamp: dds=%x dwFlags=%x\n", lpdds, dwFlags); + ret=(*pDDGetGammaRamp)(lpdds, dwFlags, lpgr); + if(ret) OutTraceE("GetGammaRamp: ERROR res=%x(%s)\n", ret, ExplainDDError(ret)); + else OutTraceD("GetGammaRamp: RGB=(%x,%x,%x)\n", lpgr->red, lpgr->green, lpgr->blue); + return ret; +} + + HRESULT WINAPI extDDSetGammaRamp(LPDIRECTDRAWSURFACE lpdds, DWORD dwFlags, LPDDGAMMARAMP lpgr) +{ + HRESULT ret; + OutTraceD("GetGammaRamp: dds=%x dwFlags=%x RGB=(%x,%x,%x)\n", lpdds, dwFlags, lpgr->red, lpgr->green, lpgr->blue); + if (dxw.dwFlags2 & DISABLEGAMMARAMP) return DD_OK; + ret=(*pDDSetGammaRamp)(lpdds, dwFlags, lpgr); + if(ret) OutTraceE("GetGammaRamp: ERROR res=%x(%s)\n", ret, ExplainDDError(ret)); + return ret; +} diff --git a/dll/dxemublt.cpp b/dll/dxemublt.cpp index 2107a5f..720c382 100644 --- a/dll/dxemublt.cpp +++ b/dll/dxemublt.cpp @@ -328,7 +328,7 @@ static HRESULT WINAPI EmuBlt_32_to_32(LPDIRECTDRAWSURFACE lpddsdst, LPRECT lpdes long srcpitch, destpitch; HRESULT res; DWORD *src32; - DWORD *dest, dest0; + DWORD *dest, *dest0; DDSURFACEDESC2 ddsd_src, ddsd_dst; w = lpdestrect->right - lpdestrect->left; @@ -336,7 +336,7 @@ static HRESULT WINAPI EmuBlt_32_to_32(LPDIRECTDRAWSURFACE lpddsdst, LPRECT lpdes memset(&ddsd_dst,0,sizeof(DDSURFACEDESC2)); ddsd_dst.dwSize = Set_dwSize_From_Surface(lpddsdst); - ddsd_dst.dxw.dwFlags1 = DDSD_LPSURFACE | DDSD_PITCH; + ddsd_dst.dwFlags = DDSD_LPSURFACE | DDSD_PITCH; if(res=(*pLock)(lpddsdst, 0, (LPDIRECTDRAWSURFACE)&ddsd_dst, DDLOCK_SURFACEMEMORYPTR|DDLOCK_WRITEONLY|DDLOCK_WAIT, 0)){ OutTraceE("EmuBlt32_32: Lock ERROR res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__); return res; @@ -344,7 +344,7 @@ static HRESULT WINAPI EmuBlt_32_to_32(LPDIRECTDRAWSURFACE lpddsdst, LPRECT lpdes memset(&ddsd_src,0,sizeof(DDSURFACEDESC2)); ddsd_src.dwSize = Set_dwSize_From_Surface(lpddssrc); - ddsd_src.dxw.dwFlags1 = DDSD_LPSURFACE | DDSD_PITCH; + ddsd_src.dwFlags = DDSD_LPSURFACE | DDSD_PITCH; if (lpsurface) { // already locked, just get info .... if(res=lpddssrc->GetSurfaceDesc((LPDDSURFACEDESC)&ddsd_src)) { OutTraceE("EmuBlt32_32: GetSurfaceDesc ERROR res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__); diff --git a/dll/dxhelper.cpp b/dll/dxhelper.cpp index 5d511c3..e55436d 100644 --- a/dll/dxhelper.cpp +++ b/dll/dxhelper.cpp @@ -72,7 +72,8 @@ char *ExplainDDSCaps(DWORD c) if (c & DDSCAPS_LIVEVIDEO) strcat(eb, "LIVEVIDEO+"); if (c & DDSCAPS_HWCODEC) strcat(eb, "HWCODEC+"); if (c & DDSCAPS_MODEX) strcat(eb, "MODEX+"); - if (c & DDSCAPS_MIPMAP) strcat(eb, "MIPMAP+"); + if (c & DDSCAPS_MIPMAP) strcat(eb, "MIPMAP+"); + if (c & DDSCAPS_RESERVED2) strcat(eb, "RESERVED2+"); if (c & DDSCAPS_ALLOCONLOAD) strcat(eb, "ALLOCONLOAD+"); if (c & DDSCAPS_VIDEOPORT) strcat(eb, "VIDEOPORT+"); if (c & DDSCAPS_LOCALVIDMEM) strcat(eb, "LOCALVIDMEM+"); @@ -1101,6 +1102,11 @@ char *ExplainGUID(GUID FAR *lpguid) case 0xb0ab3b61: sguid="IID_IDirect3DViewport3"; break; case 0x7a503555: sguid="IID_IDirect3DVertexBuffer"; break; case 0xf5049e7d: sguid="IID_IDirect3DVertexBuffer7"; break; + case 0xF2086B20: sguid="IID_IDirect3DRampDevice"; break; + case 0x881949a1: sguid="IID_IDirect3DMMXDevice"; break; + case 0x50936643: sguid="IID_IDirect3DRefDevice"; break; + case 0x8767df22: sguid="IID_IDirect3DNullDevice"; break; + case 0xf5049e78: sguid="IID_IDirect3DTnLHalDevice"; break; case 0xD7B70EE0: sguid="CLSID_DirectDraw"; break; case 0x3c305196: sguid="CLSID_DirectDraw7"; break; case 0x593817A0: sguid="CLSID_DirectDrawClipper"; break; @@ -1468,3 +1474,22 @@ char *ExplainDCType(DWORD c) if (c>=0 && c<=GDI_OBJ_LAST) return Captions[c]; return "???"; } + +char *ExplainPeekRemoveMsg(DWORD c) +{ + static char eb[128]; + strcpy(eb, (c & PM_REMOVE) ? "PM_REMOVE" : "PM_NOREMOVE"); + if(c & PM_NOYIELD) strcat(eb, "+NOYIELD"); + c >>= 16; + if(c & QS_MOUSEMOVE) strcat(eb, "+MOUSEMOVE"); + if(c & QS_MOUSEBUTTON) strcat(eb, "+MOUSEBUTTON"); + if(c & QS_KEY) strcat(eb, "+KEY"); + if(c & QS_RAWINPUT) strcat(eb, "+RAWINPUT"); + if(c & QS_PAINT) strcat(eb, "+PAINT"); + if(c & QS_POSTMESSAGE) strcat(eb, "+POSTMESSAGE"); + if(c & QS_HOTKEY) strcat(eb, "+HOTKEY"); + if(c & QS_TIMER) strcat(eb, "+TIMER"); + if(c & QS_SENDMESSAGE) strcat(eb, "+SENDMESSAGE"); + if(c & QS_ALLPOSTMESSAGE) strcat(eb, "+ALLPOSTMESSAGE"); + return(eb); +} \ No newline at end of file diff --git a/dll/dxhelper.h b/dll/dxhelper.h index 1ceb25a..a1b4121 100644 --- a/dll/dxhelper.h +++ b/dll/dxhelper.h @@ -41,3 +41,4 @@ extern char *ExplainMCICommands(DWORD); extern char *ExplainMCIFlags(DWORD, DWORD); extern char *ExplainRegType(DWORD); extern char *ExplainDCType(DWORD); +extern char *ExplainPeekRemoveMsg(DWORD); diff --git a/dll/dxhook.cpp b/dll/dxhook.cpp index 80bf360..f35e06d 100644 --- a/dll/dxhook.cpp +++ b/dll/dxhook.cpp @@ -38,7 +38,7 @@ static char *FlagNames[32]={ "AUTOREFRESH", "FIXWINFRAME", "HIDEHWCURSOR", "SLOWDOWN", "ENABLECLIPPING", "LOCKWINSTYLE", "MAPGDITOPRIMARY", "FIXTEXTOUT", "KEEPCURSORWITHIN", "USERGB565", "SUPPRESSDXERRORS", "PREVENTMAXIMIZE", - "ONEPIXELFIX", "FIXPARENTWIN", "SWITCHVIDEOMEMORY", "CLIENTREMAPPING", + "LOCKEDSURFACE", "FIXPARENTWIN", "SWITCHVIDEOMEMORY", "CLIENTREMAPPING", "HANDLEALTF4", "LOCKWINPOS", "HOOKCHILDWIN", "MESSAGEPROC" }; @@ -290,6 +290,12 @@ void SetHook(void *target, void *hookproc, void **hookedproc, char *hookname) dwTmp = *(DWORD *)target; if(dwTmp == (DWORD)hookproc) return; // already hooked if((dwTmp <= MaxHook) && (dwTmp >= MinHook)) return; // already hooked + if(dwTmp == 0){ + sprintf(msg,"SetHook ERROR: NULL target for %s\n", hookname); + OutTraceD(msg); + MessageBox(0, msg, "SetHook", MB_OK | MB_ICONEXCLAMATION); + return; // error condition + } if(!VirtualProtect(target, 4, PAGE_READWRITE, &oldprot)) { sprintf(msg,"SetHook ERROR: target=%x err=%d\n", target, GetLastError()); OutTraceD(msg); @@ -841,7 +847,6 @@ LRESULT CALLBACK extWindowProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lp if(dxw.dwFlags3 & FILTERMESSAGES){ LRESULT ret; switch(message){ - case WM_NCCALCSIZE: case WM_NCMOUSEMOVE: case WM_NCLBUTTONDOWN: case WM_NCLBUTTONUP: @@ -852,8 +857,6 @@ LRESULT CALLBACK extWindowProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lp case WM_NCMBUTTONDOWN: case WM_NCMBUTTONUP: case WM_NCMBUTTONDBLCLK: - //case WM_WINDOWPOSCHANGING: - //case WM_WINDOWPOSCHANGED: OutTraceW("WindowProc[%x]: WinMsg=%x filtered message=%x(%s)\n", hwnd, message, ExplainWinMessage(message)); ret=0; return ret; @@ -1285,6 +1288,7 @@ void HookModule(HMODULE base, int dxversion) if(dxw.dwFlags1 & HOOKDI) HookDirectInput(base, dxversion); HookDirectDraw(base, dxversion); HookDirect3D(base, dxversion); + HookDirect3D7(base, dxversion); if(dxw.dwFlags2 & HOOKOPENGL) HookOpenGLLibs(base, dxw.CustomOpenGLLib); if((dxw.dwFlags3 & EMULATEREGISTRY) || (dxw.dwTFlags & OUTREGISTRY)) HookAdvApi32(base); HookMSV4WLibs(base); // -- used by Aliens & Amazons demo: what for? diff --git a/dll/dxhook.h b/dll/dxhook.h index 2c71f12..d3c5cb8 100644 --- a/dll/dxhook.h +++ b/dll/dxhook.h @@ -1,6 +1,7 @@ extern int HookDirectDraw(HMODULE, int); extern int HookDDProxy(HMODULE, int); extern int HookDirect3D(HMODULE, int); +extern int HookDirect3D7(HMODULE, int); extern void HookOle32(HMODULE); extern void HookGDI32(HMODULE); extern int HookDirectInput(HMODULE, int); @@ -16,6 +17,7 @@ extern LPCSTR ProcToString(LPCSTR proc); extern HRESULT HookDxDiag(REFIID, LPVOID FAR*); extern FARPROC Remap_ddraw_ProcAddress(LPCSTR, HMODULE); +extern FARPROC Remap_d3d7_ProcAddress(LPCSTR, HMODULE); extern FARPROC Remap_d3d8_ProcAddress(LPCSTR, HMODULE); extern FARPROC Remap_d3d9_ProcAddress(LPCSTR, HMODULE); extern FARPROC Remap_d3d10_ProcAddress(LPCSTR, HMODULE); diff --git a/dll/dxwcore.cpp b/dll/dxwcore.cpp index e37214c..12a5498 100644 --- a/dll/dxwcore.cpp +++ b/dll/dxwcore.cpp @@ -79,24 +79,6 @@ void dxwCore::InitTarget(TARGETMAP *target) // Primary surfaces auxiliary functions /* ------------------------------------------------------------------ */ -void dxwCore::MarkPrimarySurface(LPDIRECTDRAWSURFACE ps) -{ - int i; - // OutTraceD("PRIMARYSURFACE add %x\n",ps); - for (i=0;i. #include "dxwnd.h" #include "dxwcore.hpp" -#define VERSION "2.02.35" +#define VERSION "2.02.37" #define DDTHREADLOCK 1 diff --git a/dll/dxwnd.vs2008.suo b/dll/dxwnd.vs2008.suo index bd248bb..ed2cc2f 100644 Binary files a/dll/dxwnd.vs2008.suo and b/dll/dxwnd.vs2008.suo differ diff --git a/dll/dxwnd.vs2008.vcproj b/dll/dxwnd.vs2008.vcproj index dfad440..0059bd4 100644 --- a/dll/dxwnd.vs2008.vcproj +++ b/dll/dxwnd.vs2008.vcproj @@ -1,7 +1,7 @@ + + diff --git a/dll/gdi32.cpp b/dll/gdi32.cpp index efbcc9c..4b650f9 100644 --- a/dll/gdi32.cpp +++ b/dll/gdi32.cpp @@ -794,32 +794,41 @@ BOOL WINAPI extGDIBitBlt(HDC hdcDest, int nXDest, int nYDest, int nWidth, int nH OutTraceD("GDI.BitBlt: HDC=%x nXDest=%d nYDest=%d nWidth=%d nHeight=%d hdcSrc=%x nXSrc=%d nYSrc=%d dwRop=%x(%s)\n", hdcDest, nXDest, nYDest, nWidth, nHeight, hdcSrc, nXSrc, nYSrc, dwRop, ExplainROP(dwRop)); - if (dxw.HandleFPS()) return TRUE; + OutTraceB("GDI.StretchBlt: DEBUG FullScreen=%x target hdctype=%x(%s) hwnd=%x\n", + dxw.IsFullScreen(), GetObjectType(hdcDest), ExplainDCType(GetObjectType(hdcDest)), WindowFromDC(hdcDest)); // beware: HDC could refer to screen DC that are written directly on screen, or memory DC that will be scaled to // the screen surface later on, on ReleaseDC or ddraw Blit / Flip operation. Scaling of rect coordinates is // needed only in the first case, and must be avoided on the second, otherwise the image would be scaled twice! - if (dxw.IsFullScreen() && (OBJ_DC == GetObjectType(hdcDest))){ - int nWDest, nHDest; - nWDest= nWidth; - nHDest= nHeight; - dxw.MapClient(&nXDest, &nYDest, &nWDest, &nHDest); - if (dxw.dwFlags2 & SHOWFPSOVERLAY) dxw.ShowFPS(hdcDest); - res=(*pGDIStretchBlt)(hdcDest, nXDest, nYDest, nWDest, nHDest, hdcSrc, nXSrc, nYSrc, nWidth, nHeight, dwRop); - } - else if(WindowFromDC(hdcDest)==NULL){ - // V2.02.31: See StretchBlt. - int nWDest, nHDest; - nWDest= nWidth; - nHDest= nHeight; - dxw.MapWindow(&nXDest, &nYDest, &nWDest, &nHDest); - res=(*pGDIStretchBlt)(hdcDest, nXDest, nYDest, nWDest, nHDest, hdcSrc, nXSrc, nYSrc, nWidth, nHeight, dwRop); - if (dxw.dwFlags2 & SHOWFPSOVERLAY) dxw.ShowFPS(hdcDest); + res=0; + if (OBJ_DC == GetObjectType(hdcDest)){ + if (dxw.HandleFPS()) return TRUE; + if(dxw.IsFullScreen()){ + int nWDest, nHDest; + nWDest= nWidth; + nHDest= nHeight; + dxw.MapClient(&nXDest, &nYDest, &nWDest, &nHDest); + res=(*pGDIStretchBlt)(hdcDest, nXDest, nYDest, nWDest, nHDest, hdcSrc, nXSrc, nYSrc, nWidth, nHeight, dwRop); + if (dxw.dwFlags2 & SHOWFPSOVERLAY) dxw.ShowFPS(hdcDest); + OutTrace("Debug: DC dest=(%d,%d) size=(%d,%d)\n", nXDest, nYDest, nWDest, nHDest); + } + else if(WindowFromDC(hdcDest)==NULL){ + // V2.02.31: See StretchBlt. + int nWDest, nHDest; + nWDest= nWidth; + nHDest= nHeight; + dxw.MapWindow(&nXDest, &nYDest, &nWDest, &nHDest); + res=(*pGDIStretchBlt)(hdcDest, nXDest, nYDest, nWDest, nHDest, hdcSrc, nXSrc, nYSrc, nWidth, nHeight, dwRop); + if (dxw.dwFlags2 & SHOWFPSOVERLAY) dxw.ShowFPS(hdcDest); + OutTrace("Debug: NULL dest=(%d,%d) size=(%d,%d)\n", nXDest, nYDest, nWDest, nHDest); + } } else { res=(*pGDIBitBlt)(hdcDest, nXDest, nYDest, nWidth, nHeight, hdcSrc, nXSrc, nYSrc, dwRop); + OutTrace("Debug: MEM dest=(%d,%d) size=(%d,%d)\n", nXDest, nYDest, nWidth, nHeight); } + if(!res) OutTraceE("GDI.BitBlt: ERROR err=%d at %d\n", GetLastError(), __LINE__); return res; @@ -828,28 +837,34 @@ BOOL WINAPI extGDIBitBlt(HDC hdcDest, int nXDest, int nYDest, int nWidth, int nH BOOL WINAPI extGDIPatBlt(HDC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, DWORD dwRop) { BOOL res; + BOOL IsToScreen; OutTraceD("GDI.PatBlt: HDC=%x nXDest=%d nYDest=%d nWidth=%d nHeight=%d dwRop=%x(%s)\n", hdcDest, nXDest, nYDest, nWidth, nHeight, dwRop, ExplainROP(dwRop)); - if (dxw.HandleFPS()) return TRUE; - OutTraceB("GDI.StretchBlt: DEBUG FullScreen=%x target hdctype=%x(%s) hwnd=%x\n", dxw.IsFullScreen(), GetObjectType(hdcDest), ExplainDCType(GetObjectType(hdcDest)), WindowFromDC(hdcDest)); - if (dxw.IsFullScreen() && (OBJ_DC == GetObjectType(hdcDest))){ - dxw.MapClient(&nXDest, &nYDest, &nWidth, &nHeight); - if (dxw.dwFlags2 & SHOWFPSOVERLAY) dxw.ShowFPS(hdcDest); - res=(*pGDIPatBlt)(hdcDest, nXDest, nYDest, nWidth, nHeight, dwRop); - } - else if(WindowFromDC(hdcDest)==NULL){ - // V2.02.31: See StretchBlt. - dxw.MapWindow(&nXDest, &nYDest, &nWidth, &nHeight); - res=(*pGDIPatBlt)(hdcDest, nXDest, nYDest, nWidth, nHeight, dwRop); + IsToScreen=FALSE; + res=0; + if (OBJ_DC == GetObjectType(hdcDest)){ + IsToScreen=TRUE; + if (dxw.HandleFPS()) return TRUE; + if (dxw.IsFullScreen()){ + dxw.MapClient(&nXDest, &nYDest, &nWidth, &nHeight); + if (dxw.dwFlags2 & SHOWFPSOVERLAY) dxw.ShowFPS(hdcDest); + res=(*pGDIPatBlt)(hdcDest, nXDest, nYDest, nWidth, nHeight, dwRop); + } + else if(WindowFromDC(hdcDest)==NULL){ + // V2.02.31: See StretchBlt. + dxw.MapWindow(&nXDest, &nYDest, &nWidth, &nHeight); + res=(*pGDIPatBlt)(hdcDest, nXDest, nYDest, nWidth, nHeight, dwRop); + } } else { res=(*pGDIPatBlt)(hdcDest, nXDest, nYDest, nWidth, nHeight, dwRop); } + if (IsToScreen && (dxw.dwFlags2 & SHOWFPSOVERLAY)) dxw.ShowFPS(hdcDest); if(!res) OutTraceE("GDI.PatBlt: ERROR err=%d at %d\n", GetLastError(), __LINE__); return res; @@ -859,28 +874,31 @@ BOOL WINAPI extGDIStretchBlt(HDC hdcDest, int nXDest, int nYDest, int nWidth, in HDC hdcSrc, int nXSrc, int nYSrc, int nWSrc, int nHSrc, DWORD dwRop) { BOOL res; + BOOL IsToScreen; OutTraceD("GDI.StretchBlt: HDC=%x nXDest=%d nYDest=%d nWidth=%d nHeight=%d hdcSrc=%x nXSrc=%d nYSrc=%d nWSrc=%d nHSrc=%d dwRop=%x(%s)\n", hdcDest, nXDest, nYDest, nWidth, nHeight, hdcSrc, nXSrc, nYSrc, nWSrc, nHSrc, dwRop, ExplainROP(dwRop)); - if (dxw.HandleFPS()) return TRUE; - OutTraceB("GDI.StretchBlt: DEBUG FullScreen=%x target hdctype=%x(%s) hwnd=%x\n", dxw.IsFullScreen(), GetObjectType(hdcDest), ExplainDCType(GetObjectType(hdcDest)), WindowFromDC(hdcDest)); - if (dxw.IsFullScreen() && (OBJ_DC == GetObjectType(hdcDest))){ + IsToScreen=FALSE; + if (OBJ_DC == GetObjectType(hdcDest)){ + if (dxw.HandleFPS()) return TRUE; + IsToScreen=TRUE; + if(dxw.IsFullScreen()){ dxw.MapClient(&nXDest, &nYDest, &nWidth, &nHeight); - if (dxw.dwFlags2 & SHOWFPSOVERLAY) dxw.ShowFPS(hdcDest); - } - else if(WindowFromDC(hdcDest)==NULL){ - // V2.02.31: In "Silent Hunter II" intro movie, QuickTime 5 renders the vidoe on the PrimarySurface->GetDC device context, - // that is a memory device type associated to NULL (desktop) window, through GDI StretchBlt api. So, you shoud compensate - // by scaling and offsetting to main window. - dxw.MapWindow(&nXDest, &nYDest, &nWidth, &nHeight); - if (dxw.dwFlags2 & SHOWFPSOVERLAY) dxw.ShowFPS(hdcDest); + } + else if(WindowFromDC(hdcDest)==NULL){ + // V2.02.31: In "Silent Hunter II" intro movie, QuickTime 5 renders the video on the PrimarySurface->GetDC device context, + // that is a memory device type associated to NULL (desktop) window, through GDI StretchBlt api. So, you shoud compensate + // by scaling and offsetting to main window. + dxw.MapWindow(&nXDest, &nYDest, &nWidth, &nHeight); + } } res=(*pGDIStretchBlt)(hdcDest, nXDest, nYDest, nWidth, nHeight, hdcSrc, nXSrc, nYSrc, nWSrc, nHSrc, dwRop); + if (IsToScreen && (dxw.dwFlags2 & SHOWFPSOVERLAY)) dxw.ShowFPS(hdcDest); if(!res) OutTraceE("GDI.StretchBlt: ERROR err=%d at %d\n", GetLastError(), __LINE__); return res; } diff --git a/dll/hd3d7.cpp b/dll/hd3d7.cpp new file mode 100644 index 0000000..72f48d5 --- /dev/null +++ b/dll/hd3d7.cpp @@ -0,0 +1,497 @@ +#include +#include +#include "dxwnd.h" +#include "dxwcore.hpp" +#include "dxhook.h" +#include "syslibs.h" +#include "dxhelper.h" + +// exported API + +DWORD gD3DVersion; // quick & dirty .... +#undef OutTraceD +#define OutTraceD OutTrace + +typedef HRESULT (WINAPI *Direct3DCreateDevice_Type)(GUID FAR *, LPDIRECT3D, LPDIRECTDRAWSURFACE, LPDIRECT3D *, LPUNKNOWN); +typedef HRESULT (WINAPI *Direct3DCreate_Type)(UINT, LPDIRECT3D *, LPUNKNOWN); + +Direct3DCreateDevice_Type pDirect3DCreateDevice = NULL; +Direct3DCreate_Type pDirect3DCreate = NULL; + +HRESULT WINAPI extDirect3DCreateDevice(GUID FAR *, LPDIRECT3D, LPDIRECTDRAWSURFACE, LPDIRECT3D *, LPUNKNOWN); +HRESULT WINAPI extDirect3DCreate(UINT, LPDIRECT3D *, LPUNKNOWN); + +// IDirect3D interfaces + +typedef HRESULT (WINAPI *Initialize_Type)(void *); +typedef HRESULT (WINAPI *EnumDevices_Type)(void *, LPD3DENUMDEVICESCALLBACK, LPVOID); +typedef HRESULT (WINAPI *CreateLight_Type)(void *, LPDIRECT3DLIGHT *, IUnknown *); +typedef HRESULT (WINAPI *CreateMaterial_Type)(void *, LPDIRECT3DMATERIAL *, IUnknown *); +typedef HRESULT (WINAPI *CreateViewport_Type)(void *, LPDIRECT3DVIEWPORT *, IUnknown *); +typedef HRESULT (WINAPI *FindDevice_Type)(void *, LPD3DFINDDEVICESEARCH, LPD3DFINDDEVICERESULT); +typedef HRESULT (WINAPI *CreateDevice2_Type)(void *, REFCLSID, LPDIRECTDRAWSURFACE, LPDIRECT3DDEVICE2 *); +typedef HRESULT (WINAPI *CreateDevice3_Type)(void *, REFCLSID, LPDIRECTDRAWSURFACE4, LPDIRECT3DDEVICE3 *, LPUNKNOWN); + +typedef HRESULT (WINAPI *InitializeVP_Type)(void *, LPDIRECT3D); +typedef HRESULT (WINAPI *SetViewport_Type)(void *, LPD3DVIEWPORT); +typedef HRESULT (WINAPI *GetViewport_Type)(void *, LPD3DVIEWPORT); +typedef HRESULT (WINAPI *QueryInterfaceD3_Type)(void *, REFIID, LPVOID *); + +Initialize_Type pInitialize = NULL; +EnumDevices_Type pEnumDevices = NULL; +CreateLight_Type pCreateLight = NULL; +CreateMaterial_Type pCreateMaterial = NULL; +CreateViewport_Type pCreateViewport = NULL; +FindDevice_Type pFindDevice = NULL; +CreateDevice2_Type pCreateDevice2 = NULL; +CreateDevice3_Type pCreateDevice3 = NULL; + +InitializeVP_Type pInitializeVP = NULL; +SetViewport_Type pSetViewport = NULL; +GetViewport_Type pGetViewport = NULL; +QueryInterfaceD3_Type pQueryInterfaceD3 = NULL; + +HRESULT WINAPI extInitialize(void *); +HRESULT WINAPI extEnumDevices(void *, LPD3DENUMDEVICESCALLBACK, LPVOID); +HRESULT WINAPI extCreateLight(void *, LPDIRECT3DLIGHT *, IUnknown *); +HRESULT WINAPI extCreateMaterial(void *, LPDIRECT3DMATERIAL *, IUnknown *); +HRESULT WINAPI extCreateViewport(void *, LPDIRECT3DVIEWPORT *, IUnknown *); +HRESULT WINAPI extFindDevice(void *, LPD3DFINDDEVICESEARCH, LPD3DFINDDEVICERESULT); +HRESULT WINAPI extCreateDevice2(void *, REFCLSID, LPDIRECTDRAWSURFACE, LPDIRECT3DDEVICE2 *); +HRESULT WINAPI extCreateDevice3(void *, REFCLSID, LPDIRECTDRAWSURFACE4, LPDIRECT3DDEVICE3 *, LPUNKNOWN); + +HRESULT WINAPI extInitializeVP(void *, LPDIRECT3D); +HRESULT WINAPI extSetViewport(void *, LPD3DVIEWPORT); +HRESULT WINAPI extGetViewport(void *, LPD3DVIEWPORT); +HRESULT WINAPI extQueryInterfaceD3(void *, REFIID, LPVOID *); + +extern char *ExplainDDError(DWORD); + +int HookDirect3D7(HMODULE module, int version){ + void *tmp; + HINSTANCE hinst; + LPDIRECT3D lpd3d=NULL; + + gD3DVersion = version; + + switch(version){ + case 0: + case 1: + tmp = HookAPI(module, "d3dim.dll", NULL, "Direct3DCreate", extDirect3DCreate); + if(tmp) pDirect3DCreate = (Direct3DCreate_Type)tmp; + tmp = HookAPI(module, "d3dim.dll", NULL, "Direct3DCreateDevice", extDirect3DCreateDevice); + if(tmp) pDirect3DCreateDevice = (Direct3DCreateDevice_Type)tmp; + tmp = HookAPI(module, "d3dim700.dll", NULL, "Direct3DCreate", extDirect3DCreate); + if(tmp) pDirect3DCreate = (Direct3DCreate_Type)tmp; + tmp = HookAPI(module, "d3dim700.dll", NULL, "Direct3DCreateDevice", extDirect3DCreateDevice); + if(tmp) pDirect3DCreateDevice = (Direct3DCreateDevice_Type)tmp; + break; + case 7: + hinst = LoadLibrary("d3dim.dll"); + if (hinst){ + pDirect3DCreate = + (Direct3DCreate_Type)GetProcAddress(hinst, "Direct3DCreate"); + if(pDirect3DCreate){ + lpd3d = (LPDIRECT3D)extDirect3DCreate(0x0700, &lpd3d, NULL); + if(lpd3d) lpd3d->Release(); + } + } + else { + hinst = LoadLibrary("d3dim700.dll"); + pDirect3DCreate = + (Direct3DCreate_Type)GetProcAddress(hinst, "Direct3DCreate"); + if(pDirect3DCreate){ + lpd3d = (LPDIRECT3D)extDirect3DCreate(0x0700, &lpd3d, NULL); + if(lpd3d) lpd3d->Release(); + } + } + break; + } + return 0; +} + +FARPROC Remap_d3d7_ProcAddress(LPCSTR proc, HMODULE hModule) +{ + if (!strcmp(proc,"Direct3DCreate") && !pDirect3DCreate){ + pDirect3DCreate=(Direct3DCreate_Type)(*pGetProcAddress)(hModule, proc); + OutTraceD("GetProcAddress: hooking proc=%s at addr=%x\n", ProcToString(proc), pDirect3DCreate); + return (FARPROC)extDirect3DCreate; + } + if (!strcmp(proc,"Direct3DCreateDevice") && !pDirect3DCreateDevice){ + pDirect3DCreateDevice=(Direct3DCreateDevice_Type)(*pGetProcAddress)(hModule, proc); + OutTraceD("GetProcAddress: hooking proc=%s at addr=%x\n", ProcToString(proc), pDirect3DCreateDevice); + return (FARPROC)extDirect3DCreateDevice; + } + // NULL -> keep the original call address + return NULL; +} + +HRESULT WINAPI extDirect3DCreateDevice(GUID FAR *lpGUID, LPDIRECT3D lpd3ddevice, LPDIRECTDRAWSURFACE surf, LPDIRECT3D *lplpd3ddevice, LPUNKNOWN pUnkOuter) +{ + HRESULT res; + + OutTraceD("Direct3DCreateDevice: guid=%x d3ddevice=%x dds=%x UnkOuter=%x\n", + lpGUID, lpd3ddevice, surf, pUnkOuter); + res=(*pDirect3DCreateDevice)(lpGUID, lpd3ddevice, surf, lplpd3ddevice, pUnkOuter); + if(res) OutTraceE("Direct3DCreateDevice ERROR: err=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__); + else OutTraceD("Direct3DCreateDevice: d3ddevice=%x\n", *lplpd3ddevice); + return res; +} + +void HookDirect3DSession(LPDIRECTDRAW *lplpdd, int dxversion) +{ + OutTraceD("HookDirect3DSession: d3d=%x d3dversion=%d\n", *lplpdd, dxversion); + + gD3DVersion = dxversion; + + switch(dxversion){ + case 1: + SetHook((void *)(**(DWORD **)lplpdd + 0), extQueryInterfaceD3, (void **)&pQueryInterfaceD3, "QueryInterface(D3S)"); + SetHook((void *)(**(DWORD **)lplpdd + 12), extInitialize, (void **)&pInitialize, "Initialize"); + SetHook((void *)(**(DWORD **)lplpdd + 16), extEnumDevices, (void **)&pEnumDevices, "EnumDevices"); + SetHook((void *)(**(DWORD **)lplpdd + 20), extCreateLight, (void **)&pCreateLight, "CreateLight"); + SetHook((void *)(**(DWORD **)lplpdd + 24), extCreateMaterial, (void **)&pCreateMaterial, "CreateMaterial"); + SetHook((void *)(**(DWORD **)lplpdd + 28), extCreateViewport, (void **)&pCreateViewport, "CreateViewport"); + SetHook((void *)(**(DWORD **)lplpdd + 32), extFindDevice, (void **)&pFindDevice, "FindDevice"); + break; + case 5: + SetHook((void *)(**(DWORD **)lplpdd + 0), extQueryInterfaceD3, (void **)&pQueryInterfaceD3, "QueryInterface(D3S)"); + SetHook((void *)(**(DWORD **)lplpdd + 12), extEnumDevices, (void **)&pEnumDevices, "EnumDevices"); + SetHook((void *)(**(DWORD **)lplpdd + 16), extCreateLight, (void **)&pCreateLight, "CreateLight"); + SetHook((void *)(**(DWORD **)lplpdd + 20), extCreateMaterial, (void **)&pCreateMaterial, "CreateMaterial"); + SetHook((void *)(**(DWORD **)lplpdd + 24), extCreateViewport, (void **)&pCreateViewport, "CreateViewport"); + SetHook((void *)(**(DWORD **)lplpdd + 28), extFindDevice, (void **)&pFindDevice, "FindDevice"); + SetHook((void *)(**(DWORD **)lplpdd + 32), extCreateDevice2, (void **)&pCreateDevice2, "CreateDevice(D3D2)"); + break; + case 6: + SetHook((void *)(**(DWORD **)lplpdd + 0), extQueryInterfaceD3, (void **)&pQueryInterfaceD3, "QueryInterface(D3S)"); + SetHook((void *)(**(DWORD **)lplpdd + 12), extEnumDevices, (void **)&pEnumDevices, "EnumDevices"); + SetHook((void *)(**(DWORD **)lplpdd + 16), extCreateLight, (void **)&pCreateLight, "CreateLight"); + SetHook((void *)(**(DWORD **)lplpdd + 20), extCreateMaterial, (void **)&pCreateMaterial, "CreateMaterial"); + SetHook((void *)(**(DWORD **)lplpdd + 24), extCreateViewport, (void **)&pCreateViewport, "CreateViewport"); + SetHook((void *)(**(DWORD **)lplpdd + 28), extFindDevice, (void **)&pFindDevice, "FindDevice"); + SetHook((void *)(**(DWORD **)lplpdd + 32), extCreateDevice3, (void **)&pCreateDevice3, "CreateDevice(D3D3)"); + break; + } +} + +void HookDirect3DDevice(LPDIRECTDRAW *lpd3d, int dxversion) +{ + OutTraceD("HookDirect3DDevice: d3d=%x d3dversion=%d\n", *lpd3d, dxversion); + + gD3DVersion = dxversion; + + switch(dxversion){ + case 1: + //SetHook((void *)(**(DWORD **)lpd3d + 12), extInitialize, (void **)&pInitialize, "Initialize"); + //SetHook((void *)(**(DWORD **)lpd3d + 16), extEnumDevices, (void **)&pEnumDevices, "EnumDevices"); + //SetHook((void *)(**(DWORD **)lpd3d + 20), extCreateLight, (void **)&pCreateLight, "CreateLight"); + //SetHook((void *)(**(DWORD **)lpd3d + 24), extCreateMaterial, (void **)&pCreateMaterial, "CreateMaterial"); + //SetHook((void *)(**(DWORD **)lpd3d + 28), extCreateViewport, (void **)&pCreateViewport, "CreateViewport"); + //SetHook((void *)(**(DWORD **)lpd3d + 32), extFindDevice, (void **)&pFindDevice, "FindDevice"); + break; + case 5: + case 6: + //SetHook((void *)(**(DWORD **)lpd3d + 12), extEnumDevices, (void **)&pEnumDevices, "EnumDevices"); + //SetHook((void *)(**(DWORD **)lpd3d + 16), extCreateLight, (void **)&pCreateLight, "CreateLight"); + //SetHook((void *)(**(DWORD **)lpd3d + 20), extCreateMaterial, (void **)&pCreateMaterial, "CreateMaterial"); + //SetHook((void *)(**(DWORD **)lpd3d + 24), extCreateViewport, (void **)&pCreateViewport, "CreateViewport"); + //SetHook((void *)(**(DWORD **)lpd3d + 28), extFindDevice, (void **)&pFindDevice, "FindDevice"); + break; + } +} + +HRESULT WINAPI extDirect3DCreate(UINT SDKVersion, LPDIRECT3D *lplpd3d, LPUNKNOWN pUnkOuter) +{ + HRESULT res; + + OutTraceD("Direct3DCreate: SDKVersion=%x UnkOuter=%x\n", SDKVersion, pUnkOuter); + res=(*pDirect3DCreate)(SDKVersion, lplpd3d, pUnkOuter); + + if(res) { + OutTraceE("Direct3DCreate ERROR: err=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__); + return res; + } + + HookDirect3DSession((LPDIRECTDRAW *)lplpd3d, SDKVersion); + OutTraceD("Direct3DCreate: d3d=%x\n", *lplpd3d); + return res; +} + +void HookViewport(LPDIRECT3DVIEWPORT *lpViewport, int dxversion) +{ + OutTraceD("HookViewport: Viewport=%x d3dversion=%d\n", *lpViewport, dxversion); + + switch(dxversion){ + case 1: + case 5: + case 6: + case 7: + SetHook((void *)(**(DWORD **)lpViewport + 12), extInitializeVP, (void **)&pInitializeVP, "Initialize(VP)"); + SetHook((void *)(**(DWORD **)lpViewport + 16), extGetViewport, (void **)&pGetViewport, "GetViewport"); + SetHook((void *)(**(DWORD **)lpViewport + 20), extSetViewport, (void **)&pSetViewport, "SetViewport"); + break; + } +} + +HRESULT WINAPI extQueryInterfaceD3(void *lpd3d, REFIID riid, LPVOID * ppvObj) +{ + HRESULT res; + int d3dversion; + + OutTraceD("QueryInterface(D3): d3d=%x REFIID=%x obj=%x\n", lpd3d, riid.Data1, ppvObj); + d3dversion=0; + res=(*pQueryInterfaceD3)(lpd3d, riid, ppvObj); + switch(riid.Data1){ + case 0x3BBA0080: d3dversion=1; break; + case 0x6aae1ec1: d3dversion=5; break; + case 0xbb223240: d3dversion=6; break; + case 0xf5049e77: d3dversion=7; break; + } + if(d3dversion) OutTraceD("QueryInterface(D3): hooking version=%d\n", d3dversion); + switch(d3dversion){ + case 1: + SetHook((void *)(**(DWORD **)ppvObj + 12), extInitialize, (void **)&pInitialize, "Initialize"); + SetHook((void *)(**(DWORD **)ppvObj + 16), extEnumDevices, (void **)&pEnumDevices, "EnumDevices"); + SetHook((void *)(**(DWORD **)ppvObj + 20), extCreateLight, (void **)&pCreateLight, "CreateLight"); + SetHook((void *)(**(DWORD **)ppvObj + 24), extCreateMaterial, (void **)&pCreateMaterial, "CreateMaterial"); + SetHook((void *)(**(DWORD **)ppvObj + 28), extCreateViewport, (void **)&pCreateViewport, "CreateViewport"); + SetHook((void *)(**(DWORD **)ppvObj + 32), extFindDevice, (void **)&pFindDevice, "FindDevice"); + break; + case 5: + case 6: + SetHook((void *)(**(DWORD **)ppvObj + 12), extEnumDevices, (void **)&pEnumDevices, "EnumDevices"); + SetHook((void *)(**(DWORD **)ppvObj + 16), extCreateLight, (void **)&pCreateLight, "CreateLight"); + SetHook((void *)(**(DWORD **)ppvObj + 20), extCreateMaterial, (void **)&pCreateMaterial, "CreateMaterial"); + SetHook((void *)(**(DWORD **)ppvObj + 24), extCreateViewport, (void **)&pCreateViewport, "CreateViewport"); + SetHook((void *)(**(DWORD **)ppvObj + 28), extFindDevice, (void **)&pFindDevice, "FindDevice"); + break; + } + return res; +} + +HRESULT WINAPI extInitialize(void *lpd3d) +{ + HRESULT res; + + OutTraceD("Initialize: d3d=%x\n", lpd3d); + res=(*pInitialize)(lpd3d); + if(res) OutTraceE("Initialize ERROR: err=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__); + else OutTraceD("Initialize: OK\n"); + return res; +} + +typedef struct { + LPD3DENUMDEVICESCALLBACK *cb; + LPVOID arg; +} CallbackArg; + +static void DumpD3DDevideDesc(LPD3DDEVICEDESC d3, char *label) +{ + OutTraceD("EnumDevices: CALLBACK dev=%s Size=%d Flags=%x ", label, d3->dwSize, d3->dwFlags); + if(d3->dwFlags & D3DDD_COLORMODEL) OutTraceD("ColorModel=%x ", d3->dcmColorModel); + if(d3->dwFlags & D3DDD_DEVCAPS) OutTraceD("DevCaps=%x ", d3->dwDevCaps); + if(d3->dwFlags & D3DDD_TRANSFORMCAPS) OutTraceD("TransformCaps=%x ", d3->dtcTransformCaps.dwCaps); + if(d3->dwFlags & D3DDD_LIGHTINGCAPS) OutTraceD("LightingCaps=%x ", d3->dlcLightingCaps); + if(d3->dwFlags & D3DDD_BCLIPPING) OutTraceD("Clipping=%x ", d3->bClipping); + if(d3->dwFlags & D3DDD_LINECAPS) OutTraceD("LineCaps=%x ", d3->dpcLineCaps); + if(d3->dwFlags & D3DDD_TRICAPS) OutTraceD("TriCaps=%x ", d3->dpcTriCaps); + if(d3->dwFlags & D3DDD_DEVICERENDERBITDEPTH) OutTraceD("DeviceRenderBitDepth=%d ", d3->dwDeviceRenderBitDepth); + if(d3->dwFlags & D3DDD_DEVICEZBUFFERBITDEPTH) OutTraceD("DeviceZBufferBitDepth=%d ", d3->dwDeviceZBufferBitDepth); + if(d3->dwFlags & D3DDD_MAXBUFFERSIZE) OutTraceD("MaxBufferSize=%d ", d3->dwMaxBufferSize); + if(d3->dwFlags & D3DDD_MAXVERTEXCOUNT) OutTraceD("MaxVertexCount=%d ", d3->dwMaxVertexCount); + OutTraceD("\n"); +} + +HRESULT WINAPI extDeviceProxy(GUID FAR *lpGuid, LPSTR lpDeviceDescription, LPSTR lpDeviceName, LPD3DDEVICEDESC lpd3ddd1, LPD3DDEVICEDESC lpd3ddd2, LPVOID arg) +{ + HRESULT res; + OutTraceD("EnumDevices: CALLBACK GUID=%x(%s) DeviceDescription=\"%s\", DeviceName=\"%s\", arg=%x\n", lpGuid->Data1, ExplainGUID(lpGuid), lpDeviceDescription, lpDeviceName, ((CallbackArg *)arg)->arg); + DumpD3DDevideDesc(lpd3ddd1, "HWDEV"); + DumpD3DDevideDesc(lpd3ddd2, "SWDEV"); + HookDirect3DDevice((LPDIRECTDRAW *)lpGuid, 0); + res = (*(((CallbackArg *)arg)->cb))(lpGuid, lpDeviceDescription, lpDeviceName, lpd3ddd1, lpd3ddd2, ((CallbackArg *)arg)->arg); + OutTraceD("EnumDevices: CALLBACK ret=%x\n", res); + return res; +} + +HRESULT WINAPI extEnumDevices(void *lpd3d, LPD3DENUMDEVICESCALLBACK cb, LPVOID arg) +{ + HRESULT res; + CallbackArg Arg; + + OutTraceD("EnumDevices: d3d=%x arg=%x\n", lpd3d, arg); + Arg.cb= &cb; + Arg.arg=arg; + res=(*pEnumDevices)(lpd3d, (LPD3DENUMDEVICESCALLBACK)extDeviceProxy, (LPVOID)&Arg); + if(res) OutTraceE("EnumDevices ERROR: err=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__); + else OutTraceD("EnumDevices: OK\n"); + return res; +} + +HRESULT WINAPI extCreateLight(void *lpd3d, LPDIRECT3DLIGHT *lpLight, IUnknown *p0) +{ + HRESULT res; + + OutTraceD("CreateLight: d3d=%x\n", lpd3d); + res=(*pCreateLight)(lpd3d, lpLight, p0); + if(res) OutTraceE("CreateLight ERROR: err=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__); + else OutTraceD("CreateLight: OK\n"); + return res; +} + +HRESULT WINAPI extCreateMaterial(void *lpd3d, LPDIRECT3DMATERIAL *lpMaterial, IUnknown *p0) +{ + HRESULT res; + + OutTraceD("CreateMaterial: d3d=%x\n", lpd3d); + res=(*pCreateMaterial)(lpd3d, lpMaterial, p0); + if(res) OutTraceE("CreateMaterial ERROR: err=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__); + else OutTraceD("CreateMaterial: OK\n"); + return res; +} + +HRESULT WINAPI extCreateViewport(void *lpd3d, LPDIRECT3DVIEWPORT *lpViewport, IUnknown *p0) +{ + HRESULT res; + + OutTraceD("CreateViewport: d3d=%x\n", lpd3d); + res=(*pCreateViewport)(lpd3d, lpViewport, p0); + if(res) OutTraceE("CreateViewport ERROR: err=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__); + else OutTraceD("CreateViewport: Viewport=%x\n", *lpViewport); + HookViewport(lpViewport, gD3DVersion); + return res; +} + +HRESULT WINAPI extFindDevice(void *lpd3d, LPD3DFINDDEVICESEARCH p1, LPD3DFINDDEVICERESULT p2) +{ + HRESULT res; + + OutTraceD("FindDevice: d3d=%x devsearch=%x (size=%d flags=%x caps=%x primcaps=%x colormodel=%x hw=%x guid=%x) p2=%x\n", + lpd3d, p1, p1->dwSize, p1->dwFlags, p1->dwCaps, p1->dpcPrimCaps, p1->dcmColorModel, p1->bHardware, p1->guid, p2); + res=(*pFindDevice)(lpd3d, p1, p2); + if(res) OutTraceE("FindDevice ERROR: err=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__); + else { + OutTraceD("FindDevice: GUID=%x.%x.%x.%x\n", p2->guid.Data1, p2->guid.Data2, p2->guid.Data3, p2->guid.Data4); + DumpD3DDevideDesc(&(p2->ddHwDesc), "HWDEV"); + DumpD3DDevideDesc(&(p2->ddSwDesc), "SWDEV"); + } + return res; +} + +HRESULT WINAPI extSetViewport(void *lpvp, LPD3DVIEWPORT vpd) +{ + HRESULT res; + + OutTraceD("SetViewport: viewport=%x viewportd=%x size=%d pos=(%d,%d) dim=(%dx%d) scale=(%fx%f) maxXYZ=(%f,%f,%f) minZ=%f\n", + lpvp, vpd, vpd->dwSize, vpd->dwX, vpd->dwY, vpd->dwHeight, vpd->dwWidth, vpd->dvScaleX, vpd->dvScaleY, + vpd->dvMaxX, vpd->dvMaxY, vpd->dvMaxZ, vpd->dvMinZ); + res=(*pSetViewport)(lpvp, vpd); + if(res) OutTraceE("SetViewport ERROR: err=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__); + else OutTraceD("SetViewport: OK\n"); + return res; +} + +HRESULT WINAPI extGetViewport(void *lpvp, LPD3DVIEWPORT vpd) +{ + HRESULT res; + + OutTraceD("GetViewport: viewport=%x viewportd=%x\n", lpvp, vpd); + res=(*pGetViewport)(lpvp, vpd); + if(res) OutTraceE("GetViewport ERROR: err=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__); + else OutTraceD("GetViewport: OK size=%d pos=(%d,%d) dim=(%dx%d) scale=(%fx%f) maxXYZ=(%f,%f,%f) minZ=%f\n", + vpd->dwSize, vpd->dwX, vpd->dwY, vpd->dwHeight, vpd->dwWidth, vpd->dvScaleX, vpd->dvScaleY, + vpd->dvMaxX, vpd->dvMaxY, vpd->dvMaxZ, vpd->dvMinZ); + return res; +} + +HRESULT WINAPI extInitializeVP(void *lpvp, LPDIRECT3D lpd3d) +{ + HRESULT res; + + OutTraceD("Initialize(VP): viewport=%x d3d=%x\n", lpvp, lpd3d); + res=(*pInitializeVP)(lpvp, lpd3d); + if(res) OutTraceE("Initialize(VP) ERROR: err=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__); + else OutTraceD("Initialize(VP): OK \n"); + return res; +} + +HRESULT WINAPI extCreateDevice2(void *lpd3d, REFCLSID Guid, LPDIRECTDRAWSURFACE lpdds, LPDIRECT3DDEVICE2 *lplpd3dd) +{ + HRESULT res; + + OutTraceD("CreateDevice(D3D2): d3d=%x GUID=%x(%s) lpdds=%x\n", lpd3d, Guid.Data1, ExplainGUID((GUID *)&Guid), lpdds); + res=(*pCreateDevice2)(lpd3d, Guid, lpdds, lplpd3dd); + if(res) { + OutTraceE("CreateDevice(D3D2) ERROR: err=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__); + return res; + } + + // Hook device here ...! + + return res; +} + +const GUID IID_IDirect3DRampDevice; +const GUID IID_IDirect3DRGBDevice; + +HRESULT WINAPI extCreateDevice3(void *lpd3d, REFCLSID Guid, LPDIRECTDRAWSURFACE4 lpdds, LPDIRECT3DDEVICE3 *lplpd3dd, LPUNKNOWN unk) +{ + HRESULT res; + GUID IID_IDirect3DRGBDevice = {0xA4665C60,0x2673,0x11CF,0xA3,0x1A,0x00,0xAA,0x00,0xB9,0x33,0x56}; + GUID IID_IDirect3DRampDevice = {0xF2086B20,0x259F,0x11CF,0xA3,0x1A,0x00,0xAA,0x00,0xB9,0x33,0x56}; + GUID IID_IDirect3DMMXDevice = {0x881949a1,0xd6f3,0x11d0,0x89,0xab,0x00,0xa0,0xc9,0x05,0x41,0x29}; + + OutTraceD("CreateDevice(D3D3): d3d=%x GUID=%x(%s) lpdds=%x\n", lpd3d, Guid.Data1, ExplainGUID((GUID *)&Guid), lpdds); + res=(*pCreateDevice3)(lpd3d, Guid, lpdds, lplpd3dd, unk); + //res=(*pCreateDevice3)(lpd3d, IID_IDirect3DMMXDevice, lpdds, lplpd3dd, unk); + if(res) { + OutTraceE("CreateDevice(D3D3) ERROR: err=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__); + //if(1) { + // GUID IID_IDirect3DRGBDevice = {0xA4665C60,0x2673,0x11CF,0xA3,0x1A,0x00,0xAA,0x00,0xB9,0x33,0x56}; + // GUID IID_IDirect3DRampDevice = {0xF2086B20,0x259F,0x11CF,0xA3,0x1A,0x00,0xAA,0x00,0xB9,0x33,0x56}; + // GUID IID_IDirect3DMMXDevice = {0x881949a1,0xd6f3,0x11d0,0x89,0xab,0x00,0xa0,0xc9,0x05,0x41,0x29}; + // res=(*pCreateDevice3)(lpd3d, IID_IDirect3DRGBDevice, lpdds, lplpd3dd, unk); + // if(res) OutTraceE("CreateDevice(IID_IDirect3DRGBDevice) ERROR: err=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__); + // res=(*pCreateDevice3)(lpd3d, IID_IDirect3DRampDevice, lpdds, lplpd3dd, unk); + // if(res) OutTraceE("CreateDevice(IID_IDirect3DRampDevice) ERROR: err=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__); + // res=(*pCreateDevice3)(lpd3d, IID_IDirect3DMMXDevice, lpdds, lplpd3dd, unk); + // if(res) OutTraceE("CreateDevice(IID_IDirect3DMMXDevice) ERROR: err=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__); + //} + return res; + } + + // Hook device here ...! + + return res; +} + +#if 0 +HRESULT WINAPI extInitialize(void *d3dd, LPDIRECT3D lpd3d, LPGUID lpGuid, LPD3DDEVICEDESC lpd3ddd) +{ + HRESULT res; + OutTrace("Initialize: d3dd=%x lpd3d=%x GUID=%x lpd3ddd=%x\n", d3dd, lpd3d, lpGuid->Data1, lpd3ddd); + res=(*pInitialize)(d3dd, lpd3d, lpGuid, lpd3ddd); + if(res) OutTraceE("Initialize ERROR: err=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__); + return res; +} +HRESULT WINAPI extGetCaps(void *d3dd, LPD3DDEVICEDESC,LPD3DDEVICEDESC) +//HRESULT WINAPI extSwapTextureHandles(void *d3dd, LPDIRECT3DTEXTURE,LPDIRECT3DTEXTURE) +//HRESULT WINAPI extCreateExecuteBuffer(void *d3dd, LPD3DEXECUTEBUFFERDESC,LPDIRECT3DEXECUTEBUFFER*,IUnknown*) +//HRESULT WINAPI extGetStats(void *d3dd, LPD3DSTATS) +HRESULT WINAPI extExecute(void *d3dd, LPDIRECT3DEXECUTEBUFFER lpd3dEB, LPDIRECT3DVIEWPORT lpd3dVP, DWORD dwFlags) +HRESULT WINAPI extAddViewport(void *d3dd, LPDIRECT3DVIEWPORT) +HRESULT WINAPI extDeleteViewport(void *d3dd,HIS_ LPDIRECT3DVIEWPORT) +HRESULT WINAPI extNextViewport(void *d3dd, LPDIRECT3DVIEWPORT,LPDIRECT3DVIEWPORT*,DWORD) +HRESULT WINAPI extPick(void *d3dd, LPDIRECT3DEXECUTEBUFFER,LPDIRECT3DVIEWPORT,DWORD,LPD3DRECT) +HRESULT WINAPI extGetPickRecords(void *d3dd, LPDWORD,LPD3DPICKRECORD) +HRESULT WINAPI extEnumTextureFormats(void *d3dd, LPD3DENUMTEXTUREFORMATSCALLBACK,LPVOID) +HRESULT WINAPI extCreateMatrix(void *d3dd, LPD3DMATRIXHANDLE) +HRESULT WINAPI extSetMatrix(void *d3dd, D3DMATRIXHANDLE,const LPD3DMATRIX) +HRESULT WINAPI extGetMatrix(void *d3dd, D3DMATRIXHANDLE,LPD3DMATRIX) +HRESULT WINAPI extDeleteMatrix(void *d3dd, D3DMATRIXHANDLE) +HRESULT WINAPI extBeginScene(void *d3dd) +HRESULT WINAPI extEndScene(void *d3dd) +HRESULT WINAPI extGetDirect3D(void *d3dd, LPDIRECT3D*) +#endif + diff --git a/dll/hddproxy.cpp b/dll/hddproxy.cpp index 1e1889b..3d1ac93 100644 --- a/dll/hddproxy.cpp +++ b/dll/hddproxy.cpp @@ -1186,6 +1186,7 @@ HRESULT WINAPI extGetClipperProxy(LPDIRECTDRAWSURFACE lpdds, LPDIRECTDRAWCLIPPER HRESULT WINAPI extGetFlipStatusProxy(LPDIRECTDRAWSURFACE lpdds, DWORD flags) { +#if 0 HRESULT res; OutTraceP("GetFlipStatus(S): PROXED lpdds=%x flags=%x(%s)\n", lpdds, flags, ExplainFlipStatusFlags(flags)); res=(*pGetFlipStatus)(lpdds, flags); @@ -1193,6 +1194,18 @@ HRESULT WINAPI extGetFlipStatusProxy(LPDIRECTDRAWSURFACE lpdds, DWORD flags) else if(res) OutTraceP("GetFlipStatus(S): ERROR err=%x(%s)\n", res, ExplainDDError(res)); return res; +#else + HRESULT res; + static int DeMux=0; + OutTraceP("GetFlipStatus(S): DELAYED lpdds=%x flags=%x(%s)\n", lpdds, flags, ExplainFlipStatusFlags(flags)); + DeMux = (DeMux + 1) % 10; + res=(*pGetFlipStatus)(lpdds, flags); + if(res==DDERR_WASSTILLDRAWING) OutTraceP("GetFlipStatus(S): res=%x(%s)\n", res, ExplainDDError(res)); + else + if(res) OutTraceP("GetFlipStatus(S): ERROR err=%x(%s)\n", res, ExplainDDError(res)); + if(DeMux) res=DDERR_WASSTILLDRAWING; + return res; +#endif } HRESULT WINAPI extGetOverlayPositionProxy(LPDIRECTDRAWSURFACE lpdds, LPLONG lpl1, LPLONG lpl2) diff --git a/dll/hddraw.h b/dll/hddraw.h index c0a9e5b..42e3272 100644 --- a/dll/hddraw.h +++ b/dll/hddraw.h @@ -114,3 +114,7 @@ typedef HRESULT (WINAPI *GetCapsP_Type)(LPDIRECTDRAWPALETTE, LPDWORD); typedef HRESULT (WINAPI *GetEntries_Type)(LPDIRECTDRAWPALETTE, DWORD, DWORD, DWORD, LPPALETTEENTRY); // STDMETHOD(Initialize)(THIS_ LPDIRECTDRAW, DWORD, LPPALETTEENTRY) PURE; typedef HRESULT (WINAPI *SetEntries_Type)(LPDIRECTDRAWPALETTE, DWORD, DWORD, DWORD, LPPALETTEENTRY); + +// +// GammaRamp +typedef HRESULT (WINAPI *GammaRamp_Type)(LPDIRECTDRAWSURFACE, DWORD, LPDDGAMMARAMP); diff --git a/dll/kernel32.cpp b/dll/kernel32.cpp index 052fbfe..fc339f6 100644 --- a/dll/kernel32.cpp +++ b/dll/kernel32.cpp @@ -442,6 +442,12 @@ FARPROC WINAPI extGetProcAddress(HMODULE hModule, LPCSTR proc) case SYSLIBIDX_ADVAPI32: if (remap=Remap_AdvApi32_ProcAddress(proc, hModule)) return remap; break; + case SYSLIBIDX_DIRECT3D: + if (remap=Remap_d3d7_ProcAddress(proc, hModule)) return remap; + break; + case SYSLIBIDX_DIRECT3D700: + if (remap=Remap_d3d7_ProcAddress(proc, hModule)) return remap; + break; default: break; } diff --git a/dll/ole32.cpp b/dll/ole32.cpp index 263ede1..cab838b 100644 --- a/dll/ole32.cpp +++ b/dll/ole32.cpp @@ -38,8 +38,8 @@ static void HookDDSession(LPDIRECTDRAW *, int); HRESULT STDAPICALLTYPE extCoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID riid, LPVOID FAR* ppv) { HRESULT res; - OutTraceD("CoCreateInstance: rclsid=%x UnkOuter=%x ClsContext=%x refiid=%x\n", - rclsid, pUnkOuter, dwClsContext, riid); + OutTraceD("CoCreateInstance: rclsid=%x UnkOuter=%x ClsContext=%x refiid=%x(%s)\n", + rclsid, pUnkOuter, dwClsContext, riid.Data1, ExplainGUID((GUID *)&riid)); // CLSID e436ebb3 implies loading quartz.dll to play movies through dshow: // quartz.dll must be hooked. diff --git a/dll/syslibs.h b/dll/syslibs.h index 8374288..dd22ad5 100644 --- a/dll/syslibs.h +++ b/dll/syslibs.h @@ -318,7 +318,6 @@ DXWEXTERN GetClipCursor_Type pGetClipCursor DXWINITIALIZED; DXWEXTERN GetCursorPos_Type pGetCursorPos DXWINITIALIZED; DXWEXTERN GDIGetDC_Type pGDIGetDC DXWINITIALIZED; DXWEXTERN GetDesktopWindow_Type pGetDesktopWindow DXWINITIALIZED; -DXWEXTERN GetMessage_Type pGetMessage DXWINITIALIZED; DXWEXTERN GetSystemMetrics_Type pGetSystemMetrics DXWINITIALIZED; DXWEXTERN GetTopWindow_Type pGetTopWindow DXWINITIALIZED; DXWEXTERN GDIGetDC_Type pGDIGetWindowDC DXWINITIALIZED; @@ -491,7 +490,6 @@ extern BOOL WINAPI extGetCursorPos(LPPOINT); extern HDC WINAPI extGDIGetDC(HWND); extern HDC WINAPI extDDGetDC(HWND); extern HWND WINAPI extGetDesktopWindow(void); -extern BOOL WINAPI extGetMessage(LPMSG, HWND, UINT, UINT); extern int WINAPI extGetSystemMetrics(int); extern HWND WINAPI extGetTopWindow(HWND); extern HDC WINAPI extGDIGetWindowDC(HWND); @@ -503,7 +501,6 @@ extern BOOL WINAPI extDDInvalidateRect(HWND, RECT *, BOOL); extern int WINAPI extMapWindowPoints(HWND, HWND, LPPOINT, UINT); extern BOOL WINAPI extMoveWindow(HWND, int, int, int, int, BOOL); extern BOOL WINAPI extPeekMessage(LPMSG, HWND, UINT, UINT, UINT); -extern BOOL WINAPI extPeekAnyMessage(LPMSG, HWND, UINT, UINT, UINT); extern ATOM WINAPI extRegisterClassExA(WNDCLASSEXA *); extern int WINAPI extDDReleaseDC(HWND, HDC); extern int WINAPI extGDIReleaseDC(HWND, HDC); diff --git a/dll/user32.cpp b/dll/user32.cpp index f3d65ab..4afd241 100644 --- a/dll/user32.cpp +++ b/dll/user32.cpp @@ -73,15 +73,9 @@ static HookEntry_Type RemapHooks[]={ {0, NULL, 0, 0} // terminator }; -static HookEntry_Type MessageHooks[]={ - //{"PeekMessageA", (FARPROC)PeekMessageA, (FARPROC *)&pPeekMessage, (FARPROC)extPeekMessage}, - //{"GetMessageA", (FARPROC)GetMessageA, (FARPROC *)&pGetMessage, (FARPROC)extGetMessage}, - {0, NULL, 0, 0} // terminator -}; - static HookEntry_Type PeekAllHooks[]={ - {"PeekMessageA", (FARPROC)NULL, (FARPROC *)&pPeekMessage, (FARPROC)extPeekAnyMessage}, - {"PeekMessageW", (FARPROC)NULL, (FARPROC *)&pPeekMessage, (FARPROC)extPeekAnyMessage}, + {"PeekMessageA", (FARPROC)NULL, (FARPROC *)&pPeekMessage, (FARPROC)extPeekMessage}, + {"PeekMessageW", (FARPROC)NULL, (FARPROC *)&pPeekMessage, (FARPROC)extPeekMessage}, {0, NULL, 0, 0} // terminator }; @@ -118,9 +112,6 @@ FARPROC Remap_user32_ProcAddress(LPCSTR proc, HMODULE hModule) if (addr=RemapLibrary(proc, hModule, (dxw.dwFlags1 & MAPGDITOPRIMARY) ? DDHooks : GDIHooks)) return addr; if (dxw.dwFlags1 & CLIENTREMAPPING) if (addr=RemapLibrary(proc, hModule, RemapHooks)) return addr; - // commented out since message processing was given to SetWindowHook callback - // if (dxw.dwFlags1 & MESSAGEPROC) - // if (addr=RemapLibrary(proc, hModule, MessageHooks)) return addr; if(dxw.dwFlags1 & MODIFYMOUSE) if (addr=RemapLibrary(proc, hModule, MouseHooks)) return addr; if (dxw.dwFlags1 & (PREVENTMAXIMIZE|FIXWINFRAME|LOCKWINPOS|LOCKWINSTYLE)) @@ -141,7 +132,6 @@ void HookUser32(HMODULE hModule) HookLibrary(hModule, EmulateHooks, libname); HookLibrary(hModule, (dxw.dwFlags1 & MAPGDITOPRIMARY) ? DDHooks : GDIHooks, libname); if (dxw.dwFlags1 & CLIENTREMAPPING) HookLibrary(hModule, RemapHooks, libname); - //if (dxw.dwFlags1 & MESSAGEPROC) HookLibrary(hModule, MessageHooks, libname); if(dxw.dwFlags1 & MODIFYMOUSE)HookLibrary(hModule, MouseHooks, libname); if (dxw.dwFlags1 & (PREVENTMAXIMIZE|FIXWINFRAME|LOCKWINPOS|LOCKWINSTYLE))HookLibrary(hModule, WinHooks, libname); if((dxw.dwFlags1 & (MODIFYMOUSE|SLOWDOWN|KEEPCURSORWITHIN)) || (dxw.dwFlags2 & KEEPCURSORFIXED)) HookLibrary(hModule, MouseHooks2, libname); @@ -154,7 +144,6 @@ void HookUser32Init() HookLibInit(Hooks); HookLibInit(DDHooks); HookLibInit(RemapHooks); - HookLibInit(MessageHooks); HookLibInit(MouseHooks); HookLibInit(WinHooks); HookLibInit(MouseHooks2); @@ -350,11 +339,6 @@ static LRESULT WINAPI FixWindowProc(char *ApiName, HWND hwnd, UINT Msg, WPARAM w ApiName, hwnd, Msg, ExplainWinMessage(Msg), wParam, lParam); switch(Msg){ - // attempt to fix Sleepwalker - //case WM_NCCALCSIZE: - // if (dxw.dwFlags1 & PREVENTMAXIMIZE) - // return 0; - // break; case WM_ERASEBKGND: OutTraceD("%s: prevent erase background\n", ApiName); return 1; // 1=erased @@ -370,15 +354,6 @@ static LRESULT WINAPI FixWindowProc(char *ApiName, HWND hwnd, UINT Msg, WPARAM w case WM_STYLECHANGED: dxw.FixStyle(ApiName, hwnd, wParam, lParam); break; - case WM_DISPLAYCHANGE: - // too late? to be deleted.... - if ((dxw.dwFlags1 & LOCKWINPOS) && dxw.IsFullScreen()) return 0; - if (dxw.dwFlags1 & PREVENTMAXIMIZE){ - OutTraceD("%s: WM_DISPLAYCHANGE depth=%d size=(%d,%d)\n", - ApiName, wParam, HIWORD(lParam), LOWORD(lParam)); - return 0; - } - break; case WM_SIZE: if ((dxw.dwFlags1 & LOCKWINPOS) && dxw.IsFullScreen()) return 0; if (dxw.dwFlags1 & PREVENTMAXIMIZE){ @@ -780,88 +755,20 @@ BOOL WINAPI extSetCursorPos(int x, int y) return res; } -BOOL WINAPI extPeekAnyMessage(LPMSG lpMsg, HWND hwnd, UINT wMsgFilterMin, UINT wMsgFilterMax, UINT wRemoveMsg) +BOOL WINAPI extPeekMessage(LPMSG lpMsg, HWND hwnd, UINT wMsgFilterMin, UINT wMsgFilterMax, UINT wRemoveMsg) { BOOL res; res=(*pPeekMessage)(lpMsg, hwnd, 0, 0, (wRemoveMsg & 0x000F)); - OutTraceW("PeekMessage: ANY lpmsg=%x hwnd=%x filter=(%x-%x) remove=%x msg=%x(%s) wparam=%x, lparam=%x pt=(%d,%d) res=%x\n", - lpMsg, lpMsg->hwnd, wMsgFilterMin, wMsgFilterMax, wRemoveMsg, + OutTraceW("PeekMessage: ANY lpmsg=%x hwnd=%x filter=(%x-%x) remove=%x(%s) msg=%x(%s) wparam=%x, lparam=%x pt=(%d,%d) res=%x\n", + lpMsg, lpMsg->hwnd, wMsgFilterMin, wMsgFilterMax, wRemoveMsg, ExplainPeekRemoveMsg(wRemoveMsg), lpMsg->message, ExplainWinMessage(lpMsg->message & 0xFFFF), lpMsg->wParam, lpMsg->lParam, lpMsg->pt.x, lpMsg->pt.y, res); return res; } -BOOL WINAPI extPeekMessage(LPMSG lpMsg, HWND hwnd, UINT wMsgFilterMin, UINT wMsgFilterMax, UINT wRemoveMsg) -{ - BOOL res; - UINT iRemoveMsg; - - iRemoveMsg = wRemoveMsg; - if(1) iRemoveMsg &= 0x000F; // Peek all messages - - res=(*pPeekMessage)(lpMsg, hwnd, wMsgFilterMin, wMsgFilterMax, iRemoveMsg); - - OutTraceW("PeekMessage: lpmsg=%x hwnd=%x filter=(%x-%x) remove=%x msg=%x(%s) wparam=%x, lparam=%x pt=(%d,%d) res=%x\n", - lpMsg, lpMsg->hwnd, wMsgFilterMin, wMsgFilterMax, wRemoveMsg, - lpMsg->message, ExplainWinMessage(lpMsg->message & 0xFFFF), - lpMsg->wParam, lpMsg->lParam, lpMsg->pt.x, lpMsg->pt.y, res); - - // v2.1.74: skip message fix for WM_CHAR to avoid double typing bug - switch(lpMsg->message){ - //case WM_CHAR: - case WM_KEYUP: - case WM_KEYDOWN: - return res; - } - - // fix to avoid crash in Warhammer Final Liberation, that evidently intercepts mouse position by - // peeking & removing messages from window queue and considering the lParam parameter. - // v2.1.100 - never alter the lpMsg, otherwise the message is duplicated in the queue! Work on a copy of it. - if(wRemoveMsg){ - static MSG MsgCopy; - MsgCopy=*lpMsg; - MsgCopy.pt=FixMessagePt(dxw.GethWnd(), MsgCopy.pt); - if((MsgCopy.message <= WM_MOUSELAST) && (MsgCopy.message >= WM_MOUSEFIRST)) MsgCopy.lParam = MAKELPARAM(MsgCopy.pt.x, MsgCopy.pt.y); - OutTraceC("PeekMessage: fixed lparam/pt=(%d,%d)\n", MsgCopy.pt.x, MsgCopy.pt.y); - lpMsg=&MsgCopy; - GetHookInfo()->CursorX=(short)MsgCopy.pt.x; - GetHookInfo()->CursorY=(short)MsgCopy.pt.y; - } - - return res; -} - -BOOL WINAPI extGetMessage(LPMSG lpMsg, HWND hwnd, UINT wMsgFilterMin, UINT wMsgFilterMax) -{ - BOOL res; - HWND FixedHwnd; - - res=(*pGetMessage)(lpMsg, hwnd, wMsgFilterMin, wMsgFilterMax); - - OutTraceW("GetMessage: lpmsg=%x hwnd=%x filter=(%x-%x) msg=%x(%s) wparam=%x, lparam=%x pt=(%d,%d) res=%x\n", - lpMsg, lpMsg->hwnd, wMsgFilterMin, wMsgFilterMax, - lpMsg->message, ExplainWinMessage(lpMsg->message & 0xFFFF), - lpMsg->wParam, lpMsg->lParam, lpMsg->pt.x, lpMsg->pt.y, res); - - // V2.1.68: processing ALL mouse events, to sync mouse over and mouse click events - // in "Uprising 2", now perfectly working. - DWORD Message; - Message=lpMsg->message & 0xFFFF; - if((Message <= WM_MOUSELAST) && (Message >= WM_MOUSEFIRST)){ - FixedHwnd=(hwnd)?hwnd:dxw.GethWnd(); - if(dxw.IsRealDesktop(FixedHwnd)) FixedHwnd=dxw.GethWnd(); // GPL fix... - lpMsg->pt=FixMessagePt(FixedHwnd, lpMsg->pt); - lpMsg->lParam = MAKELPARAM(lpMsg->pt.x, lpMsg->pt.y); - OutTraceC("PeekMessage: fixed lparam/pt=(%d,%d)\n", lpMsg->pt.x, lpMsg->pt.y); - GetHookInfo()->CursorX=(short)lpMsg->pt.x; - GetHookInfo()->CursorY=(short)lpMsg->pt.y; - } - return res; -} - BOOL WINAPI extClientToScreen(HWND hwnd, LPPOINT lppoint) { // v2.02.10: fully revised to handle scaled windows @@ -1742,7 +1649,6 @@ BOOL WINAPI extMoveWindow(HWND hwnd, int X, int Y, int nWidth, int nHeight, BOOL } } - ret=(*pMoveWindow)(hwnd, X, Y, nWidth, nHeight, bRepaint); if(!ret) OutTraceE("MoveWindow: ERROR err=%d at %d\n", GetLastError(), __LINE__); return ret; diff --git a/host/Release/BuildLog.htm b/host/Release/BuildLog.htm new file mode 100644 index 0000000..599e102 Binary files /dev/null and b/host/Release/BuildLog.htm differ diff --git a/host/Release/Inject.obj b/host/Release/Inject.obj new file mode 100644 index 0000000..34caff2 Binary files /dev/null and b/host/Release/Inject.obj differ diff --git a/host/Release/KillProc.obj b/host/Release/KillProc.obj new file mode 100644 index 0000000..0bc0bab Binary files /dev/null and b/host/Release/KillProc.obj differ diff --git a/host/Release/MainFrm.obj b/host/Release/MainFrm.obj new file mode 100644 index 0000000..b16764f Binary files /dev/null and b/host/Release/MainFrm.obj differ diff --git a/host/Release/StatusDialog.obj b/host/Release/StatusDialog.obj new file mode 100644 index 0000000..6a5a5ea Binary files /dev/null and b/host/Release/StatusDialog.obj differ diff --git a/host/Release/StdAfx.obj b/host/Release/StdAfx.obj new file mode 100644 index 0000000..eca6dd6 Binary files /dev/null and b/host/Release/StdAfx.obj differ diff --git a/host/Release/SystemTray.obj b/host/Release/SystemTray.obj new file mode 100644 index 0000000..2f2a12b Binary files /dev/null and b/host/Release/SystemTray.obj differ diff --git a/host/Release/TabColor.obj b/host/Release/TabColor.obj new file mode 100644 index 0000000..693e73f Binary files /dev/null and b/host/Release/TabColor.obj differ diff --git a/host/Release/TabCompat.obj b/host/Release/TabCompat.obj new file mode 100644 index 0000000..11b537b Binary files /dev/null and b/host/Release/TabCompat.obj differ diff --git a/host/Release/TabDebug.obj b/host/Release/TabDebug.obj new file mode 100644 index 0000000..9a7d6be Binary files /dev/null and b/host/Release/TabDebug.obj differ diff --git a/host/Release/TabDirectX.obj b/host/Release/TabDirectX.obj new file mode 100644 index 0000000..00802ed Binary files /dev/null and b/host/Release/TabDirectX.obj differ diff --git a/host/Release/TabGDI.obj b/host/Release/TabGDI.obj new file mode 100644 index 0000000..6341e4b Binary files /dev/null and b/host/Release/TabGDI.obj differ diff --git a/host/Release/TabLogs.obj b/host/Release/TabLogs.obj new file mode 100644 index 0000000..516e25b Binary files /dev/null and b/host/Release/TabLogs.obj differ diff --git a/host/Release/TabMouse.obj b/host/Release/TabMouse.obj new file mode 100644 index 0000000..c08ecb9 Binary files /dev/null and b/host/Release/TabMouse.obj differ diff --git a/host/Release/TabOpenGL.obj b/host/Release/TabOpenGL.obj new file mode 100644 index 0000000..6b40b2a Binary files /dev/null and b/host/Release/TabOpenGL.obj differ diff --git a/host/Release/TabProgram.obj b/host/Release/TabProgram.obj new file mode 100644 index 0000000..295331a Binary files /dev/null and b/host/Release/TabProgram.obj differ diff --git a/host/Release/TabTiming.obj b/host/Release/TabTiming.obj new file mode 100644 index 0000000..91fc170 Binary files /dev/null and b/host/Release/TabTiming.obj differ diff --git a/host/Release/TabWindow.obj b/host/Release/TabWindow.obj new file mode 100644 index 0000000..8b615c1 Binary files /dev/null and b/host/Release/TabWindow.obj differ diff --git a/host/Release/TargetDlg.obj b/host/Release/TargetDlg.obj new file mode 100644 index 0000000..69366bc Binary files /dev/null and b/host/Release/TargetDlg.obj differ diff --git a/host/Release/TimeSliderDlg.obj b/host/Release/TimeSliderDlg.obj new file mode 100644 index 0000000..ca36c6e Binary files /dev/null and b/host/Release/TimeSliderDlg.obj differ diff --git a/host/Release/dxTabCtrl.obj b/host/Release/dxTabCtrl.obj new file mode 100644 index 0000000..7c62f0c Binary files /dev/null and b/host/Release/dxTabCtrl.obj differ diff --git a/host/Release/dxwnd.exe.intermediate.manifest b/host/Release/dxwnd.exe.intermediate.manifest new file mode 100644 index 0000000..ecea6f7 --- /dev/null +++ b/host/Release/dxwnd.exe.intermediate.manifest @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/host/Release/dxwndhost.obj b/host/Release/dxwndhost.obj new file mode 100644 index 0000000..f07e9e9 Binary files /dev/null and b/host/Release/dxwndhost.obj differ diff --git a/host/Release/dxwndhost.pch b/host/Release/dxwndhost.pch new file mode 100644 index 0000000..4a642bf Binary files /dev/null and b/host/Release/dxwndhost.pch differ diff --git a/host/Release/dxwndhost.res b/host/Release/dxwndhost.res new file mode 100644 index 0000000..c22d768 Binary files /dev/null and b/host/Release/dxwndhost.res differ diff --git a/host/Release/dxwndhostDoc.obj b/host/Release/dxwndhostDoc.obj new file mode 100644 index 0000000..29b6c4a Binary files /dev/null and b/host/Release/dxwndhostDoc.obj differ diff --git a/host/Release/dxwndhostView.obj b/host/Release/dxwndhostView.obj new file mode 100644 index 0000000..0fe88df Binary files /dev/null and b/host/Release/dxwndhostView.obj differ diff --git a/host/Release/getfname.obj b/host/Release/getfname.obj new file mode 100644 index 0000000..1813caf Binary files /dev/null and b/host/Release/getfname.obj differ diff --git a/host/Release/mt.dep b/host/Release/mt.dep new file mode 100644 index 0000000..7451b80 --- /dev/null +++ b/host/Release/mt.dep @@ -0,0 +1 @@ +Manifest resource last updated at 9:28:09,93 on 12/10/2013 diff --git a/host/Release/vc90.idb b/host/Release/vc90.idb new file mode 100644 index 0000000..6b4bd2f Binary files /dev/null and b/host/Release/vc90.idb differ diff --git a/host/Resource.h b/host/Resource.h index 001b71f..3b5d970 100644 --- a/host/Resource.h +++ b/host/Resource.h @@ -36,6 +36,7 @@ #define IDD_TAB_COMPAT 160 #define IDD_TAB_GDI 161 #define IDD_TAB_COLOR 162 +#define IDD_TAB_DEBUG 163 #define IDC_AUTO 300 #define IDC_DIRECTX1 301 #define IDC_DIRECTX7 302 @@ -144,6 +145,8 @@ #define IDC_SUPPRESSD3DEXT 1101 #define IDC_FULLRECTBLT 1102 #define IDC_TIMESPEED 1103 +#define IDC_FULLRECTBLT2 1103 +#define IDC_SURFACEWARN 1103 #define IDC_HOOKDLLS 1104 #define IDC_HOOKENABLED 1105 #define IDC_DESKTOPWORKAREA 1106 @@ -171,7 +174,7 @@ #define IDC_BUFFEREDIOFIX 1128 #define IDC_FILTERMESSAGES 1129 #define IDC_PEEKALLMESSAGES 1130 -#define IDC_TRACEHOOKS 1131 +#define IDC_TRACEHOOKS 1131 #define ID_MODIFY 32771 #define ID_DELETE 32772 #define ID_ADD 32773 diff --git a/host/TabColor.cpp b/host/TabColor.cpp index 5874151..692c411 100644 --- a/host/TabColor.cpp +++ b/host/TabColor.cpp @@ -34,8 +34,6 @@ void CTabColor::DoDataExchange(CDataExchange* pDX) DDX_Check(pDX, IDC_BLACKWHITE, cTarget->m_BlackWhite); DDX_Check(pDX, IDC_USERGB565, cTarget->m_UseRGB565); DDX_Check(pDX, IDC_LOCKSYSCOLORS, cTarget->m_LockSysColors); - DDX_Check(pDX, IDC_RGB2YUV, cTarget->m_ForceRGBtoYUV); - DDX_Check(pDX, IDC_YUV2RGB, cTarget->m_ForceYUVtoRGB); } BEGIN_MESSAGE_MAP(CTabColor, CDialog) diff --git a/host/TabDebug.cpp b/host/TabDebug.cpp new file mode 100644 index 0000000..b4d8a75 --- /dev/null +++ b/host/TabDebug.cpp @@ -0,0 +1,61 @@ +// TabDebug.cpp : implementation file +// + +#include "stdafx.h" +#include "TargetDlg.h" +#include "TabDebug.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// CTabCompat dialog + +CTabDebug::CTabDebug(CWnd* pParent /*=NULL*/) +// : CTargetDlg(pParent) + : CDialog(CTabDebug::IDD, pParent) +{ + //{{AFX_DATA_INIT(CTabDebug) + // NOTE: the ClassWizard will add member initialization here + //}}AFX_DATA_INIT +} + +void CTabDebug::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + CTargetDlg *cTarget = ((CTargetDlg *)(this->GetParent()->GetParent())); + DDX_Check(pDX, IDC_RGB2YUV, cTarget->m_ForceRGBtoYUV); + DDX_Check(pDX, IDC_YUV2RGB, cTarget->m_ForceYUVtoRGB); + DDX_Check(pDX, IDC_DXPROXED, cTarget->m_DXProxed); + DDX_Check(pDX, IDC_ASSERT, cTarget->m_AssertDialog); + DDX_Check(pDX, IDC_FULLRECTBLT, cTarget->m_FullRectBlt); + DDX_Check(pDX, IDC_MARKBLIT, cTarget->m_MarkBlit); + DDX_Check(pDX, IDC_SURFACEWARN, cTarget->m_SurfaceWarn); +} + +BEGIN_MESSAGE_MAP(CTabDebug, CDialog) + //{{AFX_MSG_MAP(CTabCompat) + // NOTE: the ClassWizard will add message map macros here + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CTabCompat message handlers + + +//BOOL CTabCompat::OnInitDialog() +//{ +// AfxEnableControlContainer(); +// CListBox *List; +// CTargetDlg *cTarget = ((CTargetDlg *)(this->GetParent()->GetParent())); +// int i; +// List=(CListBox *)this->GetDlgItem(IDC_LISTFAKE); +// List->ResetContent(); +// for(i=0; i<9; i++) List->AddString(WinVersions[i].sName); +// List->SetCurSel(cTarget->m_FakeVersion); +// CDialog::OnInitDialog(); +// return TRUE; +//} \ No newline at end of file diff --git a/host/TabDebug.h b/host/TabDebug.h new file mode 100644 index 0000000..8bdcde8 --- /dev/null +++ b/host/TabDebug.h @@ -0,0 +1,50 @@ +#if !defined(AFX_TABCOMPAT_H__12345678_C906_446C_822D_322B5AB6C4C4__INCLUDED_) +#define AFX_TABCOMPAT_H__12345678_C906_446C_822D_322B5AB6C4C4__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 +// TabDirectX.h : header file +// +#include "resource.h" +#include "TargetDlg.h" + +///////////////////////////////////////////////////////////////////////////// +// CTabDirectX dialog + +//class CTabCompat : public CTargetDlg +class CTabDebug : public CDialog +{ +// Construction +public: + CTabDebug(CWnd* pParent = NULL); // standard constructor + +// Dialog Data + //{{AFX_DATA(CTabDirectX) + enum { IDD = IDD_TAB_DEBUG }; + // NOTE: the ClassWizard will add data members here + //}}AFX_DATA + + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CTabDirectX) + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + //}}AFX_VIRTUAL + +// Implementation +protected: + //BOOL OnInitDialog(); + + // Generated message map functions + //{{AFX_MSG(CTabDirectX) + // NOTE: the ClassWizard will add member functions here + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_TABTHREE_H__798A9124_C906_446C_822D_322B5AB6C4C4__INCLUDED_) diff --git a/host/TabDirectX.cpp b/host/TabDirectX.cpp index e7d47a8..6ab91e7 100644 --- a/host/TabDirectX.cpp +++ b/host/TabDirectX.cpp @@ -28,19 +28,17 @@ void CTabDirectX::DoDataExchange(CDataExchange* pDX) CTargetDlg *cTarget = ((CTargetDlg *)(this->GetParent()->GetParent())); DDX_Radio(pDX, IDC_AUTO, cTarget->m_DXVersion); DDX_Radio(pDX, IDC_NOEMULATESURFACE, cTarget->m_DxEmulationMode); - DDX_Check(pDX, IDC_HANDLEDC, cTarget->m_HandleDC); + //DDX_Check(pDX, IDC_HANDLEDC, cTarget->m_HandleDC); DDX_Check(pDX, IDC_SUPPRESSCLIPPING, cTarget->m_SuppressClipping); DDX_Check(pDX, IDC_BLITFROMBACKBUFFER, cTarget->m_BlitFromBackBuffer); DDX_Check(pDX, IDC_AUTOREFRESH, cTarget->m_AutoRefresh); DDX_Check(pDX, IDC_VIDEOTOSYSTEMMEM, cTarget->m_VideoToSystemMem); DDX_Check(pDX, IDC_SUPPRESSDXERRORS, cTarget->m_SuppressDXErrors); - DDX_Check(pDX, IDC_MARKBLIT, cTarget->m_MarkBlit); DDX_Check(pDX, IDC_BACKBUFATTACH, cTarget->m_BackBufAttach); - DDX_Check(pDX, IDC_FULLRECTBLT, cTarget->m_FullRectBlt); DDX_Check(pDX, IDC_NOPALETTEUPDATE, cTarget->m_NoPaletteUpdate); DDX_Check(pDX, IDC_SETCOMPATIBILITY, cTarget->m_SetCompatibility); DDX_Check(pDX, IDC_DISABLEHAL, cTarget->m_DisableHAL); - DDX_Check(pDX, IDC_SAVECAPS, cTarget->m_SaveCaps); + //DDX_Check(pDX, IDC_SAVECAPS, cTarget->m_SaveCaps); // DirectInput DDX_Check(pDX, IDC_HOOKDI, cTarget->m_HookDI); DDX_Text(pDX, IDC_INITX, cTarget->m_InitX); diff --git a/host/TabLogs.cpp b/host/TabLogs.cpp index 3f13f8d..1a8802f 100644 --- a/host/TabLogs.cpp +++ b/host/TabLogs.cpp @@ -22,20 +22,20 @@ CTabLogs::CTabLogs(CWnd* pParent /*=NULL*/) //}}AFX_DATA_INIT } -BOOL CTabLogs::OnInitDialog() -{ - extern BOOL gbDebug; - CDialog::OnInitDialog(); - (CButton *)(this->GetDlgItem(IDC_DXPROXED))->EnableWindow(gbDebug ? TRUE : FALSE); - (CButton *)(this->GetDlgItem(IDC_ASSERT))->EnableWindow(gbDebug ? TRUE : FALSE); - return TRUE; -} +//BOOL CTabLogs::OnInitDialog() +//{ +// extern BOOL gbDebug; +// CDialog::OnInitDialog(); +// (CButton *)(this->GetDlgItem(IDC_DXPROXED))->EnableWindow(gbDebug ? TRUE : FALSE); +// (CButton *)(this->GetDlgItem(IDC_ASSERT))->EnableWindow(gbDebug ? TRUE : FALSE); +// return TRUE; +//} void CTabLogs::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); CTargetDlg *cTarget = ((CTargetDlg *)(this->GetParent()->GetParent())); - extern BOOL gbDebug; + //extern BOOL gbDebug; DDX_Check(pDX, IDC_OUTTRACE, cTarget->m_OutTrace); DDX_Check(pDX, IDC_OUTDEBUG, cTarget->m_OutDebug); DDX_Check(pDX, IDC_CURSORTRACE, cTarget->m_CursorTrace); @@ -45,10 +45,6 @@ void CTabLogs::DoDataExchange(CDataExchange* pDX) DDX_Check(pDX, IDC_IMPORTTABLE, cTarget->m_ImportTable); DDX_Check(pDX, IDC_OUTREGISTRY, cTarget->m_RegistryOp); DDX_Check(pDX, IDC_TRACEHOOKS, cTarget->m_TraceHooks); - if(gbDebug){ - DDX_Check(pDX, IDC_DXPROXED, cTarget->m_DXProxed); - DDX_Check(pDX, IDC_ASSERT, cTarget->m_AssertDialog); - } } BEGIN_MESSAGE_MAP(CTabLogs, CDialog) diff --git a/host/TabLogs.h b/host/TabLogs.h index b587da5..0929682 100644 --- a/host/TabLogs.h +++ b/host/TabLogs.h @@ -16,7 +16,7 @@ class CTabLogs : public CDialog // Construction public: CTabLogs(CWnd* pParent = NULL); // standard constructor - virtual BOOL OnInitDialog(); + //virtual BOOL OnInitDialog(); // Dialog Data //{{AFX_DATA(CTabLogs) diff --git a/host/TargetDlg.cpp b/host/TargetDlg.cpp index ea55ce9..36ca306 100644 --- a/host/TargetDlg.cpp +++ b/host/TargetDlg.cpp @@ -11,6 +11,8 @@ static char THIS_FILE[] = __FILE__; #endif +extern BOOL gbDebug; + ///////////////////////////////////////////////////////////////////////////// // CTargetDlg Dialog @@ -106,6 +108,7 @@ CTargetDlg::CTargetDlg(CWnd* pParent /*=NULL*/) m_ForceHookOpenGL = FALSE; m_FakeVersion = FALSE; m_FullRectBlt = FALSE; + m_SurfaceWarn = FALSE; m_NoPaletteUpdate = FALSE; m_WireFrame = FALSE; m_BlackWhite = FALSE; @@ -140,6 +143,7 @@ BOOL CTargetDlg::OnInitDialog() m_tabdxTabCtrl.InsertItem(i++, _T("OpenGL")); m_tabdxTabCtrl.InsertItem(i++, _T("GDI")); m_tabdxTabCtrl.InsertItem(i++, _T("Compat")); + if (gbDebug) m_tabdxTabCtrl.InsertItem(i++, _T("Debug")); m_tabdxTabCtrl.Init(); return TRUE; } diff --git a/host/TargetDlg.h b/host/TargetDlg.h index 058f782..d53ee9b 100644 --- a/host/TargetDlg.h +++ b/host/TargetDlg.h @@ -104,6 +104,7 @@ public: BOOL m_ForceHookOpenGL; BOOL m_FakeVersion; BOOL m_FullRectBlt; + BOOL m_SurfaceWarn; BOOL m_NoPaletteUpdate; BOOL m_LimitResources; BOOL m_CDROMDriveType; diff --git a/host/dxTabCtrl.cpp b/host/dxTabCtrl.cpp index 528fc4a..d31fe5d 100644 --- a/host/dxTabCtrl.cpp +++ b/host/dxTabCtrl.cpp @@ -31,6 +31,7 @@ #include "TabCompat.h" #include "TabColor.h" #include "TabGDI.h" +#include "TabDebug.h" #ifdef _DEBUG #define new DEBUG_NEW @@ -38,6 +39,8 @@ static char THIS_FILE[] = __FILE__; #endif +extern BOOL gbDebug; + ///////////////////////////////////////////////////////////////////////////// // CDXTabCtrl @@ -54,6 +57,7 @@ CDXTabCtrl::CDXTabCtrl() m_tabPages[i++]=new CTabOpenGL; m_tabPages[i++]=new CTabGDI; m_tabPages[i++]=new CTabCompat; + if (gbDebug) m_tabPages[i++]=new CTabDebug; m_nNumberOfPages=i; } @@ -80,6 +84,7 @@ void CDXTabCtrl::Init() m_tabPages[i++]->Create(IDD_TAB_OPENGL, this); m_tabPages[i++]->Create(IDD_TAB_GDI, this); m_tabPages[i++]->Create(IDD_TAB_COMPAT, this); + if (gbDebug) m_tabPages[i++]->Create(IDD_TAB_DEBUG, this); for(int nCount=0; nCount < m_nNumberOfPages; nCount++){ m_tabPages[nCount]->ShowWindow(nCount ? SW_HIDE:SW_SHOW); diff --git a/host/dxTabCtrl.h b/host/dxTabCtrl.h index 6f9c22d..8a1a9d7 100644 --- a/host/dxTabCtrl.h +++ b/host/dxTabCtrl.h @@ -16,7 +16,7 @@ class CDXTabCtrl : public CTabCtrl // Construction public: CDXTabCtrl(); - CDialog *m_tabPages[10]; + CDialog *m_tabPages[11]; int m_tabCurrent; int m_nNumberOfPages; enum { IDD = IDC_TABPANEL }; diff --git a/host/dxwndhost.aps b/host/dxwndhost.aps index c7f92be..c4df5f6 100644 Binary files a/host/dxwndhost.aps and b/host/dxwndhost.aps differ diff --git a/host/dxwndhost.rc b/host/dxwndhost.rc index 4e41013..79a1530 100644 --- a/host/dxwndhost.rc +++ b/host/dxwndhost.rc @@ -291,9 +291,6 @@ BEGIN CONTROL "Win Events",IDC_OUTWINMESSAGES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,70,73,12 CONTROL "Cursor/Mouse",IDC_CURSORTRACE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,82,73,12 CONTROL "Import Table",IDC_IMPORTTABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,94,73,12 - GROUPBOX "debug mode only",IDC_STATIC,7,154,130,79 - CONTROL "Assert Dialog",IDC_ASSERT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,165,73,12 - CONTROL "ddraw Proxy",IDC_DXPROXED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,177,73,12 CONTROL "Debug",IDC_OUTDEBUG,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,106,73,12 CONTROL "Registry op.",IDC_OUTREGISTRY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,118,73,12 CONTROL "Hook op.",IDC_TRACEHOOKS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,130,73,12 @@ -317,17 +314,15 @@ BEGIN CONTROL "Primary Surface",IDC_EMULATESURFACE,"Button",BS_AUTORADIOBUTTON,14,156,77,12 GROUPBOX "DirectX Version Hook",IDC_STATIC,6,3,98,103,WS_GROUP GROUPBOX "Emulation",IDC_STATIC,7,109,98,61,WS_GROUP - CONTROL "Handle DC",IDC_HANDLEDC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,118,26,78,12 - CONTROL "Auto Primary Surface Refresh",IDC_AUTOREFRESH,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,118,38,126,9 + CONTROL "Auto Primary Surface Refresh",IDC_AUTOREFRESH,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,118,16,126,9 GROUPBOX "DirectDraw Surface handling",IDC_STATIC,112,3,181,167 CONTROL "VIDEO->SYSTEM surf. on fail",IDC_VIDEOTOSYSTEMMEM, - "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,118,50,126,9 - CONTROL "Suppress DX common errors",IDC_SUPPRESSDXERRORS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,118,62,127,10 - CONTROL "Make Backbuf attachable",IDC_BACKBUFATTACH,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,118,86,119,10 - CONTROL "Blit from BackBuffer",IDC_BLITFROMBACKBUFFER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,118,98,119,10 - CONTROL "Suppress clipping",IDC_SUPPRESSCLIPPING,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,118,110,119,10 - CONTROL "Full RECT Blit",IDC_FULLRECTBLT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,118,122,119,10 - CONTROL "Palette update don't Blit",IDC_NOPALETTEUPDATE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,118,134,119,10 + "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,118,28,126,9 + CONTROL "Suppress DX common errors",IDC_SUPPRESSDXERRORS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,118,40,127,10 + CONTROL "Make Backbuf attachable",IDC_BACKBUFATTACH,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,118,52,119,10 + CONTROL "Blit from BackBuffer",IDC_BLITFROMBACKBUFFER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,118,64,119,10 + CONTROL "Suppress clipping",IDC_SUPPRESSCLIPPING,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,118,76,119,10 + CONTROL "Palette update don't Blit",IDC_NOPALETTEUPDATE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,118,88,119,10 LTEXT "DirectInput initial coord. and X,Y range",IDC_STATIC,19,197,146,9 LTEXT "X",IDC_STATIC,13,212,9,9 LTEXT "Y",IDC_STATIC,40,212,9,9 @@ -344,10 +339,8 @@ BEGIN EDITTEXT IDC_MAXY,148,209,17,14,ES_AUTOHSCROLL,WS_EX_RIGHT CONTROL "DirectInput Hooking",IDC_HOOKDI,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,182,97,12 GROUPBOX "DirectInput",IDC_STATIC,7,172,286,61 - CONTROL "Set AERO compatible mode",IDC_SETCOMPATIBILITY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,118,146,109,12 - CONTROL "Highlight blit to primary",IDC_MARKBLIT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,118,74,127,10 - CONTROL "Preserve surface capabilities",IDC_SAVECAPS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,118,14,109,12 - CONTROL "Disable HAL support",IDC_DISABLEHAL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,118,158,109,12 + CONTROL "Set AERO compatible mode",IDC_SETCOMPATIBILITY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,118,100,109,12 + CONTROL "Disable HAL support",IDC_DISABLEHAL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,118,112,109,12 END IDD_TAB_MOUSE DIALOGEX 0, 0, 300, 240 @@ -466,8 +459,22 @@ BEGIN CONTROL "Simulate BW monitor",IDC_BLACKWHITE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,76,96,10 CONTROL "Set 16BPP RGB565 encoding",IDC_USERGB565,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,88,126,9 CONTROL "Lock Sys Colors",IDC_LOCKSYSCOLORS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,100,126,9 - CONTROL "Simulate YUV to RGB color conv.",IDC_YUV2RGB,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,112,126,9 - CONTROL "Simulate RGB to YUV color conv.",IDC_RGB2YUV,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,124,126,9 +END + +IDD_TAB_DEBUG DIALOGEX 0, 0, 300, 240 +STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD +FONT 8, "MS Shell Dlg", 400, 0, 0x1 +BEGIN + GROUPBOX "Debug flags",IDC_STATIC,7,3,140,144 + CONTROL "Simulate YUV to RGB color conv.",IDC_YUV2RGB,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,36,119,9 + CONTROL "Simulate RGB to YUV color conv.",IDC_RGB2YUV,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,48,119,9 + CONTROL "Highlight blit to primary",IDC_MARKBLIT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,24,99,10 + CONTROL "Full RECT Blit",IDC_FULLRECTBLT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,60,119,10 + GROUPBOX "debug mode logs",IDC_STATIC,7,154,139,79 + CONTROL "Assert Dialog",IDC_ASSERT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,166,73,11 + CONTROL "ddraw Proxy",IDC_DXPROXED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,178,73,9 + CONTROL "Warning for analytic surface mode",IDC_SURFACEWARN, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,72,127,10 END @@ -637,6 +644,14 @@ BEGIN TOPMARGIN, 3 BOTTOMMARGIN, 233 END + + IDD_TAB_DEBUG, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 293 + TOPMARGIN, 7 + BOTTOMMARGIN, 233 + END END #endif // APSTUDIO_INVOKED diff --git a/host/dxwndhost.vs2008.ncb b/host/dxwndhost.vs2008.ncb new file mode 100644 index 0000000..46530f4 Binary files /dev/null and b/host/dxwndhost.vs2008.ncb differ diff --git a/host/dxwndhost.vs2008.suo b/host/dxwndhost.vs2008.suo index 970afbb..ab5c33a 100644 Binary files a/host/dxwndhost.vs2008.suo and b/host/dxwndhost.vs2008.suo differ diff --git a/host/dxwndhost.vs2008.vcproj b/host/dxwndhost.vs2008.vcproj index 102857a..af74dc6 100644 --- a/host/dxwndhost.vs2008.vcproj +++ b/host/dxwndhost.vs2008.vcproj @@ -1,7 +1,7 @@ + + @@ -482,6 +486,10 @@ RelativePath=".\TabCompat.h" > + + diff --git a/host/dxwndhost.vs2008.vcproj.User-PC.User.user b/host/dxwndhost.vs2008.vcproj.User-PC.User.user new file mode 100644 index 0000000..0d18496 --- /dev/null +++ b/host/dxwndhost.vs2008.vcproj.User-PC.User.user @@ -0,0 +1,65 @@ + + + + + + + + + + + diff --git a/host/dxwndhostView.cpp b/host/dxwndhostView.cpp index 1b14c54..a910f87 100644 --- a/host/dxwndhostView.cpp +++ b/host/dxwndhostView.cpp @@ -213,6 +213,7 @@ static void SetTargetFromDlg(TARGETMAP *t, CTargetDlg *dlg) if(dlg->m_FakeVersion) t->flags2 |= FAKEVERSION; if(dlg->m_FullRectBlt) t->flags2 |= FULLRECTBLT; if(dlg->m_NoPaletteUpdate) t->flags2 |= NOPALETTEUPDATE; + if(dlg->m_SurfaceWarn) t->flags3 |= SURFACEWARN; t->initx = dlg->m_InitX; t->inity = dlg->m_InitY; t->minx = dlg->m_MinX; @@ -339,6 +340,7 @@ static void SetDlgFromTarget(TARGETMAP *t, CTargetDlg *dlg) dlg->m_FakeVersion = t->flags2 & FAKEVERSION ? 1 : 0; dlg->m_FullRectBlt = t->flags2 & FULLRECTBLT ? 1 : 0; dlg->m_NoPaletteUpdate = t->flags2 & NOPALETTEUPDATE ? 1 : 0; + dlg->m_SurfaceWarn = t->flags3 & SURFACEWARN ? 1 : 0; dlg->m_InitX = t->initx; dlg->m_InitY = t->inity; dlg->m_MinX = t->minx;